Skip to content

fix(web-ui): reconcile peer rollback receipts and late records - #3715

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

bobleer merged 1 commit into
openBitFun:mainfrom
bobleer:bob/fix-peer-rollback-reconciliation

Conversation

@bobleer

@bobleer bobleer commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

After a successful rollback in Peer Device Mode, the controller could keep the selected message and later turns on screen. Editing that message could also rerun over the stale transcript. This fixes the remaining receipt/replay gaps after #3707 and #3708.

  • Capture the known suffix by stable turn identity before invoking the host, then remove it and its send previews after a completed response, including responses with an omitted or incomplete retirement list.
  • Fence in-flight records in the device/session replica until a host tombstone or fresh authoritative replay takes over. Preserve new turns that reuse a storage position and permit authoritative redo regardless of whether the tombstone precedes or follows the receipt.
  • Reject stale completions after a device switch. Both edit and rollback use the same mutation service.

Type and Areas

Type: bug fix

Areas: Web UI, FlowChat, Peer Device Mode

Motivation / Impact

For test1, test2, test3, rolling back before test2 leaves only test1; editing test2 removes the old suffix before submitting the edited text. A delayed record cannot bring the deleted messages back. No wire protocol, persisted format, backend command, or user-facing copy changes.

Verification

  • Focused Vitest run across FlowChatStore, SessionRollbackService, UserMessageEditService, RelaySessionHistory, SessionRecordReplica, EventHandlerModule, UserMessageItem, storeSync, sessionActivation, sessionSceneLifecycle, sceneStore, and AgentAPI: 540 passed on the rebased commit.
  • The new regression cases first reproduced the stale suffix and late-record resurrection on the previous implementation.
  • pnpm run check:web: passed; pnpm --dir src/web-ui exec tsc --noEmit also passed after the final ordering fix.
  • pnpm run check:repo-hygiene, git diff --check, and node scripts/check-git-object-sizes.mjs --base upstream/main --head HEAD: passed.
  • User-confirmed live Peer Device retest: old messages disappeared and subsequent sends worked. The reported setup was Desktop controlling a CLI host. Automated fixtures separately cover both edit and rollback, incomplete responses, sparse history, late records, device isolation, new-turn identity, failure retention, and redo ordering.
  • Remote workspace, mobile/IM Remote Control, live Desktop-to-Desktop, and Detached Dispatch were not exercised. Detached history rollback remains explicitly unsupported.

Reviewer Notes

AI-assisted implementation. Testing level: automated regression coverage plus user-confirmed live retest of the reported Peer workflow. The fence stays with the replica rather than a global turn blacklist or fabricated revision, so the host remains authoritative.

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. No copy changes; owner guidance and the focused test command are updated.

@bobleer
bobleer merged commit f881f03 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