clarify multi-checkpoint resume output · Entire
clarify multi-checkpoint resume output
6532560→main·
pfleidi·3w ago·2 files·+38 added/-3 removed
Say that multi-checkpoint resume selects the latest readable checkpoint.
This avoids implying every skipped checkpoint was older when metadata for some checkpoint IDs may be unavailable.
Sessions
ac4b21ebff86View transcript
[?
Implement Checkpoint Policy Management SystemCodex·GPT-5.5·1 step](/content/gh/entireio/cli/session/019ef111-70d5-7203-b653-e4834b8b92c0#timeline-ac4b21ebff86/index.html)
Changes
2
cmd/entire/cli
Mresume.go+3/-3
Mresume_test.go+35
300 unmodified lines
301
302
303
304
304
305
306
307
28 unmodified lines
336
337
338
339
340
339
340
341
342
343
300 unmodified lines
return checkRemoteMetadata(ctx, w, errW, result.checkpointIDs[0], stores.Refs())
}
skipped := len(result.checkpointIDs) - 1
fmt.Fprintf(w, "Found %d checkpoints for commit %s, resuming from the latest (%d older checkpoints skipped)\n",
fmt.Fprintf(w, "Found %d checkpoints for commit %s, resuming from the latest readable checkpoint (%d skipped)\n",
len(result.checkpointIDs), result.commitHash[:7], skipped)
checkpointID = latestMetadata.CheckpointID
metadata = latestMetadata
28 unmodified lines
return resumeSession(ctx, w, errW, metadata, force)
}
// resolveLatestCheckpoint reads metadata for each checkpoint ID and returns
// the checkpoint with the latest CreatedAt.
// resolveLatestCheckpoint reads metadata for each checkpoint ID and returns the
// readable checkpoint with the latest CreatedAt.
func resolveLatestCheckpoint(ctx context.Context, store checkpointInfoReader, checkpointIDs []id.CheckpointID) (*strategy.CheckpointInfo, bool, error) {
infoMap := make(map[id.CheckpointID]strategy.CheckpointInfo, len(checkpointIDs))
for _, cpID := range checkpointIDs {
Mcmd/entire/cli/resume.go+3/-3
890 unmodified lines
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
890 unmodified lines
}
}
func TestResumeFromCurrentBranch_MultipleCheckpointsSaysLatestReadable(t *testing.T) {
tmpDir := t.TempDir()
t.Chdir(tmpDir)
t.Setenv("ENTIRE_TEST_CLAUDE_PROJECT_DIR", filepath.Join(tmpDir, "claude-projects"))
repo, w, _ := setupResumeTestRepo(t, tmpDir, false)
oldID := id.MustCheckpointID("aaa111bbb222")
newID := id.MustCheckpointID("ccc333ddd444")
writeCommittedResumeCheckpoint(t, repo, oldID, "session-old", time.Date(2025, 1, 1, 10, 0, 0, 0, time.UTC))
writeCommittedResumeCheckpoint(t, repo, newID, "session-new", time.Date(2025, 1, 1, 11, 0, 0, 0, time.UTC))
if err := os.WriteFile(filepath.Join(tmpDir, "squash.txt"), []byte("squash content"), 0o644); err != nil {
t.Fatalf("write squash file: %v", err)
}
if _, err := w.Add("squash.txt"); err != nil {
t.Fatalf("add squash file: %v", err)
}
commitMsg := fmt.Sprintf("Squash merge\n\nEntire-Checkpoint: %s\n\nEntire-Checkpoint: %s\n", oldID, newID)
if _, err := w.Commit(commitMsg, &git.CommitOptions{
Author: &object.Signature{Name: "Test User", Email: "test@example.com"},
}); err != nil {
t.Fatalf("commit squash merge: %v", err)
}
var stdout, stderr bytes.Buffer
if err := resumeFromCurrentBranch(context.Background(), &stdout, &stderr, "master", true); err != nil {
t.Fatalf("resumeFromCurrentBranch() error = %v\nstdout: %s\nstderr: %s", err, stdout.String(), stderr.String())
}
want := "resuming from the latest readable checkpoint"
if !strings.Contains(stdout.String(), want) {
t.Fatalf("stdout = %q, want substring %q", stdout.String(), want)
}
}
// TestResumeSingleSession_RejectsPathTraversalSessionID is an end-to-end proof
// that a malicious session ID cannot cause an arbitrary file write during resume.