Repository navigation
fix(openai): close preconnect realtime sessions - #116735
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 31, 2026, 8:10 AM ET / 12:10 UTC. ClawSweeper reviewWhat this changesThe PR makes OpenAI Realtime bridge cancellation terminal before the first socket connection, clears queued audio in both GA and QuickSilver adapters, and requires an explicit fresh connection. Merge readinessKeep this PR open for normal maintainer merge review. It is maintainer-authored and carries the protected Priority: P1 Review scores
Verification
How this fits togetherThe OpenAI extension’s Realtime voice bridges accept audio before a provider socket is ready, then hand it to a shared lifecycle object that owns connection generations and terminal state. That lifecycle determines whether buffered audio may reach the provider and whether close callbacks belong to the active generation. flowchart LR
A[Voice input] --> B[GA or QuickSilver bridge]
B --> C[Shared realtime lifecycle]
C --> D{Active generation?}
D -->|No: terminal| E[Discard queued audio]
D -->|Yes| F[Provider socket]
F --> G[Audio and close callbacks]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +29, Tests +73. Total +102 across 6 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Preserve one shared terminal-generation invariant in the lifecycle, retain the paired GA and QuickSilver regression coverage, and merge only after confirming late callbacks cannot revive or drain a cancelled generation. Do we have a high-confidence way to reproduce the issue? Yes, from source and supplied regression coverage: queue audio, close before the first connection, then explicitly reconnect and verify no old audio is sent. The PR also supplies a reported live GA after-fix run for the same observable boundary. Is this the best way to solve the issue? Yes, based on the supplied diff: placing preconnect terminalization in the shared lifecycle avoids two adapter-specific definitions of cancellation while each bridge clears its own queued transport state. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7af2bb62622e. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
* origin/main: (38 commits) fix(agents): compact session status change text (#116742) fix(llama-cpp): recover plaintext tool calls (#116736) fix(telegram): validate native queue arguments before fallback (#116726) chore(skills): add autonomous issue sweep workflow docs(auto-qa): require clean root-cause refactors fix(ollama): models advertise tools when /api/show fails (#109971) fix(ollama): use CJK-aware char estimate for usage fallback (#110073) fix(ollama): release failed setup response bodies before returning (#111802) feat(plugins): externalize Synthetic provider (#116720) fix(agents): unblock channel turns after restart recovery (#116728) fix(telegram): keep typing alive during active steered tasks (#116721) fix(gateway): admit standalone MCP app work (#116727) fix(googlechat): record canonical receipt thread (#116717) test(ui): cover the Talk relay start-stop race fix(ui): close superseded Talk allocations fix(agents): resume interrupted turns past progress commentary (#116725) fix(gateway): sign device proofs with challenge time (#116679) test(google): cover expired CLI OAuth compatibility fix(testing): load relay smoke through UI Vite config test(testing): guard realtime relay smoke module path ...
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Maintainer Codex contract check completed against sibling
That matches this PR's invariant: cancellation owns the current generation, late work cannot revive it, and only an explicit fresh connection becomes eligible for audio. The ClawSweeper rank-up move is satisfied. |
* origin/main: (23 commits) fix(agents): preserve resumed turns after stale terminal events (#116777) fix(browser): preserve tab-bound browser authorization (#116778) fix(doctor): correct SQLite-backed automation warnings (#116769) fix(release): skip unavailable Buzz QA runner (#116753) feat(plugins): externalize DuckDuckGo search (#116740) refactor(reply): simplify task-owned typing refresh (#116770) fix(chat): explain chat-only model limits feat(models): expose tool support to clients docs(skill): require independent proof before issue closure fix(skills): allow autonomous sweep sync (#116755) fix(irc): recognize punctuation in nickname mentions (#116758) fix(plugins): require explicit source external startup (#116759) fix(whatsapp): keep sends running when typing presence fails (#116739) fix(cli): reject dangling config path escapes (#116738) fix(qa): authenticate summaries and bound native scenario commands (#116748) fix(bedrock): reject truncated streams and preserve audio results (#116743) docs(skill): isolate autonomous issue sweep worktrees fix(ci): retire Kova runtime deps coverage (#116760) chore(i18n): refresh native locales (#116640) fix(ollama): resolve web search secret refs (#104829) ...
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
…ect-lifecycle * commit '67eace4ae77b63cfc98703626b30512d1e18d03a': chore(openai): drop release-owned changelog entry fix(openai): narrow idle lifecycle cancellation fix(openai): discard preconnect audio on close fix(openai): terminalize preconnect lifecycle
Related: #116201
What Problem This Solves
Fixes an issue where closing an OpenAI Realtime voice bridge before its first connection could retain queued audio and allow that cancelled generation's work to reach a later explicit connection.
Why This Change Was Made
The existing named OpenAI Realtime lifecycle now owns the preconnection terminal state. GA and GPT-Live adapters delegate close to it, discard queued bridge state once, ignore late post-close input, and require an explicit fresh connection generation. Connected-session behavior, retry policy, provider selection, config, and environment surfaces remain unchanged.
The current head uses a signed two-parent merge from
main; the lifecycle commit series remains intact.User Impact
Cancellation and close are idempotent before and after connection. Closing before connect no longer leaks stale audio into a later session, and an explicit reconnect starts cleanly.
Evidence
b218adb7a7d931927aa7fd577f40b31ecc113c3bgpt-realtime-2.1: cancelled generation produced no ready/audio/close event; explicit reconnect became ready once, sent no stale audio, returned 19,200 audio bytes, and repeated close emitted one callback.codex-rs/core/src/realtime_conversation.rs:286-299replaces and stops prior active state before start.codex-rs/core/src/realtime_conversation.rs:425-443terminalizes only the matching active generation.codex-rs/core/src/realtime_conversation.rs:643-669removes active state and aborts its input task on shutdown.native-i18nCI failure was baseline locale drift repaired onmainbyfe408e109f6; this exact head includes that repair.The available ChatGPT OAuth account is not entitled to GPT-Live. GPT-Live is therefore covered by focused adapter tests, while the live GA path exercises the same shared lifecycle.
AI-assisted: yes. The implementation and proof were reviewed against source, live behavior, current main, and sibling Codex ownership semantics.