Repository navigation
fix(responses): preserve upgrade-only reasoning inclusion - #7464
Conversation
Capture the bounded x-reasoning-included value from Bun's handshake event and publish it only after a successful open. Seed each canonical Responses exchange from its socket's validated default while preserving per-response metadata precedence and fallback behavior. Add real loopback and malformed-upgrade regression coverage, and document the HTTP/SSE scope and limits.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
✅ Deterministic PR hygiene checks passed. |
There was a problem hiding this comment.
Independent review of exact head 4e9212662e3e173ab7e5372b712da6c1fdecd54d against 12025981e5a3:
- Production Bun 1.4.2, isolated homes and hard cgroup limits: 250 passed, 1 intentional older-runtime-only skip, 0 failed across your two new files, my six independently written real-loopback controls, and existing WS upstream/reuse/pre-output-refusal/stage suites. The independent controls cover upgrade-only true/false/absent, prelude override, late-frame commit, retained connection, private snapshots and disposal. They were temporary validation files, removed afterward, not changes to your branch.
- Test Bun 1.4.3: 64 passed, 0 failed across your two new files and both layout guards/file-size ratchet.
- Manual response-header boundary review: only the bounded actual inclusion signal is retained; cookies, credentials, framing and per-turn quota/request IDs are excluded. Candidate metadata is promoted only after a successful open, failed upgrades preserve the original HTTP fallback, and per-exchange metadata/usage retain their owner. No Codex Security scan or live provider call was used.
Your PR arrived while I was independently preparing the same repair. I am withdrawing my redundant #7465 in favor of this earlier contributor PR; my regression evidence supports this head. No source from your branch was copied into my alternative, and no changes were pushed to your branch. The full diff and unchanged workflow/install surfaces were reviewed; hosted functional CI is already executing, so no pending fork-execution approval was needed when checked. Readiness remains yours; actual completed CI and remaining review findings still govern final approval.
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. |
|
@Ingwannu Thank you for the independent verification of #7464 and for closing #7465 as a duplicate. I've assigned you as the assignee because I want to settle the remaining design choices with the maintainer rather than treat my earlier implementation—or green CI—as the final architectural decision. I place particular weight on the maintainers' preferred transport contract and long-term maintenance cost. I compared the actual patches, not just their test results. Both correctly target only the observed
Decisions where I would value your design preference before modifying #7464:
One shared upstream caveat: current Codex readers treat I have not changed the passing #7464 implementation based on these preferences alone. My goal is to converge on whichever design you consider best for this repository, then make any agreed changes in #7464, without reviving a competing PR. |
Ingwannu
left a comment
There was a problem hiding this comment.
Approved exact head 4e9212662e3e173ab7e5372b712da6c1fdecd54d against current dev 12025981e5a3, following the independent transport/header-boundary review recorded above. Production Bun 1.4.2: 250 passed, 1 intentional older-runtime-only skip, 0 failed, including six independently written loopback controls; Bun 1.4.3: 64 passed, 0 failed with layout/ratchet guards. Actual current-head Cross-platform CI, Catalog contracts and React Doctor now completed successfully, including gates/typecheck, four selected test shards and docs build. The author has completed readiness on this unchanged head, with no open review threads or maintainer change request. Capture is actual-signal-only, promoted after successful open, bounded and cleared at disposal, with per-response metadata precedence and unchanged fallback/usage. Client-upgrade/accounting limitations remain explicitly documented. My duplicate #7465 is closed in favor of this contributor implementation. No Codex Security scan, live account request, self-approval, merge or release was performed.
Summary
Closes #7462.
When the upstream WebSocket sends
x-reasoning-includedonly in its HTTP 101 upgrade, the relay currently loses that signal while synthesizing the downstream HTTP/SSE response. Preserve the actual value from Bun's handshake event, make it available only after a successfulopen, and seed each canonical ChatGPT Responses exchange from that validated connection default.x-reasoning-included, with bounded parsing and HTTP header validation. Do not replay credentials, cookies, framing, request IDs, model/turn state, quota, or credit headers from a reusable connection.falseand empty values are preserved.This fixes the upstream-WebSocket-to-downstream-HTTP/SSE projection. It does not change the already-established downstream WebSocket handshake, infer a missing upstream signal, or claim to resolve all native Codex early-compaction/accounting cases.
Verification
Validation is on Linux, with the pinned application runtime Bun 1.4.2 and test-runner Bun 1.4.3.
bun test tests/responses/codex-ws-handshake.test.tsbun test tests/responses/codex-ws-handshake.test.tsbun test tests/responses/codex-ws-handshake-validation.test.tsbun run typecheckbun run structure:checkbun run privacy:scangit diff --cached --checkcd docs-site && bun install --frozen-lockfile && bun run buildThe main real-loopback regression was also run against an isolated copy of base
12025981e5a304cdb6b1b54f525ba8554f623977: it failed exactly at the missing header (nullinstead oftrue), after response completion and usage assertions had passed. The fixed source passes on both Bun versions. The suite includes an actual invalidSec-WebSocket-Acceptresponse to verify that a handshake event alone cannot contaminate HTTP fallback.The docs build exited 0 but its captured log ended before the final summaries. All 584 sitemap routes exist, all 585 generated HTML files are nonempty, and the build's internal-link hook separately passed against that output: 83,065 links checked.
The explicit read-as-data checks were run with inherited proxy variables removed:
bun run test --parallel=2 \ ./tests/test-layout.test.ts \ ./tests/test-layout-tooling.test.ts \ ./tests/ci-workflows/file-size-ratchet.test.ts \ ./tests/lab/core-lab-boundary.test.tsBroad local result is not green:
OCX_TEST_RUNNER_BUN=<Bun-1.4.3> bun run test:changed --parallel=2reached the runner's 900-second limit (exit 124). Its partial output recorded 11,281 passing and 141 failing test records, with 215 files not started. Several failures show unexpected HTTP 400/503 results with the environment's inherited outbound proxy; there are also timeouts. Representative comparisons against the unchanged base are complete on Bun 1.4.3. The two network cases use the same escalated environment as the broad run; the steering case uses sandboxed execution with proxies removed.reasoning-retention-v2.test.ts: canonical native-v2 casemanagement-auto-review-auth.test.ts: listener-auth casews-native-steering.test.ts: large-output replay caseThe large-output case calls
NativeSteeringReplaydirectly and does not call the modified transport modules. These are baseline controls, not a performance benchmark. Selected commands were run in both the current checkout and an isolated copy whose three modified runtime files were verified byte-for-byte against base12025981e5a304cdb6b1b54f525ba8554f623977:The proxy control removes
HTTP_PROXY,HTTPS_PROXY,ALL_PROXY,NO_PROXYand their lowercase equivalents before the selectedbun testprocess starts. The remaining local failures were not individually classified; the local broad run remains recorded as unsuccessful.Within that run, the existing directly relevant files completed with 193 passing tests and one pre-existing skip:
ws-upstream.test.ts(127 pass, 1 skip),ws-upstream-reuse.test.ts(37 pass), andws-pre-output-refusal.test.ts(29 pass). No passing file was rerun solely for confidence.Hosted validation completed successfully on exact head
4e9212662e3e173ab7e5372b712da6c1fdecd54d: all four full-suite shards and aggregatecipassed in run 39555730150. The new validation file's 20 cases passed in shard 3, and the real-handshake file's 8 cases passed in shard 4. Typecheck/GUI/privacy gates, docs build, structure, packaging, Docker, keyring, catalog contracts, React Doctor, PR target and hygiene checks also passed.An independent maintainer review reports additional Bun 1.4.2 coverage (250 passed, 1 intentional skip) and Bun 1.4.3 coverage (64 passed), plus a manual response-header boundary review. That is a
COMMENTEDreview, not an approval; no unresolved inline review findings were present when readiness was assessed.The full local suite is deferred under the documented resource exception: the import-graph run alone exceeded 15 minutes with two workers in this environment. The focused real-transport tests above cover the changed behavior. The repository-wide Linux suite completed in hosted CI as recorded above. Windows/macOS jobs were not selected by this PR's automatic scope and are not claimed as tested. The new handshake regressions use only loopback sockets and synthetic payloads, with no real credentials.
Checklist
Summary by CodeRabbit
New Features
Bug Fixes
Documentation