You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let the user edit any past user message and resubmit from that point: rewind the conversation (and optionally the worktree via checkpoint) to just before that message, then run the edited version. Often a cheaper course correction than checkpoint archaeology.
Implemented on coder/edit-and-resubmit-any-past-message-00986e (not merged).
How it works.threads.rewind truncates the transcript at a chosen past user message, clears sessionId and sets a one-shot replayContext. A CLI session cannot be rewound, so the next turn starts a fresh session seeded with a digest of the retained tail — reusing the existing hand-off prefix builder with the thread itself as source (never via handoffFrom, which drives crew sweeps and the OTel ancestor walk). Rewind starts no run: the renderer follows with the ordinary runs.start, which appends the edited text. Usage/spend history is never rewritten. restoreFiles additionally hard-resets the worktree.
UI: an Edit affordance on user bubbles opens an inline editor (Esc cancels, Cmd/Ctrl+Enter submits), then a confirm dialog naming how many messages will be dropped, with an opt-in "also restore files" shown only when the thread has a worktree. Transcript-only stays the one-click path.
Three checkpoint hazards found and fixed during review:
Checkpoints are numbered by counting checkpoint commits, and a turn that changes nothing creates none — so mapping user-message count to turn N restored the wrong tree. A scan of the live store found this in real threads. Now selected by commit time.
listCheckpoints walked all reachable history, so a thread that merged a worker branch saw that branch's checkpoints (one live thread has 8 checkpoints but max turn 3). An automatic reset could land on the fork's tree and discard the merge. Now --first-parent, fixed at the shared function so the existing restore UI benefits too.
Rewind persisted with the debounced save(); a crash in that window left files rewound and the old transcript resurrected. Now saveNow().
Also: the detail refetches right after a rewind (a failed follow-up start otherwise left dropped messages on screen), and attachments are carried through the resubmit like Retry turn does.
Tests:electron/test/rewind.test.js (real git repos, including a skipped clean turn and a merged foreign checkpoint), test/editResubmit.test.ts, test/editResubmitWiring.test.tsx. Core 38/38, renderer 865/865, electron 1046/1047 — the one failure is the web-integration reconnect suite that also fails on main. The occasional memory-server trust-ranking failure is a pre-existing flake, reproduced on an untouched main checkout.
Activity
currentbits commentedon Aug 17, 2026
Implemented on
coder/edit-and-resubmit-any-past-message-00986e(not merged).How it works.
threads.rewindtruncates the transcript at a chosen past user message, clearssessionIdand sets a one-shotreplayContext. A CLI session cannot be rewound, so the next turn starts a fresh session seeded with a digest of the retained tail — reusing the existing hand-off prefix builder with the thread itself as source (never viahandoffFrom, which drives crew sweeps and the OTel ancestor walk). Rewind starts no run: the renderer follows with the ordinaryruns.start, which appends the edited text. Usage/spend history is never rewritten.restoreFilesadditionally hard-resets the worktree.UI: an Edit affordance on user bubbles opens an inline editor (Esc cancels, Cmd/Ctrl+Enter submits), then a confirm dialog naming how many messages will be dropped, with an opt-in "also restore files" shown only when the thread has a worktree. Transcript-only stays the one-click path.
Three checkpoint hazards found and fixed during review:
turn Nrestored the wrong tree. A scan of the live store found this in real threads. Now selected by commit time.listCheckpointswalked all reachable history, so a thread that merged a worker branch saw that branch's checkpoints (one live thread has 8 checkpoints but max turn 3). An automatic reset could land on the fork's tree and discard the merge. Now--first-parent, fixed at the shared function so the existing restore UI benefits too.save(); a crash in that window left files rewound and the old transcript resurrected. NowsaveNow().Also: the detail refetches right after a rewind (a failed follow-up start otherwise left dropped messages on screen), and attachments are carried through the resubmit like Retry turn does.
Tests:
electron/test/rewind.test.js(real git repos, including a skipped clean turn and a merged foreign checkpoint),test/editResubmit.test.ts,test/editResubmitWiring.test.tsx. Core 38/38, renderer 865/865, electron 1046/1047 — the one failure is the web-integration reconnect suite that also fails onmain. The occasionalmemory-servertrust-ranking failure is a pre-existing flake, reproduced on an untouched main checkout.Merge pull request #387 from currentbits/coder/edit-and-resubmit-any-…