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
Session resume drops ~18k tokens of context with no compact_boundary #35358
A session was resumed mid-conversation via the SDK's resume option. The agent exhibited loss of context, repeatedly forgetting work done earlier in the session.
Before resume, the last assistant message reported total input tokens (input_tokens + cache_read_input_tokens + cache_creation_input_tokens) = 48,821
After resume, the first assistant message reported 30,751 — a drop of ~18,000 tokens (~37% context loss)
Key observations from the JSONL
There are no compact_boundary entries anywhere in the session file, so auto-compaction did not occur (or was not recorded)
cache_read_input_tokens dropped from 48,520 back to 8,619 (the same value seen on the very first assistant message of the session — i.e., the base system prompt + tools). This indicates the SDK rebuilt the context from scratch on resume rather than continuing from the existing cache
The session JSONL contains progress entries (type hook_progress, e.g. PostToolUse:Read, PostToolUse:Write) that have parentUuid values linking them as siblings of tool_result user messages — both are children of the same assistant message. This creates forks in the message DAG
No user-initiated rewinds or edits occurred — the DAG forks were created entirely by the SDK's internal bookkeeping
Expected behavior
Resumed session should have roughly the same context size as before the resume (minus any intentional compaction, which should produce a compact_boundary entry).
Actual behavior
~37% of context was lost silently on resume. The agent could no longer recall prior conversation content.
Reproduction
Hard to reproduce on demand — observed once so far. The session had multiple tool uses with PostToolUse hooks configured, creating hook_progress entries in the JSONL that fork the message DAG.
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.
Activity
github-actions commentedon Apr 14, 2026
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
github-actions commentedon Apr 23, 2026
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.