Skip to content

fix(xai): preserve transcription audio on reopen - #130297

Merged
steipete merged 1 commit into
mainfrom
codex/fix-xai-realtime-reopen-audio
Aug 26, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/fix-xai-realtime-reopen-audio

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where audio queued while reopening an xAI realtime transcription session could be silently dropped after the previous underlying WebSocket session had closed.

Why This Change Was Made

The lazy provider now begins the underlying reconnect before draining queued audio. The session's synchronous connect prefix reopens input acceptance, so queued chunks are delivered in order to the new generation instead of being sent into the still-closed session. Existing close, ordering, and concurrent-open behavior remains unchanged.

User Impact

Users reopening realtime transcription no longer lose the first queued audio chunks during reconnect.

Evidence

  • Genuine stateful regression: pre-fix lazy suite 28 passing / 2 failing; fixed suite 30/30.
  • Focused owner and sibling coverage passes: 38 shared owner tests, 29 WebSocket-session tests, 82 voice tests, and 481 xAI tests.
  • Exact focused formatting, type-aware lint, and diff checks pass.
  • Fresh autoreview and two independent reviews report no actionable findings.
  • Production delta: +18/-19, net -1 line; tests add the realistic reconnect regression.

@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 26, 2026 18:46
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 2:53 PM ET / 18:53 UTC.

ClawSweeper review

What this changes

The PR starts xAI transcription reconnection before flushing queued audio so audio queued during a reopen reaches the new WebSocket session.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open: current main still drains xAI transcription audio into a closed provider session before reopening it, while this focused patch reverses that sequence and adds a credible regression test. It is a protected maintainer PR, so normal human approval and exact-head CI remain required.

Priority: P1
Reviewed head: 590ecd937642561b7d3892dd935156ad7017b8ce
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused patch matches the shared session contract and adds a credible stateful regression test.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body also reports focused regression validation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body also reports focused regression validation.
Evidence reviewed 7 items Current-main defect: Current main drains the lazy wrapper queue and calls sendAudio before calling the underlying session’s connect method, so a just-closed session can discard those chunks.
Underlying session contract: The shared session synchronously clears its closed state at connect entry and queues audio until its socket is ready, so calling connect before draining is the correct owner-boundary ordering.
Patch behavior: The PR invokes the provider session’s connect method before draining wrapper audio, then awaits the same connect promise after forwarding retained chunks.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs extensions/xai/lazy-capability-providers.test.ts

Result: FAIL (failed) — step 1 run node scripts/run-vitest.mjs extensions/xai/lazy-capability-providers.test.ts: previous terminal command was still running after 30 seconds: "node scripts/run-vitest.mjs extensions/xai/lazy-capability-providers.test.ts"

[test] starting test/vitest/vitest.extension-providers.config.ts

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-130297-hdjS9P/target

[vitest] still running with no output for 30000ms.

Assertions:

  • FAIL expect_output: xAI lazy capability providers

How this fits together

xAI’s realtime transcription wrapper buffers microphone audio while its provider session loads or reconnects. It delegates the actual socket lifecycle to the shared realtime-transcription session, which queues audio until the provider reports readiness.

flowchart LR
  A[Audio input] --> B[Lazy xAI wrapper]
  B --> C[Wrapper audio queue]
  B --> D[Start reconnect]
  C --> E[Shared WebSocket session]
  D --> E
  E --> F[xAI transcription service]
Loading

Decision needed

Question Recommendation
After exact-head CI completes, should the xAI owner approve this maintainer PR to repair the reopen-audio loss path? Approve after green CI: Accept the focused provider-local repair once required checks are green on the reviewed head.

Why: The protected maintainer label requires explicit human handling even though the source review found no correctness blocker.

Before merge

  • Complete next step (P2) - The protected maintainer PR needs exact-head CI and explicit owner approval, not an automated repair branch.
Agent review details

Security

None.

PR surface

Source -1, Tests +38. Total +37 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 9 10 -1
Tests 1 47 9 +38
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 56 19 +37

Review metrics

Metric Value Why it matters
Production vs test LOC delta production +9/-10 (net -1); tests +47/-9 (net +38) The repair rearranges an existing reconnect sequence without production growth and adds a stateful regression case.

Technical review

Best possible solution:

Land the provider-local ordering repair after exact-head CI and the required maintainer review; retain the bounded queue and close-generation behavior unchanged.

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

Yes, from source: close a lazy xAI transcription session, queue audio while reopening, and the current-main wrapper forwards it before the underlying session’s synchronous reopen begins.

Is this the best way to solve the issue?

Yes. Starting the existing provider session before draining the wrapper’s retained queue uses the shared session’s established readiness queue instead of adding a parallel recovery path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 08a42a561c8f.

Labels

Label changes:

  • add P1: Current xAI transcription reconnects can silently drop retained audio for affected realtime users.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body also reports focused regression validation.

Label justifications:

  • P1: Current xAI transcription reconnects can silently drop retained audio for affected realtime users.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body also reports focused regression validation.

Evidence

What I checked:

Likely related people:

  • Dallin Romney: Git blame attributes the current-main reconnect sequence to the commit that introduced the lazy xAI transcription wrapper. (role: introduced current wrapper behavior; confidence: high; commits: eb448db8163e; files: extensions/xai/lazy-capability-providers.ts, extensions/xai/lazy-capability-providers.test.ts)
  • Peter Steinberger: Recent history shows repeated work in this lazy provider surface, including the proposed reconnect repair. (role: recent area contributor; confidence: medium; commits: 590ecd937642, 42a4d0a9b8b3; files: extensions/xai/lazy-capability-providers.ts, extensions/xai/lazy-capability-providers.test.ts)

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.

@steipete
steipete merged commit c3d95c2 into main Aug 26, 2026
169 of 170 checks passed
@steipete
steipete deleted the codex/fix-xai-realtime-reopen-audio branch August 26, 2026 19:35
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: xai maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

1 participant