cache-diagnosis-2026-04-07 is in the beta list at packages/core/src/claude-code.ts:174, :185 and :197, so it goes out on every request — I confirmed it on the wire in 432/432 captured requests on my install.
Nothing reads the result. Grepping the source for cache_diagnosis, cacheDiagnosis, cache_miss_reason or cacheMissReason returns no hits outside tests, and the dump capture is request-only: each dump writes .body.json, .meta.json and .request.json, and meta.json carries status but no response payload or headers. So whatever the server reports about a cache miss is discarded before anything can see it.
That matters because it's the one channel that answers "why did this prefix miss" without inference. Concretely, from my install today:
ses_024c9cc48 23:24:38 -> 23:34:52 gap 10.2 min read=372,687 hit
ses_024c9cc48 23:35:40 -> 23:42:38 gap 7.0 min read=0 write=377,673 miss
Same session, same model (claude-opus-5), same account and route, ttl:"1h" on all four breakpoints in both requests, and the request bodies are byte-identical for the first 200,000 bytes (cmp puts the first difference at byte 967,183, which is the new turn). The shorter gap missed and the longer one hit. I eliminated TTL expiry, prefix drift, breakpoint movement, model switch and account migration from local artifacts, and I still can't tell you why it missed — because the answer was in a response we asked for and threw away.
Suggested direction: read the diagnostic on the response path and log it at debug, alongside the actual cache_read_input_tokens / cache_creation_input_tokens. There's already a response-header read in that path — normalizeQuotaHeaders at packages/opencode/src/index.ts:1158 harvests anthropic-ratelimit-unified-* — so the plumbing to observe a response exists and this is a small addition rather than a new seam. Capturing a response artifact in the dumps when dumping is enabled would make the same information available after the fact.
Is the beta deliberate and the consumption just not built yet, or is it vestigial? Happy to send a PR once you say which, since the shape depends on whether you want it logged, dumped, or surfaced in the sidebar.
cache-diagnosis-2026-04-07is in the beta list atpackages/core/src/claude-code.ts:174,:185and:197, so it goes out on every request — I confirmed it on the wire in 432/432 captured requests on my install.Nothing reads the result. Grepping the source for
cache_diagnosis,cacheDiagnosis,cache_miss_reasonorcacheMissReasonreturns no hits outside tests, and the dump capture is request-only: each dump writes.body.json,.meta.jsonand.request.json, andmeta.jsoncarriesstatusbut no response payload or headers. So whatever the server reports about a cache miss is discarded before anything can see it.That matters because it's the one channel that answers "why did this prefix miss" without inference. Concretely, from my install today:
Same session, same model (
claude-opus-5), same account and route,ttl:"1h"on all four breakpoints in both requests, and the request bodies are byte-identical for the first 200,000 bytes (cmpputs the first difference at byte 967,183, which is the new turn). The shorter gap missed and the longer one hit. I eliminated TTL expiry, prefix drift, breakpoint movement, model switch and account migration from local artifacts, and I still can't tell you why it missed — because the answer was in a response we asked for and threw away.Suggested direction: read the diagnostic on the response path and log it at debug, alongside the actual
cache_read_input_tokens/cache_creation_input_tokens. There's already a response-header read in that path —normalizeQuotaHeadersatpackages/opencode/src/index.ts:1158harvestsanthropic-ratelimit-unified-*— so the plumbing to observe a response exists and this is a small addition rather than a new seam. Capturing a response artifact in the dumps when dumping is enabled would make the same information available after the fact.Is the beta deliberate and the consumption just not built yet, or is it vestigial? Happy to send a PR once you say which, since the shape depends on whether you want it logged, dumped, or surfaced in the sidebar.