Skip to content

feat(recording): survive engine death mid-recording + auto-rescue - #49

Merged
giraphant merged 1 commit into
mainfrom
giraphant/issue-46
Jul 25, 2026
Merged

giraphant merged 1 commit into
mainfrom
giraphant/issue-46

Conversation

@giraphant

Copy link
Copy Markdown
Owner

Closes #46 的目标 1 + 2。

变更

  • 引擎全灭不再终止录音:.recording 状态下收到致命 .error 时只做 latch(pendingErrorMessage),不再 transition——麦克风和 WAV 落盘持续到用户松键。采集失败保持原有立即报错路径(结构上区分:其流在 error 后立刻结束、无尾部 final,由消费循环出口转为致命错误)。
  • 自动救援:带 latch 的会话结束时(无论引擎死在松键前还是收尾中),完整 WAV 存为红色失败条目,并自动调度一次对该条目的重转(结果进剪贴板;救援再失败则红条目保留供手动救援,无重试循环)。
  • env 变更:saveHistory 返回条目 id;新增 rescue(id) 闭包走 AppDelegate.retranscribeEntry。

真机验证

  • 录音中断网继续说话 → 采集不停、收尾 ~2s 有界、重转找回含断网后语音的全文。
  • 离线开录 → 日志确认 recognition error → 红条目 → auto-rescue → retranscribe start 全链路。

未做(记录在案)

  • Apple 本地引擎离线兜底(issue 目标 3,"可考虑");
  • 救援时规避拒绝回放的豆包(多引擎已由路由兜底;单豆包用户救援仍会失败);
  • 录音降级期间的 HUD 提示。

🤖 Generated with Claude Code

All cloud engines dying (network drop, WS disconnect) no longer ends a
live recording. The fatal .error is latched instead of transitioned while
the controller is still .recording, so the shared mic tap and WAV keep
running until the user releases the key. The session's final then archives
the completed WAV as a failed history entry and schedules one automatic
retranscribe rescue of that entry (replay -> clipboard); if the rescue
fails too, the red entry remains for manual rescue. Engines dying after
stop (during finalization) get the same archive + auto-rescue via the
trailing-final drop branch.

Capture failure keeps its immediate fatal path, distinguished
structurally: its stream finishes right after the error with no trailing
final, which the consumer's loop exit turns into the error transition.

env changes: saveHistory now returns the new entry id; new rescue(id)
closure routed through AppDelegate.retranscribeEntry.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@giraphant
giraphant merged commit 7004cb2 into main Jul 25, 2026
@giraphant
giraphant deleted the giraphant/issue-46 branch July 25, 2026 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

录音鲁棒性:断网/引擎断连时音频持续录制 + 自动救援

1 participant