Skip to content

Checkpoints v2: Fix issue where migrations didn't check archived v2 transcripts#1080

Merged
computermode merged 3 commits intomainfrom
fix-checkpoint-gen-post-migration
Apr 29, 2026
Merged

Checkpoints v2: Fix issue where migrations didn't check archived v2 transcripts#1080
computermode merged 3 commits intomainfrom
fix-checkpoint-gen-post-migration

Conversation

@computermode
Copy link
Copy Markdown
Contributor

@computermode computermode commented Apr 29, 2026

https://entire.io/gh/entireio/cli/trails/267

Fixes a bug where the migration repair path checked only v2/full/current to decide whether a migrated checkpoint still had its raw transcript. If that transcript had already been rotated into an archived ref like v2/full/0000000000001, rerunning the migration treated it as missing and copied old historical data back into current. That made current exceed the rotation threshold, so each later checkpoint/push kept creating more bogus archived generations.

  1. Migration wrote/rotated some v2 full artifacts into archived refs like v2/full/0000000000001.
  2. Migration was rerun.
  3. The repair path checked only v2/full/current, did not see the archived raw transcript, and copied old checkpoint data back into current.
  4. That made current look full of historical checkpoints, so later writes kept tripping the generation threshold and producing 0000000000002, 0000000000003, etc.

Pre-fix:

➜  gitsync git:(test-checkpoints-v2) git push origin HEAD
[entire] Pushing v2/main to origin....
[entire] Syncing v2/main with remote..... done
[entire] Pushing v2/main to origin.... done
[entire] Pushing v2/full/current to origin...
[entire] Syncing v2/full/current with remote............... done
[entire] Pushing v2/full/current to origin... already up-to-date
[entire] Pushing v2/full/0000000000008 to origin... already up-to-date

Post-fix:

➜  gitsync git:(test-checkpoints-v2) git push origin HEAD
[entire] Pushing v2/main to origin.... done
[entire] Pushing v2/full/current to origin.... done
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 10 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 343 bytes | 343.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/entireio/gitsync.git
   a0b43db..5b29a9b  HEAD -> test-checkpoints-v2

Note

Medium Risk
Touches git-ref selection and rotation behavior for v2 checkpoint transcripts plus migration repair heuristics; mistakes could write transcripts to the wrong generation or skip needed repairs, affecting checkpoint integrity.

Overview
Fixes v2 checkpoint finalization/repair logic to avoid rewriting /full/current when the raw transcript already lives in an archived /full/* generation (preventing repeated rotations and “rehydrating” old checkpoints back into current).

Adds /full/* artifact discovery (HasFullSessionArtifacts) and updates UpdateCommitted/migration repair to use it, including writing finalized transcripts back to the archived generation where they belong and factoring rotation checks into rotateCurrentIfNeeded (only triggered when /full/current is updated). Push migration hinting is also tightened to ignore malformed v1 checkpoint entries so the CLI doesn’t suggest migration when only broken v1 data is present; tests are updated/added to cover these cases.

Reviewed by Cursor Bugbot for commit 53e6b10. Configure here.

Migration repair and committed checkpoint updates only looked in v2/full/current when deciding whether a checkpoint session had raw transcript artifacts. If a previous migration had already rotated those artifacts into v2/full/000000000000N, a rerun treated them as missing and copied the old checkpoint back into current. That repopulated current with archived data, so later ordinary writes crossed the generation threshold and kept rotating new full refs.

Teach V2GitStore to find full-session artifacts in current and archived generations, preferring complete transcript/hash pairs. Existing full artifacts are updated in the ref where they already live; only brand-new artifacts fall back to current, where the normal rotation helper can decide whether to archive.

Update migration repair to use the same generation-aware check so rerunning v1-to-v2 migration does not rehydrate archived full artifacts into current. Add regressions for archived-generation updates and migration reruns that should skip repair when archived raw artifacts are already present.

Entire-Checkpoint: beb44564441f
The pre-push migration hint checks the v1 branch for checkpoint IDs that are absent from v2. Failed or partial v1 writes can leave shard entries without a readable checkpoint summary; ListCommitted can still surface those IDs, but the migration command cannot migrate them because there is no summary to read.

That made the hook keep telling users to run entire migrate --checkpoints v2 even after all actionable v1 checkpoints had already been migrated. In the bundle that showed up as a repeated push-time hint next to normal v2 ref pushes.

Before reporting an unmigrated v1 checkpoint, read the v1 summary and ignore malformed entries that are missing or unreadable. This keeps the hint aligned with the set of checkpoints migration can actually process. Add coverage for a malformed v1-only entry so it does not resurrect the warning.

Entire-Checkpoint: 71256d04318b
Copilot AI review requested due to automatic review settings April 29, 2026 17:40
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

Fixes a post-migration v2 checkpointing issue where repos with enough checkpoints to trigger rotation would repeatedly create new /full/<generation> rotations on subsequent pushes by ensuring “finalization” updates and repair checks don’t unnecessarily rehydrate data into /full/current.

Changes:

  • Update v2 full-transcript finalization to write to the existing /full/* ref where the session’s artifacts live (current or archived), and rotate only when writing to /full/current.
  • Adjust migration “repair” logic to treat archived /full/* artifacts as satisfying required full artifacts (avoids copying them back into /full/current).
  • Add/adjust tests covering malformed v1 checkpoints, migration reruns with archived artifacts, and updating archived generations.

Reviewed changes

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

Show a summary per file
File Description
cmd/entire/cli/strategy/push_common.go Suppresses v2 migration hint when “missing” v1 entries are malformed (no readable summary).
cmd/entire/cli/strategy/push_common_test.go Adds a malformed v1 checkpoint helper + test to validate hint suppression behavior.
cmd/entire/cli/migrate.go Uses v2 store’s /full/* artifact check during repair (instead of /full/current only).
cmd/entire/cli/migrate_test.go Updates migration test expectations and adds a helper to assert /full/current stays unrehydrated.
cmd/entire/cli/checkpoint/v2_committed.go Adds /full/* artifact discovery and updates full transcript finalization to target archived refs when appropriate; refactors rotation check.
cmd/entire/cli/checkpoint/v2_generation_test.go Adds coverage ensuring UpdateCommitted updates archived generations without repopulating /full/current.

Comment thread cmd/entire/cli/checkpoint/v2_committed.go
Comment thread cmd/entire/cli/checkpoint/v2_committed.go Outdated
@computermode computermode marked this pull request as ready for review April 29, 2026 18:30
@computermode computermode requested a review from a team as a code owner April 29, 2026 18:30
@computermode computermode changed the title Checkpoints v2: Fix checkpoint gen post migration Checkpoints v2: Fix issue where migrations didn't check archived v2 transcripts Apr 29, 2026
Entire-Checkpoint: 53c2ce4a82af
@computermode computermode merged commit 6c66968 into main Apr 29, 2026
9 checks passed
@computermode computermode deleted the fix-checkpoint-gen-post-migration branch April 29, 2026 19:21
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