Repository navigation
perf(control-ui): admit warm full-UUID routes from snapshots - #177153
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
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. |
1d898f5 to
ccd4cb6
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ccd4cb6b43
ℹ️ 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".
| socket.addEventListener( | ||
| "close", | ||
| () => { | ||
| for (const [id, request] of pending) { |
There was a problem hiding this comment.
Drop delayed frames after their socket closes
When a frame is waiting in the artificial latency timer and its socket closes first—especially with --method-latency-ms—this handler deletes the request and records it as abandoned, but the already-scheduled callback still executes dispatch(event). The browser socket adapter keeps its message listener attached, so the application processes a frame from a closed transport while the benchmark reports its RPC as abandoned, contaminating reconnect measurements; cancel or suppress queued deliveries belonging to the closed socket.
Useful? React with 👍 / 👎.
ccd4cb6 to
f29d036
Compare
|
Codex review: needs maintainer review before merge. What this changesThis PR renders matching cached full-UUID conversations before route resolution and extends the benchmark to compare warm-reload paint. Example: Reload /chat/main/b1c2cd3c-1234-4321-9876-123456789abc with a matching scoped snapshot outside the cached roster.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-directed optimization addresses a verified loading waterfall, and no introduced correctness defect was established; exact-head CI remains blocked by an unexplained attachment-menu test failure. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Control UI route loader consumes browser snapshots scoped to the Gateway and account, mounts the selected conversation, and reconciles its identity through the existing Gateway resolver. flowchart TD
A[Full UUID URL] --> B[Route loader]
C[Scoped browser snapshot] --> D[Snapshot validator]
D --> B
B --> E[Cached conversation]
B --> F[Gateway resolver]
F --> E
Technical reviewBest possible solution: Render exact scoped snapshots immediately while retaining the existing snapshot validator and Gateway resolver as the sole owners of validation and authoritative identity. Do we have a high-confidence way to reproduce the issue? The baseline loader waits for network resolution when an exact cached conversation is outside the roster; the inspected baseline screenshot and reported red browser regression corroborate that path. Is this the best way to solve the issue? The implementation removes the route waterfall using existing snapshot and recovery owners, shares validation with the pane, and preserves authoritative replacement without introducing another persistent cache. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0293f8f81385. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +110, Tests +392, Docs 0, Other +166. Total +668 across 28 files. Added test files: 3. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 19, 2026, 5:32 AM ET / 09:32 UTC. |
f29d036 to
5321b21
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5321b21de9
ℹ️ 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".
| agentId: snapshot.agentId, | ||
| ...sessionRouteHints(routeLocation), | ||
| face, | ||
| sessionResolutionFromCache: "snapshot", |
There was a problem hiding this comment.
Gate sends until snapshot routes are revalidated
When sessions.resolve is slow and the cached route refers to a deleted or moved session, this returns a normal session route while revalidation runs asynchronously after commit. Nothing carries the pending validation state into ChatPane, so after chat.startup commits the composer can become enabled; because the Gateway explicitly marks chat.send as mayCreate (src/gateway/session-method-policy.ts:26), sending during this window can create or run against the stale key before the route changes to moved/not-found. Keep writes disabled until the authoritative revalidation succeeds.
AGENTS.md reference: AGENTS.md:L65-L65
Useful? React with 👍 / 👎.
5321b21 to
703a192
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 703a192eea
ℹ️ 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".
| revalidatedCache.add(target.abortController); | ||
| void verifyReconnectedSession(target, false); |
There was a problem hiding this comment.
Retry snapshot validation after transient failures
When the initial sessions.resolve revalidation for a snapshot-admitted full-UUID route rejects while the connection remains up, this controller is recorded in revalidatedCache before the attempt and the error is swallowed below. No successful replacement clears sessionResolutionFromCache, so the composer and stored outboxes remain gated, while subsequent router publications will not retry validation for this controller; the conversation stays read-only until a reload or reconnect. Mark the controller only after authoritative validation succeeds, or remove/schedule it for retry on failure.
AGENTS.md reference: ui/AGENTS.md:L16-L18
Useful? React with 👍 / 👎.
703a192 to
0b249f5
Compare
|
Final proof is updated for @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…ns.resolve (#177760) Revert the runtime part of #177153 (0d95528). It rendered a cached full-UUID chat route from the prewarmed snapshot before sessions.resolve, which won on the bench but regressed live: on Team r170 (Peter's 820-message session, 3 warm reloads) the snapshot-admitted pane mounted in one 157-190 ms task right as the WebSocket connect response arrived, so connect was handled at 619-632 ms instead of 386-425 ms (9 runs on r164-r167) and every post-hello RPC shifted ~230 ms. First rows moved slightly earlier (586-710 vs 655-778 ms), but final rows went 822-998 -> 976-1,161 ms and LoAF blocking 96-131 -> 185-227 ms. Board connect RTT was unchanged, so the cost was client-side. The bench had missed it because its handshake finished before the mount. The fix-forward attempt (mount after hello with a bounded wait, #177759) kept a 152 ms painted-transcript gain but regressed chat final rows +44.6 ms in 9/11 pairs and was rejected by its pre-declared gate, so the pre-declared fallback lands. Benchmark tooling and probes added by #177153 (paint/element timing, per-method latency, short URLs) are kept. Runtime -127 LOC. 286 focused tests, typecheck/lint, 8 warm-boot tests, full UI 831 files (remaining Crabline permission failure reproduces on main); exact-head CI green.
….resolve (openclaw#177153) On a warm reload of a chat link for a session that isn't in the cached sidebar roster, the route loader waited for sessions.resolve before mounting the pane, so the cached transcript appeared roughly 280 ms after the shell. Live on Team (Peter's 820-message session, r164) resolve returned at ~608 ms and cached rows followed at 677-689 ms while FCP was ~405 ms. When the link carries a full session UUID (32 hex, no prefix ambiguity), admit the route from the already-prewarmed conversation snapshot whose key has exactly that UUID and agent, under the snapshot owner's existing account/host scope key (re-checked after the read, together with the connection revision). Render the cached rows immediately; sessions.resolve stays authoritative: the router revalidates snapshot-admitted routes once after hello, and a deleted, moved or mismatched session is replaced exactly like a roster-admitted route. Sends and restored queued sends are held (draft kept) until the route is confirmed. Short-prefix, slug-only and ambiguous links are unchanged. No new store, persisted field or cache scope. Evidence (AWS c7a.4xlarge, 11 interleaved triplets per face, element-timing paint of the first transcript row): painted transcript chat 656 -> 384 ms, dashboard 636 -> 356 ms (11/11 each). Pre-declared accepted tradeoff: FCP +72 / +48 ms because the first paint now contains the transcript (allowed up to +100 ms when transcript paint improves >= 150 ms). A shell-first one-frame-yield variant failed qualification. Final rows and LoAF blocking improve; RPC counts unchanged; 7-pair board control passes. Runtime +128 LOC. Full UI 835 files / 3,613 tests; focused regressions for same/deleted/moved authority, held sends, reconnect during admission and router revalidation; exact-head CI green.
…ns.resolve (openclaw#177760) Revert the runtime part of openclaw#177153 (6d343c3). It rendered a cached full-UUID chat route from the prewarmed snapshot before sessions.resolve, which won on the bench but regressed live: on Team r170 (Peter's 820-message session, 3 warm reloads) the snapshot-admitted pane mounted in one 157-190 ms task right as the WebSocket connect response arrived, so connect was handled at 619-632 ms instead of 386-425 ms (9 runs on r164-r167) and every post-hello RPC shifted ~230 ms. First rows moved slightly earlier (586-710 vs 655-778 ms), but final rows went 822-998 -> 976-1,161 ms and LoAF blocking 96-131 -> 185-227 ms. Board connect RTT was unchanged, so the cost was client-side. The bench had missed it because its handshake finished before the mount. The fix-forward attempt (mount after hello with a bounded wait, openclaw#177759) kept a 152 ms painted-transcript gain but regressed chat final rows +44.6 ms in 9/11 pairs and was rejected by its pre-declared gate, so the pre-declared fallback lands. Benchmark tooling and probes added by openclaw#177153 (paint/element timing, per-method latency, short URLs) are kept. Runtime -127 LOC. 286 focused tests, typecheck/lint, 8 warm-boot tests, full UI 831 files (remaining Crabline permission failure reproduces on main); exact-head CI green.
….resolve, off the hello window (#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 (#177153) rendered the cached transcript first but its single mount landed on the WebSocket connect response and was reverted (#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.
….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
A warm reload of an off-roster full-UUID chat deep link waits for
sessions.resolvebefore mounting its cached conversation. The existing host/account/profile-scoped conversation snapshot already identifies that exact UUID and agent, but the operator sees a shell-to-transcript waterfall.Selected B: immediate snapshot admission. On the final head, B improved transcript-visible paint in 11/11 pairs on both faces: chat 656→384 ms, median paired delta −268 ms; dashboard 636→356 ms, paired −276 ms. FCP median increased 72 ms and 48 ms (paired +72 and +52), within the lead's accepted tradeoff. The first LCP was transcript text in all 22 B reloads; A's first LCP was the shell in all 22.
C (one animation frame followed by a task before admission) does not qualify: chat misses the accepted FCP tradeoff, and dashboard misses the primary gate and FCP tradeoff. C's transcript paint is 246 ms slower than B by paired median. B passes final rows, LoAF blocking, RPC count, and the seven-pair exact-key dashboard control. Board-control FCP rises 4 ms with overlapping IQRs and mixed signs (4 worse, 3 better); the declared no-regression rule treats that as noise.
Change and isolation
Implement the lead's design: admit only a complete UUID (32 hex digits, dashes optional), with the route's exact agent, from the already-started scoped conversation snapshot. Reuse the snapshot owner's validation and the same validated promise for route binding and pane hydration. No new store, persisted field, scope, product setting, or server schema.
Record whether route admission came from the roster or snapshot. Only snapshot admission gets the new automatic revalidation; existing roster and pending-session navigation keep their discovery lifecycle. Keep
sessions.resolveauthoritative: retain the same key, replace a moved key, or show not-found and remove cached rows. Prefix and slug-only URLs retain their existing behavior; ambiguous-prefix handling is unchanged.chat.startupfollows the earlier pane mount. Keep the full input URL until authoritative canonicalization, and retain the validated navigation handoff so canonical navigation sends one resolver request.Until snapshot-route revalidation settles, the composer remains editable but sending and stored outbox delivery are held by the existing send-admission owner. Empty startup history cannot recreate a deleted or moved cached key. The hold clears on same-key confirmation; replacement routes retain the old pane's hold.
A leaf type module keeps the snapshot contract out of the runtime import cycle. The superseded duplicate record-validation path is removed. Tests cover foreign host/account snapshots, agent/UUID mismatch, prefixes/slugs, deleted and moved sessions, and reconnect during admission; native browser scenarios exercise cached rows before resolution and their removal/replacement afterward.
Bench-only instrumentation tags direct transcript text owners before paint and observes Element Timing renderTime plus LCP time/element identity. It adds no production attribute. RPC accounting retains abandoned attempts from closed sockets without preventing benchmark settlement.
Evidence and predeclared decision
The campaign's EVIDENCE.md records 14 visual states over about 15 seconds, with dashboard content first at 11.75 seconds. In the later signed-in warm dashboard deep-link capture, FCP was about 405 ms, resolve returned at 608 ms, cached rows appeared at 677–689 ms, startup was sent at 673 ms, and final rows appeared at 865–888 ms. These timings identify the resolver-to-pane dependency addressed here; no private capture content is included.
Final common main baseline: 17bef10. Candidate: 0b249f5. The base includes L150/#176696 and L152/#177017. B retains immediate snapshot admission; C adds only the temporary three-line frame/task yield. The final run rebuilds A from main runtime sources and B/C from this candidate, retaining common benchmark instrumentation.
Quiet AWS c7a.4xlarge, 16 CPUs, AMD EPYC 9R14; repository headless Playwright Chromium. Eleven continuous A/B/C triplets per face, same browser per face, identical warm storage restored before every reload. General wire latency 20 ms; resolve/describe latency minimum 195 ms. All samples retained. Same untraced LoAF/RPC probes for all variants. Seven A/B control pairs use a normal exact-key dashboard URL, bypassing UUID admission. Board readiness is a sandbox resource-load milestone, not a presentation timestamp.
Rule declared before measurement:
Times are milliseconds; RPC attempts are counts. Quartiles use the inclusive method.
All eleven paired deltas, variant minus A
chat B
chat C
dashboard B
dashboard C
LCP corroboration
Exact-key dashboard control (seven pairs)
Per-pair control deltas:
Decision:
{"qualified": ["B"], "selected": "B", "boardCandidate": "B", "medianPairedCMinusB": 246.0, "cMinusB": [168, 168, 172, 168, 172, 244, 248, 264, 244, 256, 276, 348, 268, 260, 168, 160, 264, 164, 48, 288, 288, 288], "boardPass": true}.Validation
Final-head performance gates pass on AWS c7a.4xlarge lease
cbx_9168455f3ae9(run). Exact-head CI run 39270828753 is green for0b249f56ca0aa39748157ec966f0473930b0100e.Focused route/snapshot/consumer tests, import-cycle checks, all 17 changed test files individually, and the 19-test native group pass. The full UI e2e suite passes: 835 files / 3,613 tests, four existing skips, no failures (
--maxWorkers=2, 5,475 seconds). This includes warm reload, session switching, deleted-session routes, pending session creation, auth/reconnect, boot module boundaries, and real-Gateway chat loading. No full-suite waiver was used. Existing opt-in skips:desktop-resize.real-gateway,peer-followup-restart.real-gateway,chat-steer-deferred-custody.real-gateway, anddeepseek-search.real-gateway.The chat boot JS check passes against the main baseline, which includes L150/#176696: 1,447,520→1,448,295 B gzip (+775 B), 24 requests unchanged, 51,705 B headroom. New Session: 1,005,108→1,005,464 B (+356 B), 19 requests unchanged, 44,536 B headroom. CSS is unchanged. The changed-file check passes core/UI/scripts types, formatting, lint, import/controller guards, and dead exports; only the max-lines suppression ratchet and core test-root budget fail. Both failures reproduce unchanged on pinned main: existing max-lines suppressions in
chat-message.test.tsx,config-page-state.ts, andsessions-page-state.ts; core test-root counts are gateway 724 and plugins/platform 725 against 720. These are inherited, not failures introduced by this diff.Per-file test wall time (one worker, AWS)
Each unit/browser file ran as
pnpm test <file> --maxWorkers=1; the native file usednode scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts <file> --maxWorkers=1.Paths are under
ui/src/; suffixes are.test.ts, with.e2e.test.tsfor the native file.The write-readiness repair has a red/green regression: the old head enables Send during held route resolution in all three same/deleted/moved scenarios; the patched native suite passes all six snapshot-route scenarios. A focused test also proves stored outbox hold/resume after startup.
The broad prior-head sweep caught an introduced pending-session regression. Automatic revalidation was too broad: a roster-admitted Incognito creation could be revalidated while its startup was still pending. The final repair distinguishes roster from snapshot admission, restores the existing roster lifecycle, and removes the superseded navigation workaround. The added lifecycle regression fails before the repair; 44 focused tests and all 8 cloud-startup cases pass afterward.
The baseline native browser regression fails at the missing cached-text wait while resolution is held. The Element Timing browser regression proves opacity-hidden nested text does not count until shown. Autoreview is clean through P2 on the final committed head.
Automated-review clarification: the existing delayed-delivery behavior does not let retired transport frames mutate the application. The shared protocol client's message handler rejects an inactive socket/generation or aborted connection before parsing. The queued callback can still reach the browser adapter, but application frame processing stops at that guard. The close hook retires pending probe accounting; no extra transport policy was added.
Prior-head red/green validation used lease
cbx_74f7477e962d, now released. The later leasecbx_16171d806e67was also released when main introduced a benchmark conflict; the final comparison and validation used the fresh lease linked above. All owned leases are now released. No merge requested. This supersedes closed experiment #177101, which GitHub would not reopen after the branch rewrite.Size
Requested non-test/non-doc stat: 393 insertions, 60 deletions; net +333 LOC across 23 files. Application runtime: +128 LOC; benchmark/probe tooling: +205 LOC; tests: +477 LOC; docs: 0. Growth implements exact-identity/scope admission, authoritative after-hello replacement, pending-route send admission, and reproducible paint measurement. The duplicate snapshot read/validation path is removed, and route/pane reuse the validated snapshot promise.
Reproduction
Build A from the pinned main, B from this branch, and C from B with the following temporary insertion immediately after
readPrewarmedChatSnapshot(...)infindSnapshotSessionReference:Then run with the three prebuilt directories and the campaign's common probes:
Repeat with
--face dashboard. The seven-pair control uses--runs 14 --face dashboard, omits--full-uuid-route, and compares only A and B. Each invocation prewarms the supplied bundles, then restores identical saved IndexedDB/localStorage state before every reload.The paired images below use the pinned main bundle and final candidate with the same synthetic conversation and held route resolution.