Repository navigation
perf(ui): avoid unchanged sidebar projections on session switches - #194171
Conversation
Key the row projection by resolved selection, source facts, and ordered visible rows so descriptor replacements and Gateway acknowledgements do not rebuild equivalent sidebar rows. Preserve membership, lineage, Home, archive, involving-me, and draft rules. The campaign coordinator accepts the measured Chat/New boot trade for the session-switch gain; raise only those two caps to the measured head plus 64 B. Add a 20-line DOM and work-count regression allocation.
|
Codex review: needs maintainer review before merge. What this changesThis PR keys the existing sidebar row memo by resolved selection and source facts instead of navigation-object identity. Example: The selected conversation is agent:main:first and its row is already held in the sidebar list.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this maintainer-authored draft open: it addresses redundant sidebar work still present on main, and source review found no concrete introduced defect. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Control UI sidebar combines Gateway session lists, lineage descriptors, selection, filters, and attention facts into memoized row trees consumed by its renderer. flowchart LR
A[Gateway session lists] --> C[Navigation projection]
B[Route and lineage facts] --> C
C --> D[Existing row memo]
A --> D
E[Filters and attention] --> D
D --> F[Sidebar renderer]
Technical reviewBest possible solution: Retain the focused change in the existing memo owner and establish its session-switch benefit before landing. Do we have a high-confidence way to reproduce the issue? Source shows that replacing a held selection descriptor creates a new navigation projection, which current main uses to invalidate the row memo; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch is a small owner-local optimization: it preserves source invalidation, resolved selection, and supplemental descriptors without introducing another cache or projection path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 59b8a114bf6d. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +5, Tests +39, Other +2. Total +46 across 3 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 November 6, 2026, 9:36 AM ET / 14:36 UTC. |
|
🦞👀 Pull request received. I will update this pull request when review starts. |
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. |
|
Merged via squash.
|
…enclaw#194171) * perf(ui): skip equivalent sidebar selection projections Key the row projection by resolved selection, source facts, and ordered visible rows so descriptor replacements and Gateway acknowledgements do not rebuild equivalent sidebar rows. Preserve membership, lineage, Home, archive, involving-me, and draft rules. The campaign coordinator accepts the measured Chat/New boot trade for the session-switch gain; raise only those two caps to the measured head plus 64 B. Add a 20-line DOM and work-count regression allocation. * perf(ui): keep sidebar memo comparison constant size * chore(ui): retain current route byte limits * test(ui): scope catalog idle checks to the live connection * test(ui): consolidate sidebar selection regression setup
What Problem This Solves
Switching between retained conversations rebuilds the sidebar row projection when its navigation closure changes, even when the resolved selection and list facts are unchanged. This repeats work after Gateway selection acknowledgement or arrival of a descriptor already covered by the held list.
Key the existing row memo by its resolved selection and source facts. Preserve list-owner identity; include the first and last visible rows so an off-window selected descriptor remains tracked in ordinary and roster modes. Membership, lineage, Home promotion, archive/involving-me exceptions, draft suppression, and descendant highlighting remain with their existing owners. There is no new cache, state owner, listener, effect, runtime dependency, or lazy boundary.
The row key compares 42 values at 200 rows. The trade is more key formation to avoid whole-tree work. Production is 334→339 lines; regression tests stay 652 lines after consolidating shared fixtures, clock settlement, and duplicate selection setup. Final diff: two files, net +5 lines (986→991 across those files); no test-line allocation remains. All audited Solid lifecycle/imperative counts remain 0→0.
Work census and correctness
Instrumented frozen-production diagnostics use 200 synthetic sessions, 15 visible, two selections per viewport. They are separate from acceptance timings. Full row recomputations fall 10→6, tree visits 2,002→1,202, and visible-section projections 8→4. Row materializations stay four. Eight of the base's ten full-row outputs are semantically identical; head has four identical outputs and the same two actual old/new-row selection updates. Navigation still changes identity ten times. This saves repeated projection, not navigation correctness or DOM changes.
Instrumented baseline full-row calls spend 55.9 of 69.0 ms desktop and 62.4 of 77.2 ms mobile returning identical row payloads. These callback timings include instrumentation; they cannot be multiplied into, or treated as an exact fraction saved from, the earlier 231 ms sampled sidebar attribution.
The earlier exclusive sampled sidebar attribution breaks down approximately as follows; it is not the instrumented callback measurement above.
The existing mounted Home/route-selection test now also covers held descriptor reuse and updating an off-window selected descriptor, preserving its DOM identity and old/new aria-current checks. Existing owner tests cover late lineage/root visibility, collapsed ancestors, Home refresh, archive selection order, involving-me filtering, and viewing-dependent draft suppression. The held-descriptor regression failed on the original base and passes on head. Limits: no new mounted cross-combination test for excluded off-window + involving-me, Home descriptor replacement + promotion, or the roster appended endpoint; their input dependencies are retained and were independently reviewed.
Performance verdict and provenance
The completed current-base refresh is 360/360 passed observations, six cells with 20 rotated base/head/base-A/A triplets each. It compares
31a65d5and frozen productione83d404, whose production inputs are unchanged in final test-only head091ac2b.Verdict: a clear Chromium script-CPU/work-count win, plus a 5.12% paired application-time and 5.71% task-CPU improvement on 6× desktop. WebKit desktop is modest and mobile is flat; the preliminary 5.5% WebKit result did not survive the larger sample. This is not a universal 5% latency win.
The Chromium 1× desktop application tail is +5.39%, matched by A/A +5.63% (227.2 ms). WebKit mobile's +0.09% tail is also smaller than A/A +0.18% (1,097 ms). Every Chromium CPU p95 improves. Chromium 6× mobile's script ratio of aggregate medians is −5.11%, but its median paired change is −3.89%; the latter is the claim above. The large 1× mobile ratio-of-medians application movement is likewise not treated as a clean latency win. There is no attributable fresh target regression.
One-minute host-load ranges (min/median/max) were Chromium 1× 6.696/8.599/10.557, Chromium 6× 7.596/11.237/25.304, and WebKit 6.559/11.421/21.669. Every cell used identical benchmark sources. Jobs were serial; a pause between Chromium 6× and WebKit allowed the final local test/type/budget checks only after all browser children exited, and no observation spans that pause.
Earlier complete control matrix
The complete primary matrix has 24 cells ×20 rotated base/head/base-A/A triplets (1,440 observations), plus six exact-cell confirmations of ten triplets (180 observations). All 1,620 observations passed their behavior assertions. Chromium covers desktop/mobile at 1× and 6×; native WebKit covers both viewports because WebKit has no CPU-throttling API. All browsers are headless. Synthetic fixtures isolate renderer cost, not real Gateway/provider latency.
The original paired matrix compares base
ed3c5dadbdbb8f51c70d8503dbb647112d78ad44with frozen productiona94a8cfed9709c1ee18e4f6598a1273ecaffbfbb(production-identical toa1f8008c307). A subsequent conflict merge takes main's catalog test verbatim and removes this branch's superseded catalog repair; production projection remains byte-identical. Main also changed transcript/layout work, so a fresh six-cell session-switch comparison is reported separately below rather than presenting the old absolute timings as merged-head measurements.Original session-switch script CPU decreases by ratio-of-medians: Chromium desktop 1× −5.89%, 6× −8.68%; mobile 1× −6.62%, 6× −5.39%. Median paired changes are −7.28%, −4.16%, −6.68%, −6.51% respectively. Chromium desktop 6× application median is 920.45→880.10 ms (−4.38% ratio, −2.94% paired); task CPU 976.52→933.64 ms (−4.39% ratio). WebKit is modest/flat: pooled desktop application paired −1.42%; mobile paired −0.27%. Mobile 6× Chromium application is flat despite lower script CPU.
Acceptance uses ≤5% median regression with no worse p95, or ten additional pairs confirming the band. On a noisy host, CPU and actual changed-work counters govern attribution. Ratio of aggregate medians and median paired changes are different estimands; both are disclosed. Sub-1% tails are noise unless confirmed.
Control-flow flags, retained rather than hidden
Three Chromium 6× control cells received ten additional triplets. Pooled desktop typing paired application/task/script changes are +3.13/+4.88/+5.07%, versus A/A +0.94/+0.82/+4.47%. Pooled mobile typing is +0.78/+5.81/+8.92%, versus A/A +0.74/+0.27/+5.45%; its application p95 is +18.70% and script p95 +14.69%. Direct paired head/A-A mobile typing script is +0.96%, task −0.74%. Pooled mobile Settings has application/task/script p95 +7.00/+6.80/+8.17%; direct paired head/A-A task −0.91%, script +0.10%.
Separate unprimed base/head diagnostic action windows record zero calls to the changed sidebar owner, key-builder, memo, or row projection during typing (27 trusted inputs) and Settings open. Positive controls prove interception; Settings controls run after measurement. The original unprimed typing pair also records zero calls. The verified typing pair prewarms rows, so it is corroboration rather than a claim that prewarming is neutral. Settings removes the connected sidebar owner without replacing it. These bounded diagnostics explain why the noisy controls do not block this change under the campaign rule; they do not prove zero CPU difference or a control-flow speedup.
WebKit confirmations retain small tails: desktop Settings p95 53→55 ms (+3.77%); mobile typing 71→73 ms (+2.82%); pooled desktop switch 252→253 ms (+0.40%). WebKit mobile switch remains flat. The original Chromium 1× desktop toggle application p95 +8.42% is covered by A/A +9.88%, with task/script paired changes −1.80/−1.18%.
Mobile drawer: what users actually wait for
The earlier 878 of 1,095 ms is two pre-selection drawer-opening/driver waits, including the 441 ms opening animation twice. It is not a phone user waiting 878 ms after tapping a session.
A separate six-selection WebKit diagnostic measures closed DOM/inert state at median 37 ms; last DOM mutation 71 ms (p95 73); first-frame input-state sample 67 ms (p95 69), with the drawer inert, main active, and drawer/backdrop pointer-events disabled. That sample is an upper bound on observed state, not a paint or exact input-readiness timestamp. Panel opacity ends at 124 ms; transform/backdrop motion at 473 ms (p95 475); final hidden/offscreen geometry at 490.5 ms. Users still see about 0.47 s of closing/backdrop motion while input has already been released. If that veil feels slow, shorten the exit/backdrop duration in a separate UX change. This PR preserves the animation.
CI and review
The original exact-head
ci:fullrun 42242196174 passed all UI units, all seven UI E2E shards, both real-Gateway shards, performance, types, lint and security. The earlier run 42235528314 failedCached composer display reconciliation > keeps cached composer controls visually settled without accepting input before live settings(snapshot receipt timeout) andControl UI catalog publication with a real Gateway > opens Settings pickers from publication and acquires only on Refresh or Retry(discarded connection pending request). Both complete files passed once on original base and head; the composer timeout is not claimed fixed by replay. Neither was classified inherited: both passed scheduled main run 42233981965.Main #194135 independently landed the catalog lifetime/publication fix, so conflict resolution uses main's file verbatim and this PR no longer changes it. The e83d404 merged head ran fresh
ci:fullin 42252035352: every UI unit/E2E/real-Gateway job passed; the only underlying failure was the test-line ratchet (34 lines beyond the tree ceiling despite matching allocation for this PR). This was not treated as inherited. The 091ac2b follow-up consolidates equivalent fixture setup and the two descriptor regressions into the existing Home/selection case, keeps every distinct observation, removes the allocation, and passes the gate with zero test-line growth. Its focused suite passes 18/18 andpnpm tsgo:uipasses. Exact-head full CI is 42256323765, pinned to091ac2ba8d62fa7f96ea675267b63ec9f33d5738. Independent full-scope autoreview had no actionable P0–P2 findings; independent conflict-resolution review confirmed the production module is unchanged. The follow-up consolidation also has an independent, complete P0–P2 autoreview with no actionable findings; the reviewer explicitly checked descriptor, identity/ARIA, pagination, attention, approval, reparenting and fake-clock semantics. No changelog edit: release-note context is the redundant sidebar work removed by session switching.Current-main byte proof
Same-machine production builds compare merge base
31a65d5def1a5209c0d0c69ce368c597592ef8aeand heade83d404bbf3bae97842d50149079fe7748431b81. Generated asset names are normalized before compression. Final head091ac2ba8d62fa7f96ea675267b63ec9f33d5738changes only tests/allocation from that measured head; production build inputs are unchanged.The coordinator accepted the original +197 B Chat / +113 B New Session gzip trade and allowed narrowly measured cap changes if needed. That allowance is unused: no cap or baseline changes. Gzip now falls 191 B on both routes; Brotli grows 190 B. The standalone base exceeds existing largest-JS, total-CSS-raw, Chat and New gzip caps; the strict head/base comparison passes with zero violations and zero warnings, reducing route/large-chunk gzip and leaving CSS unchanged.
Evidence
Before / after
Both pairs are captured from the current paired production bundles. Mobile is explicitly opened and all drawer/backdrop animations are finished before capture; media-only observations do not enter timing statistics. The desktop SHA-256 is identical in both images, as is the mobile pair. Every image was inspected in full for incidental private data.
Original full 24-cell matrix and host-load ranges (frozen pre-merge bundles)
Complete primary timing matrix
All 1,440 observations passed: 24 cells, 20 rotated base/head/A-A triplets per cell.
Medians and p95 are base / head / A/A, in milliseconds. Ratio compares aggregate medians; paired columns are medians of per-triplet percentage changes. These estimands are not interchangeable.
Application time
Chromium CPU
Host load and provenance
All jobs used the same benchmark source hashes. Each job's raw manifest retains the checked-out revision, browser version, bundle identities and hashes, machine CPU count, and command options. The frozen production content is unchanged across the matrix, even where test-only commits changed the checked-out revision.
This is the full primary matrix. The final verdict must also incorporate the separate/pooled confirmation results and the diagnostic source census; this table alone does not retire its primary tail flags.
Original confirmation cells and direct head/A-A diagnostics
Every flagged confirmation ran ten additional rotated triplets exactly once. Standalone and pooled30 results are both shown. Medians/p95 are B/H/A-A in milliseconds. Ratio of aggregate medians and median paired changes are distinct.
The pooled WebKit desktop switch tail is +1ms/+0.40%, matched by A/A. Desktop settings retains +2ms/+3.77%; mobile typing retains +2ms/+2.82%. They are small confirmed tails inside5%, not unchanged tails.
Secondary direct head/A-A diagnostics
This secondary comparison tests shared-host drift. It does not replace the preregistered head/base comparison or subtract two percentage medians. Values below are calculated directly per matched triplet.
The mobile typing standalone confirmation was noisy: paired H/B script +15.49% and A-A/B +8.65%, while direct H/A-A script −15.85% and task −18.33%. The matched control is informative but is not proof that the primary H/B tail improved.