Context compression summary not persisted to JSONL, breaking conversation resume
Bug
When a long conversation hits context compression, the compressed summary message is sent to the API but never written to the session JSONL file. This breaks claude --resume and history scrollback because the first post-compression message references a parentUuid that doesn't exist in the file.
Steps to reproduce
- Have a long conversation that triggers context compression
- Exit the session
- Resume with
claude --resume <session-id>
Expected behavior
The resumed session should include the compression summary, giving the model context about what happened before compression. Scrolling back through history should work across compression boundaries.
Actual behavior
The resumed session only has messages from after the last compression point, with no summary. The model has essentially zero context about the conversation.
History scrollback also stops at compression boundaries since the chain is broken.
Root cause
The JSONL uses a parentUuid chain to reconstruct conversation history. When compression occurs, old messages are replaced by a summary message with a new UUID. Post-compression messages reference this summary as their parent. However, the summary message itself is never written to the JSONL. On resume, the chain tracer hits the missing UUID and stops, loading only the handful of messages after the last compression.
Environment
- Claude Code 2.1.78 through 2.1.91
- macOS 26.4
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗