resume: refresh stale logs, fetch remote checkpoints, show progress · Entire
resume: refresh stale logs, fetch remote checkpoints, show progress
dbd6f31·
Soph·2w ago·7 files·+622 added/-50 removed
Improve entire resume so it reflects the latest session state and never silently loses local work:
- Refresh on checkpoint-newer: when the committed checkpoint cleanly extends the local session log (local is a prefix of it), refresh the local log from the checkpoint instead of keeping the stale copy. Covers the cross-machine "continued and pushed elsewhere" case.
- Divergence guard: a newer checkpoint timestamp alone no longer authorizes an overwrite. If the local log holds entries the checkpoint lacks (StatusDiverged) — or is strictly newer — resume prompts before overwriting and keeps the local log when non-interactive. --force still overwrites unconditionally.
- Remote refresh before read: fetch the checkpoint metadata branch from the remote before reading, so a remotely-updated checkpoint is picked up even when its ID already resolves locally (best-effort; offline falls back to local).
- Progress: spinners around the metadata-branch fetch (refreshMetadataFromRemote) and on-demand blob fetches (FetchBlobsByHash), gated on CanPromptInteractively so hooks/agents/CI stay silent.
Internal cleanup: collapse RestoreLogsOnly's two decision maps into one via decideRestoreActions; share the keep/overwrite/conflict prompt through ConfirmOverwriteNewerLocalLogs; dedupe the resume-command print in resumeSingleSession.
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Sessions
c58158e62f02View transcript
Changes
7
MCLAUDE.md+11/-2
cmd/entire/cli
Mgit_operations.go+16
integration_test
- Mresume_test.go+129/-16
Mresume.go+107/-14
Mresume_test.go+113
strategy
Mmanual_commit_rewind.go+142/-18
Mrewind_test.go+104
resume with a branch arg switches to it and resumes its session; with no arg it opens an interactive picker of stopped sessions (across all worktrees), resolving each to its branch and pointing at the owning worktree when the branch is checked out elsewhere. Resume keeps an existing local session log as-is by default (--force overwrites it from the checkpoint). branch is checked out elsewhere. By default, resume keeps an existing local session log as-is, except when the checkpoint cleanly extends it — i.e. the local log is a prefix of the checkpoint (e.g. the session was continued and pushed from another machine) — in which case it refreshes the local log from the checkpoint since only appended entries are added. If the local log is newer than the checkpoint, or the two have diverged (the checkpoint's last entry is newer but the local log holds entries the checkpoint lacks), resume prompts before overwriting and keeps the local log when non-interactive. --force overwrites unconditionally from the checkpoint. Before reading, resume fetches the checkpoint metadata branch from the remote so a remotely-updated checkpoint is picked up even when its ID already resolves locally.
checkpoint(aliases:cp,checkpoints):list,explain,tokens,search, plus the deprecatedrewind(functional, prints a cobra deprecation message, will be removed in a future release)