Skip to content

fix(qa): QA recorder error monitor (closes #168)#175

Merged
appergb merged 1 commit into
mainfrom
fix/issue-168-qa-recorder-error-monitor
May 2, 2026
Merged

fix(qa): QA recorder error monitor (closes #168)#175
appergb merged 1 commit into
mainfrom
fix/issue-168-qa-recorder-error-monitor

Conversation

@appergb
Copy link
Copy Markdown
Collaborator

@appergb appergb commented May 2, 2026

摘要

Closes #168

QA 录音设备失败时之前永远卡 Recording 无错误反馈(runtime_errors 用 `_` 弃用)。镜像主听写的 `spawn_recorder_error_monitor` 加 QA 版本。

修复

  • `spawn_qa_recorder_error_monitor`:用 qa_state.session_id 守 stale,收到 err 后 `finish_qa_with_error("录音设备异常: ..")`
  • `begin_qa_session` Recorder::start 成功后启动监听器
  • 之前的 `_runtime_errors` 改成 `runtime_errors`

测试

  • `cargo check` ✅

@codex review。

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 ✅
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Sorry @appergb, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 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".

Comment on lines +1062 to +1064
log::error!("[coord] QA recorder runtime error: {err}");
finish_qa_with_error(&inner, format!("录音设备异常: {err}"));
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

@appergb appergb merged commit f5ffd9e into main May 2, 2026
2 checks passed
@appergb appergb deleted the fix/issue-168-qa-recorder-error-monitor branch May 2, 2026 02:51
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.

[qa] QA recorder cpal 设备失败时永久卡 Recording 状态无错误反馈

1 participant