Skip to content

Checkpoints V2: Allow for a force flag to rerun a migration that previously completed#885

Draft
computermode wants to merge 8 commits intotranscript-start-at-metadatafrom
migrate-checkpoints-v2-force-option
Draft

Checkpoints V2: Allow for a force flag to rerun a migration that previously completed#885
computermode wants to merge 8 commits intotranscript-start-at-metadatafrom
migrate-checkpoints-v2-force-option

Conversation

@computermode
Copy link
Copy Markdown
Contributor

@computermode computermode commented Apr 9, 2026

(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 --force path 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 --force flag to the hidden migrate --checkpoints v2 command to re-run checkpoint migrations even when v2 data already exists, printing a distinct "Force-migrating" message.

Threads the force option through the migration pipeline and changes migrateOneCheckpoint to 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.

Copilot AI review requested due to automatic review settings April 9, 2026 00:20
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

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 --force flag to rerun v1→v2 migration and reprocess already-migrated checkpoints.
  • Plumb force through 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.

Comment on lines +161 to 165
// 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
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
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.

2 participants