Skip to content

perf(ui): speed up large slash-command menus - #190398

Merged
steipete merged 3 commits into
mainfrom
solid2/w-webkit-chat-actions-1101
Nov 1, 2026
Merged

steipete merged 3 commits into
mainfrom
solid2/w-webkit-chat-actions-1101

Conversation

@steipete

@steipete steipete commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Large slash-command menus spend unnecessary CPU on every opening and filter update.

User Impact

Slash-command menus use less script CPU while preserving their appearance and keyboard behavior. The 1.3× WebKit/Chromium ratio target remains unmet; absolute application times improve in both engines.

Why This Change Was Made

Slash-menu openings wrapped every always-present icon in optional-content machinery. Remove those wrappers while retaining option IDs, icon classes/masks, grouping, filtering and keyboard handlers. A full 253-option opening now creates 253 fewer spans. The shared optional-content helper remains for its other callers.

This is the retained win from the WebKit chat-action investigation. No transcript-row, focus, dependency, or lazy-boundary changes are included.

Evidence

Performance proof

Built production assets, synthetic Gateway, headless Chromium/WebKit, desktop/mobile, localhost, 1× CPU. The committed engines harness measures first recorded native input through the last DOM/native-value commit; compound actions include delivery and intervening driver gaps. It is not CPU or paint time. Acceptance: interleaved base/head pairs plus A/A, median regression ≤5% with no worse p95 or further pairs; under host noise, use 20-pair CPU/work evidence. WebKit Timeline/source maps were collected separately from untraced timing.

The pre-integration retained-renderer cohort below has 120/120 passing observations, ten base/head/base-control triplets per engine/view. Values are median / p95 in ms.

Slash cycle Base Head A/A control
Desktop Chromium application 479.75 / 494.9 459.55 / 491.6 488.6 / 524.3
Desktop WebKit application 671 / 711 635 / 674 662 / 690
Mobile Chromium application 479.3 / 500.1 458.45 / 491.6 487.15 / 516.2
Mobile WebKit application 771.5 / 806 751.5 / 784 777.5 / 824
Desktop Chromium script CPU 120.92 / 124.62 112.33 / 120.30 125.22 / 133.18
Mobile Chromium script CPU 130.68 / 138.03 122.53 / 127.31 130.11 / 138.19

An additional ten slash triplets used identical slash code plus a subsequently rejected terminal-focus experiment. Across both cohorts, Chromium script CPU medians fall 122.90→112.83 ms desktop and 135.48→123.78 ms mobile (about 8%); script p95 also improves. WebKit application medians fall 669→635 and 791.5→758 ms. Every head opens 253 options with zero icon wrappers versus 253 on both baseline slots; all perform the same 68 native inputs.

The second mobile cohort was noisy: 1-minute host load reached 22.28, and unchanged A/A WebKit p95 reached 1,723 ms. Do not treat its wall-time tail as a product verdict. The 20-pair Chromium task CPU median is 435.95→414.86 ms desktop and 444.57→441.78 ms mobile; mobile task p95 moves 488.13→508.09 ms (+4.1%, A/A 513.88). Layout is a disclosed subphase limitation: mobile layout CPU median/p95 moves 49.57/54.07→50.67/58.22 ms, while total script CPU, frame-gap medians and the clean retained-bundle application cohort improve.

Reproduce with scripts/bench-control-ui-engines.ts --bundle-dir <base> --compare-bundle-dir <head> --control-bundle-dir <base> --pairs 10 --viewport both --steps chat-actions-slash using node --import ./scripts/tsx.mjs and NODE_DISABLE_COMPILE_CACHE=1.

Census and remaining gaps

Initial confirmation: 960/960 passed, 20 pairs plus an identical-build A/A slot for each action/view. Baseline d43ab9c516e6dd1effeee8cb50ea479be550232e.

Action Desktop C / W median ms W/C Mobile C / W median ms W/C Verdict
Discard 33.8 / 46 1.36× 27 / 39 1.44× Native activation/focus floor in this workload
Retry 96.6 / 114 1.18× 85.4 / 110 1.29× Below 1.3× in both slots/views
Slash cycle 483.4 / 676 1.40× 473.05 / 771.5 1.63× Retained wrapper-removal win
Terminal cycle 375.85 / 561 1.49× 1065.55 / 1026 0.96× Attributed; focus experiment rejected
Copy 1.5 / 12 8× 1.6 / 2 1.25× Desktop mostly delivery; mobile under 10 ms
Hover Unranked — 1 / 5.5 5.5× Desktop lacks input boundary; mobile under 10 ms

Discard was profiled first. Desktop input→click is 26.48–27.03 ms in WebKit versus 2.17–2.23 ms in Chromium. Click→last commit is 22.97–23.52 versus 31.63–34.37 ms. Mobile input→click is 18.09–18.37 versus 3.56–3.86 ms; post-click spans are comparable. Its durable failed-send deletion emits one queue update. Preserve native activation semantics and the existing transcript geometry owners.

Slash baseline style/layout union is ~340 ms desktop and ~490 ms mobile, predominantly native rendering. The retained-bundle W/C ratios remain about 1.38× / 1.64×: the 1.3× target is not met. Group-aware virtualization is a further avenue; this PR does not claim the residual is irreducible. contain: layout style on the popup passed 240/240 observations but brought no useful gain and was removed.

Terminal desktop has ~294–300 ms style/layout, including active-tab geometry, Ghostty focus and driver visibility checks. A focus guard was tested in 120 terminal observations and separately traced, then removed: focus had actually moved in the real desktop flow, so the guard still invoked the same ~34 ms native focus flush. It removed no work there. Preserve the required active-tab/close-button reveal and legitimate terminal focus.

Validation and size

Check Result
Composer menu unit tests 16/16 passed
Performance checker tests 42/42 passed
UI and scripts typechecks Passed; UI typecheck repeated after the main merge
Targeted lint / format Passed
Production Knip Passed after integrating main; the original matching base/head unused export was fixed upstream
Independent isolated Codex review No actionable P0–P2 findings in the final five-file diff
Before/after visuals Inspected, synthetic-only; unchanged open/filtered menu bounds
Broad proof ci:full run 41318501711: 45 jobs passed, 24 skipped

After integrating main at 99c1b1a76a9c9edbddc31f2aafc4ad2c2205ecb4, a fresh same-host base/head strict comparison passes. Startup JS 90,551→90,547 B gzip (3 requests); startup CSS stays 34,946 B / 1 request. Chat boot grows 1,276,902→1,277,076 B (+174); New boot grows 783,484→783,503 B (+19); CSS and request counts are unchanged. Accept the small gzip change for the measured renderer CPU win; the chat cap is its current measured 1,277,076 B plus the existing 811 B headroom (1,277,887 B). Startup limits and baseline are unchanged.

CI repair

The initial full CI run 41315426335 passed 43 jobs and failed only Chat responsive app behavior > remeasures a populated composer when the viewport width changes in UI E2E 4/7. Its checkout merged this PR into newer main. That main introduced a three-line mobile editing cap (c5827f7b61f), while the old test draft already occupied three lines at desktop width. Narrowing could not grow beyond the cap. Production replay confirms the original baseline and wrapper-only candidate both resize 75→117→75 px; updated main and candidate both stay 75→75→75 with that overlong fixture.

Integrate main and shorten the fixture below the cap, preserving all height-change and ResizeObserver assertions. The exact previously failing test passes headlessly against the updated production bundle (1 passed, 4 unrelated cases excluded). Its normal preflight, shared browser, fixture and cleanup remain in use through the provided prebuilt-assets contract; Node is used for the Playwright config. Full CI run 41317147005 passed the repaired resize case but found a sidebar deletion write-count failure (3 versus at most 1). The old setup accepted saved=true while cached rows were still displayed, allowing initial cached-to-live handoff writes into the deletion measurement. Wait for both live and saved before resetting counters, following existing sibling E2E readiness checks. All deletion, write-count, churn and reload assertions remain. The full two-case file passes against the exact newer-main production bundle (normal writes [1, 0]; subagent writes [1, 1]). The CI failure did not reproduce in isolated runs on either baseline, so this is a source-backed readiness repair, not a claim of deterministic red/green reproduction. Final full CI run 41318501711 passed on f7da89a635d: 45 jobs succeeded, 24 skipped. Both previously failing E2E areas passed. The old auto request was retired before replacing its head.

Production component LOC 95→90 (−5); benchmark helper 406→416 (+10) for the work counter. The checker changes one documented cap; the responsive test fixture is 573→572 lines while retaining every assertion. The sidebar readiness change adds 3 lines. Whole five-file LOC is 2,118→2,125 (+7). Solid refactor census remains zero for effects, untrack, manual listeners/queries, flush, owner APIs, cleanup and render effects in the touched component. No new owner, cache or abstraction.

Visual proof

Synthetic-only WebKit captures, identical open/filtered menu bounds before/after on desktop/mobile. The visual-only harness warms the menu and is excluded from timing evidence.

State Before After
Desktop open Desktop open before Desktop open after
Desktop filtered Desktop filtered before Desktop filtered after
Mobile open Mobile open before Mobile open after
Mobile filtered Mobile filtered before Mobile filtered after

Render always-present command and argument icons directly, eliminating 253
optional-content spans from a full menu. Preserve grouping, keyboard selection,
mask styling and lazy boundaries.

Retained-bundle pairs cut script CPU about 6% in both viewports; twenty-pair
confirmation supports about 8%. Accept 452 B of chat gzip growth and preserve
its existing 811 B budget headroom. Startup and CSS budgets stay unchanged.
@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Nov 1, 2026
@clawsweeper

clawsweeper Bot commented Nov 1, 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 Nov 1, 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-11-01T14:40:24.412447Z 2c43dc2 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.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui scripts Repository scripts size: S labels Nov 1, 2026
@steipete
steipete enabled auto-merge (squash) November 1, 2026 14:24
@steipete
steipete disabled auto-merge November 1, 2026 14:31
@clawsweeper

clawsweeper Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR removes unnecessary slash-menu icon wrappers, records their count in the benchmark, and adjusts the chat bundle budget.

Example: Open a slash menu containing 253 commands and filter to /compact.

  • Before: Opening creates 253 optional-content spans around always-present icons.
  • After: Opening creates no icon wrappers while retaining the same commands, appearance, and keyboard completion.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A small, useful optimization with production-browser measurements and visual evidence; broad validation remains unsettled by an unclassified UI timeout.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The changed option renderer is exercised through built production Control UI assets using native browser input, a synthetic Gateway, 253 options, filtering, navigation, and completion in Chromium/WebKit on desktop/mobile; reported work counts fall from 253 wrappers to zero, and inspected desktop screenshots preserve open and filtered presentation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Large slash-command menus consume avoidable CPU when opened and filtered.
Reason: The maintainer-authored direction delivers a measured CPU reduction through a smaller renderer; the remaining WebKit ratio target is explicitly disclosed rather than claimed solved.

Merge readiness

✅ Ready for maintainer review

This PR provides a measured, focused performance improvement that current main does not contain; no actionable patch defect was found, but the failed UI check remains unclassified.

Priority: P2
Reviewed head: 6cd1a45ea8c2195bb6853749d0b9036c6eea9565

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Control UI composer passes filtered command and argument choices from its existing menu state owner to lazy option renderers, which produce accessible selectable rows.

flowchart LR
  A[Composer input] --> B[Slash menu state]
  B --> C[Grouping and lazy menu shell]
  C --> D[Command and argument options]
  D --> E[Shared option renderer]
  E --> F[Accessible menu DOM]
Loading

Technical review

Best possible solution:

Render unconditional icons directly within the existing option renderer while preserving menu semantics and the documented bundle tradeoff.

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

Current main visibly creates an optional-content owner and span for every unconditional icon; the supplied production-browser measurements exercise the resulting large-menu workload, although no target code was executed during this read-only review.

Is this the best way to solve the issue?

The unnecessary work is optional-content handling around guaranteed icon elements; removing those two wrappers is the smallest complete fix and preserves the existing state, rendering, and lifecycle owners.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Composer option rendering and lazy boundaries keeps the original intent (e89e5ad: Separate synchronous menu state and accessible shells from lazily loaded rich option views.)
  • Slash icon rendering keeps the original intent (9902334: Replace repeated immutable SVG subtrees with icon masks while preserving appearance and interaction behavior.)
  • Benchmark option observation keeps the original intent (7b1267e: Avoid accessibility-role enumeration distorting the benchmark while retaining visibility and completion assertions.)
  • Chat boot budget changes intended behavior with a stated reason (bd10ba2: Account for accepted rendering improvements with a measured cap and explicit headroom.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit d003cdc adds ui/src/pages/chat/components/chat-composer-slash-menu-options.tsx:24 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d003cdc1a14d; files: ui/src/pages/chat/components/chat-composer-slash-menu-options.tsx)

PR surface

Source -5, Other +10. Total +5 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 19 24 -5
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 13 3 +10
Total 3 32 27 +5

Labels

Label changes:

  • add P2: This improves a measured interaction bottleneck for large command catalogs without changing functionality or introducing an urgent regression.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster 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 improves a measured interaction bottleneck for large command catalogs without changing functionality or introducing an urgent regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Classify the populated-composer resize timeout in the failed exact-head UI job before landing.

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 November 1, 2026, 9:33 AM ET / 14:33 UTC.

Merge current main for the named CI failure. Its three-line mobile composer cap made the prior resize draft fill the cap at both widths. Keep the same growth, shrink and observer assertions with a shorter draft. Refresh the slash-menu chat budget to the new same-host measured head plus its existing headroom.
@steipete steipete changed the title improve(ui): speed up large slash-command menus perf(ui): speed up large slash-command menus Nov 1, 2026
@steipete
steipete merged commit 4ece87e into main Nov 1, 2026
125 of 127 checks passed
@steipete
steipete deleted the solid2/w-webkit-chat-actions-1101 branch November 1, 2026 15:20
@steipete

steipete commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with prior CI and scoped validation.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 2, 2026
* perf(ui): reduce slash-menu icon rendering work

Render always-present command and argument icons directly, eliminating 253
optional-content spans from a full menu. Preserve grouping, keyboard selection,
mask styling and lazy boundaries.

Retained-bundle pairs cut script CPU about 6% in both viewports; twenty-pair
confirmation supports about 8%. Accept 452 B of chat gzip growth and preserve
its existing 811 B budget headroom. Startup and CSS budgets stay unchanged.

* test(ui): await live sidebar before counting deletion writes
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. scripts Repository scripts size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant