Repository navigation
fix(ui): reduce sidebar work and preserve fast menu selection - #154285
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 21, 2026, 2:45 AM ET / 06:45 UTC (Revision 9). ClawSweeper reviewWhat this changesThe PR reduces unnecessary sidebar measurements and chat redraws, and preserves keyboard selection while dropdown menus open or reopen. Merge readiness✅ Ready for maintainer review This remains a useful repair absent from current main. The current revision addresses the earlier popup-focus finding, and the review found no new blocking correctness or security defect. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI turns Gateway session updates and browser interactions into sidebar previews, progress cards, and chat information. Its shared dropdown component controls initial focus and keyboard selection across agent, provider, and environment pickers. flowchart LR
A[Gateway session updates] --> B[Session stores]
B --> C[Changed view presentation]
C --> D[Chat and sidebar]
E[Content and viewport changes] --> F[Batched layout measurements]
F --> D
G[Pointer and keyboard input] --> H[Shared dropdown focus]
H --> D
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +70, Tests +573, Other +40. Total +683 across 22 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep layout invalidation and initial menu focus with their existing shared owners while preserving session-scoped presentation and accepted keyboard input. Do we have a high-confidence way to reproduce the issue? Yes, from source: unchanged marquee renders schedule measurements, and dropdown opening resets focus after animation completion on current main. The supplied regressions exercise those triggers; this review did not execute them. Is this the best way to solve the issue? Yes. The patch repairs existing presentation and dropdown owners, removes competing late focus callbacks, and preserves connection, selection, and cleanup contracts without new settings. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 71d0ee197a8b. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
233ef9a to
167eac5
Compare
|
491774a to
164111d
Compare
164111d to
7ee7dcf
Compare
|
Merged via squash.
|
…aw#154285) * fix(ui): stop redundant sidebar and background session work * fix(ui): preserve keyboard selection while dropdowns open * fix(ui): retain menu selection during rapid reopen * fix(ui): wait for popup activation before initial menu focus * fix(ui): keep picker focus during fast keyboard navigation * chore(ui): shrink removed focus assertion budgets
What Problem This Solves
Fixes redundant sidebar/chat work during background activity and menu opening that overwrites a fast keyboard selection.
User Impact
Sidebar hover and foreground chat spend less time measuring stationary content or redrawing unchanged progress and PR information. Overflowing titles, touch menus, reduced motion, current-session updates, errors, and reconnects retain their contracts. Fast menu navigation keeps the chosen item through opening and rapid reopening. No settings or migration are required. The existing Web Awesome 3.12.0 patch is updated with explicit maintainer approval; the dependency version is unchanged.
Why This Change Was Made
This follows the panel-layout repair in #154179. Remaining work was being triggered too broadly: every sidebar title remeasured after an unchanged render, every scroll repositioned a stationary hovercard, and shared progress/PR notifications redrew unrelated panes.
Marquee measurements now follow actual content, size, direction, motion, and intent changes, with all reads batched before writes. Hovercards only reposition for anchor-ancestor scrolling and viewport changes, coalesced per frame. Existing stores suppress irrelevant notifications; existing presentation owners suppress unchanged per-session projections.
Evidence
Inspected presentation-parity screenshots use the same synthetic scenario. The before image is the retained baseline after #154179; the after image is freshly captured from this candidate.
Before:
After:
Dropdown regressions uncovered by CI
Web Awesome reset focus to Camera after a fast keyboard selection of Photo. The shared dropdown now initializes focus after popup activation during the first rendered animation frame, preserves accepted focus through rapid reopening and grouped content, and respects selected-row autofocus. Provider, agent, environment-mode and sidebar agent pickers declare their initial selection instead of resetting focus after animation completion. Existing pointer/hover focus restoration retains its separate contract.
Controlled browser regressions demonstrated the original late selection reset, initial-open focus failure, rapid-reopen window, provider/agent End-navigation reset, and grouped item/input autofocus loss. All repaired paths pass. The final caller cutover passes 17 bundled model-setup/group-default/agent-layout E2E cases (27.34 s), 44 caller/sidebar unit and browser cases (3.86 s), plus the shared dropdown lifecycle/ownership and identity suite. The two real selected-picker cases replace synthetic after-show unit tests and prove both focus and visibility in a long menu; their browser file plus sidebar layout ran in 1.79 s. UI typecheck, patch guard, formatting and fresh independent P0–P2 review pass. The rebase changed only surrounding lockfile context; the reviewed UI sources and patch bytes are identical.
No timeout increases, retries, weaker assertions or baseline changes were introduced. The existing Web Awesome patch update was explicitly approved; its version is unchanged.
CI and bounded stress investigation
The prior head
164111d9909passed three Linux replays of the original attachment-picker shard configuration (5/12 despite the CI job label 5/13). Ten standalone picker-file runs passed; one additional run stalled while pressing Enter on the already-resolved Add attachment trigger in the new-conversation iPhone Safari fixture. Its renderer diagnostic also timed out while the browser remained connected. The campaign stopped with nine runs unstarted. This is distinct from the reproduced Photo-to-Camera selection defect.A bounded instrumented follow-up at that exact source ran 48 viewport/Enter interactions across 12 fresh contexts, all passing in 30–311 ms (median 70.5 ms), with CPU profiles and Playwright traces retained locally. It did not recreate the original three-concurrent-run load and preceding case history. No safe root cause or fix was established; these successful interactions are non-reproduction evidence, not proof that the stall is fixed. The Blacksmith Testbox lease was stopped. Original failure and diagnostic source: Testbox run.
Two failures outside the UI changes have owning fixes incorporated from main: duplicate database-worker inventory (
f76d38a4ac5e5f4e6c5a5320436db169e33d5c8a) and Discord audio-worker fixture compilation (6319111df2121b72478de3be5691360ecb6d7e5c). The older full run also reported Codex process-inspection read-error timing asdeadlineinstead ofunavailableintransport-process-snapshot.test.ts:219; source inspection and owner coordination found no established cause or repair. A bounded replay of the original 12-file Codex group passed all 176 cases locally (59.36 s); this does not establish a fix or reproduce the original Windows/Linux runner load. This remains documented uncertainty. Original full CI run. Final CI is attached to the repaired revision; historical passing replays are not described as fixes for unexplained failures.The complete UI portion of revision
7ee7dcf7de3apassed all three UI test jobs and all 13 bundled UI E2E jobs. CI then required the two assertion-count budgets to shrink from 3 to 2 after deletion of the old focus callbacks; those exact reductions pass the ratchet and independent review. The same full run reported a Windows test-helper cleanup failure that cascaded through 42 cases after an indeterminate child/output closure. Bounded source/history inspection found that the first replacement Gateway had an empty Windows Job but unconfirmed leader or output closure; the retained indeterminate instance then caused the remaining cleanup failures. The test restores its mocked clock before this shutdown, so clock freezing was not established as the cause. The log does not distinguish the missing closure condition; existing ownership fixes are already present, and no safe repair was established. No passing replay is claimed as its repair. UI-green run and original Windows evidence.