Repository navigation
Commit uncommitted work before every agent turn, so a reset or clean can't destroy it (#321) - #1687
Conversation
Solenta-Message-Id: c28300b2-c858-4bac-8e55-d069d73507ca
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6ebabeb5db
ℹ️ 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".
| if (MID_OPERATION_MARKERS.some((m) => fs.existsSync(path.join(dir, m)))) { | ||
| return null; | ||
| } | ||
| return await maybeCreateCheckpoint(store, threadId); |
There was a problem hiding this comment.
Preserve unmerged-index conflicts before checkpointing
When a worktree has conflicts without one of these operation markers—for example, after a conflicted git stash pop or git apply --3way—this check falls through to maybeCreateCheckpoint, whose git add -A marks every conflict resolved and commits the conflict-marker contents. Starting the next turn therefore destroys the unmerged index and breaks the user's conflict-resolution workflow. Check for unmerged index entries (such as via git ls-files -u) in addition to these marker files before creating the snapshot.
Useful? React with 👍 / 👎.
Every agent turn in a worktree now starts by committing any uncommitted work: hand edits made between turns, or leftovers from a stopped or failed turn. Before this, only a successful turn was checkpointed, so that work went into the next run uncommitted, and one
git reset --hard,checkout --orclean -fdfrom the agent destroyed it for good. Part of #321.Changes
coder-checkpoint: turn Nsnapshot of the dirty worktree. It is an ordinary checkpoint, so it appears in the checkpoint list and can be restored from the UI.add -A+ commit there would seal conflict markers into a merge commit and break the conflict-resolve flow.Verification
git reset --hardandgit clean -fd, and the hand edit and the untracked file both survive in the snapshot. It fails without the runner hook (checked by reverting it).MERGE_HEADgets no snapshot; once that is cleared it does.electron/test/checkpoints.test.js: 19/19 pass.npm run test:electronin a CI-like env: 4946 pass, 3 fail. The 3 failures (PDF extraction, PTY terminal, QR banner) come frompdfjs-dist,@lydell/node-ptyandqrcode-generatormissing from the localnode_modulesclone, not from this change. CI is the real check for those.Notes for reviewers
turn N, so N drifts further from the real number of turns (restore's safety commit already does this).🤖 Generated with Claude Code