Skip to content

resume: refresh stale logs, fetch remote checkpoints, show progress#1547

Open
entire[bot] wants to merge 2 commits into
mainfrom
soph/resume-improve
Open

resume: refresh stale logs, fetch remote checkpoints, show progress#1547
entire[bot] wants to merge 2 commits into
mainfrom
soph/resume-improve

Conversation

@entire

@entire entire Bot commented Jun 27, 2026

Copy link
Copy Markdown

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).

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
@Soph Soph requested a review from Copilot June 27, 2026 19:55
@Soph Soph marked this pull request as ready for review June 27, 2026 19:55
@Soph Soph requested a review from a team as a code owner June 27, 2026 19:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread cmd/entire/cli/strategy/manual_commit_rewind.go
Comment thread cmd/entire/cli/strategy/manual_commit_rewind.go
Comment thread cmd/entire/cli/resume.go Outdated
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
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