Skip to content

fix(web-ui): remove leftover user messages after a remote Session rollback - #3708

Merged
bobleer merged 1 commit into
openBitFun:mainfrom
bobleer:fix/peer-rollback-leftover-bubbles
Nov 3, 2026
Merged

bobleer merged 1 commit into
openBitFun:mainfrom
bobleer:fix/peer-rollback-leftover-bubbles

Conversation

@bobleer

@bobleer bobleer commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

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:

  1. The host's relay records create the real turn first; afterRelayRecords flushes them before DialogTurnStarted is handled.
  2. handleDialogTurnStarted therefore finds an existing turn (projectedNewTurn is false). It only finishes the preview when userMessage.id matches, but the host assigns its own user message id.
  3. The preview is never finished. ModernFlowChatContainer renders 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 hostDialogQueue treat the session as busy, which matches the frequent manage_dialog_queue polling in the desktop logs.

Fix (controller-side, so it covers both CLI and Desktop hosts):

  • flushRelaySessionRecords finishes the preview of each turn the host records render. The reserved turn id is the join.
  • SessionRollbackService finishes the previews of the turns a rollback retired.

I also checked the host side end to end with a temporary Rust probe (paged read_history hub + real HostStreamSubscriber, not committed). After a rollback the controller receives session-gap {resync:true}, a replay of only the visible turns, then ready, 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 passed
  • Both new or extended tests fail without the fix:
    • a device-surface send whose host record arrives clears its preview, and a later retirement leaves no bubble
    • a rollback clears previews for the turns it retired
  • tsc --noEmit (web-ui): clean
  • Remote scenarios: Peer Device Mode at unit level. The host path was traced and probed for both host types: CLI uses peer_host/fanout.rs, Desktop uses lib.rs, and both go through the same synchronize_session_records path. I did not rerun a live session.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable. (none needed)

🤖 Generated with Claude Code

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>
@bobleer
bobleer merged commit 6464362 into openBitFun:main Nov 3, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant