-
Notifications
You must be signed in to change notification settings - Fork 279
fix: store tree hash in checkpoint metadata for linkage resilience #840
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
425f2a3
9164d8e
0fac13a
7b9d87d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,10 +15,12 @@ import ( | |||||||||||||||||||||||
| "github.com/entireio/cli/cmd/entire/cli/checkpoint" | ||||||||||||||||||||||||
| "github.com/entireio/cli/cmd/entire/cli/checkpoint/id" | ||||||||||||||||||||||||
| "github.com/entireio/cli/cmd/entire/cli/paths" | ||||||||||||||||||||||||
| "github.com/entireio/cli/cmd/entire/cli/session" | ||||||||||||||||||||||||
| "github.com/entireio/cli/cmd/entire/cli/trailers" | ||||||||||||||||||||||||
| "github.com/go-git/go-git/v6" | ||||||||||||||||||||||||
| "github.com/go-git/go-git/v6/plumbing" | ||||||||||||||||||||||||
| "github.com/go-git/go-git/v6/plumbing/object" | ||||||||||||||||||||||||
| "github.com/stretchr/testify/assert" | ||||||||||||||||||||||||
| "github.com/stretchr/testify/require" | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
@@ -863,6 +865,97 @@ func TestShadowStrategy_PrepareCommitMsg_SkipsSessionWhenContentCheckFails(t *te | |||||||||||||||||||||||
| require.Equal(t, originalMsg, string(content)) | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| // TestShadowStrategy_PrepareCommitMsg_AgentRevertGetsTrailer verifies that when an | ||||||||||||||||||||||||
| // agent runs git revert (REVERT_HEAD exists) and the session is ACTIVE, the commit | ||||||||||||||||||||||||
| // gets a checkpoint trailer. The agent's work should be checkpointed. | ||||||||||||||||||||||||
| func TestShadowStrategy_PrepareCommitMsg_AgentRevertGetsTrailer(t *testing.T) { | ||||||||||||||||||||||||
| dir := setupGitRepo(t) | ||||||||||||||||||||||||
| t.Chdir(dir) | ||||||||||||||||||||||||
| t.Setenv("ENTIRE_TEST_TTY", "1") | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| s := &ManualCommitStrategy{} | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| // Create an ACTIVE session (agent is running) | ||||||||||||||||||||||||
| err := s.InitializeSession(context.Background(), "agent-revert-session", agent.AgentTypeClaudeCode, "", "revert the change", "") | ||||||||||||||||||||||||
| require.NoError(t, err) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| // Save a checkpoint so there's content | ||||||||||||||||||||||||
| metaDir := filepath.Join(".entire", "metadata", "agent-revert-session") | ||||||||||||||||||||||||
| require.NoError(t, os.MkdirAll(filepath.Join(dir, metaDir), 0o755)) | ||||||||||||||||||||||||
| transcript := `{"type":"human","message":{"content":"revert the change"}}` + "\n" + | ||||||||||||||||||||||||
| `{"type":"assistant","message":{"content":"I'll revert that"}}` + "\n" | ||||||||||||||||||||||||
| require.NoError(t, os.WriteFile(filepath.Join(dir, metaDir, "full.jsonl"), []byte(transcript), 0o644)) | ||||||||||||||||||||||||
|
Comment on lines
+883
to
+887
|
||||||||||||||||||||||||
| metaDir := filepath.Join(".entire", "metadata", "agent-revert-session") | |
| require.NoError(t, os.MkdirAll(filepath.Join(dir, metaDir), 0o755)) | |
| transcript := `{"type":"human","message":{"content":"revert the change"}}` + "\n" + | |
| `{"type":"assistant","message":{"content":"I'll revert that"}}` + "\n" | |
| require.NoError(t, os.WriteFile(filepath.Join(dir, metaDir, "full.jsonl"), []byte(transcript), 0o644)) | |
| metaDir := ".entire/metadata/agent-revert-session" | |
| metaDirFS := filepath.Join(dir, filepath.FromSlash(metaDir)) | |
| require.NoError(t, os.MkdirAll(metaDirFS, 0o755)) | |
| transcript := `{"type":"human","message":{"content":"revert the change"}}` + "\n" + | |
| `{"type":"assistant","message":{"content":"I'll revert that"}}` + "\n" | |
| require.NoError(t, os.WriteFile(filepath.Join(metaDirFS, "full.jsonl"), []byte(transcript), 0o644)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agent revert trailer added but condensation skipped in PostCommit
Medium Severity
PrepareCommitMsgnow adds a checkpoint trailer during agent-initiated revert/cherry-pick (active session + sequence operation), but thePostCommithandler still setsIsRebaseInProgress: truefor all sequence operations viaisGitSequenceOperation(ctx). SinceREVERT_HEAD/CHERRY_PICK_HEADremain present during thepost-commithook, the state machine receivesIsRebaseInProgress: trueand emits noActionCondense, so no checkpoint data is ever written. The commit ends up with a danglingEntire-Checkpointtrailer pointing to a nonexistent checkpoint ID.Additional Locations (1)
cmd/entire/cli/strategy/manual_commit_hooks.go#L874-L878