Skip to content

perf(ui): defer menu navigation until first open - #181024

Merged
steipete merged 18 commits into
mainfrom
solid2/w-perf-menu-boot
Oct 23, 2026
Merged

steipete merged 18 commits into
mainfrom
solid2/w-perf-menu-boot

Conversation

@steipete

@steipete steipete commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Closed menus loaded Zag navigation during Chat and New Session boot. Defer that runtime until a menu opens. The existing native overlay keeps admission, dismissal, initial focus, item DOM and pointer activation synchronous; one Zag implementation takes over keyboard navigation after loading. Queued input preserves order, retained-focus listboxes and embedded controls remain actionable, and a failed import has a visible retry.

The cold facade also preserves native item selectors, initial-row scrolling, and Zag pointerdown focus prevention. Without the last behavior, focusing a trigger settled its ancestor animation and moved it 24 px before pointerup, causing a real click to miss. The shared/personal rejected-publication recovery cases and a focused pointerdown regression verify the repair. Right-click and macOS Control-click retain their native behavior.

Performance

Matched same-machine production builds: base source 4f8cf06b18925ff494a305ac364cdbb8271227fe, candidate runtime source 6cdc426ae6b, Node 26.12.1. Candidate includes current main fb824384939; that revision has no UI/shared-source or budget difference from the measured base. Both builds have exactly identical fixed build metadata, including dirty: false, and the same 29 verified packaged-plugin files. Both use build ID solid2-boot-comparison; these controlled metadata inputs are distinct from actual source identity.

Surface Main gzip Candidate gzip Savings JS requests
Startup 316,336 B 316,327 B 9 B 7 → 7
Chat 1,386,742 B 1,353,266 B 33,476 B 23 → 23
New Session 859,888 B 826,422 B 33,466 B 17 → 17

Startup CSS is unchanged: 41,124 B gzip / one request. The strict matched comparison has zero violations and warnings. Caps fall from 1,439,860/871,648 B to 1,405,102/837,725 B, using ceil(candidate × main cap / measured main) to preserve relative headroom. Route request caps remain 25/19, two above observed use. No startup baseline is raised. The original split reduced one route request; current main's additional chunk changes make final request counts equal while retaining the byte reduction.

Production LOC across seven affected modules: 2,252 → 2,627 (+375). Growth is the synchronous facade, loading/error handling and ordered replay around the deferred runtime; there is no second navigation implementation. Refactor census: one effect, four untrack, zero render effects/direct DOM listeners/queries/flush/Solid owner APIs.

Evidence

Check Result
UI typecheck after current-main integration Passed on fb824384939 integration
Matched production build + strict performance Passed, zero violations/warnings
Production Knip Passed after current-main integration
Independent isolated P0–P2 review Final integrated review scoped-clean, zero actionable findings
Loading browser tests 16/16 Chromium + WebKit; latest pointerdown/loading Chromium run 9/9
Provider/agent/loading regression set 38/38
Footer keyboard cases Original e27926c head: 2 failures; focus-echo guard: 2/2 passed
Shared + personal rejected-publication recovery, production build 2/2
Multi-select disabled keyboard readiness Exact base/head replays 15/15; repaired observable-readiness test 15/15
Header toolbar test after earlier merge conflict 7/7
Import cycles Zero after moving the shared selector into a leaf
Original trigger-Space E2E Red on 7106175, green after entry-highlight repair; assertions unchanged
Cold entry-highlight browser regression Red before repair (alpha instead of beta); final guarded loading suites 10/10 Chromium and 10/10 WebKit
Final focus-repair types, lint, format and isolated P0–P2 review Passed; review scoped-clean
Account-change palette E2E CI exposed premature reopen before Bob profile adoption; controlled response + adopted-identity wait passes the exact case with every retirement assertion intact
Current replacement-head ci:full Passed on exact 2d61b9691b4504deaabc166118246e079176480f: run 39879246857, including all UI E2E and real-Gateway shards

The trigger-Space CI failure was reproduced locally: if native entry focused a row but the user returned to the trigger before the import resolved, the runtime lost that row highlight. The synchronous facade now forwards row-focus events through the existing ordered queue, and the duplicate runtime-only handler is removed. Exact-head UI CI then exposed a focus echo: the warm runtime refocused its current row after scheduling ArrowDown, queuing that old highlight after the navigation. The facade now compares against the live runtime highlight before queuing focus. Both original footer cases fail on the preceding head and pass with this guard; no state or second focus owner was added. The original E2E assertions pass unchanged.

Run 39877171146 exposed command palette file drops > retains a dropped draft across reconnect and retires it for another account: the palette still showed Alice’s draft. The test had reopened after transport connection, before the users.self result adopted Bob and retired the old launcher. It now controls that profile response and waits for Bob before reopening. The exact case passes against the existing production build (1 passed, 3 skipped); blank draft, zero attachments, and no session creation remain asserted. This test-only correction changes no production bytes or timing path. The following current-main merge resolved only conflicting budget values; the official boot manifest was regenerated and the fresh same-input byte comparison is above. The Node test runtime is required by Playwright.

The browser test updates await observable lazy content/highlight readiness, while retaining directional, disabled-row, permission and focus assertions. The dedicated delayed-import suite separately protects queued keyboard input. No local full E2E suite was run.

Prior-runtime timing evidence, not a new timing claim after main integration: ten serial alternating cold-cache pairs on the same Blacksmith Testbox, 240 transcript messages, untraced. Predeclared acceptance allowed at most 5% median regression and no p95 worsening for transcript and enabled composer. Transcript median 433.35 → 373.75 ms; p95 587.7 → 531.9 ms. Composer median 432.35 → 373.0 ms; p95 586.7 → 530.9 ms. Both passed. Remote proof run. This timing used original base e875ec9c918c523373f37d66a53468667faf58bd; subsequent interaction fixes and current-main integration preserve the deferred runtime/import boundary but have not been re-timed as a combined head. Current byte proof above is fresh. Both task Testbox leases are completed; no active lease remains.

Synthetic screenshots

Inspected full-frame synthetic fixture captures; no private user data or credentials. Before opening the menu, its navigation runtime is absent from the boot graph. The middle image holds that import pending; the final image shows queued keyboard navigation replayed after it resolves:

Before After: runtime pending After: keyboard replay settled
Before, menu open After, menu open during runtime loading After, replay moved focus to Pin session

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 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 22, 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 🔄 Running since 2026-10-23T00:37:58.139194Z 2d61b96 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: XL labels Oct 22, 2026
# Conflicts:
#	config/control-ui-startup-budget-baseline.json

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8004eaef32

ℹ️ 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".

{
"startupJsGzipBytes": 315696,
"reason": "Keep the stricter startup baseline after runtime English deferrals; measured head 315926 B",
"startupJsGzipBytes": 315967,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep the startup baseline from moving upward

This raises the enforced startup baseline from 315,696 B to 315,967 B even though the measured candidate is only 315,928 B and the change reports a 34 B reduction. Because the checker adds its 512 B growth tolerance and 64 B build variance to this value, the edit silently permits an additional 271 B of future startup growth; the candidate already fits under the previous enforcement limit, so retain the existing baseline rather than weakening the regression gate.

Useful? React with 👍 / 👎.

@steipete
steipete enabled auto-merge (squash) October 22, 2026 22:19
@steipete
steipete disabled auto-merge October 22, 2026 22:20
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR loads menu navigation on first opening while retaining synchronous native opening, focus, and pointer activation.

Example: Open Chat without opening a menu.

  • Before: Reported boot JavaScript is 1,417,609 gzip bytes across 24 requests.
  • After: Reported boot JavaScript is 1,384,892 gzip bytes across 23 requests.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The optimization has useful measurements and inspected product-page media, but replay ordering and affected consumer assertions require repair.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): Inspected built-page synthetic screenshots show synchronous opening during held navigation loading and focus moving to Pin session after replay; the body records matched bundle and timing results, while remote timing logs could not be independently inspected because their storage redirect was blocked.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Chat and New Session load navigation code even when every menu remains closed.
Reason: The maintainer-authored direction removes measured boot work while retaining the existing native overlay and Zag owners.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⛔ Needs changes before merge - 2 items remain

Keep open: this PR provides a useful boot reduction, but queued Home/End navigation can activate the wrong row, and existing consumer tests need to accommodate deferred completion.

Priority: P2
Reviewed head: ae22aa99e9ec66685c2acf57806e912c5a0093d3

Before merge

  • Wait for Home and End focus before replaying the next key (P2) - During a cold opening, queue End followed by Enter while the runtime import is pending. Zag's END transition schedules its highlight update in another microtask, and its store then publishes roving focus asynchronously. This single-microtask wait can resume replay before that focus publication. The replay target is still the old row; menu-runtime.ts then resets the new highlight from that stale target before processing Enter, activating the old action. The Mermaid production-page sequence ArrowDown→End→Enter currently times out waiting for expansion, consistent with selecting Show source instead. Settle the runtime's resulting focus before draining the next intent, and cover Home/End successors alongside the existing ArrowDown cases.
  • Update picker consumer tests to await deferred navigation outcomes (P2) - The new import boundary makes first-open highlighting and queued selection finish after module loading, but the existing picker tests still await only picker.updateComplete before asserting those outcomes. That promise covers bridge rendering, not runtime loading or replay. Exact-head CI consequently reports missing active descendants and zero onChange calls in select-picker.behavior.browser.test.ts. Update the affected tests to await observable highlight or selection completion while preserving synchronous admission assertions and all existing expected values.

Findings

  • [P2] Wait for Home and End focus before replaying the next key — ui/src/components/solid/menu-machine.ts:114-118
  • [P2] Update picker consumer tests to await deferred navigation outcomes — ui/src/components/solid/menu-machine.ts:87

Tests

  • Missing end-to-end proof: Add held-import Home→Enter and End→Enter regressions, and restore the existing Mermaid expansion scenario.
Agent review details

How this fits together

The shared Control UI menu binding connects native overlay lifecycle and rendered controls to Zag keyboard navigation, highlighting, and submenu behavior.

flowchart TD
  A[Menu and picker callers] --> B[Synchronous menu binding]
  B --> C[Native overlay lifecycle]
  B --> D[Deferred runtime import]
  D --> E[Zag navigation]
  E --> F[Item focus and activation]
Loading

Technical review

Best possible solution:

Keep one deferred Zag runtime, settle its focus publication before replaying subsequent keys, and update affected consumer assertions without weakening their behavior checks.

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

The eager boot import is visible on current main; the introduced replay defect follows from the pinned scheduler contract and is supported by the failing production-page Mermaid sequence, without a local reproduction run.

Is this the best way to solve the issue?

Deferring the existing navigation owner is appropriate, but replay must wait for its resulting focus before another key can derive a target.

Full review comments:

  • [P2] Wait for Home and End focus before replaying the next key — ui/src/components/solid/menu-machine.ts:114-118
    During a cold opening, queue End followed by Enter while the runtime import is pending. Zag's END transition schedules its highlight update in another microtask, and its store then publishes roving focus asynchronously. This single-microtask wait can resume replay before that focus publication. The replay target is still the old row; menu-runtime.ts then resets the new highlight from that stale target before processing Enter, activating the old action. The Mermaid production-page sequence ArrowDown→End→Enter currently times out waiting for expansion, consistent with selecting Show source instead. Settle the runtime's resulting focus before draining the next intent, and cover Home/End successors alongside the existing ArrowDown cases.
    Confidence: 0.96
    Late finding: first raised on code an earlier review cycle already covered.
  • [P2] Update picker consumer tests to await deferred navigation outcomes — ui/src/components/solid/menu-machine.ts:87
    The new import boundary makes first-open highlighting and queued selection finish after module loading, but the existing picker tests still await only picker.updateComplete before asserting those outcomes. That promise covers bridge rendering, not runtime loading or replay. Exact-head CI consequently reports missing active descendants and zero onChange calls in select-picker.behavior.browser.test.ts. Update the affected tests to await observable highlight or selection completion while preserving synchronous admission assertions and all existing expected values.
    Confidence: 0.99
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Native lifecycle and menu navigation keeps the original intent (b68c44c: The native overlay migration established one lifecycle owner while retaining Zag navigation, keyboard behavior, focus, and cancellation.)
  • Picker and retained-focus integration keeps the original intent (ecdc40d: The picker migration preserved selection, keyboard navigation, and existing callers through the shared menu adapter.)
  • Boot inventory and performance budgets keeps the original intent (c4fd27d: Prior runtime-English deferrals reduced route boot work and tightened its budgets; this PR further ratchets route budgets and leaves the startup baseline outside its introduced diff.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • pnpm --dir ui test src/components/solid/menu-navigation-loading.browser.test.tsx src/components/solid/menu-navigation.browser.test.tsx src/components/select-picker.behavior.browser.test.ts
  • pnpm test:ui:e2e ui/src/e2e/chat-mermaid-alternatives.e2e.test.ts
  • pnpm tsgo:ui
  • git diff --check

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit b68c44c adds ui/src/components/solid/menu.tsx:77 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b68c44ca8f3c; files: ui/src/components/solid/menu.tsx)

PR surface

Source +285, Tests +159, Other 0. Total +444 across 11 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 8 899 614 +285
Tests 2 163 4 +159
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 6 6 0
Total 11 1068 624 +444

Review metrics

Metric Value Why it matters
Production versus test growth Production +353 LOC; tests +159 LOC Component-source deltas reflect the deferred facade, recovery presentation, and replay support around one retained navigation implementation; the new tests cover distinct loading boundaries.

Labels

Label changes:

  • add P2: A useful performance improvement has a focused cold-opening keyboard defect and repairable consumer-test failures.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🐚 platinum hermit and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: A useful performance improvement has a focused cold-opening keyboard defect and repairable consumer-test failures.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🐚 platinum hermit and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • 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 22, 2026, 6:39 PM ET / 22:39 UTC.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 52ec3d6b3f

ℹ️ 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".

if (context.get("anchorPoint")) {
action(["reposition"]);
loading = true;
setError(undefined);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore focus after a successful menu-runtime retry

When a non-stale runtime import fails once and then succeeds on Retry, this immediately clears the error and removes the focused retry button while the overlay remains open. The subsequent initialization only adopts an already-focused menu item, so focus falls to body and keyboard input no longer reaches the open menu; preserve the retry control until loading settles or explicitly restore focus to the menu/input after success. .agents/skills/solid/references/overlays.mdL34-L39

Useful? React with 👍 / 👎.

@steipete
steipete merged commit 69740ce into main Oct 23, 2026
114 checks passed
@steipete
steipete deleted the solid2/w-perf-menu-boot branch October 23, 2026 01:01
@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 23, 2026
* perf(ui): defer menu navigation until first open

* perf(ui): ratchet deferred menu boot budgets

* perf(ui): preserve menu boot headroom after main merge

* fix(ui): break lazy menu navigation import cycle

* fix(ui): preserve focus during lazy menu navigation

* fix(ui): preserve cold menu clicks through focus changes

* test(ui): await lazy multi-select initial highlight

* fix(ui): retain cold menu entry highlight

* fix(ui): avoid echoing menu-owned focus into navigation

* perf(ui): ratchet deferred menu boot caps on current main

* test(ui): await account adoption before palette reopen

* perf(ui): refresh boot graph after main integration

* perf(ui): ratchet combined menu boot caps
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. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant