Skip to content

perf(control-ui): reduce sidebar work during live session updates - #176453

Merged
steipete merged 5 commits into
mainfrom
steipete/coldload-sidebar-projection-owner
Oct 19, 2026
Merged

steipete merged 5 commits into
mainfrom
steipete/coldload-sidebar-projection-owner

Conversation

@steipete

@steipete steipete commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Reduces sidebar work while live session events arrive after a signed-in dashboard deep-link reload. The campaign's original reload trace had 14 visible states over roughly 15 seconds; this lane addresses the shared sidebar projection hot path and repairs the stale benchmark readiness selector so the replay actually runs on the current UI.

User Impact

The sidebar keeps its existing grouping, nesting, expansion, Home, pinning, and snooze behavior while spending less main-thread time on unchanged rows. No configuration, server schema, or durable stored-shape changes.

Why This Change Was Made

The four consumers already share navigation, row, section, and Home memos. A session publication invalidates navigation and repeats formatting for every row even when most raw row identities are unchanged. A sidebar-owned WeakMap now retains that formatting, with separate root/child slots and explicit inputs for context, default agent, viewer, locale, selection, visual run state, prepared work, PRs, outbox/drafts, attention, status notes, and child loading. Membership, parentage, active-parent folding, expansion, and Home visibility remain with the existing tree owner.

The former standalone runtime timestamp map moves into this row-lifetime owner. Memo primitives live in a leaf module so navigation never imports the projection pipeline to obtain its cache type. The change deliberately retains broad session revision invalidation: dropping it would miss external prepared-work, PR, and lifecycle facts.

Evidence

Eleven interleaved baseline/candidate pairs on one quiet AWS c7a.4xlarge lease (observed 16 vCPU AMD EPYC 9R14), using the Team-scale fixture and repository Chromium. Each unprofiled run delivered all 240 live events. Baseline/candidate order alternated per pair; both used immutable production bundles on base 944eba49f398480d2776f3698a7605f719dcc6bf. The projection patch rebased without conflicts; final-head functional validation is listed below.

Metric Baseline median [IQR] Candidate median [IQR]
Scripting ms/event 11.338 [11.315, 11.386] 10.559 [10.515, 10.659]
Live scripting total ms 2721.0 [2715.5, 2732.8] 2534.1 [2523.7, 2558.2]
Reload LoAF blocking ms 509.0 [489.0, 568.5] 592.0 [509.5, 637.0]
FCP ms 388.0 [366.0, 390.0] 388.0 [364.0, 390.0]

Primary gate passes: 6.87% less scripting/event, non-overlapping IQRs, better in 11/11 pairs, median paired delta −0.827 ms/event. Reload blocking has a higher candidate median, overlapping IQRs, and mixed pair signs (7 worse, 4 better), so it does not meet the campaign's secondary regression threshold of non-overlapping IQRs or ≥9/11 worse pairs plus the magnitude threshold. Live RPCs were zero throughout; reload RPC counts had median 86 in both variants (range 56–86).

Pair Baseline ms/event Candidate ms/event Paired delta Reload blocking delta ms
1 11.159 10.660 −0.499 +82
2 11.455 10.559 −0.896 +81
3 11.350 10.475 −0.875 +40
4 11.332 10.658 −0.674 −1
5 11.310 10.613 −0.697 +176
6 11.300 10.662 −0.638 −131
7 11.443 10.712 −0.731 +132
8 11.319 10.435 −0.884 −38
9 11.383 10.547 −0.836 −49
10 11.338 10.511 −0.827 +1
11 11.390 10.519 −0.870 +160

Separate sampled CPU profiles reproduce the live hot path: the baseline spends 571.4 ms, or 12.9% of aggregated samples, in projectSidebarAgentSessionRows before measuring the fix. These timings are inflated by profiling and are attribution evidence, not acceptance measurements. The candidate used --cpu-profile-compare.

Function, inclusive ms Baseline Candidate
projectSidebarAgentSessionRows 571.435 471.026
projectSessionTree 436.908 305.067
projectSidebarHomeSession 150.252 122.807
toSidebarSession (navigation owner) 357.077 151.907
visibleSessionRowsInOrder 1086.063 967.968
synchronizePresentedSessions 1042.986 926.526
childSessionParents (navigation owner) 1024.952 919.102
selectedAgentSessionRows 624.615 519.375

AWS lease cbx_a729a7ce7686: baseline profile, candidate profile, 11 pairs.

Behavior and checks

  • Regression is red before the fix: changing only the second accepted row unnecessarily formats the unchanged first row. Green after the fix.
  • Final-head focused tests: 203 pass across six files (memo 14, navigation logic 31, tree 3, section projection 13, sidebar sessions 112, rail 30). pnpm test <file> --maxWorkers=1 wall times on AWS: 9.01 s, 4.21 s, 3.73 s, 3.94 s, 16.34 s, 7.49 s respectively. The added memo regression failed on old behavior in 18.98 s.
  • Detached Codex autoreview: clean through P2.
  • Repair validation on AWS cbx_35da83a727b3: run. Madge: zero cycles. Team-scale e2e: pass, including paged roster, pins, plugins, inline widgets, cache restoration, and reload (52.09 s runner duration). The readiness check now uses the header common to chip and roster modes; agent-named headers only exist in roster mode.
  • Final head: ea2306bf4a91440291c3b10e1e381087595f6686. Four existing test fixtures now publish replacement rows for edited facts, preserving all assertions and unchanged row identities. They pass in the final-head focused run. This test-only repair is clean through P2.
  • Exact-head CI: all three UI unit-test shards and the repaired core-lint job pass. The bundle-size job has an inherited failure: its own base build is 1,490,230 B against the 1,490,000 B chat boot limit; candidate is 1,490,435 B (+205 B). Main has the same violation: run 39168070659 / job 117795289336 reports 1,494,544 B against the same 1,490,000 B limit. All other CI jobs completed successfully or were skipped; the aggregate CI gate fails on that size violation.
  • Full UI e2e completed on the exact head on AWS cbx_569628be8acf, run: 827 files passed, 3 failed, 3 skipped; 3,586 tests passed, 1 failed, 7 skipped, in 6,033.62 s. The failures are setup-related: Workboard native bundle and tooltip activation need WebKit, and the automation-management fixture rejects a group-writable artifact ancestor. Setup-corrected focused replays now pass: Workboard + tooltip in Chromium/WebKit, 4 tests, and automation management, 2 tests. WebKit was installed and the automation artifact directory stayed inside the checkout under non-writable ancestors. The first automation replay reached cleanup but used an artifact path outside the checkout; its corrected replay passes. Combined coverage: 830 files / 3,591 tests passed, 3 files / 3 tests skipped, no unresolved e2e failures. This is a full invocation plus focused setup repairs, not a second all-green full invocation.
  • Existing skipped files: chat-steer-deferred-custody.real-gateway, deepseek-search.real-gateway, and desktop-resize.real-gateway (one test each).
  • Required native coverage passes: native session sidebar (3 tests), child expansion (3), roster (3), Home attention (1), pin priority (1), custom snooze (2), and Team-scale cold load (1).
  • node scripts/check-changed.mjs completed: all core-test, UI, and script typechecks, changed-file lint/format, i18n, controller, and SQLite guards pass. Overall result is red on repository-wide findings outside this diff: three unlisted max-lines suppressions, plugins-platform with 723 test roots against 720, and the existing unused-export list. All 41 reported files/configuration owners inspected are byte-identical to the PR base; the script unused-export scan passes. No exception or baseline was changed.

Reload-only follow-up (coordinator gate)

Both routes pass the fixed reload-blocking gate. Board has a higher candidate median and is worse in 8/11 pairs; its IQRs overlap by only 0.5 ms. Warm chat improves at the median and is worse in 5/11 pairs. Neither route has non-overlapping worse blocking IQRs or ≥9/11 worse pairs. This is acceptance under that fixed rule, not a claim that board reload improved.

One fresh quiet AWS c7a.4xlarge lease, cbx_0df288ff9a14 (observed 16 vCPU AMD EPYC 9R14, about 31 GiB RAM); completed run. Eleven interleaved pairs per route, variant order alternated per pair, route order alternated across pairs. One immutable baseline bundle and one candidate bundle were built before timing. Both use base 4392036843f6cc6f53df2d1a0aaa64afb030c87c with the same faithful fixture/harness; only the sidebar runtime change differs. Candidate runtime is the published head ea2306bf4a91440291c3b10e1e381087595f6686. No live replay or active-run churn is enabled; every measured reload delivered the normal 18 boot events and restored the same 80-message bounded snapshot from the 240-message fixture. Repository Chromium, 1719×1179, 35 ms inbound latency / 4 ms minimum wire spacing. Lifecycle wrappers and timeline tracing are disabled for all timing runs; the canonical LoAF/mutation and RPC probes remain enabled. The temporary benchmark copy changes only route selection, dashboard-specific readiness, wrapper settings, and provenance. Screenshots confirm the board and chat routes render their distinct intended layouts. The temporary harness is retained with the local report; no tracked benchmark or production edit was needed.

Route / metric Baseline median [IQR], ms Candidate median [IQR], ms Median paired delta Worse pairs
Board: LoAF blocking 189 [182, 207.5] 210 [207, 214] +19 8/11
Board: FCP 392 [390, 402] 408 [400, 408] +16 7/11
Warm chat: LoAF blocking 237 [196, 240.5] 225 [179, 229.5] -12 5/11
Warm chat: FCP 284 [280, 420] 424 [286, 484] +8 8/11

FCP is reported separately from the fixed blocking gate. Warm-chat FCP has a +140 ms difference of medians and a +8 ms median paired delta, with wide overlapping IQRs and 8/11 worse pairs. Board FCP has one tied pair. The full distributions are retained rather than reduced to a no-regression claim.

Pair Board blocking Δ, ms Board FCP Δ, ms Warm chat blocking Δ, ms Warm chat FCP Δ, ms
1 +25 +16 +6 +8
2 -35 +124 -12 +12
3 -15 -100 -12 +8
4 +7 +16 -84 +144
5 +46 -104 +13 -4
6 +27 +0 +7 -4
7 +41 +16 +48 -132
8 +17 +8 -50 +148
9 -16 -116 +73 +120
10 +29 +120 -22 +8
11 +19 +24 -83 +144

Separate reload-only --cpu-profile-compare captures use three profiled reloads per variant per route on the same lease. These timings include profiler overhead and are attribution, not acceptance measurements. No live phase exists in these profiles. Moved functions are matched by source owner/name so the memo extraction does not count as new work. Inclusive functions nest and must not be summed.

Reload CPU attribution, ms Board baseline Board candidate Chat baseline Chat candidate
Agent/session projection, inclusive 24.955 19.293 23.862 19.081
Tree projection, inclusive 19.558 14.612 20.762 14.524
Home projection, inclusive 4.690 3.566 4.071 3.880
Navigation row formatting, inclusive 30.142 11.811 28.050 13.376
Navigation + old/new memo owners, total self (median per run) 22.966 23.237 25.196 19.661
New retained-slot owner, self (median per run) — 0.000 — 0.388

The candidate slot-owner self samples are board [0, 1.061, 0] ms and chat [0, 0.388, 1.387] ms. A zero sample means below resolution, not zero allocation cost. The slot-owner inclusive medians are 4.576 ms on board and 3.929 ms on chat, including work it calls. The row owner adds about 0.27 ms self at the board median and falls about 5.54 ms on chat; these captures do not attribute the board’s +21 ms blocking median to slot construction. No lazy-build change was attempted because both routes passed the fixed gate.

RPC counts vary across runs: board request medians are 83/83 and chat 57/57; per-pair RPC median delta is zero for both. All 44 timing runs have no live replay and pass route/content readiness. Host load before each run was 1.05–2.98 on 16 vCPU. The initial temporary-harness attempt completed the baseline profile but failed writing summary metadata; it produced no accepted timing pairs and was rerun into a fresh directory.

The published source remains unchanged; CI run 39172147593 is on this exact head. Its only substantive red remains the inherited chat boot-size limit (base 1,490,230 B > 1,490,000 B; candidate 1,490,435 B), as documented above. The PR stays ready; lead owns merge. The measurement lease is released after artifact collection.

Size and ownership

Application runtime delta: +65 LOC. The explicit dynamic-input contract and retained root/child slots require growth; the old timestamp map/plumbing is replaced. Benchmark instrumentation/readiness adds +11 LOC, benchmark documentation +4: +105 with the campaign's exact filter, which also includes +25 lines of test-fixture helpers. Application runtime remains +65. No second tree owner or Solid store rewrite. All AWS leases used for measurement and validation have been released.

Synthetic before/after

Captured from the synthetic Team-scale fixture during replay. The transcript position differs with capture timing; sidebar layout and behavior are unchanged. No private Team capture is included.

Before:

Synthetic sidebar before row projection reuse

After:

Synthetic sidebar after row projection reuse

@clawsweeper

clawsweeper Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui scripts Repository scripts size: XS labels Oct 18, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 18, 2026
@clawsweeper

clawsweeper Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR reuses unchanged sidebar row formatting during live updates and repairs the cold-load benchmark readiness checks.

Example: A 300-session dashboard receives 240 live events.

  • Before: The reported baseline median is 11.338 ms of scripting per event.
  • After: The candidate median is 10.559 ms per event, with unchanged sidebar presentation.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, justified optimization with production-browser evidence, explicit invalidation, and no actionable findings; the inherited CI gate remains a landing concern.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Production Chromium bundles exercised the changed sidebar owner during 240-event synthetic replay across eleven paired comparisons; inspected before/after captures and reported final-head browser results support preserved presentation and completed reload assertions.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Live session updates repeat formatting for unchanged sidebar rows and consume avoidable main-thread time.
Reason: The maintainer-authored direction is supported by consistent paired measurements, with no new configuration, persistent format, or competing projection owner.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-directed optimization has measured value, preserves the existing projection ownership, and introduces no actionable defect found in this review.

Priority: P3
Reviewed head: ea2306bf4a91440291c3b10e1e381087595f6686

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway session publications enter the Control UI session owners; sidebar navigation formats their rows before the existing tree and section projections produce visible navigation.

flowchart LR
  A[Gateway session events] --> B[Session publication owners]
  B --> C[Sidebar navigation]
  C --> D[Row formatting cache]
  D --> E[Tree and section projection]
  E --> F[Visible sidebar]
Loading

Technical review

Best possible solution:

Retain this focused row-lifetime cache while preserving authoritative publications and the existing tree projection.

Do we have a high-confidence way to reproduce the issue?

The base formats every row again after a session publication; the committed mounted-sidebar regression and reported red-before/green-after result isolate unchanged-row work.

Is this the best way to solve the issue?

The change is appropriately scoped: reuse formatting at its existing owner, retain broad upstream invalidation, and leave membership, nesting, expansion, and Home decisions with their current owners.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against f93eea455c72.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 6f24d83 adds ui/src/components/sidebar-projection-memo.ts:69 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 6f24d835b4a5; files: ui/src/components/sidebar-projection-memo.ts)

PR surface

Source +65, Tests +41, Docs +4, Other +11. Total +121 across 13 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 203 138 +65
Tests 7 60 19 +41
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 1 14 3 +11
Total 13 281 160 +121

Review metrics

Metric Value Why it matters
Runtime versus test growth Application runtime +65 LOC; tests and fixtures +41 LOC Runtime growth expresses row-level invalidation and separate root/child slots; test changes protect unchanged-row reuse and preserve existing assertions under immutable publications.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P3: A measured performance improvement with preserved behavior and no demonstrated urgent user-facing failure.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-18T20:54:55.597Z sha 1e888ee :: needs maintainer review before merge. :: none

Reviewed October 18, 2026, 9:35 PM ET / October 19, 2026, 01:35 UTC (Revision 2).

@steipete
steipete force-pushed the steipete/coldload-sidebar-projection-owner branch from 1e888ee to a8fd350 Compare October 18, 2026 21:16
@steipete steipete changed the title experiment(control-ui): share sidebar row projection work [do not merge] perf(control-ui): reduce sidebar work during live session updates Oct 18, 2026
@steipete
steipete marked this pull request as ready for review October 18, 2026 21:17
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T22:28:29.890173Z ea2306b New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@steipete
steipete force-pushed the steipete/coldload-sidebar-projection-owner branch 2 times, most recently from 827223d to 89bd9b9 Compare October 18, 2026 22:06
Reuse formatted rows across immutable session publications while preserving live context, attention, run-state, and child-loading invalidation. Keep membership and tree projection with their existing owner.
…ness

Keep the memo primitives outside the sidebar projection pipeline to remove the import cycle. Wait for the shared chat header in the Team-scale rig so both chip and roster modes reach their existing content assertions.
Preserve assertions for owner attribution, group membership, and pinned dashboard navigation while replacing rows whose published facts change. Reuse the rail fixture's existing publisher.
@steipete
steipete force-pushed the steipete/coldload-sidebar-projection-owner branch from 89bd9b9 to ea2306b Compare October 18, 2026 22:25
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Final head: ea2306b. The PR body now includes the eleven performance pairs, final-head tests, full UI e2e results with successful setup-corrected focused replays, and inherited CI failure evidence from main. No source changes followed the clean P2 review.

@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Oct 19, 2026
@steipete
steipete merged commit c2549f8 into main Oct 19, 2026
133 of 137 checks passed
@steipete
steipete deleted the steipete/coldload-sidebar-projection-owner branch October 19, 2026 01:56
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 19, 2026
…ve events (openclaw#176453)

Every live session event rebuilt sidebar row presentations for the whole roster: under a Team-scale 240-event replay, projectSidebarAgentSessionRows was ~12.9% of sampled CPU (602 ms inclusive per replay in the earlier attribution), shared by visibleSessionRowsInOrder, synchronizePresentedSessions, childSessionParents and selectedAgentSessionRows.

Row formatting now belongs to the row's lifetime: a per-row memo (separately for root and child placement) reuses the previous presentation when the row object and every external input it reads (context, default agent, self user, locale, active/visually-active state, run state, work-session, PR summary, outbox count, draft flag, attention resolver, agent status note, child loading) are unchanged. Owners publish replacement rows and new identities when facts change. The bench's live-replay readiness assertion is updated for the current header.

Eleven interleaved AWS c7a.4xlarge pairs, live-event replay: scripting per event 11.338 -> 10.559 ms (-6.87%, 11/11 pairs, non-overlapping IQR); live scripting 2,721 -> 2,534 ms per 240 events. A separate reload-only check (11 pairs per route): board blocking 189 -> 210 ms (8/11 worse, overlapping IQR), warm chat 237 -> 225 ms; the reload-window profile shows the new slot owner at 0-1.4 ms and row-owner self time flat (board) or lower (chat). Runtime +65 LOC. 203 focused tests and full UI e2e (830 files / 3,591 tests) pass; the remaining CI red is the inherited chat boot JS bundle cap.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant