Description
When the provider finishes with finish_reason: network_error the last user message row shows only the copy button — the revert/undo affordance is missing. Users expect to be able to revert the failed turn (to retry or remove it), especially after transient network failures.
Screenshot/behavior: input I last gave shows only copy, no revert arrow.
Root cause
- Failed turns still create a checkpoint (
CheckpointReactor.ts:355 status: error, thread.turn.diff.complete), but they often have no assistant_message or a synthetic assistant:${turnId} id that never appears in timelineEntries.
ChatView.tsx:2620 derives revertTurnCountByUserMessageId only by scanning forward to the next assistant message and looking up turnDiffSummaryByAssistantMessageId. When the assistant message is missing/synthetic the lookup misses -> canRevertAgentWork false -> MessagesTimeline.tsx:995 hides the revert button.
Evidence:
apps/server/src/orchestration/Layers/CheckpointReactor.ts:355,65 creates error checkpoint.
apps/web/src/components/ChatView.tsx:2620-2651 direct scan misses.
apps/web/src/components/chat/MessagesTimeline.tsx:995,1068 only renders copy.
Expected
After any terminal turn, including network_error/status:error/missing, the preceding user message must expose the revert button (disabled only when isRevertingCheckpoint or isWorking).
Patch
Managed via fh as fix-chat-show-revert-after-network-error-vq3yckjy:
- Keep existing assistant-message scan, add fallback: map nth user message to nth checkpoint sorted by
completedAt (1:1 user->turn) when direct scan finds nothing. Covers synthetic ids and zero-message failed turns.
- Change:
apps/web/src/components/ChatView.tsx:2620 + fallback block.
Verify:
pnpm exec vp test run apps/web/src/components/ChatView.logic.test.ts
pnpm exec vp test run apps/web/src/components/chat/MessagesTimeline.logic.test.ts
Manual: trigger Provider finish_reason: network_error (e.g. kill network mid-turn), observe last user bubble now shows undo icon next to copy.
Tracking
Description
When the provider finishes with
finish_reason: network_errorthe last user message row shows only the copy button — the revert/undo affordance is missing. Users expect to be able to revert the failed turn (to retry or remove it), especially after transient network failures.Screenshot/behavior: input I last gave shows only copy, no revert arrow.
Root cause
CheckpointReactor.ts:355status: error,thread.turn.diff.complete), but they often have no assistant_message or a syntheticassistant:${turnId}id that never appears intimelineEntries.ChatView.tsx:2620derivesrevertTurnCountByUserMessageIdonly by scanning forward to the next assistant message and looking upturnDiffSummaryByAssistantMessageId. When the assistant message is missing/synthetic the lookup misses ->canRevertAgentWorkfalse ->MessagesTimeline.tsx:995hides the revert button.Evidence:
apps/server/src/orchestration/Layers/CheckpointReactor.ts:355,65creates error checkpoint.apps/web/src/components/ChatView.tsx:2620-2651direct scan misses.apps/web/src/components/chat/MessagesTimeline.tsx:995,1068only renders copy.Expected
After any terminal turn, including
network_error/status:error/missing, the preceding user message must expose the revert button (disabled only whenisRevertingCheckpointorisWorking).Patch
Managed via
fhasfix-chat-show-revert-after-network-error-vq3yckjy:completedAt(1:1 user->turn) when direct scan finds nothing. Covers synthetic ids and zero-message failed turns.apps/web/src/components/ChatView.tsx:2620+ fallback block.Verify:
Manual: trigger
Provider finish_reason: network_error(e.g. kill network mid-turn), observe last user bubble now shows undo icon next to copy.Tracking
fix-chat-show-revert-after-network-error-vq3yckjyin ImBIOS/.forkhubfix-chat-show-revert-after-network-error