Repository navigation
perf(ui): avoid Chat downloads for New Session plugins - #179367
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: 7a8f9c25ef
ℹ️ 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".
|
Codex review: needs changes before merge. What this changesThis PR separates plugin-action helpers from Chat bundles and extends the cold-load benchmark to measure New Session. Example: Open New Session with seven advertised plugins in the synthetic team-scale workload.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 2 items remain Keep this PR open: the loading improvement is useful and maintainer-directed, but two benchmark defects remain after the earlier overlay-validation fix. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe Control UI build assigns modules to chunks that the Gateway serves to browsers; plugin initialization and route imports determine which chunks a navigation downloads. flowchart TD
A[UI source modules] --> B[Chunk policy]
B --> C[Production assets]
C --> D[Gateway HTTP]
D --> E[New Session browser]
E --> F[Plugin initialization]
F --> G[Plugin action helper]
Technical reviewBest possible solution: Keep the existing chunk-owner fix, wait for plugin activation before recording New Session totals, and reject its unsupported dashboard paint probe. Do we have a high-confidence way to reproduce the issue? Source inspection establishes both benchmark failure paths, and the supplied browser measurements establish the original overfetch; no target code was executed during this read-only review. Is this the best way to solve the issue? The production change is the smallest fix using the existing chunk owner, and the emitted dependency-closure regression protects the intended loading boundary. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a5e54e449604. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +3, Tests +10, Docs +5, Other +77. Total +95 across 4 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 HistoryReview history (1 earlier review cycle)
Reviewed October 21, 2026, 7:40 AM ET / 11:40 UTC (Revision 2). |
|
@clawsweeper re-review The sole actionable review finding is fixed in 1e3eb5f, with before/after benchmark-entry validation and a clean independent review. The PR body records the correction, unchanged 40-run performance inputs, and corrected full-CI trigger with ci:full already present. |
|
🦞👀 Re-review progress:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1e3eb5f40d
ℹ️ 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".
| !state.pending && | ||
| !state.queued && | ||
| state.idleMs > 750 | ||
| ); | ||
| }); | ||
| return; |
There was a problem hiding this comment.
Wait for plugin activation before ending New Session runs
When --boot-route new --first-load is combined with a sufficiently low supported --download-kbps, this branch can finish after 750 ms of RPC quiet while the seven advertised plugins' JS/CSS assets are still loading. Those fetches are not represented by __coldLoad.pending, and unlike the Chat branch this path never waits for the final plugin navigation registration, so the immediately collected resource waterfall can omit in-flight assets and understate transfer size and last-asset timing—the measurements this route was added to capture. Wait for plugin activation/readiness before returning.
Useful? React with 👍 / 👎.
| bootRoute === "new" && | ||
| (!firstLoad || | ||
| values["live-events"] || | ||
| values["session-switch"] || | ||
| values["streaming-reply"] || | ||
| values["overlay-probe"]) |
There was a problem hiding this comment.
Reject dashboard paint probes on New Session
With --boot-route new --first-load --dashboard-paint-marker under the default traced, dashboard-face settings, validation accepts the invocation even though /new never renders the fixture board containing the marker. The later filmstrip check therefore always throws Filmstrip never captured the synthetic dashboard paint marker after completing the run; include this Chat/dashboard-only phase in the New Session rejection so the unsupported combination fails before producing artifacts.
Useful? React with 👍 / 👎.
|
Merged via squash.
|
Move Session English into its canonical lazy catalog and register it at all translating consumers without changing copy or primary behavior. Keep pending widget presentation lazy and use the canonical shared plugin-actions grouping; regenerate the branch-specific boot manifest. Adapt the source repair by Peter Steinberger from #179227 and #179367, retaining the existing Details geometry and dashboard menu lifecycle. Preserve startup and route budgets without changing their policies. Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: RomneyDa <[email protected]>
* perf(ui): avoid loading chat assets on New Session * fix(scripts): reject New Session overlay cold-load probes * perf(ui): share plugin actions without an extra boot request
What Problem This Solves
Gateway-advertised plugin contributions on New Session can download the Chat renderer and its styles, even though that route does not show a transcript. Their shared action helper was assigned to the Chat boot group.
User Impact
The build now assigns that helper to the existing shared boot group. Plugin initialization can use it without pulling in Chat or adding a separate request. Host tags, selectors, plugin behavior, and lazy feature boundaries stay intact. No configuration or migration is required.
Why This Change Was Made
The helper's only runtime dependency is already shared; its other imports are type-only. Reusing that group is smaller than adding another runtime chunk. The accepted cost is a small amount of helper code in New Session's existing shared request even when no plugin is advertised.
The existing cold-load benchmark now supports
/new, records request initiators and RPC timings, and separates enabled-composer readiness from automatic focus. Its regression fixture verifies the emitted plugin import closure stays outside Chat and startup. Setting the fixture's chunk-size floor to zero makes its small virtual modules exercise grouping.Evidence
Baseline:
390d7993abd2878426b159b8016b4fef34700b62. Final head:5f20b27dc3cdc1858fc26c21a8f965167d483edb. The previous dedicated-chunk revision crossed Chat's cap in run 39592031196: 1,499,876 → 1,500,213 gzip bytes and 25 → 26 requests. This revision removes that extra chunk; no budget is raised.Startup total drops from 371,501 to 371,466 gzip bytes, within the migration's 374,285-byte budget with one CSS request. The strict check reports only the existing tighter startup-JS ceiling (325,476 B) on both sides. Chat fits its 1,500,000-byte cap. Both builds use identical release metadata and the same source baseline. Build cache use differs only in artifact reuse/publication; no build-time comparison is claimed.
pnpm ui:build, both sidespnpm tsgo:ui;pnpm tsgo:scriptspnpm test ui/src/app/control-ui-chunking.test.ts --maxWorkers=1pnpm deadcode:knipTiming protocol: real Gateway HTTP documents/assets, synthetic bootstrap/WebSocket replies/media, warmed Gateway caches, fresh Chromium and disabled browser HTTP cache, 35 ms network latency, 10 Mbps downstream, 4× CPU slowdown, fixed fixture time, 1719×1179 viewport. Four separate source-mapped profiled captures are excluded from timing distributions. DOM visibility is not compositor paint. p95 is nearest-rank (the maximum at n=10). The one-minute host load ranged 149.3–192.6. All four diagnostic captures contain inspected synthetic data; no remote compute lease was used.
Measured distributions
The stable win is removing New Session's late Chat download. Its last asset finishes 602 ms earlier at the median (paired median −650 ms). Its composer median is 50 ms slower and p95 438 ms slower (+16.4%); automatic-focus p95 is 452 ms slower. These regressions are retained and accepted for the measured download reduction; no New Session readiness improvement is claimed. Plugin loading begins around 2.72 s, after the composer is enabled around 2.4 s. The small shared helper adds 363 gzip bytes to the existing New Session boot payload even without advertised plugins.
Chat makes the same 50 asset requests, transferring 80 fewer Brotli bytes. Its timing distributions improve, with lower median host load on candidate samples. The loaded behavior and request count are unchanged, so no causal Chat latency win is claimed. Chat does not automatically focus its composer in either variant. Document size is identical per route and this PR changes no Gateway serving code; TTFB differences are observations, not a compression improvement claim.
Representative command (one fresh-browser sample; alternate base/head order for each pair and use
new/chatseparately):Request-chain map
The Gateway activates only the requested route's emitted hints. HTML discovery starts initial and explicit-route preload requests together. Boot execution starts configuration retrieval and route warmup alongside connection startup. The sampled median stages below come from the actual emitted preload paths, request waterfall and RPC marks; a row's median is independent of adjacent rows.
Chat's subscription/cursor admission before
chat.startupprotects event consistency. New Session's plain route has no unconditional loader RPC. The defect was the laterplugin descriptor response → plugin loader → Chat boot closureedge; it now reaches the existing shared helper without importing Chat. Conditional libraries and plugin descriptors remain lazy.Separate source-mapped profiled filmstrips bound the inspected transition: New base skeleton 7,180.3 → composer visible 7,358.7 ms; candidate 5,394.3 → 5,523.0 ms. Chat base skeleton 6,529.2 → transcript visible 6,746.8 ms; candidate 7,823.8 → 8,033.2 ms. These are diagnostic frame bounds, not comparative timing samples or physical-display timestamps. The four CPU profiles map 97.3–98.8% of sampled asset frames; their render/sidebar stacks remain with the UI owners.
Critical path and compression decisions
The document already starts the initial graph and unconditional route module/CSS preloads in parallel. Application boot starts configuration retrieval and explicit route warmup before connecting. Chat's
connect → subscription acknowledgment → retained-snapshot admission → chat.startup → history publication/layoutchain preserves event/cursor correctness; raw speculative boot RPCs would bypass that owner. Plain New Session has no unconditional data-loader RPC. JSON5, detail panels, Canvas, and advertised plugin assets remain conditional.There is one initial stylesheet. A selected nondefault palette deliberately blocks to avoid a wrong-theme flash. Fonts use
font-display: swap. A separate early-font experiment did not consistently improve tails, so it is not shipped.Keep build-time compression plus the existing cache. Immutable assets already ship Brotli q9 and canonical gzip9 sidecars. Rewritten HTML uses q4/gzip6 and a bounded four-entry promise cache. Twelve interleaved representative compression rounds measured HTML q4 at 6,609 B and 0.776/3.087 ms median/p95, versus q9 at 6,145 B and 2.302/31.905 ms. Saving 464 B does not justify the tail. Sampled core JS q9 saves 11,891 B versus q4, with CPU paid at build time. Static
index.html.brcannot represent route/base/bootstrap/CSP-specific rewriting. These are representative compression diagnostics, not final-head HTTP timings.The unsupported
--boot-route new --first-load --overlay-probecombination is rejected during argument validation, before browser artifacts. The earlier late failure was reproduced through the real benchmark entry point; supported Chat overlay probes are unaffected.LOC across the four changed files: 2,788 → 2,889. Production chunk policy adds four lines; the remaining growth extends the requested benchmark, documentation, and existing regression fixture. No
ui/srcfeature implementation changes.The fresh before/after images below were inspected in full and contain synthetic fixture data only.