Repository navigation
fix(web-ui): fix Session rollback when remote-controlling a CLI host - #3688
Merged
bobleer merged 2 commits intoNov 2, 2026
Merged
Conversation
Relay replicas and optimistic truncation derive a Turn catalog on the controller and mint their own revision strings. The host computes its catalog revision independently, so these values can never match a host-issued token. Prefix them with `local:` and expose `isHostIssuedTurnCatalogRevision` so consumers can tell them apart. Co-Authored-By: Claude <noreply@anthropic.com>
In Peer Device Mode the controller's Turn catalog comes from relay records, and its revision was sent to the CLI host as `expectedCatalogRevision`. The host always rejected it with "Session rollback target is stale", so rollback never worked while remote-controlling a CLI host. Only send host-issued revisions. The host still validates the target Turn id and `expectedStorageTurnIndex`, the same fallback already used when the catalog does not cover the projected Turns. Co-Authored-By: Claude <noreply@anthropic.com>
This was referenced Nov 3, 2026
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
When Desktop remote-controls a CLI host in Peer Device Mode, every Session rollback fails with
Validation error: Session rollback target is stale.Cause: the controller builds the Turn catalog for a peer Session from relay records, and
refreshRelayTurnCataloggives it a revision it made up,relay:<turnIds>.SessionRollbackServicesent that value asexpectedCatalogRevision. The host computes its ownv2-<sha256>revision inapply_targeted_session_revert_locked, so the two can never match.Fix:
truncateDialogTurnsFrom) now start withlocal:. AddedisHostIssuedTurnCatalogRevisionto tell them apart.expectedCatalogRevisiononly when the host issued it. The host still checks the target Turn id andexpectedStorageTurnIndex. This is the same fallback already used when the catalog does not cover the displayed Turns.Type and Areas
Type: bug fix
Areas: web UI (flow_chat), Peer Device Mode
Motivation / Impact
Session rollback works again when remote-controlling a CLI host. Local Sessions are unchanged: their catalogs come from the host and keep the full revision check.
Verification
pnpm --dir src/web-ui run test:run src/flow_chat/services/SessionRollbackService.test.ts src/flow_chat/store/FlowChatStore.test.ts: 280 passedpnpm run type-check:web: passedReviewer Notes
upstream/mainand open PRs; no existing fix was found.Checklist
🤖 Generated with Claude Code