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
{{ message }}
Repository navigation
Input tokens inconsistent with circle context #34712
At version 1.17.12, count input token was wrong. Input tokens was increase wrong. I also try to compact but Input token still do not decrease while Usage show less.
Plugins
NA
OpenCode version
1.17.12
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response
Reacted by Kirill Lebedinov, Pyae Sone Maung, Jardel, Ray and royruho
This is a very critical issue I also experience.
at least for v 1.17.12 - v.1.17.14
The token count is inflated - /compact does not reduce it and worst of all
this means that we can't track context size, therefore when to /compact the session
Environment
OpenCode version: 1.17.14 (also reproduced on 1.17.12 per the original report)
Last known good: 1.17.11 — the inflated count does not occur there
Interface: Desktop / Web (TUI is unaffected — see below)
OS: [your OS + version]
Provider/model: [e.g. Anthropic / Claude Sonnet 4.5]
Summary
The input/context token count is inflated in Web/Desktop and /compact does not bring it down, even though the Usage view reports a smaller number. The TUI, in the same session, shows the correct (much lower) count.
Steps to reproduce
Start a session and run enough turns to accumulate history (tool calls / file reads help).
Compare the token count shown in the TUI vs. Web/Desktop for the same session — Web/Desktop is several times higher.
Run /compact. The TUI count drops as expected; the Web/Desktop input-token figure stays high and can keep climbing.
TUI vs Web/Desktop
This looks like the long-standing display discrepancy from #3322: the TUI reports the current context (last message), while Web/Desktop aggregates across the whole session, so its number is cumulative rather than the actual prompt size.
Likely root cause
I think this is the accumulation bug described in #30649: session token fields (including tokens_cache_read) are summed additively every turn in projector.ts, so the session total is a lifetime counter, not the current context. That explains why /compact can't reduce it — pruning messages doesn't decrement a cumulative counter — and why it keeps increasing. When overflow/compaction logic reads that inflated cumulative value, sessions also hit context_length_exceeded errors even when the true context would fit (related: #17746, #29857).
Regression window
Clean on 1.17.11, present on 1.17.12 and 1.17.14.
Activity
github-actions commentedon Jul 1, 2026
This issue might be a duplicate of existing issues. Please check:
/compact command does not compress - context increases instead— similar symptom of compact not reducing token countMulti-step tool calls overwrite token counts instead of accumulating— related incorrect token counting behaviorSession token usage grows unbounded via cache.read— token count growing unexpectedlywickedits commentedon Jul 8, 2026
Weird that nobody has addressed this critical visual bug already
royruho commentedon Jul 8, 2026
This is a very critical issue I also experience.
at least for v 1.17.12 - v.1.17.14
The token count is inflated - /compact does not reduce it and worst of all
this means that we can't track context size, therefore when to /compact the session
Issue exist both for web and desktop
TUI works fine
yochaym22 commentedon Jul 8, 2026
Seeing the same thing.
Environment
OpenCode version: 1.17.14 (also reproduced on 1.17.12 per the original report)
Last known good: 1.17.11 — the inflated count does not occur there
Interface: Desktop / Web (TUI is unaffected — see below)
OS: [your OS + version]
Provider/model: [e.g. Anthropic / Claude Sonnet 4.5]
Summary
The input/context token count is inflated in Web/Desktop and /compact does not bring it down, even though the Usage view reports a smaller number. The TUI, in the same session, shows the correct (much lower) count.
Steps to reproduce
Start a session and run enough turns to accumulate history (tool calls / file reads help).
Compare the token count shown in the TUI vs. Web/Desktop for the same session — Web/Desktop is several times higher.
Run /compact. The TUI count drops as expected; the Web/Desktop input-token figure stays high and can keep climbing.
TUI vs Web/Desktop
This looks like the long-standing display discrepancy from #3322: the TUI reports the current context (last message), while Web/Desktop aggregates across the whole session, so its number is cumulative rather than the actual prompt size.
Likely root cause
I think this is the accumulation bug described in #30649: session token fields (including tokens_cache_read) are summed additively every turn in projector.ts, so the session total is a lifetime counter, not the current context. That explains why /compact can't reduce it — pruning messages doesn't decrement a cumulative counter — and why it keeps increasing. When overflow/compaction logic reads that inflated cumulative value, sessions also hit context_length_exceeded errors even when the true context would fit (related: #17746, #29857).
Regression window
Clean on 1.17.11, present on 1.17.12 and 1.17.14.
github-actions commentedon Sep 7, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.