Skip to content

Checkpoint metadata lost after history rewrites (rebase, squash merge, force-push) #321

@arosenfeld2003

Description

@arosenfeld2003

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

  1. Store commit_tree_hash in metadata — PR Add commit_tree_hash to checkpoint metadata #319
  2. Implement entire repair command — 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions