Repository navigation
perf(ui): defer chat header menu contents - #180886
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 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9a713bdc5c
ℹ️ 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".
| "ui/src/pages/chat/components/chat-composer-slash-menu-dom.tsx", | ||
| "ui/src/pages/chat/components/chat-composer-slash-menu.tsx", | ||
| "ui/src/pages/chat/components/chat-effort-picker.tsx", | ||
| "ui/src/pages/chat/components/chat-lazy-boundary.tsx", |
There was a problem hiding this comment.
Keep chat-only code out of the shared boot graph
When loading /new, this regenerated shared capture now fetches chat-lazy-boundary.tsx, even though a repo-wide search shows every importer is under ui/src/pages/chat. This is part of a measurable New Session regression recorded in the same diff—from 1,000,561 B to 1,016,231 B gzip—so the chat-only additions should remain in the chat-exclusive chunk rather than being accepted by lowering the route budget.
AGENTS.md reference: ui/AGENTS.md:L76-L79
Useful? React with 👍 / 👎.
|
Codex review: needs changes before merge. What this changesThis PR loads chat header session and sharing menu bodies on first open and moves Settings-only English copy out of boot. Example: Open Chat without opening either header menu.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 3 items remain Keep this useful, maintainer-directed performance PR open; stale-chunk recovery and three failing UI check shards need focused repairs. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe Control UI header receives session facts and callbacks from existing pane owners; native Menu shells handle interaction while deferred components construct entries and forward actions to those owners. flowchart LR
A[Chat pane owner] --> B[Header menu shells]
B --> C[Native Menu]
C --> D[Lazy menu bodies]
D --> E[Existing session actions]
E --> F[Gateway]
Technical reviewBest possible solution: Keep the existing Menu shells and domain owners, add guarded stale-chunk recovery to both deferred bodies, and migrate affected tests to their new readiness boundaries. Do we have a high-confidence way to reproduce the issue? Current-main static imports establish eager menu dependencies, and the new retry callbacks establish the stale-chunk recovery failure without executing target code. Is this the best way to solve the issue? Deferring the existing menu bodies is a focused solution that preserves ownership; reuse the established reload recovery operation instead of leaving Retry unable to recover removed assets. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ce9941f4db62. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
PR surfaceSource +272, Tests +64, Other 0. Total +336 across 27 files. Added test files: 1. View PR surface stats
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 22, 2026, 2:56 PM ET / 18:56 UTC. |
|
Merged via explicitly authorized admin squash with prior CI and scoped validation.
|
* perf(ui): defer header session menu contents * perf(ui): retain settings copy behind lazy boundary * test(ui): await deferred header menu contents
What Problem This Solves
Opening a Chat transcript currently downloads the session-menu builders, sharing panel, and their dependencies before either menu is opened.
User Impact
Chat boot downloads 21,346 fewer gzip bytes with the same 26 JavaScript requests. New Session also sheds 2,174 bytes, and startup remains unchanged within the 64-byte build variance. The existing header triggers, menus, selectors, keyboard behavior, and actions stay available.
Why This Change Was Made
Keep the native menu shell and trigger eager; load the session-menu content and desktop sharing body when opened. The shared empty session data now has a lightweight owner, and direct fact imports avoid bringing the sharing implementation back into boot through a facade. Nine Settings-only English strings also remain behind the Settings boundary.
This is a focused follow-up to the module attribution in #180852 (the top-30 tables for both boot graphs are in that PR). It does not claim the campaign's full 15% Chat / 10% New Session target. The route caps are ratcheted using the same relative headroom as before; startup is updated through the canonical baseline command.
Evidence
Same-machine production builds and strict performance comparison, using shipped gzip sidecars:
Cold-reload synthetic production-preview measurement, 10 interleaved before/after pairs: transcript median/p95 522.0 / 1397.6 ms → 530.5 / 1202.9 ms; composer 521.4 / 1397.0 ms → 529.8 / 1202.3 ms. Median +1.6%, p95 −13.9%, within the preregistered 20% nonregression rule. This is no speedup claim. The initial 10-pair dataset showed a +24.9% p95 regression during network waits/overlapping review; the controlled repeat removed that overlap. Both datasets are retained in the task evidence.
Timing uses Vite's production HTTP preview with synthetic bootstrap, WebSocket RPC, and media, not a live Gateway: 390 sessions (200 first page, 30 pinned), 34 owners, 120 people, 6 agents, 7 plugins, 120 cron jobs, 54 child sessions, 240 transcript messages and 12 inline widgets; cold HTTP cache, CPU throttle 1, simulated RPC latency 35 ms.
The focused header test runs emitted Solid untracked-read diagnostics. The eager initial reads were subsequently removed; no diagnostic-free rerun is claimed. CI with
ci:fullsupplies the broad UI, E2E, extension and real-Gateway proof.The initial full run (39832022427) exposed supporting tests that treated the visible native menu shell as completed lazy content. They now wait for the actual rows; the shared unit helper waits for Vitest import settlement before its DOM deadline. Original row counts, placement, action, and focus assertions are preserved. The synthetic chunking fixture now explicitly groups its shared modules/styles independently of the production capture. Focused repair proof: 107/107 tests across five unit files; after helper refinement, 83/83 across its two consumers; 5/5 E2E tests across the two failed files. Typecheck and targeted lint pass.
That initial run also fails
Control UI catalog publication with a real Gateway > opens Settings pickers from publication and acquires only on Refresh or Retry, matching scheduled-main run 39832966696. Its separate repair is #180899; it is distinct from the header readiness fixes.All changed-file LOC: 17,569 → 17,934 (net +365, including tests, locale files and generated metadata). Header implementation production only: 5,657 → 5,937 (+280, excluding tests, locale relocation, generated manifest and tooling). The Settings-copy relocation adds no lines; the remaining growth is focused test/fixture coverage. Most churn moves existing menu bodies into their lazy modules.
The simplification pass retained the existing native Menu owner, removed facade imports that reintroduced eager dependencies, and found no further safe cut. The remaining production growth implements late focus handoff, loading/retry rendering, and retained item/action lookup across the lazy boundary. The one new cold-load test covers that boundary; existing tests only await the newly asynchronous entries. No domain owner, cache, or duplicate menu implementation was added.
Before / after
All captures use synthetic data. The first visible transcript/composer and the opened menus preserve their layout.