Repository navigation
fix(apple): a two-second Gateway stall ends realtime Talk - #180572
Conversation
The shared Apple kit ended relay Talk once 48 microphone appends were waiting (about 2 s) or any append took longer than 8 s. Bound in-flight audio by time (3 s) instead, admit frames before their send task starts, drop frames over the budget with one notice and one recovery notice, and treat an append unanswered for 30 s as the liveness failure, matching browser relay Talk. The kit sends the notices as status keys; iOS localizes them and keeps the call in the listening phase. Closes openclaw#180426
|
🦞👀 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 bounds pending Apple Talk microphone audio to three seconds, drops excess frames without ending the call, and extends append deadlines to 30 seconds. Example: The Gateway freezes for five seconds during an Apple realtime Talk call.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness✅ Ready for maintainer review Keep this PR: it addresses a current Apple Talk failure with a focused patch, and the added runtime logs resolve the previous proof hold; no introduced correctness defect was identified. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe shared Apple relay receives PCM16 microphone frames from iOS and macOS, sends them through a socket-bound Gateway transport, and reports playback, status, and termination events to each app. flowchart LR
A[Apple microphone capture] --> B[Shared relay input budget]
B --> C[Socket-bound Gateway transport]
C --> D[Gateway Talk session]
D --> E[Realtime voice provider]
B --> F[iOS status presentation]
Technical reviewBest possible solution: Keep bounded audio admission and generation cleanup in the existing shared relay, with failure-close detachment handled by the companion PR. Do we have a high-confidence way to reproduce the issue? Current-main source deterministically terminates at 48 outstanding appends or an eight-second append timeout, and the contributor reports baseline device failure and base-failing regressions; this review executed no target code. Is this the best way to solve the issue? The patch repairs admission at the existing shared owner, preserves bounded memory and terminal error handling, and uses the existing app status path without adding retries, configuration, or a competing relay implementation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8f195e6a4239. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +45, Tests -14, Docs +2. Total +33 across 6 files. Added test files: 0. View PR surface stats
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 HistoryReview history (1 earlier review cycle)
Reviewed October 22, 2026, 9:15 AM ET / 13:15 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…80572) * fix(apple): keep realtime Talk through a slow Gateway The shared Apple kit ended relay Talk once 48 microphone appends were waiting (about 2 s) or any append took longer than 8 s. Bound in-flight audio by time (3 s) instead, admit frames before their send task starts, drop frames over the budget with one notice and one recovery notice, and treat an append unanswered for 30 s as the liveness failure, matching browser relay Talk. The kit sends the notices as status keys; iOS localizes them and keeps the call in the listening phase. Closes openclaw#180426 * test(apple): pin the realtime append deadline instead of simulating a stall
* fix(apple): keep realtime Talk through a slow Gateway The shared Apple kit ended relay Talk once 48 microphone appends were waiting (about 2 s) or any append took longer than 8 s. Bound in-flight audio by time (3 s) instead, admit frames before their send task starts, drop frames over the budget with one notice and one recovery notice, and treat an append unanswered for 30 s as the liveness failure, matching browser relay Talk. The kit sends the notices as status keys; iOS localizes them and keeps the call in the listening phase. Closes #180426 * test(apple): pin the realtime append deadline instead of simulating a stall Release adaptation: stable's realtime-sessions doc lacks the browser relay paragraph, so only an Apple-specific paragraph was added. The later #180571 (detach Talk failures from agent answers) is a separate capability-gated feature, not a regression fix, and was not included. (cherry picked from commit f85897e)
Related: #180426 (#180571 covers the failure close)
Related: #155839, #173388
What Problem This Solves
Fixes: on iOS and macOS, Gateway-relay realtime Talk ends with "Realtime audio input fell behind. Reconnecting…" once
about two seconds of microphone appends are waiting (48 requests), and it also ends when any single append takes longer
than 8 seconds.
User Impact
User impact: a Gateway or network stall now costs the microphone audio sent during the stall, plus a "repeat the last
part" notice on iOS, instead of the call. Talk still ends when an append fails or stays unanswered for 30 seconds.
macOS drops audio the same way but has no surface for relay status notices.
Why This Change Was Made
This applies the browser relay contract (#155839, #173490) to the shared Apple kit:
The Gateway answers appends in order (one handler; appends during an output cancellation wait on one drain), so a
per-request deadline equal to the 30 s liveness window acts like the browser's renewable watchdog without a separate
timer. Like the other relay statuses, the kit sends the two notices as status keys and iOS localizes them, mapping both
to the listening phase; otherwise the generic status path would show an active call as idle and freeze the input meter.
Tradeoff: a Gateway that stops answering while keeping the socket open is now detected after 30 s instead of about 2 s,
as in browser Talk. A lost connection still ends the call immediately. If a notice arrives while the assistant is
speaking, iOS shows listening until the next speaking change.
Evidence
Kit:
microphone saturation terminates once without sending the frame past the capbecameinput past the audio budget is dropped without ending the call, anda one second gateway stall does not saturate microphone inputbecameaudio appends give a stalled Gateway thirty seconds to answer, which pins the deadlineeach append hands the transport (the transport owns the timer). iOS:
realtime input loss notices keep the call listening.swift test --filter RealtimeTalkRelaySessionon macOS(Swift 6.4, Xcode 27): 62 tests in 7 suites passed. With only the new kit tests applied to the base, both fail: the
over-budget frames are still admitted, and appends get the old 8 s deadline. iOS 27 simulator:
TalkModeConfigParsingTests,TalkModeManagerTests,TalkRealtimeConsultCancellationTests, andTalkRealtimeVoiceSessionCleanupTestspass, and the app build includes the project's SwiftFormat lint and strictSwiftLint phases.
pnpm native:i18n:baselineregeneratedapps/.i18n/native-source.json;pnpm native:i18n:verifypasses. Localestrings follow through the native locale refresh workflow.
End to end against a 2026.10.5 Gateway that we froze with
docker pause(the way fix(talk): a sub-second stall ends the realtime call and cuts playback #155839 was proven):3 s of audio arrived late, then latency returned to normal.
reconnected after the Gateway resumed.
continued. The recovery notice was replaced by "Thinking…" within a second, so it is easy to miss; unlike
browser Talk, iOS has no persistent notice surface.
Trace of the macOS runs (Gateway log and macOS unified log, ids removed, all times UTC+8)
The Gateway logs failed relay requests and lifecycle calls, not successful appends, so the 5 s run shows up as the
absence of a close or a new session around a consult that still ran. The 35 s freeze also outlived the session on the
Gateway side, so its queued appends were answered with
Unknown Talk sessiononce it resumed.The macOS app builds;
pnpm format:docs:checkandgit diff --checkpass.The macOS end-to-end run used the debug binary with the microphone and speech usage strings embedded at
link time (plain
swift buildoutput has no Info.plist) and a local one-word workaround for an unrelatedcrash when Speech Recognition permission is first requested; that crash will be reported separately.
AI-assisted (Claude Code). The change and the evidence above were run and reviewed as described.