[Bug] Compaction summary renders above the last message pre-compaction
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
In transcript mode (Ctrl+O), the summary is rendered above the Conversation compacted divider, sometimes even above the last pre-compaction message.
What Should Happen?
The summary should render directly below the Conversation compacted divider, since that is where it belongs in the message chain.
Cause according to Claude investigation
The summary is the boundary's child, but it carries an earlier timestamp than its own parent. Across 71 session files on this machine that holds for 20 of 20 compact summaries, on versions 2.1.250, .251, .259, .263, .269, .274 and .278:
| | summary.timestamp − boundary.timestamp |
|---|---|
| min | −0.004 s |
| median | −0.207 s |
| max | −0.627 s |
The structural links are correct, so this is purely a timestamp fault:
- the summary's
parentUuidresolves to the boundary record in the same file — 20/20; - the boundary's
logicalParentUuidresolves to a record genuinely older than the summary — 20/20; - the summary has exactly one child.
The logical ordering is intact and recoverable. Only the timestamp disagrees with it.
Steps to Reproduce
- Run a session until it compacts, or run
/compact. - Press Ctrl+O for transcript mode.
- Look below the
Conversation compacteddivider — the summary is not there. - Scroll up past the divider — the summary is sitting above it, among the pre-compaction messages.
To confirm it in the data:
f=$(grep -l '"isCompactSummary":true' ~/.claude/projects/*/*.jsonl | xargs ls -t | head -1)
jq -r 'select(.isCompactSummary==true) | "summary: \(.timestamp) parent: \(.parentUuid)"' "$f"
then compare that timestamp against the compact_boundary record with the matching uuid.
The summary text itself can be read with:
jq -r 'select(.isCompactSummary==true) | .message.content' "$f"
Error Messages/Logs
None — no errors are produced. The summary is written correctly and in full; it is placed wrongly on screen.
Is this a regression?
Unknown. Every version in my local session history that compacted at all shows the inverted timestamp (2.1.250 through 2.1.278), so I have no known-good build to bisect against.
Last Working Version
Unknown — see above.
Environment Info
- Platform: darwin
- Terminal: xterm-256color
- Version: 2.1.278
- Feedback ID: 9ef56b02-b244-4191-a5f8-b073092dd9b2
Related
- #27242 — "No working mechanism to review previous context after compaction…". The umbrella case; this is one concrete, fixable instance of it.
- #85065 — reports the transcript screen capping at the last 30 messages behind a dim
Ctrl+E to show N previous messagesline. Not the cause here, but it compounds it: a summary that sorts above the divider and outside the rendered window is doubly hard to find. - #46603 — attributes post-compaction display problems to a
parentUuidthat never lands in the JSONL. That is not what happens here; these 20 chains resolve cleanly and only the timestamp is inverted. Likely a separate fault.