Phase 4A:建立受控 ASR consumer routing 与语音设置 - #2396
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
Walkthrough该 PR 引入 Changes语音输入与资源优化系统喵
Estimated code review effort: 5 (Critical) | ~150 minutes Possibly related PRs
Suggested labels: Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR centralizes voice transcript routing and recognition settings. The main changes are:
Confidence Score: 5/5This looks safe to merge.
|
| Filename | Overview |
|---|---|
| main_logic/voice_input/registry.py | Adds token-pinned consumer registration, dispatch, and invalidation. |
| main_logic/core/asr_runtime.py | Connects Core ASR lifecycle callbacks to the controlled consumer registry. |
| main_logic/asr_client/runtime.py | Associates partial transcripts with the prepared turn token. |
| static/app/app-audio-capture.js | Adds the shared voice-recognition settings popover and setting synchronization. |
Sequence Diagram
sequenceDiagram
participant Mic as Microphone
participant ASR as Independent ASR
participant Registry as Voice Input Registry
participant Consumer as Core or Game Consumer
Mic->>ASR: PCM with ingress identity
ASR->>Registry: Prepare turn token
ASR->>Registry: Partial or final transcript
Registry->>Consumer: Deliver only pinned route
Consumer-->>Registry: Complete or cancel route
Reviews (28): Last reviewed commit: "test(settings): strengthen reset default..." | Re-trigger Greptile
c24fdf7 to
99b67c3
Compare
fc68230 to
9730015
Compare
|
@codex 全面审查一下 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 99b67c358f
ℹ️ 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".
|
已处理 Codex P1 review(
PR 描述中的对应路由说明也已同步修正。 |
139369a to
aa13f85
Compare
aa13f85 to
fa31299
Compare
|
本次已按 #2345 的最终架构重新收敛并更新堆叠基线:Phase 4A 的 ASR 运行时改动现位于 |
|
两个 P2 已在
边界保持不变:只修改 验证结果:
堆叠检查:#2398、#2408 均未单独修改该前端文件,不应复制同一修复;后续只需按 #2396 → #2398 → #2408 顺序继承新基线。 |
14fe8f5 to
0fb3c77
Compare
Stacked rebase / Provider recovery owner 边界本 PR 已纯 rebase 到修复后的 #2345
精确组合验证:129 passed;Core package contract、Ruff 与 diff check 通过。前端浏览器测试 2 项通过,剩余 1 项仅因本地未生成 React chat bundle 而出现既有静态资源 404,与设置或 Soniox recovery 无关。 |
2d6a6be to
392e89e
Compare
ASR consumer routing 最终边界补充本 PR 的最终职责已收敛为:在最新版 #2345 之上建立统一、受控的 ASR consumer routing;#2345 不再扩容。
验证结果:consumer routing/core 单测 97 passed, |
Restack 完成回执已按上面的收敛边界完成实现整理和依次 restack:
GitHub 上的 stacked base 镜像分支已经同步。目前三层 PR 均为 Draft / CLEAN,祖先关系为: 边界核对:
验证结果:
|
392e89e to
9a58231
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Review feedback follow-up已在
验证结果:
本轮未修改 Provider worker/policy、TTS、Omni、SmartTurn 4B 或 speaker shadow 边界。 |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8526e93d1d
ℹ️ 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".
Latest review follow-up (
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b97e73667a
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 70e8793095
ℹ️ 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".
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
main_logic/core/asr_runtime.py (1)
2345-2467: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win给
final_swap_task加个等待超时兜底喵。
_dispatch_core_asr_transcript这里用的是无超时asyncio.wait((swap_task,)),而final_swap_task的prime_context(...)/close()/flush...等链路没有统一的wait_for保护;如果热切换卡住,这个 serial dispatch worker 也会被拖死喵。可以加一个合理的整体熔断超时,或让_perform_final_swap_sequence对关键外部 await 统一设定时限喵。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@main_logic/core/asr_runtime.py` around lines 2345 - 2467, 为 _dispatch_core_asr_transcript 中等待 final_swap_task 的逻辑增加合理的整体超时熔断,避免热切换链路卡住时阻塞 serial dispatch worker;使用超时等待并在超时后继续执行现有的失效路由检查与安全返回流程,保持正常完成的 swap_task 行为不变。
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@main_logic/core/asr_runtime.py`:
- Around line 2345-2467: 为 _dispatch_core_asr_transcript 中等待 final_swap_task
的逻辑增加合理的整体超时熔断,避免热切换链路卡住时阻塞 serial dispatch
worker;使用超时等待并在超时后继续执行现有的失效路由检查与安全返回流程,保持正常完成的 swap_task 行为不变。
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 559bf839-ed7d-47a8-97d7-3408d15ec3bf
📒 Files selected for processing (2)
main_logic/core/asr_runtime.pytests/unit/test_core_independent_asr.py
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
Project-N-E-K-O/N.E.K.O.-PC(manual)
|
Addressed the latest CodeRabbit outside-diff concern in a34df02 without using autofix. The unbounded |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 437da12a5e
ℹ️ 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".
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/unit/test_app_websocket_static.py (1)
1539-1615: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
resetPriorDecision.value没跟着默认值翻转改喵,三处「重置到默认值」断言可能测不出真的 bug 喵!
independentAsrEnabled的默认值已经从false改成true,但resetPriorDecision.value(Line 1542)还是硬编码的true,没有同步调整喵。这样一来:
- Line 1558
reset.S.independentAsrEnabled === true- Line 1589
resetBody.independentAsrEnabled === true- Line 1612
resetPersisted._sharedWriteMeta.asrDecision.value === true这三条纯值比较,就算重置逻辑压根没生效、只是把
resetPriorDecision的旧值原样带过去,结果碰巧也是true,断言照样能通过,起不到「验证真的 rebase 到新默认值」的作用了喵。对比之下 Line 1576 因为多了resetWritebackDecision.writeId > resetPriorDecision.writeId的顺序校验,才真正能抓出「没有 rebase」这种 bug 喵~建议把
resetPriorDecision.value改回和新默认值相反的false,让这几条值断言重新具备区分度,但因为这是个巨长的测试函数、后面还复用了resetPriorDecision做resetRace场景,改完请务必跑一遍确认下游断言没被连带带偏喵。🔍 建议改动
const resetPriorDecision = { writeId: Date.now() + 1000, writerId: 'server-before-reset', - value: true, + value: false, };🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/unit/test_app_websocket_static.py` around lines 1539 - 1615, Update the resetPriorDecision fixture in the reset test scenario so its value is false, opposite to the current independentAsrEnabled default of true. Keep the reset.S, resetBody, and resetPersisted assertions validating true, and verify the later resetRace reuse of resetPriorDecision still has the intended expectations after this fixture change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tests/unit/test_app_websocket_static.py`:
- Around line 1539-1615: Update the resetPriorDecision fixture in the reset test
scenario so its value is false, opposite to the current independentAsrEnabled
default of true. Keep the reset.S, resetBody, and resetPersisted assertions
validating true, and verify the later resetRace reuse of resetPriorDecision
still has the intended expectations after this fixture change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 035c6635-a994-4332-a6b0-97b434e68619
📒 Files selected for processing (2)
static/app/app-settings.jstests/unit/test_app_websocket_static.py
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
Project-N-E-K-O/N.E.K.O.-PC(manual)
|
已处理 CodeRabbit 最新 outside-diff 测试建议,提交为 \137d1deae\。 |
改动概述 / Summary
Phase 4A 已按最新
main重新实现,不复用旧 PR 的 Core/runtime 历史。该 PR 只收敛语音识别设置、turn identity、受控 transcript consumer registry,以及 Core/game 内建接线。共 6 个阶段提交、36 个文件:
fix(voice): align ASR defaults and optimization semanticsfeat(voice): add shared recognition settings popoverrefactor(voice): attach turn identity to partial transcriptsfeat(voice): add controlled transcript consumer registryfeat(asr): route Core and game transcripts through registrytest(voice): enforce cancellation and empty-final barriers冻结语义
false保持不变。VoicePartialEvent和 final 使用完整VoiceTurnToken;任一 lease、route 或 audio generation 不匹配时都 fail-closed。VoiceInputRegistry与LLMSessionManager同生命周期,内建core_chat与gameconsumer 只注册一次。abandon(None)。依赖与硬边界
voice_input依赖方向合同:仅允许依赖自身包、voice_turn.contracts与utils.game_route_state;同时禁止asr_client反向导入voice_input。静态和动态 import 都覆盖。utils.game_route_state边界完成。回归报告 / Regression Report
VoiceInputRegistry,完成 Core/game consumer 与 MicLease owner 接线,并补齐默认设置、共享 popover 和依赖方向合同。VoiceTurnToken与 consumer;所有事件按同一 identity barrier 校验,final/empty-final 只终止一次,切换或不可用路径直接丢弃且不回退;Core preview/turn 按原 token 精确清理。不拆分理由 / Why Not Split
该改动按 6 个独立提交分阶段审阅,但必须作为一个原子 PR 合入:设置默认值、前端入口、turn token 合同、registry、Core/game 接线和竞态/结构合同共同定义同一 fail-closed 语义。拆成可独立合入的 PR 会在中间状态留下 partial 无身份、registry 未接线或取消屏障不完整的组合。36 个文件中还包含 8 个同步 locale 文件、新增模块和集中测试,实际生产改动仍保持在 Phase 4A 冻结边界内。
测试 / Testing
8445 passed, 46 skipped;rebase 后 Phase 4A 聚焦回归:494 passed。8 passed;i18n sync gate 通过。215 passed、audio stream queue119 passed、Registry24 passed、preview 专项14 passed。node --check、git diff --check均通过。detect_changes(upstream/main...HEAD):风险LOW,545 个映射符号、0 条受影响执行流;禁止路径命中 0。Summary by CodeRabbit