fix(qa): QA recorder error monitor (closes #168)#175
Conversation
QA 录音中麦克风设备消失 / cpal 内部 panic 时,QA 流程之前**没有**对应
runtime error 监听器(recorder_errors 用 _ 弃用),导致:
- QA 浮窗一直显示"录音中"
- 用户按 Option 第二次没反应
- 必须按 Esc 才能脱困
修:
- 新增 spawn_qa_recorder_error_monitor,镜像 dictation 现有 spawn_recorder_error_monitor
- begin_qa_session Recorder::start 成功后启动监听器
- 用 qa_state.session_id 守卫 stale 事件
- 收到 error → finish_qa_with_error("录音设备异常: ..") → emit 错误胶囊 + 浮窗错误状态
测试:
- cargo check ✅
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 65d4b5243b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| log::error!("[coord] QA recorder runtime error: {err}"); | ||
| finish_qa_with_error(&inner, format!("录音设备异常: {err}")); | ||
| } |
There was a problem hiding this comment.
Stop QA resources before marking runtime-error session idle
When a recorder runtime error occurs, this path immediately calls finish_qa_with_error, which only updates UI/state and sets qa_state.phase = Idle but does not take() and stop qa_recorder or cancel qa_asr. In this scenario, cancel_qa_session will no longer clean up because it early-returns on Idle, so the failed recorder/asr can remain alive and the old Recorder may be dropped without stop() (its own docs say drop does not stop), causing leaked audio threads and possible microphone/device contention on the next QA attempt.
Useful? React with 👍 / 👎.
摘要
Closes #168
QA 录音设备失败时之前永远卡 Recording 无错误反馈(runtime_errors 用 `_` 弃用)。镜像主听写的 `spawn_recorder_error_monitor` 加 QA 版本。
修复
测试
@codex review。