feat: v2 dual-write for checkpoints behind feature flag#759
Conversation
... for transcript writes to /full/current ref
... instead of adding it to the permanent `/main` ref.
There was a problem hiding this comment.
Pull request overview
Adds a feature-flagged “checkpoints v2” dual-write path so the manual-commit strategy can persist checkpoint data to both the existing v1 metadata branch and the new v2 custom refs, enabling a gradual migration without breaking current read paths.
Changes:
- Wire dual-write into
CondenseSessionand stop-time finalization (UpdateCommitted) behindsettings.IsCheckpointsV2Enabled(), with v2 failures treated as best-effort. - Introduce
V2GitStoreto write v2 checkpoint data to custom refs (/mainfor metadata/prompts,/full/currentfor raw transcript + content hash). - Add unit + strategy-level + integration tests, and extend integration
TestEnvhelpers to read from arbitrary refs.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| cmd/entire/cli/strategy/manual_commit_condensation.go | Builds shared v1/v2 write opts and adds best-effort v2 dual-write during condensation. |
| cmd/entire/cli/strategy/manual_commit_hooks.go | Adds best-effort v2 dual-write during stop-time checkpoint finalization. |
| cmd/entire/cli/strategy/manual_commit_test.go | Adds strategy-level tests for v2 dual-write enabled/disabled behavior. |
| cmd/entire/cli/paths/paths.go | Defines v2 custom ref names under refs/entire/.... |
| cmd/entire/cli/integration_test/v2_dual_write_test.go | Adds integration coverage for full workflow, disabled path, and stop-time finalization. |
| cmd/entire/cli/integration_test/testenv.go | Adds helpers for reading files from full refs and for checking ref existence. |
| cmd/entire/cli/checkpoint/v2_store.go | Adds low-level v2 ref creation/state/update primitives. |
| cmd/entire/cli/checkpoint/v2_committed.go | Implements v2 committed write/update logic for /main and /full/current. |
| cmd/entire/cli/checkpoint/v2_store_test.go | Adds unit tests for v2 ref management and committed write/update behavior. |
| cmd/entire/cli/checkpoint/committed.go | Reuses shared write-option validation via validateWriteOpts. |
| cmd/entire/cli/checkpoint/checkpoint.go | Makes SessionFilePaths JSON fields omitempty to support v2 layouts with missing fields. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
computermode
left a comment
There was a problem hiding this comment.
We chatted about these changes together, approving to unblock testing/progress. Thank you for thinking through the updated ref changes and talking through them with me. 😄
Since GH swallowed my comments and I can't seem to undo that, I'll echo here that I think creating packages for v1 vs v2 might be a nice way to approach changes like this in the future.
Entire-Checkpoint: f28ddc010230
Summary
Introduces checkpoints v2 dual-write support. When
checkpoints_v2is enabled in strategy options, the CLI writes checkpoint data to both v1 (entire/checkpoints/v1branch) and v2 custom refs (refs/entire/checkpoints/v2/mainandrefs/entire/checkpoints/v2/full/current).V2GitStore— new store type for v2 ref operations, separate fromGitStore(v1) to simplify future v1 removal/mainref — receives metadata, prompts, session metadata (no raw transcript or content hash). Compacttranscript.jsonlwill be added here once compaction (workstream B) is ready/full/currentref — accumulates raw transcripts (full.jsonl) +content_hash.txtacross checkpoints via tree splicing (same pattern as v1). Generation rotation will archive and reset this ref when it reaches capacity (future work)CondenseSessionand stop-time finalization both dual-write, gated bysettings.IsCheckpointsV2Enabled(). V2 failures are best-effort (logged as warnings, never block v1)What's NOT in scope (future steps per design spec)
/mainentire status,entire explain,entire resume)/full/currentTest plan
V2GitStore(ref management, write/update for both refs, multi-session, accumulation, edge cases)CondenseSession)mise run fmt && mise run lint— 0 issuesmise run test:ci— all unit, integration, and E2E canary tests pass🤖 Generated with Claude Code