Skip to content

Add per-checkpoint Fork and any-two checkpoint compare to the Git tab - #1626

Merged
currentbits merged 3 commits into
mainfrom
coder/checkpoint-graph-fork-from-any-checkpoin-c1a491
Oct 13, 2026
Merged

currentbits merged 3 commits into
mainfrom
coder/checkpoint-graph-fork-from-any-checkpoin-c1a491

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Closes the remaining parts of #252. In the Git tab, the checkpoints list can now start a new thread from any checkpoint and compare any two checkpoints.

What changed

Fork from a checkpoint

  • New forkFromCheckpoint service. threads:fork sends requests to it when the input includes checkpointSha.
  • checkpointForkPoint (in worktrees-checkpoints.js) checks that the sha is one of the source thread's checkpoints and throws Unknown checkpoint if it isn't. It then works out where to cut the transcript, using the same lookup as restore: the message-id trailer in the commit body, or else the last message created by the commit's timestamp (+999ms).
  • The fork gets its own worktree. The checkpoint sha is recorded as leadSnapshotSha, so the worktree starts at that commit and never falls back to main.
  • In forkThread, a Claude fork that gets its own worktree no longer --resumes the source session. Claude stores sessions per cwd, so a new worktree replays the context instead.

Compare any two checkpoints

  • git:turnDiff / turnDiff take an optional from. It is held to the same rule as sha: it must be one of the thread's checkpoints, or the result is an empty diff.
  • TurnDiffPanel takes an optional label to replace its header (e.g. Turn 1 → 3).

UI (AgentsPanel → CheckpointsCard)

  • Each checkpoint row has a compare checkbox. Ticking two shows a lazy-loaded TurnDiffPanel with the range between them, using the saved split/unified preference. Ticking only one shows a hint to pick another.
  • Each row has a Fork button, disabled while a fork is in progress. Errors show on the existing global fork banner.
  • CheckpointsCard is keyed by thread id, so checkbox picks reset when you switch threads.
  • Small CSS changes let the row wrap when the panel is narrow.

Tests

  • electron/test/turn-diff.test.js:
    • A from range matches git diff c1 c3, and a from that isn't a checkpoint returns an empty diff.
    • A fork from a checkpoint gets a worktree at that sha, a transcript cut at that turn, and replay instead of resume, and the source thread is left unchanged.
    • A sha that isn't a checkpoint is rejected and no thread is created.
  • test/checkpoints.test.tsx: renderer coverage for the new checkpoint controls.

🤖 Generated with Claude Code

Solenta-Message-Id: 71aa67e9-228f-428e-9ee1-d21391230aad
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T14:17:35.900565Z 7855840 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7855840b49

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/App.tsx
Comment on lines +1066 to +1068
const forkFromCheckpoint = useCallback(
(threadId: string, sha: string) =>
forkThread(threadId, { checkpointSha: sha }),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Honor checkpoint forks in the browser-dev adapter

When the app runs via npm run dev in a browser, resolveCoderApi selects devCoder, but src/dev/threads.ts's fork implementation ignores checkpointSha and only copies history for messageId. Clicking this new Fork button therefore creates an ordinary empty thread with no checkpoint-derived worktree instead of the files and conversation advertised by the UI. Handle checkpointSha in the dev adapter or suppress this control there.

Useful? React with 👍 / 👎.

Willem and others added 2 commits October 13, 2026 16:32
A late git write into repo/.git made the diff-scopes afterEach rmSync
fail with ENOTEMPTY on ubuntu CI (#1626). Same retry the other store
and workflow tests already use.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@currentbits
currentbits merged commit f1dd2a9 into main Oct 13, 2026
6 checks passed
currentbits pushed a commit that referenced this pull request Oct 19, 2026
A late git write into repo/.git made the diff-scopes afterEach rmSync
fail with ENOTEMPTY on ubuntu CI (#1626). Same retry the other store
and workflow tests already use.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant