You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR #14743 addresses the root causes of Anthropic prefix cache misses: system prompt was a single merged block (dynamic content invalidated stable content), bash tool schema included the absolute cwd (changed per-repo), and skill tool ordering was nondeterministic. If you're on Anthropic, cross-repo first-prompt hit rate goes from 0% → 97.6% in my setup. The prefix stability fixes may also help providers with automatic prefix caching (OpenAI, DeepSeek, Gemini, etc.) but I can't confirm for DeepInfra specifically.
request to have a look it, I have inspected OpenCode SQLite DB -> it confirms gemini "byte identical prefix cache is working for gemini but its not working for deepInfra"
Adding one more data point from a separate investigation that may help narrow this down.
In our case, we saw repeated delayed turns with inconsistent cache.read, but the strongest signal was that multiple delayed turns shared the same stored request-state snapshot while cache behavior still flipped between hit and miss.
An anonymized example from the analyzed session tree:
Time
Snapshot stable?
Input tokens
Cache read
Result
17:41:09
yes
81,851
0
tool-calls
17:41:17
yes
82,132
0
tool-calls
17:41:27
yes
82,859
0
tool-calls
17:41:40
yes
196
83,392
tool-calls
17:41:53
yes
-423
84,160
tool-calls
17:42:09
yes
84,358
0
tool-calls
Because the stored snapshot stayed stable inside the cluster, this did not look like a simple case of the system prompt changing on every miss. It seems more consistent with either cache reuse instability for effectively identical request state, or inconsistent token/cache accounting.
Related issue with the fuller anonymized analysis: #20565
Activity
github-actions commentedon Feb 18, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
If you believe this was flagged incorrectly, please let a maintainer know.
bhagirathsinh-vaghela commentedon Feb 23, 2026
PR #14743 addresses the root causes of Anthropic prefix cache misses: system prompt was a single merged block (dynamic content invalidated stable content), bash tool schema included the absolute cwd (changed per-repo), and skill tool ordering was nondeterministic. If you're on Anthropic, cross-repo first-prompt hit rate goes from 0% → 97.6% in my setup. The prefix stability fixes may also help providers with automatic prefix caching (OpenAI, DeepSeek, Gemini, etc.) but I can't confirm for DeepInfra specifically.
surapuramakhil commentedon Feb 23, 2026
for now I have switched to gemini Api's - As i am able to see chache hits for it.
TomLucidor commentedon Feb 24, 2026
Does this problem apply to other LLM APIs? #5224
surapuramakhil commentedon Feb 24, 2026
@TomLucidor
#5224 -> i have seen this in deep infra
but suprisingly gemini Api's are getting cache chits but not deep infra, both uses byte idential prefix (implicit caching)
surapuramakhil commentedon Feb 25, 2026
@thdxr @adamdotdevin @rekram1-node
request to have a look it, I have inspected OpenCode SQLite DB -> it confirms gemini "byte identical prefix cache is working for gemini but its not working for deepInfra"
surapuramakhil commentedon Feb 25, 2026
note: looks like this is only happening to moonshoot/ kimi 2.5 model
rothnic commentedon Apr 2, 2026
Adding one more data point from a separate investigation that may help narrow this down.
In our case, we saw repeated delayed turns with inconsistent
cache.read, but the strongest signal was that multiple delayed turns shared the same stored request-state snapshot while cache behavior still flipped between hit and miss.An anonymized example from the analyzed session tree:
Because the stored snapshot stayed stable inside the cluster, this did not look like a simple case of the system prompt changing on every miss. It seems more consistent with either cache reuse instability for effectively identical request state, or inconsistent token/cache accounting.
Related issue with the fuller anonymized analysis: #20565
rekram1-node commentedon May 22, 2026
believe this is resolved now