resume: refresh stale logs, fetch remote checkpoints, show progress#1547
Open
entire[bot] wants to merge 2 commits into
Open
resume: refresh stale logs, fetch remote checkpoints, show progress#1547entire[bot] wants to merge 2 commits into
entire[bot] wants to merge 2 commits into
Conversation
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> Entire-Checkpoint: c58158e62f02
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates entire resume to more reliably synchronize local session logs with checkpoint data across machines, avoid silently losing local-only transcript entries, and improve perceived responsiveness by showing progress during remote metadata/blob fetches.
Changes:
- Refreshes checkpoint metadata from remotes before reading checkpoints so remotely-updated checkpoint content is picked up even when the checkpoint ID already resolves locally.
- Refines the log-restore policy to overwrite local logs only when the checkpoint cleanly extends them (local is a prefix), and adds a divergence guard that prompts/keeps local logs when overwrite would drop local-only entries (unless
--force). - Adds unit + integration coverage for “checkpoint extends local” and “diverged logs kept without force” scenarios, and documents the updated behavior.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| cmd/entire/cli/strategy/rewind_test.go | Adds RestoreLogsOnly tests for checkpoint-newer clean-extension refresh and divergence keep behavior. |
| cmd/entire/cli/strategy/manual_commit_rewind.go | Implements per-session restore decisions, divergence detection via “clean continuation” check, and non-interactive overwrite confirmation behavior. |
| cmd/entire/cli/resume.go | Fetches metadata refs from remotes before resume and applies the same clean-extension vs divergence policy in the single-session path. |
| cmd/entire/cli/resume_test.go | Adds unit tests covering single-session clean-extension overwrite and divergence keep behavior. |
| cmd/entire/cli/integration_test/resume_test.go | Updates/extends integration coverage for divergence keep behavior and remote-refresh end-to-end scenario. |
| cmd/entire/cli/git_operations.go | Adds an interactive-only spinner around on-demand blob fetches to surface progress during remote reads. |
| CLAUDE.md | Updates architectural docs to reflect the new resume log refresh/divergence behavior and remote metadata refresh. |
Copilot review on #1547: - Privacy: the non-interactive divergence/keep message no longer echoes prompt text (user content) — it identifies the conflict by session ID only, since that output can land in CI logs / captured stderr. - Memory: TranscriptIsCleanContinuation now walks both transcripts line-by-line in place (bytes.IndexByte) instead of strings.Split-ing the whole byte slices, avoiding transient copies/allocs on large logs (and the bufio line-length cap). Adds a focused table test for its edge cases. - Consistency: gate refreshMetadataFromRemote's spinner on CanPromptInteractively too, matching FetchBlobsByHash, so agent/CI invocations stay silent on a pty. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Entire-Checkpoint: dc10f63e5cc1
Soph
approved these changes
Jun 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://entire.io/gh/entireio/cli/trails/679
Improve entire resume so it reflects the latest session state and never silently loses local work:
Refresh on checkpoint-newer when the checkpoint cleanly extends the local log (local is a prefix).
Divergence guard: a newer checkpoint timestamp alone no longer authorizes overwrite; if the local log holds entries the checkpoint lacks (or is strictly newer), prompt and keep when non-interactive. --force still overwrites.
Fetch the checkpoint metadata branch from the remote before reading, so a remotely-updated checkpoint is picked up even when its ID resolves locally.
Spinners around the metadata-branch fetch and on-demand blob fetches, gated on CanPromptInteractively so hooks/agents/CI stay silent.
Reviewed via /simplify (4 cleanup agents) and a Codex correctness pass (which surfaced the divergence-guard gap, now fixed).