Skip to content

fix(apple): a two-second Gateway stall ends realtime Talk - #180572

Merged
steipete merged 2 commits into
openclaw:mainfrom
kybrcore:fix/apple-talk-relay-input-budget
Oct 23, 2026
Merged

steipete merged 2 commits into
openclaw:mainfrom
kybrcore:fix/apple-talk-relay-input-budget

Conversation

@kybrcore

@kybrcore kybrcore commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • in-flight microphone audio is bounded by time (3 s), not by request count;
  • frames are admitted before their send task starts, so a stall no longer queues one task per callback;
  • frames over the budget are dropped, with one notice per loss episode and one recovery notice;
  • the relay ends only on an explicit append error or an append unanswered for 30 s.

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 cap became
    input past the audio budget is dropped without ending the call, and a one second gateway stall does not saturate microphone input became audio appends give a stalled Gateway thirty seconds to answer, which pins the deadline
    each append hands the transport (the transport owns the timer). iOS:
    realtime input loss notices keep the call listening. swift test --filter RealtimeTalkRelaySession on 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, and
    TalkRealtimeVoiceSessionCleanupTests pass, and the app build includes the project's SwiftFormat lint and strict
    SwiftLint phases.

  • pnpm native:i18n:baseline regenerated apps/.i18n/native-source.json; pnpm native:i18n:verify passes. Locale
    strings 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):

    • macOS, 5 s freeze: the same relay session continued (a later consult ran in it) and no close was sent; up to
      3 s of audio arrived late, then latency returned to normal.
    • macOS, 35 s freeze: the client ended the relay at 30.3 s with "gateway request timed out after 30000ms" and
      reconnected after the Gateway resumed.
    • iOS simulator, 5 s freeze: the status line showed the notice below about 3.4 s into the stall and the call
      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.
    • Baseline: an iPhone on App Store build 2026.10.50 (without this change) dropped the call on the same 5 s freeze.
    Trace of the macOS runs (Gateway log and macOS unified log, ids removed, all times UTC+8)
    17:55:17.114 gateway  res ✓ talk.session.create                      # relay session for this run
    17:58:11.405 gateway  lane enqueue: lane=talk                         # consult before the freeze
    17:59:03.548 docker pause (5 s)
    17:59:08.875 docker unpause
    18:00:57.219 gateway  lane enqueue: lane=talk                         # consult in the same relay session
    18:01:00.504 gateway  lane task done: lane=talk durationMs=3285
    # no talk.session.close or talk.session.create between 17:55:17 and 18:12:22
    18:11:46.943 docker pause (35 s)
    18:12:17.295 client   talk realtime microphone failed: Realtime audio failed: gateway request timed out after 30000ms
    18:12:17.530 client   talk realtime terminated=audioInputFailed
    18:12:22.270 docker unpause
    18:12:22.534 gateway  res ✗ talk.session.appendAudio UNAVAILABLE Unknown Talk session   # x31, queued during the freeze
    18:12:22.562 gateway  res ✗ talk.session.close UNAVAILABLE Unknown Talk session
    18:12:22.915 gateway  res ✓ talk.session.create                      # client reconnects
    

    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 session once it resumed.

    iOS Talk status line: Realtime audio input fell behind; repeat the last part
  • The macOS app builds; pnpm format:docs:check and git diff --check pass.

  • The macOS end-to-end run used the debug binary with the microphone and speech usage strings embedded at
    link time (plain swift build output has no Info.plist) and a local one-word workaround for an unrelated
    crash 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.

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
@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: ios App: ios size: M labels Oct 22, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 22, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This 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.

  • Before: The pending microphone requests exceed the 48-request cap and terminate the call.
  • After: The relay drops audio beyond its three-second budget, continues after recovery, and shows repeat guidance on iOS.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused patch has sufficient production-path evidence and no identified defect; overall scope remains partial against the broader linked issue.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (logs): The shared Apple relay was exercised through the macOS app against a real 2026.10.5 Gateway with injected five- and 35-second freezes; supplied logs show same-relay activity after recovery and the 30000 ms terminal timeout, while the inspected iOS screenshot shows repeat guidance. These additions resolve the earlier proof request, and the subsequent commit changes only a test.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: Apple realtime Talk disconnects during recoverable Gateway stalls.
Reason: This is a useful, bounded repair of the linked issue's latency failure; preserving accepted agent work after a terminal failure remains in #180571.

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
Reviewed head: 588faffbd7cff83eb15fa7d92fa1fa4a2a86bfea

Before merge

None.

Findings

None.

Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

  • Fatal input saturation and append deadline changes intended behavior with a stated reason (057ed79: The shared relay established bounded microphone work and visible terminal recovery; fix(ios): play realtime voice replies reliably with xAI #163146 later enlarged the cap to tolerate ordinary latency.)
  • iOS realtime status presentation keeps the original intent (c147e0e: The refactor consolidated realtime presentation while preserving localized text, phase, and Watch semantics; the new notice mapping preserves that ownership.)
  • Audio-input regression tests changes intended behavior with a stated reason (662d377: Existing relay tests were split into cohesive suites without changing their assertions; replacing saturation expectations is explained by the intended behavioral repair.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +45, Tests -14, Docs +2. Total +33 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 64 19 +45
Tests 2 54 68 -14
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 120 87 +33

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.
  • remove proof: 📸 screenshot: Current real behavior proof evidence kind is logs.

Label justifications:

  • P1: A short Gateway stall terminates an active Apple voice workflow and can interrupt an agent answer; current source and supplied device observations establish user impact.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-22T12:02:13.530Z sha 4dfb453 :: needs real behavior proof before merge. :: none

Reviewed October 22, 2026, 9:15 AM ET / 13:15 UTC (Revision 2).

@kybrcore

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 22, 2026
@steipete
steipete merged commit f85897e into openclaw:main Oct 23, 2026
102 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 23, 2026
…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
RomneyDa pushed a commit that referenced this pull request Oct 26, 2026
* 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: ios App: ios docs Improvements or additions to documentation P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants