Repository navigation
perf(control-ui): split cached chat mount after connect dispatch - #179701
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
f6ab019 to
524a0e9
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
524a0e9 to
d3bb139
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 524a0e9411
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -315,6 +315,7 @@ export abstract class ChatPaneLifecycle extends ChatPaneSessionObservation { | |||
| } | |||
| pageState.sidebarLayout = this.restorePaneSidebarLayout(pageState.sidebarLayout); | |||
| pageState.getWorkContext = () => this.workContext; | |||
| pageState.isRouteSessionPending = () => this.routeResolutionPending; | |||
There was a problem hiding this comment.
Gate cached transcript mutations until route confirmation
When an off-roster UUID is provisionally mounted and sessions.resolve later reports it as moved, mismatched, or deleted, cached message actions are already enabled: createChatPaneSessionActionCallbacks can expose rewind/fork actions, whose handlers immediately call sessions.rewind or sessions.fork. The new pending predicate is only consulted by send/outbox paths, so clicking one of these actions while the cached transcript is visible can mutate the stale session before route authority resolves. Propagate this state into all session mutation gates, including rewind, fork, abort, and branch switching.
AGENTS.md reference: AGENTS.md:L65-L65
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in the current head. Provisional route admission now reaches the shared session-action gate and the dispatch owners for rewind, fork, branch switching, reset, abort and settings. Retained callbacks recheck authority; queued Stop remains held and resumes after confirmation. Regression coverage exercises pending-to-confirmed transitions and stale callbacks, including a readiness case that failed before the repair. The snapshot and send admission rules remain intact.
ede2d83 to
37cb28b
Compare
|
@clawsweeper re-review The current head fixes the provisional-route mutation finding, including retained callbacks, settings changes, and queued Stop. Focused regressions, admission browser tests, UI typecheck and targeted lint pass. The PR body now includes the final-head interleaved measurements and synthetic screenshots; it explicitly tracks the full-suite and CI gates still running. |
|
🦞👀 Re-review progress:
|
37cb28b to
1b54170
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1b541706d9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const branchSwitchAccess = readChatSessionActionAccess( | ||
| this.context.gateway.snapshot, | ||
| Boolean(this.state?.chatRunId), | ||
| { routePending: this.routeResolutionPending }, |
There was a problem hiding this comment.
Gate all header mutations until route confirmation
When an off-roster cached route is mounted and chat.startup returns a session descriptor before a held sessions.resolve, this pending flag disables only branch switching. The same header still exposes handleHeaderSessionAction, which dispatches rename, ownership/metadata changes, archive, and delete without checking routeResolutionPending (chat-pane-session-menu.ts:349-395), so a user can mutate cached session A before route authority redirects to session B or reports deletion. Fresh evidence beyond the prior comment is that these header mutation paths bypass the newly added shared action gate; gate their admission and recheck immediately before dispatch.
AGENTS.md reference: AGENTS.md:L65-L65
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed on 7b86a68ee33e007fb88bc51c5e653c6e5da97126. Header presentation and dispatch now share pending-route access; rename, metadata/lifecycle and placement actions remain unavailable until authoritative confirmation. Retained rename/action callbacks also recheck before dispatch. The same admission contract is enforced by the other mutation owners.
The regression proving chat.startup can publish before held sessions.resolve passes through the browser (all 10 admission cases), and the relevant mutation regressions fail against the old handlers and pass with the guards. The final-head full UI run and all failure classifications are recorded in the PR; exact-head CI is green.
1b54170 to
727b6e3
Compare
|
🦞👀 Re-review progress:
|
974978f to
5ee2d37
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5ee2d37fa4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| face: { type: "string", default: "dashboard" }, | ||
| "short-route": { type: "boolean", default: false }, | ||
| "full-uuid-route": { type: "boolean", default: false }, | ||
| "off-roster-route": { type: "boolean", default: false }, |
There was a problem hiding this comment.
Require a UUID route for off-roster benchmarks
When --off-roster-route is used without --full-uuid-route or --short-route, the URL selection below falls through to controlUiSessionUrl, which deliberately emits an exact-key literal route. That route bypasses the new full-UUID snapshot-admission and sessions.resolve flow, while the fixture still removes the session from the saved roster and the summary reports offRosterRoute: true; the benchmark therefore completes with plausible but unrelated timings. Make this option imply a UUID route or reject the invalid flag combination.
Useful? React with 👍 / 👎.
|
@clawsweeper re-review Updated head fixes canonical-global agent restoration at the bootstrap owner and adds a deterministic regression. The final native comparison passed 30/30 on head and 30/30 on base; exact-head CI and P2 autoreview pass. Composer/restored-outbox-only write holds remain the deliberate scoped contract described in the PR. The full UI result and exact-base comparisons are now in the body. Two intermittent color assertions remain explicitly unclassified; they are not being presented as inherited or hidden by weaker assertions. |
|
🦞👀 Re-review progress:
|
5ee2d37 to
24c08ef
Compare
….resolve, off the hello window (openclaw#179701) On a warm reload of a full-UUID chat link for a session outside the cached sidebar roster (Peter's sessions on Team), the transcript waited for sessions.resolve before the pane mounted. An earlier attempt (openclaw#177153) rendered the cached transcript first but its single mount landed on the WebSocket connect response and was reverted (openclaw#177760). Admit the route from the account/host-scoped prewarmed snapshot only for an exact full-UUID + agent match (scope key and connection revision re-checked after the read), schedule the cached pane mount after the connect request is sent and split it so no task lands in the hello window, and keep sessions.resolve authoritative (deleted, moved or mismatched sessions are replaced). Composer sends and restored queued sends are held until the route is confirmed; other mutations stay server-authorized by session key, ID or view ticket and fail safely on a deleted/moved session (see "Write hold scope" in the PR). Saved agent selection is restored after roster hydration so a fresh shell reopening the canonical global session lands on the selected agent (regression test; the old head reproduced the failure, 0/30 on the final head and base). Evidence (AWS c7a.4xlarge, 11 interleaved triplets): transcript paint 1,112 -> 860 ms (11/11), final rows 1,279 -> 1,119 ms, LoAF 240 -> 208 ms, FCP flat. Accepted tradeoff: hello handling +15.6 ms paired, which does not cascade (final rows improve in the same runs). Live rule: revert if Team's live final rows or hello regress materially. Runtime +163 LOC; startup gzip 325,800 -> 325,703 B. 179 unit and 34 focused e2e tests; full UI 842 passed (QA-lab failure reproduces on base; two intermittent color assertions - a sidebar hover reference captured mid-transition and a theme-change color read - did not differ meaningfully between head and base in paired replays and passed in CI); exact-head CI green.
What Problem This Solves
Reloading a full-UUID chat deep link waited for
sessions.resolvebefore mounting an already cached transcript, leaving a serial blank/skeleton interval. The pane can now mount from an exact, scoped snapshot after the initial connect request is sent. Cached rows hydrate in a separate task after hello;sessions.resolveremains authoritative and replaces deleted, moved, or mismatched routes.The snapshot path requires a full UUID, matching agent, matching account/host snapshot key, and the same connection revision after its asynchronous read. Roster matches keep their existing precedence. Parsed prewarm data stays with the snapshot-store owner and is shared with hydration.
Write hold scope
Only composer sends and restored queued sends/outboxes wait for route confirmation. Admission already requires an exact full-UUID and agent match on the account/host-scoped snapshot, so a stale mapping means the session was recently deleted or moved. Other mutations retain server-side authorization and target resolution by session key, ID, or view ticket, and fail safely without writing to another session. Task suggestion, question, and board-action affordances come from live data. User-composed messages are the harmful stale-target case, so delivery is held until confirmation. A different confirmed outbox remains independent.
This scope is an explicit maintainer decision. The previous per-call-site holds across goals, history actions, boards, discussion, headers, reactions, menus, sharing, settings, and run lifecycle are removed. No generic mutation gate or new targeting registry is introduced.
Reconnect verification stays at the route loader and is loaded through the existing async boundary. Moving its route-specific parsing out of eager startup code also removes this PR’s startup gzip growth without raising a ceiling.
Accepted tradeoff
The previously accepted comparison showed hello +14.5 ms paired (11/11 slower), against transcript paint −252 ms, final rows −205 ms, and LoAF blocking −93 ms. The earlier tuned experiment showed hello +13 ms versus transcript −240 ms, final rows −197 ms, and LoAF −29 ms. The hello shift was accepted because it did not cascade into the outcome metrics.
L156/#177153 was reverted in #177760 after an early mount delayed hello and subsequent RPCs. The split schedule preserves the corrected handshake timing and yields cached-row hydration after hello. Live revert rule: revert if live hello or final rows materially regress after deployment. This PR does not deploy the service.
Evidence
Campaign evidence for a signed-in reload of a dashboard deep link recorded 14 visible states and sidebar settlement around 15 seconds. This change targets the cached-chat route-resolution dependency.
The accepted performance comparison is retained below. A subsequent canonical-global reopen repair is described after the tables; it does not execute for these explicit UUID routes.
Performance comparison head:
974978ffcd7b51361e2cbf940984b57d484f141e; measured base:9d2ac90d14da283e9f6595eeaf483f4c19a5dbac.AWS Crabbox
cbx_b98c9da9a02b, fixedc7a.4xlarge(16 CPUs, 30 GiB available); run. Same repo Chromium, Team-scale fixture and probes across all variants. Eleven interleaved triplets: baseline / original split / final tuned split. Connect is withheld until 340 ms and then takes 220 ms; resolve/describe take 195 ms. The primary gate is at least 100 ms better transcript paint and at least 9/11 faster pairs; hello follows the explicitly accepted tradeoff. Other secondaries use the campaign IQR/paired regression rule; FCP may rise at most 50 ms.The final transcript-paint gate passes in 11/11 pairs (paired median −252 ms). Final rows improve 11/11 (−158.9 ms paired), LoAF 10/11 (−38 ms paired), and FCP is flat. Hello-handled shifts +15.6 ms paired (10/11), while response dispatch is flat (−0.2 ms paired); no downstream cascade appears. The warm-roster control has overlapping IQRs and no regression. The off-roster request census is 50 → 51 RPCs: one additional session-scoped
cron.list; other method counts match.The first mount task is 78 ms median, ending at 415–422 ms. Final cached-row hydration runs in a separate 151 ms median task, starting 615–628 ms, after hello-handled in all 11 runs. Original split folds that work into the hello task; its LoAF result is worse than the tuned split.
Startup JS gzip is 325,810 → 325,768 B (−42 B) on the remote same-toolchain builds, replacing the previous +170 B growth. No budget/ceiling is changed. The unchanged 325,657 B enforcement advisory is inherited (base +153 B, final +111 B); chat boot stays below 1,500,000 B (1,443,895 → 1,444,683 B).
Off-roster full-UUID reload
Milliseconds, median [Q1–Q3], inclusive quartiles. Each variant has 11 runs.
Paired deltas: Original split minus baseline
Paired deltas: Tuned split (final) minus baseline
Warm roster reload control
Milliseconds, median [Q1–Q3], inclusive quartiles. Each variant has 11 runs.
Paired deltas: Final minus baseline
Prior split-mount validation
Head
974978ffcd7b51361e2cbf940984b57d484f141e:All remote proof used AWS lease
cbx_b98c9da9a02b, fixedc7a.4xlarge. Command:node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts. Focused unit tests also prove the new admission/send behavior fails on the old production path.Private mutation boundary is writable by another POSIX principal.Same case/error reproduced with the baseline runtime projection (32 s including build); its owner and the entire extensions/src/test/config trees are unchanged..chat-details-sessionassertion as scheduled-main run 39693906280 / job 119546724037; timeout budgets differ (10 s remote, 30 s CI).The baseline classification runs retained the candidate UI test files while restoring all changed runtime route/pane/send owners. Source hashes, tree identities and symbol-reference comparisons verify the unchanged inputs to those global guards. They are baseline-runtime projections, not a claim that the whole checkout was main.
The subsequent canonical-global CI failure is resolved by the owner repair below; it is not classified as inherited from a passing replay.
pnpm test <file> --maxWorkers=1wall times (remote, viacorepack pnpm):ui/src/e2e/chat-snapshot-route.e2e.test.tsui/src/pages/chat/route-snapshot.test.tsui/src/pages/chat/chat-route-write-readiness.test.tsui/src/pages/chat/route-warm-boot.test.tsui/src/test-helpers/control-ui-cold-load-probes.browser.test.tsui/src/test-helpers/control-ui-team-scale-fixture.test.tsCanonical global reopen repair
Final head:
5ee2d37fa4293184e0ace4695f9304125fe6be27; current base:cadafc0084e25aa63a91506d4378d1f6db7ea7d2.CI run 39696722804, job 119556453178 exposed a real ordering defect: an implicit canonical-global reopen selected the default agent before the roster arrived, then retained that default because it was valid. A saved selection could consequently reopen
/chat/dummyinstead of/chat/openclaw. The resolver now chooses defaults and validates the saved selection after the roster read and existing connection checks. This removes ten runtime lines; explicit agent precedence, removed-agent fallback, and reconnect fences remain intact.The new deterministic regression fails with the old owner (
/chat/dummy) and passes after repair (/chat/openclaw). The pre-repair head reproduced the identical native-E2E failure in a diagnostic pilot (1/3 head attempts; base 0/3). That small pilot is not a rate comparison. The completed final-head comparison used thirty alternating-order pairs on one AWSc7a.4xlarge, pinned to two CPUs with native E2E--maxWorkers=2and the samechat-boot-render-stormcompanion. Each invocation used fresh browser state and a separate module cache. Tracked source was verified against the selected revision before each trial.5ee2d37fa429cadafc0084e2These counts do not establish that the original failure was inherited or quantify an amplification by the split mount. The matching native failure and red/green deterministic regression establish the repaired ordering defect. No timeouts, retries, weakened assertions, or test-only production hooks were added.
Final focused units: 179/179 pass across 12 files, including the new saved-agent regression and existing warm-route, connection replacement, snapshot admission, composer, and outbox boundaries.
corepack pnpm test ui/src/app/bootstrap.agent-selection.test.ts --maxWorkers=1took 10.895 s (12 passing tests; new cold module cache).Final same-toolchain bundle comparison on the updated base: startup gzip 325,800 → 325,703 B (−97 B). The base-aware budget check reports no violations or warnings; no ceiling is raised. The unchanged absolute 325,657 B limit remains exceeded by both builds (base +143 B, final +46 B). Chat boot is 1,443,181 → 1,443,906 B, below its unchanged 1,500,000 B ceiling. This replaces the original +170 B startup growth.
Final proof: AWS lease
cbx_28bd62bf493a, run. Final full UI: 842 passed / 3 failed / 4 skipped files (849); 3667 passed / 3 failed / 4 skipped tests; 5494.92 s. The canonical-global test and all 13 snapshot-admission cases pass in the full run. Focused native E2E also passes 34/34.The exact-base comparison used a detached checkout of
cadafc0084e2on the same AWS machine, with dependencies and runtime rebuilt. Baseline run reproduces the QA-lab POSIX boundary error and the complete max-lines, core-graph, and unused-export outputs. All core/UI/script typechecks, formatting and changed-file lint pass. No baseline or ceiling was raised.Two full-suite color assertions remain unclassified, not claimed as inherited. A further seven-pair comparison used alternating head/base order on the same instance:
The sidebar test freezes a reference color while it is transitioning; the retry test reads colors across a theme change. These are candidate test-timing explanations, not proof of inheritance. The lead approved this content, including the recorded unresolved color assertions, before requesting the rebase-only update below. No assertion, timeout, retry, or product behavior was changed to hide them.
Exact-head CI run 39710543926 is green, including selected UI E2E shards; the transient dependency-review status completed successfully without a rerun. Full-diff and final-commit autoreview are clean through P2, the latter with the resolver, caller, identity helpers, and test setup supplied as source context.
Per the follow-up instruction, no new 11-triplet performance comparison is required: the explicit full-UUID route returns before the changed implicit-landing block. The accepted performance table above remains tied to its original measured head. The message-delivery hold and UUID admission are unchanged by this repair.
Rebase-only validation
The lead approved the previous content at
5ee2d37fa4293184e0ace4695f9304125fe6be27. Rebased onto5684da26ff62d6a5b0e847c67d32fedd74635764; final head is24c08ef6d39ee156b65606adede37557349cd048.route-warm-boot.test.ts: retained main's reduced scenario matrix and abort cleanup, with this PR's"roster"cache-provenance assertion.bootstrap-location.ts: retained agent/default selection after awaited roster hydration and connection revalidation, combining the equivalent saved-agent fix now on main with this PR's ordering; retained main's foreground-scope resynchronization after hello. Explicit-UUID admission and composer/outbox holds are unchanged.The pre-push follow-up rebase was conflict-free;
git range-diffshows all 13 PR patches unchanged by it. No performance rerun: neither conflict changed the explicit-UUID mount path. The accepted measurements above remain evidence for their stated measured revisions.Final-head proof on AWS
c7a.4xlarge, leasecbx_1e23a424733d(run):The
pnpm test ui/src/app/bootstrap.agent-selection.test.ts --maxWorkers=1wall time was 10.395 seconds. The first AWS setup attempt stopped before tests because the image had Node 24.19.0; validation used the current required Node 24.22.1. The lease was released after collecting proof. No merge or deployment performed.Code size and ownership
Application runtime after rebase: +163 LOC (235 additions / 72 deletions), reduced from +272. The difference from the prior +158 accounting comes from the newer base, which already includes the saved-agent hydration fix. The requested production filter (
git diff --stat origin/main...HEAD -- ':!*.test.ts' ':!*test-support*' ':!docs/*') is +177 LOC (268 / 91), 25 files; that filter also includes bench/test helpers. Necessary growth implements scoped UUID admission, authoritative replacement, split hydration, and message-delivery hold/resume. It removes the obsolete per-action policy and shares the snapshot parse between admission and hydration.Files are confined to the chat route/snapshot/send/pane owners, app route verification, and the existing bench/fixture/probe owners plus their regression tests. No server schema, durable record, configuration option, or permission model changes.
Synthetic before / after
The attached 400/800/1100/1500 ms filmstrips use only the synthetic Team-scale fixture. Screenshot capture is illustrative; the untraced measurements above are the performance evidence. No private captures are uploaded.