fix(webui): settle Plan UI after terminal tasks - #1552
Open
lihongguang-0014 wants to merge 9 commits into
Open
Conversation
(cherry picked from commit 9c252b9)
Settle clarify requests and Plan presentation from authoritative task outcomes while preserving exact request ownership. Reconcile hydration and stream generations without allowing stale events to resurrect terminal UI state.
Keep task-terminal Plan presentation provisional until the authoritative resumable or cancelled PlanRun snapshot arrives. Route reconnect and history terminal owners through the same clarify settlement path, including successful and direct-mode turns.
Keep Plan mutations disabled while terminal task presentation waits for an authoritative owner-free PlanRun snapshot. Release the fence only when accepted run, plan, session, or epoch state supersedes the provisional projection.
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
Root cause
The WebUI treated transport stop signals, Plan activity, and clarify responses as partially independent state machines. Clarify submission was also rendered as replied before server acknowledgement, while pending-input hydration lacked enough per-request sequence and stream-generation provenance. That allowed terminal tasks to leave interactive cards or a locked composer behind, and allowed delayed events or reconnect hydration to resurrect terminal UI state.
Scope and non-goals
This is a WebUI-only state-settlement change. It does not alter backend task lifecycle, broker behavior, wire schemas, persistence, or database structure. It does not add durable reply correlation for historical legacy Meta clarifies that have no request ID; that pre-existing reload behavior remains outside this fix.
Compatibility and platforms
The change preserves the existing RPC/event contract and accepts current task/turn identifier variants. It covers structured request-ID clarifies and live legacy Meta clarifies in both session and direct modes. It applies to the shared WebUI used by browser and desktop surfaces; no backend migration is required.
Validation
npx vitest run.git diff --checkpassed.Manual live desktop/gateway validation was not performed; terminal races and ownership boundaries are covered by deterministic contract and component tests.
Release note
Yes — user-visible bug fix for Plan-mode terminal cleanup and clarify-card settlement.
Fixes #1329
Fixes #1497
Commit Lineage
9c252b9ca1a18be491af939eecc404950ffc1a71.3713b900and its exact revert5452055d, have zero net contribution and were not replayed.3aa23149268ba474353a8e576f8124afdcd3045d, cherry-picked with-xonto base5599683468a28e86849373e3ff28eb265cb04284; the original author is preserved.82e3cc7bcf2d9e5ae83e34732cc2dc112ea1dacc, review correctionsba1f3c5144133237e2c59f97068172f3a46e4155andc4ca69fd3a31fc55c5ef1c1c80cb0bf6c1369c76, hydration-watermark correction94fd1ed69ea01dfa8288b1bb0749560ae57f8a86, and terminal-recovery race correction9e57c0ec2e32329d256a4f24af6d10b06f75c3ea.e074f8bdf088070cf63090ded162cd68e536f918incorporatesmainatf4e65ef26cb2bb190dd9e6910027f571effa4922, including the session-lifecycle boundary refactor, without conflicts.git range-diff 5452055d0e147c03d423d08eccbc92097537c9b5..9c252b9ca1a18be491af939eecc404950ffc1a71 5599683468a28e86849373e3ff28eb265cb04284..3aa23149268ba474353a8e576f8124afdcd3045d.