Skip to content

Stop sending cache_control to the Codex/ChatGPT endpoint - #121

Merged
github-actions[bot] merged 1 commit into
mainfrom
fix/codex-cache-control-rejected
Aug 1, 2026
Merged

Stop sending cache_control to the Codex/ChatGPT endpoint#121
github-actions[bot] merged 1 commit into
mainfrom
fix/codex-cache-control-rejected

Conversation

@mohitranka

Copy link
Copy Markdown
Contributor

Summary

  • The last remaining open P0 from the 2026-08-01 usability audits: the ChatGPT backend-api Codex endpoint (chatgpt.com/backend-api) rejects an input[].content[].cache_control field outright with HTTP 400 "Unknown parameter: 'input[0].content[0].cache_control'." — blocking the entire openai_codex (ChatGPT subscription) provider profile on literally the first message, with no successful chat completion observed in either prior audit pass.
  • codex.rs is the only caller of apply_codex_prompt_cache and talks exclusively to this one endpoint, so there's no capability split to gate on — this transport doesn't support prompt-cache breakpoints at all, unlike the Anthropic and OpenAI-compatible transports (both left untouched and still cache correctly).
  • Removed the apply_codex_prompt_cache call from codex.rs::complete, and deleted the now-dead apply_codex_prompt_cache/attach_codex_cache_to_input_item from prompt_cache.rs rather than leaving unreferenced code behind.

Test plan

  • cargo test --package forge-model — 49/49, including a new regression test codex_request_body_never_contains_cache_control.
  • cargo fmt --all -- --check, cargo clippy --workspace --all-targets --locked -- -D warnings, cargo test --workspace --all-targets --locked — all clean.
  • Re-ran the exact original repro against the real release binary on OpenAI Codex/ChatGPT sign-in with gpt-5.4: for the first time across either audit pass, the request succeeded completely end-to-end — real tool call ("Explored repository"), a real diff shown in the TUI, header ✓ Completed, and git diff on disk confirms the actual file change (Hello, {name}!Hi there, {name}!).

The ChatGPT backend-api Codex endpoint (chatgpt.com/backend-api)
rejects an input[].content[].cache_control field outright:

  HTTP 400 "Unknown parameter: 'input[0].content[0].cache_control'."

on literally the first message, unlike the Anthropic and
OpenAI-compatible transports, which cache correctly with the same
kind of field. codex.rs is the only consumer of the Codex responses
API shape and talks exclusively to this endpoint, so there is no
capability split to gate on here — prompt caching for this profile
isn't supported, not merely disabled.

Remove the apply_codex_prompt_cache call from codex.rs::complete, and
delete the now-dead apply_codex_prompt_cache/
attach_codex_cache_to_input_item from prompt_cache.rs (no other
caller).

Adds a regression test asserting the codex request body never
contains cache_control. Live-verified against the real release binary
on OpenAI Codex/ChatGPT sign-in with gpt-5.4: the exact repro from the
2026-08-01 usability audit now succeeds end-to-end for the first time
in either audit pass -- real tool call, real diff, file change
confirmed on disk via git diff.
@github-actions
github-actions Bot enabled auto-merge (squash) August 1, 2026 13:24
@github-actions
github-actions Bot merged commit 10f38a5 into main Aug 1, 2026
6 checks passed
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