[Bug] Session restoration causes incorrect token usage reporting after auto-compact
Status Fixed / completed
Reported on v2.1.113
Maintainer reply None cached
Activity 4 comments · opened Apr 18, 2026 · closed Apr 18, 2026
Bug Description
My 5 hours session was just reset and somehow the 5 hours tokens jumped to 7%!!! this keeps happening for me in the past session restorations. Even if it did session restore there is no way it filled my context to 7%... i haven't ran anything i just reopened this terminal and it asked me if i want to compact and i clicked yes and than immediately it jumped to 7%.. This is either a bug or something with the usage counting wrong. This is worth alot of money to me since we are paying per usage
Environment Info
- Platform: win32
- Terminal: null
- Version: 2.1.113
- Feedback ID: e11b3a8b-ce05-458a-a253-cd91f176f8b4
Errors
[{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server github invalid: Missing environment variables: GITHUB_PERSONAL_ACCESS_TOKEN\n at PjH (B:/~BUN/root/src/entrypoints/cli.js:2807:30077)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-18T13:01:03.589Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server github invalid: Missing environment variables: GITHUB_PERSONAL_ACCESS_TOKEN\n at PjH (B:/~BUN/root/src/entrypoints/cli.js:2807:30077)\n at async V (B:/~BUN/root/src/entrypoints/cli.js:6187:11830)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-18T13:01:07.889Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server github invalid: Missing environment variables: GITHUB_PERSONAL_ACCESS_TOKEN\n at PjH (B:/~BUN/root/src/entrypoints/cli.js:2807:30077)\n at async G (B:/~BUN/root/src/entrypoints/cli.js:6187:11023)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-18T13:01:07.890Z"}]
4 Comments
Session restoration causing token usage to jump to 7% immediately after auto-compact — for a freshly opened terminal that has not run any commands — is a token accounting bug during the session restore + compact sequence.
The 7% jump on a fresh session start suggests the compact operation itself is consuming tokens, and those tokens are being attributed to the new session rather than the old one, or the compact result is being pre-loaded as context that counts against the new session's budget.
The likely cause: When a session is restored after auto-compact, the compacted summary is injected as context for the new session. If that summary is large (which it can be after a long session), it consumes a significant portion of the session's context budget immediately. The 7% you see is the compacted summary consuming roughly 7% of the session's total context allocation at start time.
This is a known cost of compaction — the summary replaces the full history — but the billing/reporting should reflect this accurately:
The related concern about financial impact is legitimate — if compact summaries consistently count against the session's usage metrics, users are being charged for prior work every time they start a new session after compaction.
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
same issue as the other issues
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.