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
I noticed this issue while working on the footer token counter, but this happens on opencode official releases as well.
After discussing the issue on discord, several users saw a similar behavior.
While some could NOT reproduce it over dozens of tries, others witnessed it at close to a 50% rate.
This issue was seen on multiple providers and models so far:
github-copilot/gpt-4.1
openai/gpt-4.1
google/gemini-2.5-pro
It isn't clear whether opencode sends system prompt etc in duplicate or if the token count mechanism suffers from a counting error.
This is issue likely hits every models and providers, for some users? Could lead to preemptive auto /compact in a session and probably other shenanigans?
I also been seeing session token count regress at times for no apparent reason 🤦♂️
Activity
github-actions commentedon Aug 14, 2025
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case of token counts jumping unexpectedly or regressing during sessions.
rekram1-node commentedon Sep 14, 2025
will be fixed in next release
rekram1-node commentedon Sep 15, 2025
nvm this solution sucked
rekram1-node commentedon Sep 15, 2025
this is just the input + cached tokens double counting
spoons-and-mirrors commentedon Sep 26, 2025
this PR seems to fix it:
#2653