Low cache hit rate when Codex integrates with GPT-5.5
What version of Codex CLI is running?
0.125.0
Which model were you using?
gpt-5.5
What platform is your computer?
WSL2
What terminal emulator and version are you using (if applicable)?
Windows Terminal
What issue are you seeing?
When Codex integrates with the GPT-5.5 model, its cache hit rate is very low, which causes costs to be consumed rapidly.
In contrast, OpenCode integrated with GPT-5.5 has no such problem and maintains a high cache hit rate.
Besides, Codex paired with GPT-5.4 also achieves a high cache hit rate normally.
What steps can reproduce the bug?
We tested Codex integrated with GPT-5.4 and GPT-5.5 respectively. By checking the session logs of both versions, we can see there is a significant difference in the frequency of cached_input_tokens.
What is the expected behavior?
The expected behavior is that Codex with GPT-5.5 should maintain a normal high cache hit rate, consistent with the performance of Codex + GPT-5.4 and OpenCode + GPT-5.5, to avoid excessive and rapid cost consumption.
Additional information
_No response_
17 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Thanks for the feedback. We track cache miss rates closely on the server, and we don't see any anomalous behavior related to Codex and gpt-5.5. It's possible that the session you analyzed wasn't representative.
We're receiving similar reports from other sources, so I'm going to reopen this issue until we're able to reconcile these reports with our server-side stats.
Can confirm. Codex Desktop on Mac OS with an API key.
Other users in our org with API keys also have this problem, although they're TUI/OpenCode users. So it's probably not about the harness.
Had to switch back to 5.4, where caching is totally fine. On my personal subscription, 5.5 is totally fine.
@etraut-openai I can share session ids with cache misses if it helps.
Yes, I also confirm this. I am using the API Key billing, not a subscription. Whether using the CLI or the desktop version, when using GPT-5.5, the cache hit rate is almost always 0%. Once I switch back to GPT-5.4, the cache ratio returns to normal, at 90% or higher. I didn’t make any changes other than switching the model in Codex settings. I even checked the request body JSON shape, nothing wrong at all. I think there must be something wrong in OpenAI server
Can confirm too, GPT-5.5 cache hit rates are close to zero in both Codex and Opencode for me. GPT-5.4 is doing fine with otherwise identical configs.
If you're seeing this problem, please use
/feedbackto upload the session and post the session ID here. Thanks!Hey @etraut-openai , reported these sessions via
/feedback:019df1e4-9669-76a1-bdde-280bd0d241ac
019df1e7-bf0a-7543-b3ec-30074cd7d528
019df1ed-1dc4-7221-9888-e5f75488ffde
Also been seeing this issue. Cache hit rate with 5.4 was ~94% and it dropped to 85% with 5.5. In certain instances I saw 8 consecutive cache misses within my session.
I uploaded several affected sessions with
/feedback/feedback/upload.The pattern I see locally is not a steady low cache hit rate. The aggregate hit
rate is high, but there are isolated catastrophic collapses inside otherwise
healthy high-context sessions: 200k-240k input-token requests with 1-3% cache
hit rate, seconds after 98-100% hits, then immediately recovering.
Uploaded thread IDs and representative miss moments:
019dda83-e45e-7740-89ec-3c6c789c398d:2026-04-29T18:49:55.375Z, rollout line 748, input 230,330, hit 2.8%, uncached 223,802. Prior token events were 99.6/99.8/99.7/99.9/99.8/99.5/99.8/99.8%.019dda86-583a-7430-9b0f-af1a6dd3c755:2026-04-29T19:34:29Z, rollout lines 826/839, input 229,641, hit 2.8%, uncached 223,113.019dda9a-2e7f-7af0-a9cb-bcb63cec8b77:2026-05-03T21:59:09.713Z, rollout line 119649, input 240,110, hit 1.4%, uncached 236,654. Prior token events: 98.6/98.3/97.3/99.7/99.1/99.8/99.9/99.8%; next events recovered to 99.6/99.7/99.7/98.9/99.8% after a 10.6s gap and only 178 new chars.019def0d-178f-79d1-ad2d-5213fa7245c6:2026-05-03T22:31:08.296Z, rollout line 8418, input 238,349, hit 2.7%, uncached 231,821. Prior token events: 99.9/99.6/99.7/99.1/99.7/99.8/99.5/99.5%; next recovered to 99.1/99.3% before compaction.019ded0c-78f5-7cf2-9645-110e2c40bf47:2026-05-05T00:00:35.489Z, rollout line 14782, input 218,023, hit 1.6%, uncached 214,567. Prior: 94.5/99.8/99.6/97.0/94.8/99.7/99.9/98.5%; next recovered to 99.9/99.8/99.7%.Bulk local scan, 2026-04-29 through 2026-05-05 UTC:
This does not look like cache expiry: several examples happen 5-30s after
strong hits and recover immediately. It also does not look like the documented
">15 requests/min with the same prefix" cache-key overflow case; in the
uncached>=200kband I found 0 events with 15+ previous same-thread tokenevents in the preceding minute.
Related live-session observation while uploading feedback: two of the long
threads (
019dda9a...and019ded0c...) were not inert when resumed just tosubmit
/feedback; they resumed/continued paused work and had to beinterrupted again before or after upload. That may be related to the "old active
mega threads still updating" behavior users are seeing.
Still seeing these cache misses for 5.5, which make session cost skyrocket.
Submitted a couple more sessions via feedback, here are correlation ids:
930e9e7b-1f1e-40ff-acad-e709a6371646
2c22e6d4-a83a-49ed-82dd-a514936d918d
Codex Responses API — Prompt Cache Stuck at Tools-Only Floor
Status: Open. Likely server-side regression. Filed pending OpenAI response.
Reporter: OpenCode (third-party CLI/daemon built on top of
@opencode-ai/codex-provider, a custom AI SDK V2 adapter that speaks the same Responses API wire format ascodex-rs).Affected: Codex Responses API via ChatGPT-subscription auth. Multiple GPT-5.4 and GPT-5.5 sessions show the same floor. Replicates across fresh sessions and multiple working directories.
---
Executive summary
usage.input_tokens_details.cached_tokensconsistently caps at 4608 across an entire codex session, regardless of:gpt-5.5andgpt-5.4both affected)delta=truewithprevious_response_id) vs full re-send (delta=false)ContentPart[]array — same floor)prompt_cache_keyvalue (composite vs pure${threadId}— same floor)input[](mid-chain atlastUserIdxvs head at index 0 — same floor)The 4608 figure ≈
instructions + tools schematoken count for our setup. It looks like the prefix cache hit ends precisely wheretoolsends and the conversation chain begins.A historical session under the same OpenCode binary on 2026-05-10 22:48–23:56 showed cache_read growing 35,840 → 49,152 → 117,248 → 137,216 → 181,248 across consecutive turns under
delta=trueANDdelta=false. Cache worked until something changed between then and our next sessions.Sessions starting 2026-05-11 all stuck at 4608. Same daemon binary lineage (we restarted the daemon several times for unrelated reasons), same
@opencode-ai/codex-providercode path, same upstream codex-cli reference atf7e8ff8e50(then76845d716bafter pull).---
Reproduction
model: "gpt-5.5"(also reproduces ongpt-5.4)store: false,prompt_cache_key: "<sessionId>",previous_response_id: <chained>instructions: stable text (we tested driver-only ~2.5KB and monolithic ~65KB; both hit 4608)usage.input_tokens_details.cached_tokens = 0(fresh)previous_response_idsetcached_tokens = 4608regardless ofinput_tokens(which grows naturally as conversation extends)cached_tokensstays at 4608. Occasional one-turn jumps to 50,688 / 71,168 right after a chain reset, then back to 4608.---
Diagnostic data
Sample USAGE telemetry across 49 turns of a single session
Historical comparison (working session 2026-05-10)
Request body fingerprint (current broken sessions)
driverHash,developerBundle.totalChars,userBundle.totalChars,prompt_cache_key,model,tools— all verified byte-stable across turns via local telemetry. No drift.---
What we tried (none lifted the floor)
BaseInstructions::default()(275 lines fromrefs/codex/codex-rs/protocol/src/prompts/base_instructions/default.md, md57a62de0a7552d52b455f48d9a1e96016). No change.prompt_cache_key = thread_id(matching upstreamclient.rs:713): switched our adapter from a composite key to purethreadId. Verified the value is byte-stable across all turns. No change.input[]opens with onedeveloperbundle item + oneuserbundle item, mirroringbuild_initial_context()incore/src/session/mod.rs:2553-2761. No change.input[0]: confirmed bundles always at chain head, not mid-conversation (transport delta-slice correctly trims them out as already-in-chain). No change.ContentPart[]: tested both shapes. Raw string matched pre-break (May 9) wire that historically cached well. Both forms hit 4608. Reverted toContentPart[]for upstream alignment.finishReasonfallback fix: when terminalresponse.completedevent fails to arrive but text was emitted, we now default to"stop"instead of"unknown". Stops a runloop empty-round guard from issuing chain resets every few turns. Visibly stabilized chain (see #6 in upstream impact below) but did not improve cache_read floor.gpt-5.5→gpt-5.4: same floor.---
Hypothesis status
All three issues open, no assignee, no resolution.
---
Operational impact
A single chat turn under cache=4608 with input ≈ 80k tokens costs full price for ~75k uncached tokens. The 5h ChatGPT subscription quota gets exhausted in roughly 10 minutes of active multi-turn use, where the same workload before the regression was sustainable for hours.
For any third-party tool relying on the Codex Responses API for non-trivial multi-turn work — agent loops, repo-wide code edits, long debug sessions — the cache regression is a hard blocker.
---
What we would like from OpenAI
ResponsesAPI requests withprevious_response_idset — the public docs do not address chain-mode interaction with prefix cache, leaving a black-box where third-party clients cannot self-debug.extended_cache_signatureor similar explicit field clients can use to confirm what prefix the server hashed for cache lookup. Right now we have no way to tell whether our prompts are byte-stable from the server's perspective.---
Repro environment
@opencode-ai/codex-provider^x.xrefs/codexsubmodule pinned at76845d716b(rust-v0.0.2504301132-6092)gpt-5.5,gpt-5.4store: falseservice_tier: undefined (default)reasoning.effort: configured (no impact tested)---
Related references
refs/codex/codex-rs/core/src/session/mod.rs:2553-2761(build_initial_context())refs/codex/codex-rs/core/src/client.rs:713(prompt_cache_key = self.state.thread_id.to_string())BaseInstructionsdefault:refs/codex/codex-rs/protocol/src/prompts/base_instructions/default.md019e2e4d-e84b-78e3-bfb1-0b0c923200d5
This might be connected https://github.com/openclaw/openclaw/issues/84110 Started with 2026.5.12 update
019e4e09-2723-74f0-ad76-496e30ab9a70
I am not attaching the raw payload JSON publicly because it contains full instructions, tool schemas, tool outputs, local paths, and request metadata. I checked the relevant payloads locally and did not find API keys,
bearer tokens, cookies, refresh tokens, or access tokens, but the raw files still contain more context than should be posted in a public issue.
The interesting part is a sequence of three consecutive Responses requests in the same thread:
2026-05-22T04:56:09.758Z2026-05-22T04:56:16.306Zinput_tokens=29658cached_input_tokens=264962026-05-22T04:56:18.856Z2026-05-22T04:56:21.451Zinput_tokens=30168cached_input_tokens=34562026-05-22T04:56:23.098Z2026-05-22T04:56:25.136Zinput_tokens=30394cached_input_tokens=30080The middle request is the low-cache one. Comparing it with the previous request:
instructionsare identicaltoolsare identicalmodelis the same:gpt-5.5prompt_cache_keyis the sameoutcome=incrementalrequest_without_input_hashis stablerequest_tools_hashis stableTiming also makes cache expiry unlikely:
So this looks like a single intermittent prompt-cache collapse inside an otherwise healthy same-thread incremental Responses API chain. The following request recovered immediately to
cached_input_tokens=30080.I’ve encountered the same issue before.
It seems to happen when the WebSocket of the
backend-api/codex/responsesreconnects. If the user continues speaking after being idle for a while, the connection reconnects, and thecached_tokenscounter resets and starts over. I suspect this is related to the new retention/eviction policy in GPT-5.5, and possibly to the request no longer being routed to the same backend instance after reconnection (just an assumption).<img width="1872" height="522" alt="Image" src="https://github.com/user-attachments/assets/58a628be-5552-4c72-8899-ef1e991ce346" />
It seems much more noticeable when using Azure Codex, since we typically use HTTPS/SSE instead of WebSockets.
For example,
id:"resp_0442f7dc3e2b541c016a1a095214588199bbeabf8cf52eef1e"prompt_cache_key:"019e74ff-6cf1-7d40-80ce-0c8baa3ad6cf"id:"resp_0fd6c96548b5311c016a1a099e911081938f04ba42de133e60"prompt_cache_key:"019e74ff-6cf1-7d40-80ce-0c8baa3ad6cf"