fix(capsule): 润色/插入失败改走 error 态——失败提示不再被前端丢掉 - #874
Merged
Conversation
胶囊只在 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>
Contributor
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
This was referenced Aug 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
问题
胶囊只在
error态渲染message。done态按设计是「冻结光效淡出、不带文字」:但
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,红字提示Done,提示被吞Error,红字提示DoneDone(不变)下游对三种终态(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_sessionnow sendsCapsuleState::Errorwhen insert/polish failsPreviously all sessions sent
Done, hiding failure messagesPolish failures silently fell back to raw text with no UI indication
Success sessions still send
CapsuleState::Doneas beforeDiagram Walkthrough
flowchart LR A["end_session"] --> B{"Session failed?"} B -- "Yes" --> C["CapsuleState::Error"] B -- "No" --> D["CapsuleState::Done"]File Walkthrough
dictation.rs
Route failed sessions to error capsule stateopenless-all/app/src-tauri/src/coordinator/dictation.rs
session_failedfrom TSF insert failure, polish error, orfailed insert status
CapsuleState::Errorfor failures andCapsuleState::Doneforsuccess
confusion