Repository navigation
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
✅ Deterministic PR hygiene checks passed. |
|
Superseded by the earlier contributor PR #7464, which arrived while this independent fix was being prepared. I validated its exact head |
Summary
Fixes #7462 for the canonical ChatGPT WS-to-HTTP/SSE response path.
A native upstream can send
x-reasoning-includedonly on its successful 101 upgrade. The session previously discarded it, so the relay committed an SSE response without the actual signal. Capture Bun's optional nativehandshakeevent beforeopen, validate the bounded raw-header shape, retain only that connection-level signal and seed each exchange's existing metadata owner before dispatch. Prelude metadata keeps precedence; later frames stay in-band without rewriting committed headers.Only the actual upstream value is carried. Absent/malformed/ambiguous/oversized observations stay absent; credentials, cookies, request IDs and stale quota snapshots are not retained. Reused exchanges get private snapshots; close/disposal clears the connection value. No retry/fallback, tool execution, token totals, or model capability is added. This does not retrofit an already-committed client WebSocket upgrade or establish the cause of an early-compaction incident.
The mapped contract is documented in a focused structure document and ADR (the existing wire-shape owner was already at its 600-line budget), with a user-facing protocol note. No dependency, workflow or live configuration changes.
Verification
Base:
12025981e5a304cdb6b1b54f525ba8554f623977. Serial Linux execution asubuntuin disposable HOME/CODEX_HOME/OPENCODEX_HOME, under hard cgroup CPU/RAM/swap/process/time limits.bun test tests/responses/ws-upgrade-reasoning-header.test.ts tests/responses/ws-upstream.test.ts tests/responses/ws-upstream-reuse.test.ts tests/responses/ws-pre-output-refusal.test.ts tests/responses/ws-failure-stage.test.ts: 232 passed, 1 intentional older-runtime-only skip, 0 failed. Covers actual sockets/usage, malformed bounds, reuse, cancellation, fallback, refusal and stage accounting.tests/test-layout.test.ts,tests/test-layout-tooling.test.ts,tests/ci-workflows/file-size-ratchet.test.ts: 52 passed, 0 failed. Both layout maps updated; no size cap raised.bun scripts/structure-ssot.ts --fix(index generation + validation),bun scripts/privacy-scan.ts, andgit diff --cached --check: passed.RAYON_NUM_THREADS=2 UV_THREADPOOL_SIZE=2 bun node_modules/astro/bin/astro.mjs build: passed, 585 pages / 83,065 internal links. An initial attempt aborted during Pagefind under the same process cap; limiting worker threads passed without raising resource limits.Resource exception / remaining validation: full project typecheck exceeded the local five-minute envelope twice during this same maintenance session on the same dependency graph; do not present that as a pass. Full-suite and import-graph expansion are deferred to the existing hosted CI for this Draft, with the focused and indirect subprocess/relay/layout coverage above executed locally. The exact new PR head still needs its actual hosted typecheck/test execution and independent review. No Codex Security scan was invoked.
Checklist
Review readiness checklist