fix(session): publish rollback invalidation before replacement root - #1295
Conversation
The frontend prefix-hides everything after a rewind cut while the session projection still claims redo is available. The replacement root's message.updated could arrive before the flip that invalidates redo, so the new branch (including the latest assistant reply) stayed hidden until a refresh re-fetched the authoritative page. Sequence the projection flip before the message publish. Co-authored-by: synergy-agent <299070056+synergy-agent@users.noreply.github.com>
|
Review complete. All checks run green, the regression test is genuine (verified red/green), and the ordering claim holds up against both the bus implementation and the frontend prefix-cut semantics. Here is my review. Review: #1295 — publish rollback invalidation before replacement rootVerdict: sound, no blocking findings. The change is minimal (a 5-line reorder in What I verifiedRoot cause matches the code. The reorder actually guarantees the ordering. The flip can't be swallowed by publish dedup. No deadlock on the hot path. Tests are real evidence.
One non-blocking observationIf Synergy: review complete — no blocking findings, 1 non-blocking observation |
Summary
After a rewind, the frontend prefix-hides everything at/after the rollback cut while the session projection still claims redo is available.
Session.updateMessagepublished the replacement root'smessage.updatedbefore flipping the persisted projection, so the new branch — including the latest assistant reply — could arrive whilecanUnrollbackwas stilltrueand stay hidden until a refresh re-fetched the authoritative page. Tool cards stayed visible because they ride unsequenced streaming events, matching the reported symptom.Change
Session.updateMessagenow awaitspublishRollbackInvalidationbefore publishing the written message'smessage.updated, so the invalidation'ssession.updated(canUnrollback: false) is always sequenced ahead of the replacement root.Verification
packages/synergy/test/session/rollback.test.tsasserts the bus publish order (fails before, passes after).bug-fixdecision record.