Checkpoints V2: Allow for a force flag to rerun a migration that previously completed#885
Conversation
Entire-Checkpoint: d55bdfeec2aa
Entire-Checkpoint: 6c0391841a6f
Checkpoints V2: Support compact format for Copilot CLI
Entire-Checkpoint: f7f21da24771
There was a problem hiding this comment.
Pull request overview
Adds a --force option to the hidden entire migrate --checkpoints v2 command so users can rerun the v1→v2 checkpoint migration even when v2 data already exists (e.g., after migration logic changes).
Changes:
- Add
--forceflag to rerun v1→v2 migration and reprocess already-migrated checkpoints. - Plumb
forcethrough migration functions to bypass the “already migrated” repair/backfill-only path. - Add unit tests covering forced remigration behavior and flag registration.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cmd/entire/cli/migrate.go | Adds --force and updates migration flow to rewrite existing v2 checkpoints when enabled. |
| cmd/entire/cli/migrate_test.go | Updates existing tests for new function signatures and adds tests for --force behavior. |
| // Already in v2 — when not forcing, check if any aspect of sessions are missing and backfill | ||
| if existing != nil && !force { | ||
| repaired, repairErr := repairPartialV2Checkpoint(ctx, repo, v1Store, v2Store, info, existing) | ||
| if repairErr != nil { | ||
| return repairErr |
There was a problem hiding this comment.
With --force, already-migrated v2 checkpoints will be rewritten via v2Store.WriteCommitted, which clears the entire session subtree under /full/current (including any tasks/ metadata). If copyTaskMetadataToV2(...) later fails, the code currently only logs a warning and continues, which can silently drop previously-migrated task metadata on a forced rerun. Consider making task-metadata copy failures fatal when force is enabled, or otherwise ensuring existing tasks/ content is preserved when the copy step fails.
(WIP: will open and update this PR description once #877 is tested and reviewed since this PR depends on that one. The diff is a little messy since I merged main into this branch but apparently not into that one - will clean this up tomorrow)
Note
Medium Risk
Adds a
--forcepath that overwrites existing v2 checkpoint data, which increases the chance of unintended data loss if used incorrectly. Logic change is localized to migration flow and covered by new tests.Overview
Adds a
--forceflag to the hiddenmigrate --checkpoints v2command to re-run checkpoint migrations even when v2 data already exists, printing a distinct "Force-migrating" message.Threads the
forceoption through the migration pipeline and changesmigrateOneCheckpointto skip repair/backfill behavior when forcing, instead rewriting v2 session data from v1.Updates and expands tests to pass the new parameter everywhere and to validate forced re-migration behavior (single/multiple checkpoints) plus flag registration.
Reviewed by Cursor Bugbot for commit f2569e8. Configure here.