Skip to content

fix(capsule): 润色/插入失败改走 error 态——失败提示不再被前端丢掉 - #874

Merged
appergb merged 1 commit into
Open-Less:betafrom
bigsongeth:fix/polish-failure-invisible
Aug 2, 2026
Merged

fix(capsule): 润色/插入失败改走 error 态——失败提示不再被前端丢掉#874
appergb merged 1 commit into
Open-Less:betafrom
bigsongeth:fix/polish-failure-invisible

Conversation

@bigsongeth

@bigsongeth bigsongeth commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

User description

问题

胶囊只在 error 态渲染 messagedone 态按设计是「冻结光效淡出、不带文字」:

// Capsule.tsx, VoiceOrbStage
{state === 'error' && (<span style={errorGlowTextStyle}>{message || t('capsule.error')}</span>)}

end_session 无论成败都发 CapsuleState::Done。于是 default_done_message 拼出来的失败文案,全部在前端被丢弃——算了、传了、不显示。

最典型的受害者是润色失败:LLM 调用失败时会静默回退成未润色的原文,而胶囊照常显示成功态,界面上没有任何痕迹。

default_done_message 里那句注释写着「polish 失败优先告知用户,即使 insert 成功也要让用户知道这版是原文」——意图完全正确,只是这句话从来没能显示出来。

实际影响

我在排查一台机器上的问题时撞上的:LLM 凭证意外失效后,连续十几个小时、每一句听写都在拿未润色的原文。日志里每一句都老老实实 [ERROR] polish failed, falling back to raw,但界面上一切正常。

用户的体感是「今天出来的字怎么变笨了」,完全不知道该往凭证那边查——只能靠感觉察觉,这对一个每天用几百次的功能来说代价挺大。

改动

按结果选状态,文案生成逻辑一行没动:

情况 改前 改后
润色失败(回退原文) Done,提示被吞 Error,红字提示
插入失败 Done,提示被吞 Error,红字提示
TSF 未上屏 Done,提示被吞 Error,红字提示
正常成功 Done Done(不变)

下游对三种终态(Done/Cancelled/Error)的处理是一致的(见 capsule_focus.rs 的终态自动清除),不需要额外适配。

两个想听听维护者意见的点

1. PasteSent / CopiedFallback 的文案同样显示不出来

default_done_message 还会产出「已尝试粘贴」和「已复制,请粘贴」。后者是需要用户动手的——粘贴失败退回复制,用户不粘贴就什么都没有。但它们不是错误,套 error 的红色发光样式我觉得偏重了,所以这个 PR 没动。

如果你们觉得该显示,我倾向给 done 态加一种中性文字样式(不是红字),可以另开 PR。想先听听你们对「done 态是否允许带文字」的设计取向。

2. 一闪而过可能还是不够

CAPSULE_AUTO_HIDE_DELAY_MS 是 2 秒。凭证失效这类问题不是偶发,是会一直错下去的,红字闪两秒仍可能被错过。或许值得在连续失败 N 次后于托盘/设置里挂个持久标记。这属于产品判断,没放进这个 PR。

验证

cargo check 通过,无新增 warning。


PR Type

Bug fix


Description

  • end_session now sends CapsuleState::Error when insert/polish fails

  • Previously all sessions sent Done, hiding failure messages

  • Polish failures silently fell back to raw text with no UI indication

  • Success sessions still send CapsuleState::Done as before


Diagram Walkthrough

flowchart LR
  A["end_session"] --> B{"Session failed?"}
  B -- "Yes" --> C["CapsuleState::Error"]
  B -- "No" --> D["CapsuleState::Done"]
Loading

File Walkthrough

Relevant files
Bug fix
dictation.rs
Route failed sessions to error capsule state                         

openless-all/app/src-tauri/src/coordinator/dictation.rs

  • Compute session_failed from TSF insert failure, polish error, or
    failed insert status
  • Choose CapsuleState::Error for failures and CapsuleState::Done for
    success
  • Added comments explaining why failure messages must use error state
  • Failure messages are now visible in the UI, preventing silent fallback
    confusion
+16/-1   

胶囊只在 error 态渲染 message,done 态按设计是「冻结光效淡出、不带文字」
(Capsule.tsx 的 VoiceOrbStage:`state === 'error' && <span>{message}</span>`)。

但 end_session 无论成败都发 CapsuleState::Done。于是 default_done_message
辛辛苦苦拼出来的失败文案,全部在前端被丢弃——算了、传了、不显示。

最典型的受害者是润色失败。它会静默回退成未润色的原文,而胶囊照常显示成功态,
界面上没有任何痕迹。实测后果:LLM 凭证失效后连着十几个小时每一句都在拿原文,
用户只能靠「今天出来的字怎么变笨了」察觉,而日志里其实每一句都 ERROR 了。
default_done_message 的注释写着「polish 失败优先告知用户」——意图是对的,
只是这句话从来没能显示出来。

改成按结果选状态:润色失败 / 插入失败 / TSF 未上屏走 error 态,成功仍走 done。
文案生成逻辑一行没动,只改用哪个状态发出去。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ No major issues detected

@appergb appergb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已审查失败终态映射:润色失败、TSF 必需插入失败和 InsertStatus::Failed 均进入 Error,保留原终态自动清理行为。四平台 CI 通过,并已在最新 beta 上与 #875/#876 联合验证:819 个 Rust 测试、26 个前端/契约测试及生产构建通过。

@appergb
appergb merged commit 95edf89 into Open-Less:beta Aug 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants