-
Notifications
You must be signed in to change notification settings - Fork 157
Description
Problem
When git history is rewritten (interactive rebase, squash merge, force-push), the Entire-Checkpoint trailer on user commits is lost. This breaks the link between code commits and their session metadata on entire/checkpoints/v1, effectively orphaning the checkpoint data.
This is inherent to how trailers work — they live inside the commit object, and any operation that rewrites commits produces new SHAs without the original trailers.
Proposed solution
Store a git tree hash in checkpoint metadata as a content-addressable anchor. A rebased commit has a different commit SHA but the same tree hash if the file content didn't change. A future entire repair command could scan the current branch for commits whose tree hash matches a checkpoint's stored tree hash and re-add the Entire-Checkpoint trailer.
Note: tree hash matching only works when file content is unchanged (clean rebase/cherry-pick); rewrites that modify content (conflict resolution, squash combining multiple commits) will need additional heuristics like timestamp proximity or file-set overlap.
Steps
- Store
commit_tree_hashin metadata — PR Add commit_tree_hash to checkpoint metadata #319 - Implement
entire repaircommand — scan branch history, match tree hashes, re-add trailers
Impact
Any workflow that rewrites history (common with squash merges, rebasing feature branches onto main) will silently lose checkpoint links. The entire session cleanup command already detects orphaned checkpoints but cannot fix them.