fix(realtime): preserve base URL routing components - #2567
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. 32 mixed files remain; 0 existing customizations changed. Compared 32 existing customizations unchanged
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 33574452304 --repo openai/openai-node \
--name castiron-custom-code-33574452304-1 --dir /tmp/castiron-custom-code-33574452304-1
git apply --stat /tmp/castiron-custom-code-33574452304-1/custom-code.patch
cat /tmp/castiron-custom-code-33574452304-1/custom-code.patchOr reproduce it from an SDK checkout containing the vendored reporter: git fetch --no-tags origin 82c5b2def367f88d9c05c83b23dfb78ac6b9f25c c6cf81556ebb38a20fa011c3ed20849dc3d72bcb
python3 scripts/castiron/custom_code_report.py report \
--base 82c5b2def367f88d9c05c83b23dfb78ac6b9f25c \
--head c6cf81556ebb38a20fa011c3ed20849dc3d72bcb --fetch --require-head-hash --public \
--out /tmp/castiron-custom-code-c6cf81556ebb
cat /tmp/castiron-custom-code-c6cf81556ebb/custom-code.patchThis is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR. |
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
I checked the stable and beta URL builders against the routing/precedence boundaries here. Parsing baseURL before appending the endpoint keeps the pathname mutation separate from the query and fragment, so routing parameters are no longer absorbed into the /realtime suffix. Assigning through URL.pathname also preserves the encoded path cases covered by the regression matrix.
The later searchParams.set(...) calls still give explicit session parameters (model, call_id, intent) precedence over same-named values from the base URL while leaving unrelated and repeated routing parameters intact. The Azure path remains intentionally separate: it normalizes /v1, clears the inherited search, and then applies its GA parameters. Clearing hash for both paths is also correct before opening the WebSocket.
The browser/Node and stable/beta constructor coverage exercises the public call paths rather than only the helper. I don't see a blocking URL-construction regression in the current head.
jbeckwith-oai
left a comment
There was a problem hiding this comment.
Reviewed the exact head. The pathname-based construction preserves routing queries, repeated values, encoded path segments, and explicit session-parameter precedence while stripping fragments; Azure and custom callback behavior remain intact. Focused Realtime tests passed locally (178), root typechecking passed, and CI is green.
Summary
Fix Realtime endpoint construction when a custom
baseURLcontains routing query parameters or a fragment.realtimeto the parsed URL pathname in both stable and beta Realtime helpers.buildRealtimeURLcallback behavior unchanged.Reproduction
Given
baseURL: 'https://example.com/v1?route=tenant', string concatenation currently puts the endpoint suffix inside the routing parameter:The old URL requests the wrong path and corrupts the routing value. A fragment in the base URL likewise absorbs the endpoint suffix and leaves a fragment on the WebSocket URL. Both public native-WebSocket and Node
wswrappers use these helpers.Regression coverage
Add 21 cases covering query-bearing base URLs with and without trailing slashes, root paths, encoded path segments, repeated routing parameters, fragments, transcription intent, and stable/beta public constructors and asynchronous sideband factories with rotating credentials. Nineteen cases fail before the fix; the two query-free controls already pass.
Validation
Scope is four handwritten files only. Generated HTTP-client URL construction, dependencies, and CI policies are unchanged.