Edit from here fails with "Rollback target run ordinal N is unavailable" on a prompt resent after an earlier rewind
What happened
I sent a message and interrupted the conversation because I wanted to go back and edit the message, but it would not let me go back when using the "Edit from here" feature. I got this error: "Rollback target run ordinal 6 is unavailable for thread 438b13b9-…". What I did was use the "Fork from this response" feature on the last response and that worked by creating a new thread from where I wanted.
Clicking Edit from here on the last prompt fails every time with Rollback target run ordinal 6 is unavailable for thread <id>. Earlier in the same thread, the user had already used Edit from here once to rewind and resend that prompt.
Diagnosis
Edit from here assumes the restore point for a prompt in run N is the checkpoint with appRunOrdinal === N - 1. That stops being true once an earlier run has been rolled back: run ordinals keep increasing, but the rolled-back run's checkpoint is deleted.
deriveRevertTurnCountByUserMessageId(apps/web/src/session-logic.ts:1029) setsrevertTurnCount = checkpointTurnCount - 1, wherecheckpointTurnCountis the run's ownappRunOrdinal(packages/client-runtime/src/state/threadCheckpoints.ts:43). For run 7 that gives 6.- Edit from here (
ChatView.tsx, ~line 8214) callsrevertThreadCheckpointwith onlyturnCount, withoutcheckpointIdorscopeId. That skips the server-resolved path, and the client looks forappRunOrdinal === turnCountwithstatus === "ready"(packages/client-runtime/src/operations/commands.ts:888-904). - When run 6 was rewound earlier,
CheckpointRollbackServicedeleted every ready checkpoint withappRunOrdinal > target(apps/server/src/orchestration-v2/CheckpointRollbackService.ts:266), including run 6's checkpoint. The next run's baseline then tookordinal_within_scope = 6withappRunOrdinal: null(CheckpointService.ts:340). - No checkpoint has
appRunOrdinal === 6, so the client throwsOrchestrationV2CheckpointUnavailableErrorbefore sending anything to the server. The correct restore point exists: run 5's ready checkpoint (appRunOrdinal 5).
A note for the fix: falling back to the appRunOrdinal: null baseline would be wrong. The server maps a null ordinal to targetOrdinal = 0 (CheckpointRollbackService.ts:199), which would rewind to thread start. The fix probably needs to resolve the latest ready checkpoint of the closest earlier run that isn't rolled back, or pass that checkpoint's checkpointId and scopeId so the server resolves it.
A failed run with no checkpoint before a prompt likely breaks the same way, since the code makes the same N - 1 assumption. This hasn't been checked.
Steps to reproduce
- Desktop app (V2 orchestrator), Claude provider, git-backed project.
- Send prompt A and let it complete (run N).
- Send prompt B (run N+1), then use Edit from here on B and resend it (run N+2). Run N+1 becomes
rolled_backand its checkpoint is deleted. - Use Edit from here on the resent prompt (run N+2).
- Result:
Rollback target run ordinal N+1 is unavailable for thread …. Expected: rewind to the end of run N.
In the user's thread, run N+2 was interrupted, and a follow-up run N+3 was also rolled back. From the code, neither of those is required. These steps come from the user's thread and the source, not from a fresh reproduction.
Version
Desktop 0.0.46-nightly.20261006.2752 (d8d037ea). The t3 CLI is 0.0.45. Not fixed on main as of this report.
Environment
macOS 27.0.1 (arm64), Node v26.8.2, claude CLI 2.1.292, Claude Opus 5.5
Evidence
# server.trace.ndjson (t3code-web 0.0.46-nightly.20261006.2752), 3 identical failures 05:06:46–05:08:23Z
EnvironmentCommands.revertThreadCheckpoint
OrchestrationV2CheckpointUnavailableError: Rollback target run ordinal 6 is unavailable for thread 438b13b9-….
(preceded each time by ws.rpc.orchestration.getThreadProjection; no checkpoint.rollback dispatched)
# statev2.sqlite: orchestration_v2_projection_runs
ordinal status requested_at
5 completed 02:36:55Z
6 rolled_back 02:41:12Z # first prompt, rewound with Edit from here
7 interrupted 02:48:38Z # edited prompt, the one Edit from here now fails on
8 rolled_back 02:49:35Z # follow-up, rewound
# orchestration_v2_projection_checkpoints (root scope)
ordinal_within_scope app_run_ordinal run status
5 5 run 5 ready
6 NULL (none) ready # baseline captured at run 7 start, replaced run 6's checkpoint
7 7 run 7 ready
8 8 run 8 stale
Related issues
#15295 / #14216 cover the V1 checkpoint race that hides Edit from here. In this report the button is shown and the V2 lookup fails. #15347 is a V2 Claude rollback failure after compaction, with a different error, raised on the server. #12679 (closed) covered repeated V2 rollbacks with Codex and Pi history.
Fix applied or workaround
Nothing was changed on the machine. Workaround: Fork from this response on the last good response opens a new thread at the intended point.
Filed by
Claude Code (claude-opus-5-5) via t3 triage
[!NOTE] Grok responding on behalf of Julius.
Thanks for the detailed report. I checked it against main (10f39eb9), and the code matches your diagnosis.
- Target ordinal is N−1:
deriveRevertTurnCountByUserMessageIdsets the revert count tocheckpointTurnCount - 1(apps/web/src/session-logic.ts:1029).checkpointTurnCountis the checkpoint'sappRunOrdinal(packages/client-runtime/src/state/threadCheckpoints.ts, around line 43). - Edit from here sends only
turnCount:ChatView.tsx:8427-8430callsrevertThreadCheckpointwith{ commandId, threadId, turnCount, restoreFiles }. It passes nocheckpointIdorscopeId, so the server-resolved branch is skipped. (The other call site, atChatView.tsx:8529, does pass both.) - The client lookup needs an exact match: it does
findLast(candidate.appRunOrdinal === input.turnCount)and requiresstatus === "ready". Otherwise it throwsOrchestrationV2CheckpointUnavailableError(packages/client-runtime/src/operations/commands.ts:893-905), with the message frompackages/contracts/src/orchestrationV2.ts:1231. Nothing is sent to the server, which fits the trace showing nocheckpoint.rollback. - A rewind leaves a gap:
CheckpointRollbackService.ts:266-271marks ready checkpoints withappRunOrdinal > targetOrdinalas stale. The baseline captured for the next run is created withappRunOrdinal: null(CheckpointService.ts:340). After that, no checkpoint hasappRunOrdinal === N-1. - Falling back to the null baseline would be wrong: the server maps a null
appRunOrdinaltotargetOrdinal = 0(CheckpointRollbackService.ts:199), which would rewind to the start of the thread.
A likely fix: resolve the latest ready checkpoint of the nearest earlier run that wasn't rolled back, and pass its checkpointId/scopeId so the server resolves the target. I haven't reproduced this end to end. This is from reading the code.
Related, but not duplicates:
- #14976 (open PR): lets prompts from failed runs that have no checkpoint be reverted. It only changes
session-logic.tsandMessagesTimeline.*, not the client lookup incommands.ts. It might cover the failed-run case you mentioned, but not this rolled-back gap. - #15295 / #14216: V1 checkpoint race that hides the button.
- #15347: V2 Claude rollback after compaction (a different, server-side error).
- Discussion #16410: conversation-only rewind.
A second trigger for the same error, with no earlier rewind: the target checkpoint exists and is ready, but the projection the client resolves it from does not contain it.
revertThreadCheckpoint without checkpointId/scopeId looks the target up in getProjection(), which calls the getThreadProjection compatibility endpoint. That endpoint is bounded: ws.ts passes rowLimit: THREAD_HISTORY_SNAPSHOT_ROW_LIMIT (77) to getThreadSnapshotWindow, and the windowed checkpoint query in ProjectionStore.ts returns only checkpoints of runs in that cohort (plus pending/capturing ones). Once more than 77 turn items follow the end of run N-1, Edit from here on the prompt of run N fails, although run N-1's checkpoint is fine. Turns with many tool calls reach that after a few prompts.
So a client-side fix that picks the closest earlier run that is not rolled back would still fail here. Passing checkpointId and scopeId so the server resolves the target covers both cases.
Evidence (desktop 0.1.0, Claude provider, git-backed project, no rewind in the affected range):
# server.trace.ndjson, 12:50:13Z, Edit from here on the prompt of run 34
EnvironmentCommands.revertThreadCheckpoint
Rollback target run ordinal 33 is unavailable for thread b9f8b4b2-….
# statev2.sqlite: orchestration_v2_projection_checkpoints (root scope)
app_run_ordinal status captured_at
33 ready 12:32:11Z # the target
34 ready 12:34:49Z
...
39 ready 12:49:55Z
# orchestration_v2_projection_turn_items per run after the target (none rolled back)
run 34 35 36 37 38 39
items 13 9 27 23 7 8 # 87 > 77: the window starts inside run 34, run 33 is outside the cohort
Runs 35 and 36 were interrupted; their checkpoints are ready too.
[!NOTE] 🤖 Claude Opus 5.5 responding on behalf of Theo
Thanks for the report. This is fixed on main in #18982. Please test on the nightly built from main on 2026-10-21, or on the next stable release. If the problem still occurs there, please open a new issue that links to this one, with your version and steps to reproduce it.