fix: prevent Voice Wake crash after Talk audio capture#99137
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 2, 2026, 1:46 PM ET / 17:46 UTC. Summary PR surface: Other +149. Total +149 across 3 files. Reproducibility: no. high-confidence standalone reproduction path was established in this read-only review; the linked issue provides physical iPhone crash logs and before-fix context, and current main still matches the failing restart/tap-install source path. Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land this focused VoiceWakeManager lifecycle hardening after maintainer review, keeping the linked crash issue open until this PR or an equivalent fix merges. Do we have a high-confidence way to reproduce the issue? No high-confidence standalone reproduction path was established in this read-only review; the linked issue provides physical iPhone crash logs and before-fix context, and current main still matches the failing restart/tap-install source path. Is this the best way to solve the issue? Yes: after the follow-up commit, the PR fixes the issue at the VoiceWakeManager lifecycle boundary, covers pending and in-flight starts, leaves Talk routing unchanged, and adds focused regression coverage. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 55ed57a4e39b. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Other +149. Total +149 across 3 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
@clawsweeper re-review Addressed the prior findings in c9f532b:
|
|
🦞🧹 I asked ClawSweeper to review this item again. |
f751286 to
520aa10
Compare
|
Maintainer fixup complete and land-ready at rebased exact head
Simulator microphone capture is intentionally unavailable; the physical-iPhone run remains the authoritative AVAudioNode after-proof. |
520aa10 to
933a88c
Compare
|
Merged via squash.
|
* fix: prevent Voice Wake audio restart race * fix: handle in-flight Voice Wake suspension * test(ios): harden Voice Wake lifecycle proof * fix(ios): remove Voice Wake tap after failed start --------- Co-authored-by: Peter Steinberger <[email protected]>
Related: #99093
What Problem This Solves
Fixes an issue where iOS users with Voice Wake enabled could hit a foreground crash after using Talk or other microphone capture, including screen recording with microphone enabled. The observed crashes abort while Voice Wake is reinstalling its microphone tap after another audio path releases capture.
Why This Change Was Made
Voice Wake restarts now go through one scheduled-start path that cancels stale pending starts, prevents overlapping
start()attempts, and debounces restarts after external audio capture. External-capture suspension now covers listening, queued, and already in-flight starts so push-to-talk, camera/audio capture, backgrounding, and Talk teardown cannot leave a start racing towardinstallTap.Talk suppression tears down Voice Wake without marking it as externally suspended, so the existing Talk enable/disable caller sequence can restart Voice Wake normally when Talk is disabled. The manager also rechecks suppression/enabled/external-suspension state before rebuilding the AVAudioEngine pipeline and rejects invalid microphone input formats before installing a tap.
This is intentionally limited to the Voice Wake restart/audio-tap lifecycle; it does not change Talk routing, push, share extension, widget, or watch behavior.
User Impact
Voice Wake should resume more reliably after Talk, push-to-talk, camera/audio capture, foregrounding, and screen-recording-adjacent audio-session changes instead of racing into a duplicate or invalid mic tap install.
Evidence
EXC_CRASH/SIGABRTreports all point toVoiceWakeManager.startRecognition()callingAVAudioNode.installTap(...)from Voice Wake restart paths.5bd27b91599f3ec0c2af293159332fa9c8f7ee146907a09847ad8cf5a19d2f9e; contact sheet SHA-256:2aff73e9004a3f05d4820b494467452adf4ca1df5cb7a3a4cdd41e2befed4793.swiftformat --lint --config config/swiftformat apps/ios/Sources/Voice/VoiceWakeManager.swift apps/ios/Tests/VoiceWakeManagerSuppressionTests.swiftswiftlint lint --config config/swiftlint.yml --strict -- apps/ios/Sources/Voice/VoiceWakeManager.swift apps/ios/Tests/VoiceWakeManagerSuppressionTests.swiftgit diff --checkpnpm native:i18n:sync && pnpm native:i18n:checkxcodebuild test -project apps/ios/OpenClaw.xcodeproj -scheme OpenClaw -destination 'platform=iOS Simulator,name=iPhone 17,OS=26.5' -only-testing:OpenClawTests/VoiceWakeManagerStateTests -only-testing:OpenClawTests/VoiceWakeManagerSuppressionTests(7 tests in 2 suites; build graph included share extension, live activity widget, and watch app targets)AI-assisted: yes (Codex)