Repository navigation
fix(web-ui): remove leftover user messages after a remote Session rollback - #3708
Merged
bobleer merged 1 commit intoNov 3, 2026
Merged
Conversation
A send from the controller renders a display-only preview, keyed by the reserved turn ID, until a real Turn adopts it. On a device surface the host's records create that Turn before DialogTurnStarted is handled, and the host assigns its own user message ID, so the preview was never finished. It stayed hidden only while its Turn existed: after a rollback retired the Turn, the stale preview reappeared as a bare user message. Lingering previews also made the host queue look busy. Finish a preview when the relay records render its Turn, and finish the previews of Turns a rollback retires. Applies to CLI and Desktop hosts. Co-Authored-By: Claude <noreply@anthropic.com>
3 tasks done
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
Follow-up to #3688 and #3707. After rolling back while remote-controlling another device, the model replies disappear, but the user messages of the retired turns stay on screen as bare bubbles.
Cause: a send from the controller renders a display-only submitted-message preview, keyed by the reserved turn id, until a real turn adopts it (
submittedMessagePresentation). On a device surface:afterRelayRecordsflushes them beforeDialogTurnStartedis handled.handleDialogTurnStartedtherefore finds an existing turn (projectedNewTurnis false). It only finishes the preview whenuserMessage.idmatches, but the host assigns its own user message id.ModernFlowChatContainerrenders a preview whenever no turn with its id exists, so it stays hidden only until a rollback retires the turn, then shows up as a bare user message.Lingering previews also made
hostDialogQueuetreat the session as busy, which matches the frequentmanage_dialog_queuepolling in the desktop logs.Fix (controller-side, so it covers both CLI and Desktop hosts):
flushRelaySessionRecordsfinishes the preview of each turn the host records render. The reserved turn id is the join.SessionRollbackServicefinishes the previews of the turns a rollback retired.I also checked the host side end to end with a temporary Rust probe (paged
read_historyhub + realHostStreamSubscriber, not committed). After a rollback the controller receivessession-gap {resync:true}, a replay of only the visible turns, thenready, as designed in #3707. The leftover bubbles were not host data.Type and Areas
Type: bug fix
Areas: web UI (flow_chat), Peer Device Mode
Motivation / Impact
Rollback in Peer Device Mode now removes the retired user messages too. Sends from the controller no longer leave hidden previews behind.
Verification
node scripts/run-vitest.mjs run src/flow_chat src/app/components/NavPanel(web-ui): 5122 passedtsc --noEmit(web-ui): cleanpeer_host/fanout.rs, Desktop useslib.rs, and both go through the samesynchronize_session_recordspath. I did not rerun a live session.Checklist
🤖 Generated with Claude Code