Repository navigation
perf(sessions): stop Control UI list refresh bursts - #164764
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: blocked before merge. Reviewed October 4, 2026, 3:41 AM ET / 07:41 UTC (Revision 8). ClawSweeper reviewWhat this changesThe PR reduces Control UI session-list traffic through compact rows, shared dashboard pagination, certified event updates, on-demand details, and bounded caller diagnostics. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 3 items remain The performance improvement remains useful beyond current main, but the previously reported compact-row context-budget regression still blocks merge. The available runtime evidence supports the traffic reduction. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI receives session lists and change events from the Gateway. Its shared session owner maintains list membership and row facts for the sidebar, dashboards, activity views, and session management. flowchart TD
A[Gateway session state] --> B[Compact lists and row events]
B --> C[Shared session owner]
C --> D{Membership established?}
D -->|Yes| E[Update held rows]
D -->|No| F[Paced authoritative refresh]
E --> G[Control UI views]
F --> G
G --> H[Full details on expansion]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +240, Tests +529, Docs +40. Total +809 across 62 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Keep compact lists and shared refresh ownership while carrying the Gateway-validated budget fact needed by collapsed meters. Do we have a high-confidence way to reproduce the issue? Yes, from source: load a fresh collapsed compact row with 160,000 used tokens, a validated 180,000 prompt budget, and a 200,000 cap. The omitted budget makes the meter show 80% warning instead of 89% danger; this review did not execute that path. Is this the best way to solve the issue? No, not completely: shared pagination and event reconciliation fit the existing owners, but compact presentation must preserve facts consumed by collapsed views. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3e8edffc4313. LabelsLabel changes: No label changes. Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
|
Pull request was converted to draft
Use compact attributed UI list requests, retain managed dashboard pages, and reconcile certified row, board, child-owner, and unchanged count-facet facts before a minute fallback. Read expanded settings and chat command details through the existing descriptor owner. Preserve full native rows and authoritative refreshes for uncertain membership.
f175d1b to
869c477
Compare
* perf(sessions): avoid Control UI list refresh bursts Use compact attributed UI list requests, retain managed dashboard pages, and reconcile certified row, board, child-owner, and unchanged count-facet facts before a minute fallback. Read expanded settings and chat command details through the existing descriptor owner. Preserve full native rows and authoritative refreshes for uncertain membership. * fix(sessions): normalize missing observer agent context * fix(sessions): initialize the detail observation binding * fix(sessions): preserve warm roster cache with compact queries
What Problem This Solves
Control UI session lists still sent full rows, and dashboard snapshot notifications restarted pagination. Slow/large responses did not identify which UI caller requested them.
User Impact
List views use compact rows and apply certified row updates without list refetches. Loaded dashboard pages stay with the managed list owner. Expanded settings and chat commands read exact session descriptors. Native clients retain the full-row default.
Slow and >=200 KiB
sessions.listjournal lines include bounded caller source, compact/full mode, limit, offset, and filter names. Filter text and identities are not logged; metric labels are unchanged.Why This Change Was Made
The shared request builder still defaulted to full rows, including connection bootstrap. Disabled title/preview enrichment unnecessarily prevented the Sessions page from applying row events. The gallery kept a second paging loop outside its managed window. Child lists and the sidebar count facet also refreshed unchanged data.
The existing session capability owns list membership, request coalescing, and row provenance. Gallery pagination now extends that window. Prepared
hasBoardandchildOwnerSessionKeysreceipts certify filtered membership; child ownership uses the Gateway's existing time-aware retention resolver and invalidates frozen presentations when owners expire. Count facets retain their aggregate only when admitted old/new facts prove unchanged contributions. Unknown membership, ownership/running/sharing/archive changes, incomplete ancestry, and overlapping reads retain authoritative refreshes. Healthy traffic uses the shared >=60 s fallback.Changed callers: sidebar/bootstrap/children/counts, dashboard gallery and progress widgets, Activity, Sessions page, agent roster, chat commands, command palette, and Skill Workshop. Diagnostic source is excluded from query identity, so caller attribution does not fragment coalescing.
Production LOC: +252 net (502 additions, 250 deletions) using the requested exclusions (including 10 lines of scoped instructions and 2 test-helper assertion lines). Growth is required for permanent diagnostics, explicit board/child membership receipts and conservative event admission, and lifecycle-safe descriptor hydration after compact rows omit detail fields. The independent gallery pager, broad chat-command list/alias/cache lookup, and Activity's duplicate timer were removed. The existing v1 warm-roster cache retains only membership fields in its persisted query; wire-only source and row mode are omitted before its unchanged strict validation. No new configuration, dependency, persistent cache, or storage schema.
Evidence
UI/Gateway validation is green; CI is blocked by one unchanged native test fixture. Current-head CI on
869c477b2742d28a9afe6726e6fa00c012c882cdfinished with 76 successful jobs, 13 intentional skips, and one root failure plus the derived CI-gate failure. All three UI unit shards, six mocked UI E2E shards, both real-Gateway shards, bundled protocol, types, builds, and every separate workflow passed. Testbox focused tests and the complete changed-file gate also passed.The sole blocker is macos-swift packages: among 2,259 tests,
ChatViewModelTests/history retry backoff does not retain an abandoned presentationtimed out atChatViewModelTests.swift:9715–9718while waiting for its initial fixture bootstrap (27.208 s against the helper's 15 s polling budget). It never reached the abandonment behavior under test and usesTestChatTransport, not the Gateway.apps/sharedis unchanged between the tested basef28801628446and this PR. Current main was checked and still has this polling site. The native owner has an existingloadAndWaitBootstraphelper at line 457 that joinsbootstrapTask; that is the next correction to validate. Native sources were not edited and the failed job was not blindly rerun, preserving this lane's explicit UI/Gateway boundary. The first full CI run exposed a real warm-roster cache admission regression and stale exact-request expectations. Both are repaired and independently reviewed on869c477b2742d28a9afe6726e6fa00c012c882cd; the focused cache, warm-boot, and caller replays passed. Its unrelated inherited MCP test-type failure was fixed upstream by #164795 and integrated by rebasing ontof28801628446a76a77fc856b01c87464fe7701a4. All 62 task-file blobs are identical across that rebase, with only four lane commits above main.The real browser rig uses synthetic state, a dist Gateway and built Control UI, 501 sessions, 201 persisted dashboards, one tab across chat/dashboard/Sessions/Agents/Activity for five minutes, then five minutes of steady Agents traffic. It sends two actual
sessions.patchupdates per second and counts actual WebSocket response bytes. Routes are mutually exclusive; the sidebar and retained views share the connection. Before caller tags existed, classification uses recorded request shapes and is marked inferred. Fresh identical seeding after each build prevents the one-hour child-retention boundary from confounding the comparison. Latency speedups are not claimed on the shared rig.Five-minute steady observation: 118 → 49 list calls (58.47% fewer) and 12,743,848 → 5,966,638 response bytes (53.18% fewer), with 600 successful row updates in each window.
KB is decimal. The new minute recovery path increases roster/primary/child reads, including five pages for the synthetic 500-child parent; those bytes are included in the totals. During the respective 60-second mounted-route windows, gallery reads fell 142 → 0 (2,602,944 → 0 B), Sessions-page reads 11 → 0 (1,036,728 → 0 B), and chat-child reads 12 → 0 (9,744 → 0 B). All 110 automatic candidate list requests across the campaign used compact rows and bounded source tags.
The controlled 200-row probe shrank 335,497 → 239,081 bytes (28.74%). Candidate full rows are 347,481 B after membership receipts; compact removes 108,400 B of detail metadata at the same scope.
Mechanism evidence: the original gallery issued 133 tail-page and 11 first-page reads in a minute, up to four calls in one second. A 200-row full response measured 335,497 bytes. An initial three-page full agent-roster burst was reproduced; the production recurrence frequency was not reproduced and is not claimed.
Validation:
tbx_01m42sxksbkhbafj60yj5tg37q,blacksmith-testbox/openclaw-check): 305 tests in 6 files passed, Vitest 30.97 s / wrapper 31.75 s; full command including frozen installation 55.81 s. The complete changed-file gate passed in 23m 6.115s, including all 27 core test-type projects, core/UI types, formatting, lint, exports, and all guards. The 4-file E2E replay passed all 13 tests, Vitest 109.28 s / command including preparation 167.48 s. This covers the cache round trip, terminal-event state, sidebar/Activity/plugin callers, warm reload, dashboard demand, Sessions filtering, and real-Gateway command-palette search.node scripts/run-vitest.mjs <named files> --maxWorkers=1(thepnpm testowner); these are wall/CI execution seconds, excluding lease transfer/build setup.f175d1b73435): passed, exit 0, on the Linux rig usingnode scripts/check-changed.mjs --staged --timedafter the authorized queue fallback. All 52 then-changed file blobs matched headf175d1b73435644e5e30bd83ec0d03ceb27fbc76. Core/UI types, all 27 core test-type projects, formatting, ratchets, export scans, lint, styles, import cycles, and remaining guards passed. Earlier runs caught an optional agent ID passed to a nullable helper and a deferred observation handle flagged byprefer-const; both now use explicit nullish state, with independent review. The existing main fix for the ratchet reader'sENOBUFSwas integrated by rebase. No baselines, rules, or expected failures were relaxed.Blacksmith Testbox provider/profile:
blacksmith-testbox/openclaw-check. Original leasestbx_01m42cxtw73ma74s2k47jsm51kandtbx_01m42f1ykk8w40xkcfmq4gfpteare stopped. Replacement leasetbx_01m42hngnjavgdgkn9mn8zyb2tremained queued for about an hour and was stopped after the authorized rig fallback passed the remaining real-Gateway replay. Commands: focusednode scripts/run-vitest.mjs ... --maxWorkers=1,pnpm protocol:check, andnode scripts/check-changed.mjsagainst the pinned task base. The first lease compared with stale localmain; selecting the published lane ref reduced sync from 26,055 files / ~2 min to 47–52 files / 9–12 s.Reviewed source was based on
07e28778a9b451a34e157680153fd5af7479877a; head0fc7ac46bc095fde339f5003616c4fd98d69d118was rebased on8a0b0c458bbdac520a8f99b4735144722f698be7. Every changed file was byte-identical across that rebase. The real-Gateway replay includes the absent-agent normalization (7e383c949281e1db72aedc40dec721f5646bbdda). Headf175d1b73435644e5e30bd83ec0d03ceb27fbc76additionally initializes the private observation handle explicitly; optional-chain behavior and request/event logic are unchanged. Its complete patch hash matches the staged patch used by the final gate. The subsequent cache repair adds the fourth task commit, with its current-head validation described above. Production deployment/attribution remains outside this PR's proof. The client wasopenclaw-control-ui webchat; no native client was involved in this reproduction.Limitations: synthetic single-tab Linux proof, no production rollout. The controlled comparison builds exited 0 with startup-JS warnings at 366.0 → 366.7 KiB against a 364.7 KiB target. After rebasing, the current Testbox build passes that budget at 364.6 KiB (373,342 B; limit 373,454 B). Its CSS is above the advisory target at 49.4 KiB but below the 50 KiB hard ceiling (610 B headroom). Synthetic dashboard iframes logged sandbox service-worker access denials (26 before / 20 after), with no mutation errors. The rig was shared, so no CPU or latency improvement is claimed.
Final Linux rig replay command (isolated state, runtime build, and Chromium under the task worktree;
nice -n 10 ionice -c3):The steady RPC measurement uses one fresh browser context and one initial navigation, followed entirely by SPA navigation. The cache correction only changes the copied record sent to IndexedDB; writes neither publish live roster state nor trigger Gateway requests, and hydration cannot replace connected live state. The saved connected-RPC measurements remain tied to their measured revision; they do not prove warm-start persistence or measure IndexedDB CPU/timer effects.
Final Testbox lease:
tbx_01m42sxksbkhbafj60yj5tg37q(blacksmith-testbox,openclaw-check), pinned to the current lane ref, stopped after proof and verified absent. All task-owned rig processes and remote worktrees are cleaned up. Earlier repair leasetbx_01m42s6nf34ny6pc9h8w0qjz3ewas stopped when rebasing changed the base/head, before any command ran.Current-head focused replay commands and browser costs
On
tbx_01m42sxksbkhbafj60yj5tg37q, after verifying HEAD869c477b2742d28a9afe6726e6fa00c012c882cd:These existing flows exercise browser storage and profile isolation, visible retained-error rows, query stability, and per-tab demand. The repair adds no Gateway boots, polling loops, or timing waits. The dashboard file crosses 30 s because it exercises four real browser recovery/demand scenarios; owner-level unit tests cannot establish the rendered error/recovery and tab lifecycle contract.
Current-head complete Testbox gate
Provider
blacksmith-testbox, leasetbx_01m42sxksbkhbafj60yj5tg37q, HEAD869c477b2742d28a9afe6726e6fa00c012c882cd; exit 0.