Bug Description
Rewind history is completely lost after automatic compaction in sessions that have extensive rewind usage (branching conversation tree). After compaction, only ~2 messages are visible in rewind despite the session containing a large multi-day conversation.
Environment
- Claude Code version: 2.1.34
- OS: macOS (Darwin 25.2.0)
Steps to Reproduce
- Start a long Claude Code session
- Use rewind frequently throughout the session (creating a non-linear conversation tree)
- Continue working until automatic compaction (context limit) is triggered
- After compaction, attempt to rewind — only post-compaction messages are visible
Analysis
I analyzed the session JSONL file and found the following:
Tree structure:
- Total nodes in tree: 10,671
- Main path (root to latest message): 64 messages (all post-compaction)
- Nodes on dead branches (from rewinds): 10,607
- Branch points (rewinds): 275 (max 6 children at a single branch point)
- 3 separate root nodes exist in the tree
The bug — isSidechain never set:
- Off-path user/assistant messages with
isSidechain=False: 2,303
- Off-path user/assistant messages with
isSidechain=True: 0
When rewinding during the session, abandoned branches were never marked as isSidechain=True. All messages in the entire tree have isSidechain=False.
When compaction occurred, it created a new root node (system message with conversation summary) with parentUuid=None. The main path now traces from this new root forward — completely disconnected from the pre-compaction tree. The original conversation (rooted at 2 earlier root nodes) is intact in the JSONL but unreachable via rewind navigation, which follows parentUuid links backward from the current leaf.
Timeline:
- Day 1 — Original session root (conversation begins)
- Day 1 through Day 3 — Extensive work with many rewinds creating 275 branch points
- Day 3 — Compaction creates new root node with summary, severing the tree
- Day 3+ — Only 64 messages on the new main path, rewind shows ~2 messages
Expected Behavior
Rewind should be able to navigate back through the pre-compaction conversation history, as it does in sessions without heavy rewind usage.
Actual Behavior
Rewind only shows messages after compaction. The entire pre-compaction conversation (spanning 2+ days of work) is inaccessible via rewind.
Possible Root Causes
isSidechain not being set on rewind: When the user rewinds, the abandoned branch messages should be marked isSidechain=True but this never happens (0 out of 10,671 nodes have this flag set to True)
- Compaction disconnects the tree: The new summary root node has
parentUuid=None instead of linking back into the pre-compaction tree, making the old tree unreachable via parent traversal
Workaround
The full conversation is preserved in the session JSONL file and can be read directly, but it's not navigable through the rewind UI.
This report was generated by Claude Code
Bug Description
Rewind history is completely lost after automatic compaction in sessions that have extensive rewind usage (branching conversation tree). After compaction, only ~2 messages are visible in rewind despite the session containing a large multi-day conversation.
Environment
Steps to Reproduce
Analysis
I analyzed the session JSONL file and found the following:
Tree structure:
The bug —
isSidechainnever set:isSidechain=False: 2,303isSidechain=True: 0When rewinding during the session, abandoned branches were never marked as
isSidechain=True. All messages in the entire tree haveisSidechain=False.When compaction occurred, it created a new root node (system message with conversation summary) with
parentUuid=None. The main path now traces from this new root forward — completely disconnected from the pre-compaction tree. The original conversation (rooted at 2 earlier root nodes) is intact in the JSONL but unreachable via rewind navigation, which followsparentUuidlinks backward from the current leaf.Timeline:
Expected Behavior
Rewind should be able to navigate back through the pre-compaction conversation history, as it does in sessions without heavy rewind usage.
Actual Behavior
Rewind only shows messages after compaction. The entire pre-compaction conversation (spanning 2+ days of work) is inaccessible via rewind.
Possible Root Causes
isSidechainnot being set on rewind: When the user rewinds, the abandoned branch messages should be markedisSidechain=Truebut this never happens (0 out of 10,671 nodes have this flag set to True)parentUuid=Noneinstead of linking back into the pre-compaction tree, making the old tree unreachable via parent traversalWorkaround
The full conversation is preserved in the session JSONL file and can be read directly, but it's not navigable through the rewind UI.
This report was generated by Claude Code