Repository navigation
perf(ui): retain agent selector rows and retire selection routes - #185990
Conversation
…-perf-agent-reopen-round2 # Conflicts: # scripts/bench-control-ui-interactions.ts
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesThis PR retains agent-menu content across selections and immediately retires obsolete Agents route receipts. Example: Select Data agent 0299 from a hydrated 300-agent roster.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this owner-directed optimization addresses repeated renderer work still present on main. No actionable introduced defect was found; exact-head CI remains blocked. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe shared selector consumes roster options, identity data, and the current selection, then emits a selected agent ID; the Agents route translates URL and selection intent into page data. flowchart LR
R[Agent roster and identities] --> S[Agent selector]
S --> M[Menu interaction owner]
S --> A[Avatar resource owner]
M --> C[Settings selection owner]
C --> L[Agents route loader]
L --> P[Agents page]
Technical reviewBest possible solution: Retain the existing Menu and avatar owners while preserving keyed row content and retiring unused selection receipts. Do we have a high-confidence way to reproduce the issue? Current-main source shows selection-dependent JSX reconstruction and intent-keyed route receipts; supplied browser measurements demonstrate the resulting repeated work, but no target code was executed during this read-only review. Is this the best way to solve the issue? The smallest complete repair is keyed presentation retention plus route-receipt retirement using existing owners; the diff preserves current interaction, resource, roster, and selection-intent contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f810bb4eede7. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +25, Tests +103, Docs +34, Other +251. Total +413 across 9 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 27, 2026, 10:50 AM ET / 14:50 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…nclaw#185990) * perf(ui): retain keyed agent option content * test(ui): record retained agent avatar identities * test(ui): qualify agent selector retention and warm identity reads * style(ui): format agent selector performance proof * perf(ui): retain avatar descriptors across agent selections * test(ui): cover missing agent fallback retirement * fix(ui): type the agent selector fallback memo * test(ui): measure retained heap across agent selections * perf(ui): retain agent menu rows and retire selection receipts * test(ui): settle layout before comparing draft geometry
Selecting an agent in a 300-agent roster retained each menu button but rebuilt all 300 inner avatars and labels. Selection-specific route receipts also stayed cached for 30 minutes despite never being reused.
Retain the menu content and avatar descriptors by agent key, reconcile checked metadata by ID, and memoize the missing-selection fallback. Retire obsolete Agents route receipts immediately while preserving the module and roster caches. Menu continues to own keyboard, pointer, focus and ARIA behavior; the avatar loader retains resource ownership.
The warm-selection workload shows a real CPU reduction at both CPU rates. It still misses the campaign task-time targets (100 ms at 1×, 200 ms at 4×). The separate retention validator remains red; this PR does not claim bounded memory.
Proof
29348382adaa; 8 other cases excluded; UI types and scoped formatting passed9d1a13732ff8vs basee4749abd4ec; zero warnings or violations9d1a13732ff8ci:fullrun 40532099102: three baseline-reproduced E2E failures plus their aggregate gate; all other jobs, including both real-Gateway shards, passedA/C are the same frozen original
154e39f03a2dbundle; H is the frozen pre-integrationed1160360aahead. These 120 observations were collected before merging current main and are retained as that exact-head evidence, not relabeled as a new merged-head run. Cells below are median / p95 / min–max, in milliseconds. P95 uses the same nearest-rank calculation as the harness. Wall is automation-to-assertion, not INP. Script/task use thread CPU time; renderer CPU spans the full renderer process interval. Runs were headless and untraced.1x timing and A/A control
One-minute host load ranges: A 20.83–26.50, H 21.50–26.46, C 20.83–26.50.
4x timing and A/A control
One-minute host load ranges: A 22.85–38.90, H 22.46–39.49, C 22.40–39.49.
At 1×, A/A task, renderer, layout/style and wall medians are outside the timing band. The script control median is −0.14% and p95 +1.07%, versus H script median −42.26% and p95 −40.55%; the CPU reduction and retained-row counters support the win despite noisy aggregate timing. At 4×, A/A task/renderer/script medians are +2.26%/+2.34%/−0.71%, with lower p95s. H task median/p95 improve 36.04%/35.80%, and script improves 43.41%/43.82%.
The test selects agent 0299 from an already hydrated roster and settles the resulting route. It does not establish cold hydration, first reopen, roster replacement, whole-page disposal or network-latency performance. Every measured action makes zero identity requests; setting an identity delay would not turn it into an RTT measurement.
Retention result and limits
Ten cycles of four actual selections return to main before forced-GC snapshots. The candidate holds one active Agents receipt before/after, replacing the old growth from five to 45 receipts (four to 44 cached entries). Live/disposed Solid owners, candidate DOM/detached nodes and listener counters remain flat in this finite test.
The unchanged validator fails because active timeouts grow A/H/C +41/+1/+41. The remaining single timeout is not attributed. Candidate forced-GC heap grows 1,372,604 B, versus 1,290,500/1,223,672 B for A/C. A separate snapshot attribution finds 82.4% of summed self-size growth among the largest groups in V8 code/bytecode/feedback/deoptimization metadata. A projection WeakMap's allocated table grows while its observed target edges stay at 1,200. This is finite evidence, not an unlimited-duration memory bound.
The timing runs do not force GC: at 4× the H
heapAftermedian is +20.21% versus A, with C +71.71%. Those GC-sensitive samples do not support an all-memory improvement claim. No validator, budget or expected failure was relaxed.Before and after
Inspected synthetic data only. Both captures show the same selected agent; the version footer is cropped. All six uncropped A/H/C qualification images were also inspected.
Before:
After:
Scope and size
Ten changed files against merge base
e4749abd4ec: 4,476→4,884 LOC (+408), including production 266→291 (+25). The final test-only repair is 2 insertions/7 deletions; production remains byte-identical to the built9d1a13732ff8head. The remaining growth is the focused regression/benchmark/retention proof and documentation. Simplification reused Menu's existing custom-render contract; there is no new lifecycle or focus owner. Solid census: memos 3→4, projections 0→2,onSettled1→1; effects, render effects, component cleanup, untrack, direct listeners/DOM queries, flush and owner APIs remain zero.Release-note context: large agent selectors retain their menu contents during selection and avoid caching obsolete selection-route receipts. Existing routes, tags, classes and selectors remain intact; no dependency or preference changes.
Main integration
A real merge conflict required merging
e4749abd4ec. Both mobile drawer guards and main's plugin catalog window/scroll behavior are preserved; a focused independent review of the combined resolution found no actionable issue. The selector, route and their tests, Menu implementation and avatar renderer remain byte-identical to the measureded116head. Main also changes shared overlay colors, layout measurement and shell/bootstrap code, so the earlier timing distributions and screenshots stay explicitly attributed to their frozen context.Final build comparison uses identical packaged inputs for memory-core, nostr and WhatsApp (13 manifest/package/UI files, hash-verified before and after); it does not compare inventories of different sizes. The focused lint was initially invoked with the broader scripts config and cancelled through normal cleanup after it admitted unnecessary package-boundary preparation. Its correct scoped-config replacement passed; the cancelled receipt is retained, and no passing checks were rerun.
CI attribution and test repair
Completed exact-head
ci:fullrun 40532099102 tested mergeda97507604a0, with verified ordered parents main5e27a6cf109fand PR29348382adaa. Reconstructing those parents produces the identical tested tree. All other jobs passed, including both real-Gateway shards. Its three failing E2E cases also fail on clean main43dc38e6c137, the latest completed scheduled-main revision (40523031614, rechecked while newer40532514201remained in progress):Control UI chat send pending handoff > does not recreate a consumed prompt outside the visible history page after reconnect43dc: same line 517, expected zero / received oneChat startup request priority > reconciles an explicit suggestion refresh after an event while chat remains held (hidden: true)Chat header and delegated work > keeps new batches in Details and opens Subagents manually without duplicate wait status43dc: same line 211, waiting for the1 subagent runningbutton; local/CI default timeouts are 10/30 secondsThe main replays use unchanged source/config/lockfile, retained logs and result JSON, with exact executed-name checks. The first invocation executed three named cases (two failures, group preview passed, 17 others excluded). The header invocation executed exactly one case and failed. No fixtures, assertions or thresholds changed. The CI summary only compared shard names and labels the header shard new; attribution here uses the exact failing test and matching actual-main replay. Failed scheduled-main log downloads returned empty files and supply no evidence.
The prior-head run also exposed a group-preview geometry readiness race. That case passed both original local baselines, so it was not classified as inherited. CI compared x=89.796875 before sending with x=411 afterward following a mobile-to-desktop viewport reset; its readiness predicate accepted both layouts. The test-only repair uses the existing
waitForLayoutSettledhelper, preserving viewport/theme/RTL coverage and final x/y/style assertions. The exact case passed once locally (1.36 seconds, eight excluded), after full-context independent review, UI types and scoped formatting; the current full CI has no failure for it. This is not a local red/green claim for the intermittent race.The prior auto-merge request was explicitly retired before pushing this replacement. Fresh exact-head review and native
github_pendingpreparation are complete. The three attributed CI failures use the documented native replacement/admin route; failed CI and the separate local retention failure remain recorded as failures. No budget or validator threshold was relaxed. Timing, build and screenshot evidence retains its original measured source attribution; the final test repair changes no production bytes.