-
Notifications
You must be signed in to change notification settings - Fork 0
Store tree hash in checkpoint metadata for linkage resilience after history rewrites #154
Description
Problem
When users rewrite git history (e.g. git rebase -i reword, git filter-branch --msg-filter, git commit --amend), the Partio-Checkpoint: trailer is stripped from the rewritten commit message. The checkpoint data still exists on partio/checkpoints/v1, but the rewritten commit no longer points to it. The user loses their agent label and session link.
A commit's tree hash represents its code content. History rewrites change the commit SHA and can strip the message, but the tree hash stays the same (same code = same tree). By storing the tree hash during checkpoint creation, the web-side or partio rewind can match rewritten commits to their original checkpoints via tree hash when no trailer is found.
What to implement
Add TreeHash string \json:"tree_hash,omitempty"`tocheckpoint.Metadataininternal/checkpoint/checkpoint.go`.
In the post-commit hook (internal/hooks/postcommit.go), resolve the current commit's tree hash via git rev-parse HEAD^{tree} and store it in Metadata.TreeHash before writing to the orphan branch.
Inspiration
entireio/cliPR #840 — store tree hash in checkpoint metadata for linkage resilienceentireio/cliissue #834 — rewording commits can silently break linkage when trailers are dropped
Program file
.minions/programs/store-tree-hash-in-checkpoint-metadata.md