Repository navigation
Rewind and diff work past a run that never started; skip the files question when nothing changed - #4
Merged
Conversation
…stion when nothing changed Rewinding to a message whose previous run was cancelled before it started failed with "Rollback target run ordinal N is unavailable". The client resolved the target with an exact appRunOrdinal match, but a run that never started captures no checkpoint, so ordinals across checkpoints are not contiguous. The resolver now takes the newest checkpoint at or before the ordinal, or the thread-start checkpoint. The "Edit from here?" dialog asked whether to revert files even when no run after the revert point changed any. It now rewinds straight away, keeping the workspace, when every later checkpoint is ready with no changed files; missing or errored checkpoints still ask. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…n that never started The diff panel asks for a run's changes from "its ordinal minus one". CheckpointDiffQuery resolved that baseline with an exact appRunOrdinal match, so when the previous run was cancelled before it started (no checkpoint) the diff failed with "Checkpoint ref is unavailable for turn N". The baseline now comes from the newest ready checkpoint at or before that ordinal, or the root scope's ordinal zero before any. The lookup is shared with the client rewind resolver through @t3tools/shared/checkpointOrdinal. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Summary
A run that never starts (cancelled while queued, or steered into the run before it) gets no checkpoint. Rewind and the diff panel both looked up a checkpoint by exact run number, so the gap broke them. Both now use the newest ready checkpoint at or before that run (shared:
packages/shared/src/checkpointOrdinal.ts).The "Edit from here?" dialog no longer asks about files when no files changed since the revert point:
Evidence
Real thread: run 1 completed, run 2 cancelled before start (no checkpoint), run 3 completed. Rewind on run 3's message failed.
commands.test.ts:280→OrchestrationV2CheckpointUnavailableError: Rollback target run ordinal 2 is unavailable for thread thread-v2.After:
Tests 28 passed (28)CheckpointDiffQuery.test.ts:199→CheckpointRefUnavailableError: ... Checkpoint ref is unavailable for turn 2.After:
Test Files 2 passed (2), Tests 34 passed (34)session-logic.test.ts:348→TypeError: revertTouchesFiles is not a functionAfter:
Tests 51 passed (51)Typecheck:
packages/shared,packages/client-runtime,apps/server,apps/webexit 0.Merge Danger
Door: two-way
Lookup and UI logic only; no data migration or stored-state change. Revert the two commits to undo.
Blast Radius: small
Touches rewind and the diff panel only. One edge: an empty changed-file list can also mean the server could not compute the diff, so the dialog is skipped and files are kept. Nothing is lost.
🤖 Generated with Claude Code