Skip to content

Phase 1: mirror committed checkpoints to v1 custom ref (opt-in, local-only)#1300

Merged
computermode merged 4 commits into
mainfrom
v1.1-mirror-populate
May 29, 2026
Merged

Phase 1: mirror committed checkpoints to v1 custom ref (opt-in, local-only)#1300
computermode merged 4 commits into
mainfrom
v1.1-mirror-populate

Conversation

@computermode
Copy link
Copy Markdown
Contributor

@computermode computermode commented May 29, 2026

Summary

Phase 1 of the v1.1 checkpoints rollout. Adds opt-in, local-only mirroring of committed checkpoint metadata to a new v1 custom ref refs/entire/checkpoints/v1.1, gated on strategy_options.checkpoints_version: "1.1" (string only).

  • v1 (refs/heads/entire/checkpoints/v1) remains the source of truth.
  • The custom ref is never read, pushed, or fetched in this PR — it is only populated, so later phases can verify it and eventually flip reads/writes over to it.
  • Staged rollout this is step 1 of: mirror → verify reads → flip reads (v1 fallback) → push/fetch → replace.

What changed

  • paths new const MetadataRefName = "refs/entire/checkpoints/v1.1". Lives under refs/entire/ so it stays invisible to git branch -a / GitHub's branch UI and is not pulled by a default git clone.
  • settings the string checkpoints_version: "1.1" is now a recognized value mapping to data-format major version 1 (so it no longer trips the "unsupported version, falling back" warning). New gate MirrorsToV1CustomRef. Only the string "1.1" opts in; the numeric form 1.1 falls back to v1 and logs as unsupported.
  • strategy new mirrorMetadataToV1CustomRef(ctx, repo) helper that, when opted in, advances the custom ref to the v1 branch's current commit using SafelyAdvanceLocalRef (the established ancestry-safe advancement for refs/entire/ metadata refs). Wired into all post-commit-hook committed writes: condensation, finalize, and combined-attribution (UpdateCheckpointSummary). A mirror failure is logged, never propagated, so it can't affect the v1 write that preceded it.
  • Tests settings gate; mirror-helper unit tests (create / disabled no-op / advance / v1-missing no-op); integration tests that run the real CondenseSession and finalize (PostCommit + HandleTurnEnd) paths and assert the custom ref equals v1's actual checkpoint commit; and a pre-push test proving the custom ref is never pushed while the v1 branch is.

Divergences from the handoff plan (plan.md) and why

Follows the plan's scope and intent but not its mechanism (a MirroringCommittedStore wrapper on a reworked GitStore):

  1. No MirroringCommittedStore, no GitStore rework, no signature change (plan §GitStore, §Write Return Values, §MirroringCommittedStore). Replaced by a post-write ref-sync helper — same outcome, much smaller blast radius, zero churn to the working v1 write path.
  2. No seed behavior / vercel.json init (plan §Seed Behavior). N/A under mirroring: the custom ref only ever points at v1's existing commit; it is never independently initialized.
  3. Dev docs (plan Task 6) intentionally omitted for this PR.

(Earlier divergences now closed: the opt-in is string-only per the plan; and the custom ref now advances ancestry-safely via SafelyAdvanceLocalRef rather than a raw SetReference.)

Known limitation — comprehensive mirroring deferred (follow-up)

Mirroring covers the post-commit-hook write paths (condensation, finalize, combined-attribution). Two non-hook paths also advance the v1 ref and do not mirror yet:

  • UpdateSummary (explain --generate)
  • attach (WriteCommitted)

After either of those, the custom ref lags v1 until the next hook write re-syncs it. Benign for phase 1 (nothing reads the custom ref), but must be addressed before reads flip in phase 2. Deferred per PR review.

Note for the follow-up: every committed write — including explain's, which goes through NewCommittedReader/DualCheckpointReader rather than a raw *GitStore — ultimately funnels through GitStore's four committed-write methods. So a single mirror point inside GitStore (gated + cached) is the clean way to cover all paths and any future writer, rather than wiring each construction site.

Out of scope (per plan)

Reads (list/explain/rewind stay v1-only for reading), push/fetch/reconcile/cleanup/doctor for the custom ref, and any new CLI surface — all untouched.

Testing

  • mise run lint clean (0 issues).
  • Full unit suite passes; strategy + settings packages green.

🤖 Generated with Claude Code

Phase 1 of the v1.1 rollout: when strategy_options.checkpoints_version
is "1.1", advance a local-only v1 custom ref
(refs/entire/checkpoints/v1.1) to the v1 metadata branch's commit after
each committed checkpoint write (condensation + finalization). v1 stays
the source of truth; nothing reads the custom ref and it is never pushed
or fetched in this phase.

Implemented as a small post-write ref-sync helper rather than the plan's
MirroringCommittedStore wrapper, avoiding GitStore and
WriteCommitted/UpdateCommitted signature changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Entire-Checkpoint: 73f0dc5db2be
@computermode computermode requested a review from a team as a code owner May 29, 2026 18:51
Copilot AI review requested due to automatic review settings May 29, 2026 18:51
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 8007d39. Configure here.

Comment thread cmd/entire/cli/strategy/v1_custom_ref_mirror.go Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Phase 1 of a staged v1.1 checkpoints rollout. When strategy_options.checkpoints_version is "1.1" (or JSON number 1.1), committed checkpoint metadata written to the existing v1 branch is additionally mirrored locally to a new custom ref refs/entire/checkpoints/v1.1. v1 remains authoritative; the new ref is never read, fetched, or pushed in this PR. Mirror failures are logged only and never affect the underlying v1 write.

Changes:

  • Add paths.MetadataRefName = "refs/entire/checkpoints/v1.1" and a mirrorMetadataToV1CustomRef helper invoked after WriteCommitted in CondenseSession and once after the finalizeAllTurnCheckpoints update loop.
  • Recognize "1.1" / 1.1 as a valid checkpoints_version mapping to v1 data format (avoids the "unsupported version" warning) and add MirrorsToV1CustomRef gate on both package and EntireSettings.
  • Add unit, integration, and pre-push tests covering enabled/disabled mirroring, advancing/missing-ref cases, and the invariant that the custom ref is never pushed.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
cmd/entire/cli/paths/paths.go Adds MetadataRefName constant for the v1.1 custom ref.
cmd/entire/cli/settings/settings.go Recognizes 1.1/"1.1" as v1 format and adds MirrorsToV1CustomRef gate (package + receiver).
cmd/entire/cli/settings/settings_test.go Tests MirrorsToV1CustomRef value matrix and that 1.1 is a recognized version.
cmd/entire/cli/strategy/v1_custom_ref_mirror.go New helper that points the custom ref at the v1 branch tip when opted in; logs mirror failures.
cmd/entire/cli/strategy/v1_custom_ref_mirror_test.go Unit + integration tests for mirror behavior, real condense/finalize paths, and pre-push exclusion.
cmd/entire/cli/strategy/manual_commit_condensation.go Invokes mirror helper after the v1 committed write.
cmd/entire/cli/strategy/manual_commit_hooks.go Invokes mirror helper once after finalizeAllTurnCheckpoints update loop.

Comment thread cmd/entire/cli/strategy/v1_custom_ref_mirror.go
Comment thread cmd/entire/cli/paths/paths.go
Only the string checkpoints_version "1.1" enables mirroring; the numeric
form 1.1 now falls back to v1 and logs as unsupported, matching the
plan's string-only intent. Simplifies isV1CustomRefValue to a single
type assertion.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Entire-Checkpoint: a0e27638ea22
Comment thread cmd/entire/cli/strategy/v1_custom_ref_mirror.go Outdated
pfleidi
pfleidi previously approved these changes May 29, 2026
Copy link
Copy Markdown
Contributor

@pfleidi pfleidi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left two minor comments. Otherwise, it looks good 👍

Mirror the v1 custom ref via SafelyAdvanceLocalRef instead of a raw
SetReference, matching the established ancestry-safe advancement rule
for metadata refs under refs/entire/ (addresses PR review). For the
local single-writer mirror this is always a fast-forward; the helper
also handles the missing/equal/diverged cases.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Entire-Checkpoint: e79036c379c9
updateCombinedAttributionForCheckpoint runs in the post-commit hook and
issues a committed write (UpdateCheckpointSummary) that advances v1 after
per-session condensation has already mirrored. Mirror the v1 custom ref
there too so it tracks v1 across the full post-commit flow.

explain (--generate UpdateSummary) and attach remain unmirrored and are
tracked as a follow-up.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Entire-Checkpoint: d5f194d3e477
@computermode
Copy link
Copy Markdown
Contributor Author

Verified that checkpoints are mirrored in a test repo. Tested with a new session and then an advancement of the session and noticed both refs advanced.

➜  test-repo git:(new-v-1-1) ✗ git rev-parse refs/entire/checkpoints/v1.1 refs/heads/entire/checkpoints/v1
2930e5278d124d2e2877008fabd99b632192c514
2930e5278d124d2e2877008fabd99b632192c514

@computermode computermode merged commit 40d576f into main May 29, 2026
9 checks passed
@computermode computermode deleted the v1.1-mirror-populate branch May 29, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants