v0.3.4 — Transport-protocol fidelity: response-header passthrough + compaction-request bypass
Fix
- POST response-header passthrough: the upstream response's
x-codex-*rate-limit snapshot family,x-models-etag, and request id are now mirrored onto the downstream SSE response (previously all dropped, so Codex couldn't see its rate-limit state behind the proxy). The POST handler first pulls the first event to force round 1 open, then answers downstream with round-1 response headers. - Remote-compaction requests are never folded: a request whose input ends with a
compaction_triggeritem passes through as a single round, even if its usage happens to land right on the518n−2boundary — the trigger must be last and Codex requires exactly onecompactionoutput item, both of which a continuation replay would break. Adds a new round verdictcompaction_request. The community's real-world observation on openai/codex#30364 (zero-reasoning retries blowing out auto-compaction) independently confirms the necessity of this convergence. x-codex-turn-statesticky-routing token contract replay: if the upstream issues this header on a folded round 1, continuation requests carry it back verbatim (set-once mirroring Codex's per-turn semantics; not overridden when the client brings its own). In practice the current backend does not issue it, so this is dormant contract support.- Rolls up the fixes accumulated since v0.3.3: deterministic teardown on the fold-abort path (
drive_foldexplicitly closes the generator,fold aborted downstreamis always logged), the truncation-tier ceiling loosened (--max-ndefaults to 0 = no ceiling, observed capturing up to n=13), global arguments placed before a CLI subcommand no longer being overridden by subparser defaults, and evals log-contract alignment.
Empirical basis (all real-hardware verified, codex 0.142.5 × gpt-5.5)
- Direct probe of the real backend: POST response headers carry the full rate-limit snapshot but not
x-reasoning-included/x-codex-turn-state; the WS 101 handshake carries onlyx-models-etag. Accordingly the WS accept stays bare — declaring headers the upstream doesn't would skew Codex's context accounting away from a direct connection. - The candy benchmark run in parallel across four effort tiers (low/medium/high/xhigh): round 1 was exactly 516 in all of them, and after folding all four tiers answered correctly (2–4 rounds, reasoning rescued at 4–12× the truncated amount).
- With a fold sandwiched in the middle of a tool loop, subsequent incremental frames on the same connection rebuilt correctly with continuous caching;
codex exec resumehad full context across connections; force-killing the client mid-generation had the proxy tear down deterministically and keep serving healthily; 4-way concurrency had no cross-talk.
Other
- Added
CHANGELOG.md; documented thecompaction_requestround verdict; addedtest_ws.pyto the development/contributing section. - Each round adds a
round openlog line recording upstream-header presence (reasoning_included/turn_state/ request id) for wire-level diagnosis. - Versioning policy: a 0.0.1-level bump is the default release granularity (the unreleased 0.4.0 number was reeled back to 0.3.4).
中文说明
本版聚焦传输协议保真:把上游 POST 的 x-codex-* 限额快照家族、x-models-etag 与 request id 镜像回下游,让 Codex 在代理后仍能看到限额状态;对以 compaction_trigger 结尾的远程压缩请求单轮直通、永不折叠(新增 compaction_request 判定词);并按契约回传 x-codex-turn-state sticky 路由令牌(当前后端未签发,属休眠支持)。同时并入 v0.3.3 后的若干修复,附带四档 effort 与工具循环/并发的真机实测依据。