Skip to content

perf(workboard): reduce per-card observer and listener overhead - #183763

Merged
steipete merged 12 commits into
mainfrom
solid2/w-perf-workboard-resources
Oct 25, 2026
Merged

steipete merged 12 commits into
mainfrom
solid2/w-perf-workboard-resources

Conversation

@steipete

@steipete steipete commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Large Workboards retain thousands of global listeners and roughly one label ResizeObserver per card, even with their popovers closed.

User Impact

A 1,000-card Workboard keeps far fewer observers and global listeners while preserving menus, status popovers, and label overflow. Event-dispatch script CPU improved by 3.70% in the measured desktop workload; this is not an overall latency claim.

Why This Change Was Made

Share label observations per document while retaining the existing batched measurements. Register shared positioning and dismissal listeners only while a popover is open or a hover deadline is pending, then release them when the last consumer retires. Native cancellation, placement, and independent target cleanup remain intact.

Evidence

Runtime evidence compares native Workboard source from ce3e893fcc72 and 9af2f95d4354. Desktop counts use the retained ce96af7ffd30 harness; desktop CPU and desktop screenshots use e93ef0f0112. Corrected touch-enabled mobile counts and screenshots use measured harness 2750a6d4d04a; the complete plugin source, compiled generations, and asset hashes match the earlier runtime pair. These are production renderers with synthetic Gateway data, not real-Gateway latency measurements. Retained pre-integration shipping-byte checks compare 39ceca404cec with 2750a6d4d04a.

Integrated main at 3c4d8d99cfc5 after the Browser resource lane landed. The resolution preserves both scenario families and mobile context options, combines their native service-worker bypass guards, and adopts main’s generic event-and-phase listener counter. Workboard diagnostics now consume that existing counter; the older scalar projection is gone. Workboard production and test sources, and the observation-browser helper, are byte-identical to the measured head. The four-file integration delta passed a separate independent review, scripts types, scoped lint, and formatting. The integrated head's full CI run passed its UI unit shards and performance check, but three E2E assertions failed. The follow-up below changes only those tests; the Workboard runtime remains byte-identical. Retained evidence is labeled by its tested head.

The CI follow-up keeps the original behavior contracts: Memory records the mounted stylesheet handles and verifies those exact nodes detach; Session Details pauses its real body animation at creation while preserving the row/envelope counters; task PRs wait for the existing chat-route readiness before focus and use a named 30-second foreground-card and metadata wait within the existing 120-second test limit. The task CI trace spent 16.278 seconds in branch-cache work before metadata started, beyond the earlier 15-second poll. Nested PR metadata and authority assertions remain intact.

No inherited-failure exemption is claimed. Memory passed on both base 3c4d8d99cfc5 and runtime head 413b6af24675; baseline Session attempts hit Chromium context-creation crashes, while the baseline task-PR retry timed out earlier waiting for its focus-opened hovercard. The repaired tests passed focused types, lint, formatting, and a complete independent P0–P2 review. The final focused local attempt passed the owned-stylesheet test. Session Details stopped at a Chromium context-creation SIGSEGV before its assertions. The task-PR card wait hit its old 10-second limit; retained diagnostics then showed the card visible at 11.38 seconds, with focus and foreground acknowledgement intact. The final one-line follow-up applies the same 30-second readiness bound to that card wait. It has fresh types, formatting, lint and independent review; it is not claimed as a passing local browser replay. Replacement-head CI completed successfully on 82cc36ecf109: 49 jobs passed, 24 were skipped, and none failed. The latest normal main merge at 82cc36ecf109 preserves every Workboard runtime, fixture, and repaired E2E file byte-for-byte. It only composes main’s heap/heavy-content harness additions with the Workboard scenario flags. This two-file integration passed scripts types, scoped lint/format, and a separate independent P0–P2 review with no actionable findings. The previous manual CI dispatch stopped before tests because GitHub retained a stale PR merge ref; a normal main merge and push triggered fresh PR CI on 82cc36ecf109. Its exact-head preflight passed, confirming the fresh run accepted the PR identity; the complete run is now green.

Check Before → after / result
Final head / merge base 82cc36ecf1091d86233138408d462ba8941f3658 / 9141755ddadb3ad69fd123f4bc46f05a4aeba93a
Retained shipping-byte head / base 2750a6d4d04a / 39ceca404cec
Native review Earlier initialization stopped on a crash-orphaned Git index.lock. The coordinator removed that empty orphaned lock; fresh native initialization, PR-head checkout, and exact-head artifact validation then completed successfully. Historical local test failures remain recorded in the validated review. The earlier auto request was confirmed cancelled, so landing uses reviewed replacement recovery.
Current-head PR CI Run 40232287201, completed successfully on 82cc36ecf109 (observed 2026-10-25 21:17 UTC): 49 jobs passed, 24 skipped, zero failures. All 3 UI unit shards, all 7 Control UI E2E shards, both real-Gateway shards, performance, preflight, security-fast, and PostgreSQL conformance passed; ci:full retained. The separate browser-extension job was skipped; the run does not claim coverage beyond its selected jobs.
Performance job in prior failed CI run (413b6af24675) Run 40222258934: performance job passed; the overall run failed three E2E tests. Startup JS 270,263 B gzip / CSS 31,616 B; 5 JS + 1 CSS, unchanged. Chat JS 1,227,310 B and CSS 121,554 B; New Session JS 747,923 B and CSS 85,682 B, all unchanged.
Prior-head PR CI (2750a6d4d04a) Run 40220103933: all 3 UI unit shards, 6 Control UI E2E shards, browser-extension bootstrap in E2E shard 7, and 2 real-Gateway shards passed. The ordinary ci:full inventory retains its explicit WebKit/release-only exclusions; other jobs were still finishing at this observation.
Desktop active ResizeObservers / window listeners / document listeners 1,005 → 6 / 2,074 → 66 / 3,052 → 52
Touch-enabled mobile active ResizeObservers / window listeners / document listeners 1,004 → 5 / 2,074 → 66 / 3,050 → 50
Observed resize targets Desktop 2,043 and mobile 2,008, unchanged
Actual mobile renderer Both pages: 1 touch point, coarse primary pointer, and no primary hover
Native behavior and lifetime Cancellation, coalesced toggles, menu/status placement, closed-listener retirement, and 1,000 → 500 → 0 → 1,000 card lifecycle passed
Event-dispatch script CPU, 20 interleaved desktop pairs Median 1,280.38 → 1,232.96 ms (−3.70%); p95 1,326.35 → 1,266.48 ms (−4.51%)
Remount script CPU, 20 interleaved desktop pairs Median 4,658.23 → 4,632.42 ms (−0.55%); p95 4,868.56 → 4,755.48 ms (−2.32%)
A/A control, 10 interleaved desktop pairs per scenario Script medians −0.43% events / −1.31% remount; p95 +0.03% / +2.96%
Retained pre-integration startup JS / CSS gzip and requests 273,896 B / 40,097 B, unchanged; 7 JS + 1 CSS
Retained pre-integration strict byte check Passed; startup and tracked route totals unchanged, no violations or warnings
Native Workboard plugin assets 315,412 → 316,138 B gzip (+726 B); 5 assets on each side
Tests and types Card-content 3/3 and lifetime 2/2 reused with unchanged production/test sources; integrated UI and Workboard browser types passed; final correction and four-file main integration scripts types, scoped lint, and formatting passed
Production Knip Pre-integration head 2750a6d4d04a passed with no findings; the integration preserves all runtime sources
Independent review All broad-review passes completed; the mobile harness finding was fixed and a focused review passed. The four-file main integration also passed its separate review
Visuals Six retained desktop captures and two corrected touch-enabled mobile captures inspected; synthetic-only, no meaningful visual regression
Native visible/hidden idle Eight covered cells: five original passes plus three setup-recovery passes; 1,000 cards retained during real 3-second observations. Hidden script CPU was 0 ms in all four cells; whole-browser hidden wakeups remain unknown because renderer sets changed

The event-dispatch improvement is modest. Remount task CPU changed +0.68% median / +1.81% p95 and wall time +0.98% / +2.26%. The shared host load was about 21–46; another lane's closeout unexpectedly installed cached dependencies for a reported 9.6 seconds, with exact overlap unknown. All 80 A/B and 40 A/A observations are retained without adjustment or exclusion. The corrected mobile pair proves counts and behavior only; it makes no timing claim. All captured browser identities retired, with no remaining or unknown identities.

Idle observations are descriptive single samples, not an energy claim. Visible interrupt wakeups were 193 → 197 on desktop and 230 → 354 at mobile width; both had zero package-idle wakeups. The native idle path and historical narrow-screen captures use mobile width without touch emulation. All four hidden wakeup totals remain unknown. The three recovery cells repeat only setup failures after adding Workboard to the existing service-worker bypass guard; the original failures remain retained.

The older e93ef0f0112 mobile counts and screenshots also used a 390 × 844 desktop context without touch emulation. They remain historical evidence and are not relabeled. The corrected mobile pair checks actual renderer capabilities, preserves the same native plugin generations, and supplies the mobile screenshots below. Earlier full-Chromium shutdown crashes and fixture setup failures remain separate failed attempts.

Against integrated main across the 13 changed paths, runtime LOC is 735 → 923 (+188); tests 1,987 → 2,259 (+272); measurement harness 3,786 → 4,719 (+933); type/baseline support 17 → 18 (+1). Total scoped LOC is 6,525 → 7,919 (+1,394). The three CI test repairs add 15 net lines. The additional runtime code replaces per-card resource ownership; the fixture covers distinct native cancellation, positioning, cleanup, CPU, and idle paths.

Release-note context: reduce Workboard card observer/listener overhead while preserving menus, status popovers, and label overflow.

Screenshots

State Before After
Desktop closed Workboard desktop closed before Workboard desktop closed after
Desktop menu Workboard desktop menu before Workboard desktop menu after
Desktop status Workboard desktop status before Workboard desktop status after
Touch-enabled mobile, after native lifecycle Workboard mobile before Workboard mobile after

Keep status dismissal listeners only while open or hover-pending, and share
popover positioning listeners within each document. Pool label resize
observation while retaining the existing measurement frame batch.

Preserve pending-hover dismissal and native popover behavior. Cover independent
retirement and idempotent label cleanup after a newer sibling pool is created.

Source reviewed at P0-P2 with no actionable findings. Runtime, type, lint,
build, and performance validation remain held for the coordinated proof run.
Target the inert board-name span for pointer parking and cancellation proof. Retain native Chromium exit receipts without replacing a primary close failure.
Share label resize observations and retain global positioning and dismissal
listeners only while needed. Preserve native popover cancellation, placement,
and independent target cleanup. Keep mobile resource proof touch-enabled.
@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 25, 2026
@clawsweeper

clawsweeper Bot commented Oct 25, 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 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-25T20:48:13.351698Z 82cc36e 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.

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 25, 2026
@clawsweeper

clawsweeper Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR shares Workboard label observers and registers shared popover listeners only while needed.

Example: Open a Workboard containing 1,000 labeled cards on desktop.

  • Before: The reported production-renderer measurement retains 1,005 ResizeObservers, 2,074 window listeners, and 3,052 document listeners.
  • After: The same workload retains 6 ResizeObservers, 66 window listeners, and 52 document listeners while preserving label overflow and menus.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful resource optimization with production-browser evidence, focused lifetime coverage, and no actionable finding; timing and energy conclusions remain appropriately narrow.
Proof confidence 🐚 platinum hermit (4/6) This maintainer-authored PR is outside the ordinary contributor proof gate; supplied evidence exercises the built Control UI and native Workboard renderer with synthetic Gateway data, records cancellation and resource retirement, and includes eight inspected before/after images.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Large Workboards retain unnecessary browser observers and global listeners even while card popovers are closed.
Reason: The maintainer-authored direction has clear measured resource value, preserves existing interaction behavior, and carefully limits its modest CPU claim.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it delivers a substantial resource reduction on large Workboards, and the reviewed diff introduces no concrete correctness or security defect.

Priority: P2
Reviewed head: 2750a6d4d04af13a6be4a2e0cd2fe88b73de5b85

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The added lifetime regressions are reported passing, but a red-on-base run is not recorded.
Agent review details

How this fits together

The bundled Workboard plugin renders Gateway card and session data in the Control UI; browser resize, pointer, scroll, and keyboard events drive label layout and popover presentation.

flowchart TD
  A[Gateway card and session data] --> B[Workboard Solid cards]
  B --> C[Shared label observer]
  C --> D[Existing batched label measurement]
  E[Browser input and viewport events] --> F[Active popover environment]
  F --> B
  D --> B
Loading

Technical review

Best possible solution:

Retain the shared resources in the existing Workboard presentation owners and land after required CI completes.

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

Current-main source allocates observers and global listeners per mounted card, matching the supplied 1,000-card browser measurements; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The change removes repeated native registrations at their existing owners, preserves label batching and dismissal policies, and keeps plugin code within its public integration boundary.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit b2adfe1 adds extensions/workboard/browser/pages/workboard/view-session-status.tsx:2 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b2adfe1e4b83; files: extensions/workboard/browser/pages/workboard/view-session-status.tsx)
  • Vyctor H. Brzezowski: Raw commit 86b9f2d adds extensions/workboard/browser/pages/workboard/view-popover.ts:28 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 86b9f2d8fab4; files: extensions/workboard/browser/pages/workboard/view-popover.ts)

PR surface

Source +189, Tests +257, Other +1049. Total +1495 across 12 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 4 237 48 +189
Tests 2 258 1 +257
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 6 1079 30 +1049
Total 12 1574 79 +1495

Review metrics

Metric Value Why it matters
Runtime versus regression coverage Production +188 lines; tests +257 lines Document-scoped allocation and teardown justify the runtime growth; tests cover distinct shared-resource and retirement failures.
Benchmark options 2 new benchmark CLI options --workboard-source-root and --compare-workboard-source-root pin measured plugin sources without adding product configuration.

Labels

Label changes:

  • add P2: This is a useful performance improvement for large Workboards with a limited blast radius and no demonstrated urgent user regression.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: This is a useful performance improvement for large Workboards with a limited blast radius and no demonstrated urgent user regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

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.

Reviewed October 25, 2026, 2:30 PM ET / 18:30 UTC.

Preserve both resource scenario families and native service-worker bypass guards. Use the shared event-and-phase listener counter from main for Workboard diagnostics; production components and tests are unchanged.
@steipete
steipete enabled auto-merge (squash) October 25, 2026 18:47
Assert disposal of the mounted Memory stylesheet handles, and pause the real desktop section animation at creation without changing process animation counters.

Wait for chat route readiness before native focus activation. Share a bounded foreground-readiness wait for the cold hovercard and nested task PR metadata while retaining authority and metadata assertions.
@steipete
steipete disabled auto-merge October 25, 2026 19:45
Preserve both Workboard and heavy-content fixture options while integrating current main. Workboard runtime and repaired E2E sources remain unchanged. The prior exact-head dispatch stopped before tests because GitHub retained the earlier PR merge ref.
@steipete
steipete merged commit aacbfcd into main Oct 25, 2026
146 checks passed
@steipete
steipete deleted the solid2/w-perf-workboard-resources branch October 25, 2026 21:24
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 26, 2026
…claw#183763)

* perf(workboard): share card observers and popover listeners

Keep status dismissal listeners only while open or hover-pending, and share
popover positioning listeners within each document. Pool label resize
observation while retaining the existing measurement frame batch.

Preserve pending-hover dismissal and native popover behavior. Cover independent
retirement and idempotent label cleanup after a newer sibling pool is created.

Source reviewed at P0-P2 with no actionable findings. Runtime, type, lint,
build, and performance validation remain held for the coordinated proof run.

* fix(workboard): declare modal action element for JSX

* test(workboard): hover cards before native menu proof

* test(workboard): isolate browser resource observations

* test(workboard): scope popover resource assertions

* test(ui): repair neutral workboard resource interactions

Target the inert board-name span for pointer parking and cancellation proof. Retain native Chromium exit receipts without replacing a primary close failure.

* test(ui): stabilize asynchronous E2E readiness

Assert disposal of the mounted Memory stylesheet handles, and pause the real desktop section animation at creation without changing process animation counters.

Wait for chat route readiness before native focus activation. Share a bounded foreground-readiness wait for the cold hovercard and nested task PR metadata while retaining authority and metadata assertions.
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 ci:full Keep ordinary native-locale CI selection on the next PR run. P2 Normal backlog priority with limited blast radius. plugin: workboard proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XL 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