Skip to content

fix(ios): play realtime voice replies reliably with xAI - #163146

Merged
roboclaw-bot merged 5 commits into
openclaw:mainfrom
Marvinthebored:fix/realtime-voice-content-20261002
Oct 2, 2026
Merged

roboclaw-bot merged 5 commits into
openclaw:mainfrom
Marvinthebored:fix/realtime-voice-content-20261002

Conversation

@Marvinthebored

@Marvinthebored Marvinthebored commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Related: #163122
Companion: #163153

What Problem This Solves

Fixes: realtime voice on iOS fails or degrades under normal use. Burst replies overflow the output queue and end the session ("playback fell behind, reconnecting") with no audio; short Gateway stalls overflow the microphone send queue and end the session ("audio input fell behind"); playback runs only three buffers ahead and refills through the main thread, so it chops; and UI rendering on the main thread delays or drops the first words of each reply. Playback-mark acknowledgments sent during startup are also lost.

User Impact

User impact: realtime voice sessions stay connected and replies play smoothly and in full, from the first word, while the chat UI is busy. No Gateway, confirmation, transcript, or chat UI behavior changes.

Why This Change Was Made

The native player and relay output now schedule audio off the main actor, keeping playback-drain, cancellation, and generation fences. Input and output queues are bounded but sized for the burst delivery realtime providers use.

During startup, the output owner now receives the relay identity before buffered startup events are replayed, so a buffered mark or clear can be acknowledged. A separate startup-routing gate still keeps newly arriving audio behind the replayed startup events.

Evidence

Pinned integration base: 8a754c57f5976e6bccab119ad47df0645c94f093.

  • Physical iPhone: before the off-main change, replies lost their opening words under UI load ("-erlin, Paris and Rome…"). After it, the same prompt played complete ("Berlin, Paris, and Rome"), and later sessions were reported at parity with the web client. This does not certify Bluetooth route changes.
  • Startup acknowledgment (red → green): restoring the old late identity assignment makes buffered startup clear acknowledges its playback mark time out; with the fix it passes, alongside installed relay identity does not open startup routing. A separate harness against the real macOS AVAudioEngine backend observed the mark acknowledgment off-main during a 2 s main-actor stall (silent PCM; not an audibility claim).
  • Test synchronization (review findings): the main-stall regression now blocks the main thread on a bounded completion barrier signaled by the audio boundary, instead of a fixed 1.5 s spin. The prebuffer test now awaits the observed playback start and drains the backend queue before asserting, including the no-start case.
  • This head: Realtime|GatewayNodeSession suites — 165 tests in 11 suites passed; native macOS product build passed; SwiftFormat and strict SwiftLint clean on changed files; native i18n verify passed.

AI-assisted (Kiro with Claude). Change set reviewed against the earlier physically tested build.

@clawsweeper

clawsweeper Bot commented Oct 2, 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 app: ios App: ios gateway Gateway runtime size: XL labels Oct 2, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. 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. labels Oct 2, 2026
@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 2, 2026, 4:54 AM ET / 08:54 UTC (Revision 10).

ClawSweeper review

What this changes

The PR moves Apple realtime voice playback off the UI thread, increases bounded audio capacity, and preserves playback acknowledgments during startup.

Merge readiness

✅ Ready for maintainer review

This remains a useful native voice reliability fix: current main and the latest release retain the affected playback path. The prior blockers are resolved, and this review found no new blocking defect.

Priority: P1
Reviewed head: 694c0bc3df12173d0a2cb263feabcbb7b4ec0425

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, coherent repair with scoped native behavior evidence and resolved prior findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): Reported physical-iPhone before/after playback under UI load demonstrates complete opening words through the retained native player path; real macOS AVAudioEngine observations separately cover off-main startup acknowledgment. Tests supplement cancellation and drain coverage. Bluetooth route changes are not claimed, and no stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Reported physical-iPhone before/after playback under UI load demonstrates complete opening words through the retained native player path; real macOS AVAudioEngine observations separately cover off-main startup acknowledgment. Tests supplement cancellation and drain coverage. Bluetooth route changes are not claimed, and no stored-data contract changes.
Evidence reviewed 8 items Pinned introduced changes: Reviewed the merge-base-to-head changes, retaining 694c0bc as the original PR head. Base-only workflow and dependency changes are outside this PR's introduced delta; the supplied stale test merge does not establish removal of current-main behavior.
Current-main necessity: Current main still declares the player MainActor-bound, limits scheduled buffers to three, and routes completion refill through the main actor. The player and relay source have no changes between the pinned integration base and fetched main.
Latest-release comparison: The supplied latest release, v2026.9.7, contains the same MainActor-bound, three-buffer player; the central repair is not already present there.
Findings None None.
Security None None.

How this fits together

Apple realtime Talk receives microphone input and provider replies through the Gateway relay. The shared native audio subsystem schedules replies on the device and reports playback completion back to the Gateway.

flowchart LR
  A[Microphone input] --> B[Gateway relay]
  B --> C[Reply audio and playback marks]
  C --> D[Startup and cancellation gates]
  D --> E[Native playback queue]
  E --> F[Device speaker]
  E --> G[Playback acknowledgments]
  G --> B
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Other +1133. Total +1133 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 9 1616 483 +1133
Total 9 1616 483 +1133

Review metrics

Metric Value Why it matters
Production versus test growth production +422 lines, tests +711 lines Production growth is explained by moving relay output into a serialized owner and implementing off-main playback; tests cover startup, drain, cancellation, and stalled execution.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #163122
Summary: This PR is the candidate repair for the native audio portion of the broader report; transcript and confirmation work remain separate.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep native audio scheduling independent of UI work while preserving bounded buffering, cancellation fences, and acknowledgments tied to actual playback drain.

Do we have a high-confidence way to reproduce the issue?

Yes, source establishes a focused path: receive burst reply audio while the main actor is busy, with playback refill constrained to three buffers. Physical-device observations corroborate the symptom; this review did not execute a current-main reproduction.

Is this the best way to solve the issue?

Yes, the native output owner removes the scheduling dependency at the affected boundary while retaining the existing playback interface and cancellation semantics.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 2a390ec08773.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: Reported physical-device failures interrupt normal realtime voice replies and lose their opening words.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; 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. Sufficient (live_output): Reported physical-iPhone before/after playback under UI load demonstrates complete opening words through the retained native player path; real macOS AVAudioEngine observations separately cover off-main startup acknowledgment. Tests supplement cancellation and drain coverage. Bluetooth route changes are not claimed, and no stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. Reported physical-iPhone before/after playback under UI load demonstrates complete opening words through the retained native player path; real macOS AVAudioEngine observations separately cover off-main startup acknowledgment. Tests supplement cancellation and drain coverage. Bluetooth route changes are not claimed, and no stored-data contract changes.

Evidence

What I checked:

  • Pinned introduced changes: Reviewed the merge-base-to-head changes, retaining 694c0bc as the original PR head. Base-only workflow and dependency changes are outside this PR's introduced delta; the supplied stale test merge does not establish removal of current-main behavior. (694c0bc3df12)
  • Current-main necessity: Current main still declares the player MainActor-bound, limits scheduled buffers to three, and routes completion refill through the main actor. The player and relay source have no changes between the pinned integration base and fetched main. (apps/shared/OpenClawKit/Sources/OpenClawKit/RealtimePCMStreamingAudioPlayer.swift:5, 2a390ec08773)
  • Latest-release comparison: The supplied latest release, v2026.9.7, contains the same MainActor-bound, three-buffer player; the central repair is not already present there. (apps/shared/OpenClawKit/Sources/OpenClawKit/RealtimePCMStreamingAudioPlayer.swift:5, c074824a27c9)
  • Prior findings resolved: Startup installs the output owner's relay identity before buffered events replay while retaining a separate routing gate. The changed tests use an audio-boundary completion barrier and await playback start before draining the backend queue and asserting. These address all three retained prior finding types. (apps/shared/OpenClawKit/Sources/OpenClawKit/RealtimeTalkRelaySession.swift:408, 694c0bc3df12)
  • Real native behavior evidence: The captured PR body reports physical-iPhone before/after acceptance under UI load: clipped opening words became the complete spoken reply. It also reports the real macOS AVAudioEngine backend acknowledging a playback mark during a two-second main-actor stall. The physical evidence covers the retained off-main implementation; the latest startup repair has separate native-boundary evidence. Silent PCM is not treated as audibility proof, and Bluetooth route changes are outside the claim. The reported 165 passing tests and native build are supplemental; this read-only review did not execute them. (694c0bc3df12)
  • Production entrypoint and compatibility: The iOS Talk owner constructs the shared relay with RealtimePCMStreamingAudioPlayer. The patch retains the existing actor-bound playback protocol for other clients while the native backend uses synchronous generation registration and serialized backend operations. No persisted format, provider selection, plugin API, or confirmation policy changes are introduced. (apps/ios/Sources/Voice/TalkModeManager.swift:2289, 694c0bc3df12)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-02T01:27:10.453Z sha 458f534 :: needs real behavior proof before merge. :: [P2] Initialize acknowledgment identity before processing startup output
  • reviewed 2026-10-02T01:47:42.679Z sha 7fe2c28 :: needs changes before merge. :: [P2] [P2] Replace the fixed-duration spin with a completion barrier | [P2] [P2] Await playback start before asserting the prebuffer result
  • reviewed 2026-10-02T01:55:58.232Z sha 7fe2c28 :: needs changes before merge. :: [P2] [P2] Replace the fixed-duration spin with a completion barrier | [P2] [P2] Await playback start before asserting the prebuffer result
  • reviewed 2026-10-02T03:09:29.964Z sha 7fe2c28 :: needs changes before merge. :: [P2] [P2] Replace the fixed-duration spin with a completion barrier | [P2] [P2] Await playback start before asserting the prebuffer result
  • reviewed 2026-10-02T06:06:59.134Z sha 079294a :: blocked before merge. :: [P2] [P2] Install acknowledgment identity before replaying startup events | [P2] [P2] Replace the fixed-duration spin with a completion barrier | [P2] [P2] Await playback start before asserting the prebuffer result
  • reviewed 2026-10-02T06:20:41.372Z sha 079294a :: blocked before merge. :: [P2] [P2] Install acknowledgment identity before replaying startup events | [P2] [P2] Replace the fixed-duration spin with a completion barrier | [P2] [P2] Await playback start before asserting the prebuffer result
  • reviewed 2026-10-02T08:19:03.981Z sha 694c0bc :: needs maintainer review before merge. :: none
  • reviewed 2026-10-02T08:40:09.775Z sha 694c0bc :: needs maintainer review before merge. :: none

@Marvinthebored Marvinthebored changed the title fix: realtime voice replies stall and spoken confirmations stay blocked fix(ios): enable x.ai realtime voice with reliable audio and spoken confirmations Oct 2, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 2, 2026
@Marvinthebored
Marvinthebored marked this pull request as draft October 2, 2026 03:02
@Marvinthebored Marvinthebored changed the title fix(ios): enable x.ai realtime voice with reliable audio and spoken confirmations fix(ios): keep realtime reply audio flowing during UI work Oct 2, 2026
@openclaw-barnacle openclaw-barnacle Bot removed app: ios App: ios gateway Gateway runtime labels Oct 2, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Oct 2, 2026
Install the relay identity on the output owner before buffered startup
events replay, so a buffered mark or clear is acknowledged. A separate
startup-routing gate keeps new audio behind the replayed startup events.

The main-stall regression now blocks the main thread on a bounded
completion barrier instead of a fixed spin, and the prebuffer test awaits
the observed start and drains the backend queue before asserting.
@clawsweeper clawsweeper Bot added the rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. label Oct 2, 2026
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 2, 2026
@Marvinthebored
Marvinthebored marked this pull request as ready for review October 2, 2026 08:31
@Marvinthebored Marvinthebored changed the title fix(ios): keep realtime reply audio flowing during UI work fix(ios): play realtime voice replies reliably with xAI Oct 2, 2026
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Landing review for 694c0bc3df12173d0a2cb263feabcbb7b4ec0425: no blocking findings remain. The shared Apple audio owner now schedules/refills off-main, while startup replay, generation fencing, cancellation, and actual-drain acknowledgments remain coherent. Current main still has the affected three-buffer, MainActor-bound path.

Verified exact-head CI 36984563290: OpenClawKit 2,120 tests in 179 suites; macOS 2,473 tests in 280 suites; iOS smoke green. git diff --check 8a754c57f5976e6bccab119ad47df0645c94f093...694c0bc3df12173d0a2cb263feabcbb7b4ec0425 passed. Native review-validate-artifacts and OPENCLAW_TESTBOX=1 scripts/pr prepare-run 163146 passed without changing the source head.

Fresh independent autoreview through P2 is scoped-clean. Its initial prebuffer/barge-in concern was checked against the real iOS/macOS capture routes and interruption policy, then independently adjudicated: speaker routes suppress input; isolated headsets deliberately allow fresh speech to cancel buffered output. There is no requirement to play a reply audibly before honoring that interruption, so no speculative timing change was added. Apple scheduleBuffer completion/stop semantics were checked directly.

Production Swift delta: +828/-406 (net +422); tests: +786/-75 (net +711); localization source metadata net zero. Growth creates the serialized off-main output/backend boundary rather than retaining the old main-actor scheduling path.

Physical-iPhone and real AVAudioEngine evidence remains contributor-reported, as described in the PR; I did not run a fresh device session, and Bluetooth route changes are not certified. The broader linked issue remains open for its separate transcript/confirmation work. Squash will preserve the source contributor and add Tak Hoffman’s requested co-author credit.

@roboclaw-bot
roboclaw-bot merged commit 646916d into openclaw:main Oct 2, 2026
164 of 167 checks passed
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 3, 2026
)

Keep native realtime voice replies complete under UI load by moving playback and output routing off the main actor, retaining generation/cancellation fences, and accepting bounded provider bursts. Install acknowledgment identity before replaying startup output.

Related: openclaw#163122. Transcript and confirmation work remain separate.

Verified exact-head CI run 36984563290, including native Swift suites and iOS smoke. Contributor supplied physical-iPhone before/after playback evidence; Bluetooth route changes are not certified.

Landing session: https://team.openclaw.ai/chat/roboclaw/dashboard/060f4613-1c9e-4402-8400-66113d2e4463

Co-authored-by: Tak Hoffman <[email protected]>
Co-authored-by: Takhoffman <[email protected]>
Co-authored-by: Marvinthebored <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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.

4 participants