Skip to content

feat(codex): zstd-compress Codex OAuth turn bodies and stop advertising gzip upstream - #180

Merged
HTExplicit merged 3 commits into
mainfrom
feat/codex-zstd-transport
Sep 17, 2026
Merged

HTExplicit merged 3 commits into
mainfrom
feat/codex-zstd-transport

Conversation

@HTExplicit

Copy link
Copy Markdown
Owner

Summary

Third PR of the Codex identity series (after #178 and #179).

  • Streaming /backend-api/codex/responses request bodies of OpenAI OAuth-like accounts are zstd-compressed (level 3, Content-Encoding: zstd) at send time, matching the official Codex client, which compresses only these turns. Compression happens on a wire clone after every body rewrite, so reasoning recovery, diagnostics and retries keep reading plain JSON. Replayable requests are compressed from a GetBody snapshot; a body read failure on a non-replayable request is reported as a transport error instead of sending a truncated body. gateway.openai_codex_request_zstd (default true) turns it off.
  • The OpenAI HTTP transports (openai_h2, openai_h1, openai_h1_fallback) and the WebSocket handshake client no longer let Go add Accept-Encoding: gzip; compressed responses are still decoded by the existing response decompression.
  • All Responses-endpoint POSTs, including the PAT/OAuth alpha-search web-search fallback, go through one send helper.

Verification

🤖 Generated with Claude Code

Codex added 3 commits September 18, 2026 05:31
…ng gzip upstream

- compress the streaming /backend-api/codex/responses request body with zstd (level 3,
  Content-Encoding: zstd) for OpenAI OAuth-like accounts at send time, on a wire clone so
  reasoning recovery, diagnostics and retries keep reading plain JSON; compact and other
  requests stay uncompressed like the official client; gateway.openai_codex_request_zstd
  (default true) turns it off
- disable Go's automatic Accept-Encoding: gzip on the OpenAI HTTP transports and on the
  WebSocket handshake client; compressed responses are still decoded manually
…bodies, cover alpha-search fallback

- replayable requests are compressed from a GetBody snapshot so the original request is
  never touched; non-replayable requests propagate a body read error instead of sending a
  truncated prefix; encoder failures fall back to plaintext
- route every Responses-endpoint POST through doOpenAICodexUpstream, including the
  PAT/OAuth alpha-search web-search fallback
@HTExplicit
HTExplicit merged commit 6faa380 into main Sep 17, 2026
16 checks passed
@HTExplicit
HTExplicit deleted the feat/codex-zstd-transport branch September 17, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant