Repository navigation
fix(ios): stop the speech permission prompt from crashing on Allow - #196822
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR marks both iOS speech-authorization callbacks @sendable to prevent inherited main-actor isolation from trapping. Example: On a fresh iPhone 17 simulator running iOS 27, request Speech Recognition from Device Settings and tap Allow.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it provides a focused fix for a current iOS permission crash, with no actionable correctness or security findings. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherVoice startup and native Device Settings request speech authorization through PermissionRequestBridge, which starts prompts on the main actor and safely receives asynchronous permission results. flowchart TD
A[Chat dictation and voice] --> C[Permission request bridge]
B[Device Settings] --> C
C --> D[iOS speech permission prompt]
D --> E[Sendable callback]
E --> F[Thread safe completion]
F --> G[Resume requesting flow]
Technical reviewBest possible solution: Merge the two callback annotations once the existing CI gates pass. Do we have a high-confidence way to reproduce the issue? The source exposes the actor-inheritance path, and the author reports fresh-simulator failures for both callers with matching crash frames; no target code was executed during this review. Is this the best way to solve the issue? The annotations are the smallest complete repair: callbacks may execute off the main actor while permission initiation and result settlement retain their existing owners. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0c5c4754c33d. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +2. Total +2 across 2 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 10, 2026, 2:33 PM ET / 19:33 UTC. |
|
Merged via squash.
|
…196822) (cherry picked from commit c301da9) Release adaptation: none. Both baseline callbacks use the identical MainActor permission bridge and Sendable completion contract. Companion audit through 7bccde6 found no later same-path changes or PR mentions; existing callers, permission tests, and native source inventory require no changes. Linux host has no Swift/Xcode; real TCC callback proof remains the merged PR simulator evidence. Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vincentkoc <[email protected]> (cherry picked from commit 5ae04a993e3977b7123016da0ee690fad2942f88)
Port Telegram callbacks, hook session keys, private-topic approvals and interactive widgets with complete send/edit/route security companions. Include Feishu captioned media, iOS permission Sendable callbacks, WebKit animation/menu retirement and pending automations props handling. Keep Matrix malformed formatted-mention parsing linear-time. Adapt the 11.4 equivalents to the fixed beta baseline where available. Source PRs: #196217, #191585, #196822, #194027, #197519, #198038, #196991, #198380, #198658, #184432. Companion scope: #191647, #192162, #198022, #197271, #194146; #197670 is folded into #197519 equivalent. (cherry picked from commit 928c118) (cherry picked from commit 569ca48) (cherry picked from commit efa744e) (cherry picked from commit c301da9) (cherry picked from commit 641c4d5) (cherry picked from commit b9d3fb4) (cherry picked from commit a213a51) (cherry picked from commit ec46689) (cherry picked from commit 779d22e) (cherry picked from commit 129ccc3) (cherry picked from commit 849c050) (cherry picked from commit b22f35f) (cherry picked from commit 8b414e9) (cherry picked from commit 01ecda4) (cherry picked from commit f978e54) (cherry picked from commit 6e60479) (cherry picked from commit ec7b49a) (cherry picked from commit 1d72ad0) (cherry picked from commit 5e2c66f) (cherry picked from commit dfb6454) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit f7c581c7f8bf0e57c7d8799e928a121b24462450) Co-authored-by: vincentkoc <[email protected]>



What Problem This Solves
On iOS, tapping Allow on the speech-recognition permission prompt crashes the app (
EXC_BREAKPOINT). This hits every new user the first time they use dictation, Talk or Voice Wake, and also when they request Speech Recognition from Settings → Device Settings → Permissions.Root cause
Both call sites pass a closure literal to
SFSpeechRecognizer.requestAuthorizationfrom insidePermissionRequestBridge.awaitRequest'sstartclosure, which is@MainActor. Under Swift 6 the literal inherits that main-actor isolation. TCC calls the handler on a background queue, so the runtime isolation check (swift_task_isCurrentExecutor→dispatch_assert_queue_fail) traps.Crash frames on
main:closure #1 in closure #1 in static VoicePermissionSupport.requestSpeechPermission()closure #1 in closure #2 in IOSDeviceSettingsPermissions.request(_:isCurrent:)Change
Mark both handlers
@Sendable, so they are nonisolated and only forward the result to the bridge's@Sendablecompletion, which is already thread-safe.Evidence
Fresh iPhone 17 simulator per run (iOS 27):
mainI also checked the other requests on the same Permissions page on
main: Contacts, Photos, Notifications, Calendars, Reminders, Camera, Microphone and Location. None of them crash, so the fix is limited to the two speech handlers.SwiftFormat and SwiftLint strict are clean. There's no unit test: the trap needs the real TCC callback queue, so the simulator run above is the proof.
Size: +4/−2 production lines.