feat: add opt-in Realtime reconnect and send queue - #681
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Castiron custom code✅ No new custom-code files detected. 50 mixed files remain; 0 existing customizations changed. Compared 50 existing customizations unchanged
10 more in the full report. A changed generated baseline means this report cannot reliably identify which handwritten lines changed. Inspect the custom-code diffDownload the exact patch produced by this run (requires repository access): gh run download 34187284081 --repo openai/openai-ruby \
--name castiron-custom-code-34187284081-1 --dir /tmp/castiron-custom-code-34187284081-1
git apply --stat /tmp/castiron-custom-code-34187284081-1/custom-code.patch
cat /tmp/castiron-custom-code-34187284081-1/custom-code.patchOr reproduce it from an SDK checkout containing the vendored reporter: git fetch --no-tags origin 345dabbb3246ce5fc389424d008e4937cf87395c 6125c0e6ca86e8352e9e4b08f72bfc9b052d11cc
python3 scripts/castiron/custom_code_report.py report \
--base 345dabbb3246ce5fc389424d008e4937cf87395c \
--head 6125c0e6ca86e8352e9e4b08f72bfc9b052d11cc --fetch --require-head-hash --public \
--out /tmp/castiron-custom-code-6125c0e6ca86
cat /tmp/castiron-custom-code-6125c0e6ca86/custom-code.patchThis is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f54cbbf78
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
markstuart-oai
left a comment
There was a problem hiding this comment.
Reviewed all 16 changed files at 6125c0e, including the maintained Realtime/WebSocket ownership paths, examples, and RBI/RBS contracts. No substantive correctness or structural findings. Recovery remains isolated in Realtime and reuses the canonical handshake/authentication and transport helpers; no changed file crosses 1,000 lines. Explicit restoration/flush and terminal handling of uncertain writes are preserved.
Independently reproduced the four caller-isolation/completion regressions using the pre-fix recovery implementation and verified they pass on this head. Fresh Ruby 4.0.6 validation: 35 reconnect tests / 202 assertions passed; the broader Realtime, Responses WebSocket, and client run completed 329 tests / 1,949 assertions with zero failures and two errors in unchanged proxy tests (also reproduced in isolation). Additional cancellation/queue-accounting probes passed. Sorbet and all 1,290 RBS files validated. I did not rerun the full mock-server suite, cross-version matrix, OkTest, or live API tests.
Summary
Dropped Realtime connections currently require callers to build their own recovery loop. Add
reconnect: trueto the existingclient.realtime.connectAPI, defaulting tofalsefor compatibility. Recovery keeps one logical connection and runs the application block once, with finite transient-only retries, jittered backoff, refreshed authentication, and cancellation of outstanding socket work.Optional byte-bounded retention holds outgoing events while recovering. Applications restore session state and call
flush_pendingexplicitly; the SDK never automatically replays an uncertain write. Terminal errors distinguish never-attempted events from uncertain delivery without including payloads in their messages. Each sender receives only its own payload and delivery result, and successful writes are acknowledged atomically before clearing their in-flight identity.The change is confined to maintained Realtime helpers, RBI/RBS, documentation, and focused tests. Transcription and existing-call sideband behavior are unchanged. Reopening a socket does not restore conversation, audio, or tool state.
Validation
The caller-isolation regressions reproduced the original failure and the close/callback edge cases before the fix, then passed after correction. The repair passed three fresh-context adversarial-review rounds, ending with two consecutive clean rounds on the unchanged diff, plus the full test and lint checks above.