Repository navigation
fix(ui): restore the Control UI startup JavaScript budget - #132124
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Exact-head CI is green for Complete Linux changed gate, full build, 102 focused tests, before/after Chromium E2E and production-bundle navigation/tool-toggle/save-error proof passed. The owner repair moves unchanged policy matching from eager display helpers into the existing lazy Agents page and removes one redundant wrapper; production net -2 lines, no tests/budgets/baselines changed. The saving applies to the initial preload graph, not a claim that the shared catalog disappears from deferred Chat boot or that whole-bundle gzip shrinks. Fresh isolated Codex autoreview and deslop found no accepted actionable finding. Latest ClawSweeper state was checked immediately before native preparation: only its acknowledgement is currently published, with no Rank-up moves to apply. No separate review rule is enforced by the live main rules; the required CI gate is green. Proceeding through the repository-native prepare/merge flow, without bypass. Post-merge verification: landed file bytes match the reviewed patch. Concurrent unrelated PR #132020 changed the committed baseline from346,461 to347,255 B while this repair was in flight; this PR did not change it. Rebuilding merged main |
|
Merged via squash.
|
Related: #132091 (qualified admission-test performance PR blocked by this mainline build failure).
What Problem This Solves
Resolves a problem where Control UI builds on current main exceed the unchanged startup JavaScript gzip budget, blocking CI for unrelated changes. Clean main
3f02452df0c3dd2b8573c67356e6507a57824ce0measures 347,427 B, above 347,037 B. The last passing main build inspected was993f82e1b36478a555577e85bfc79086b9cdefdfat 346,597 B (CI); the admission PR's failing Linux build reports 347,195 B (CI).Why This Change Was Made
Shared agent display helpers imported tool-policy evaluation, which pulled the core tool catalog and its descriptions into every initial HTML/preload graph. Only the already-lazy Agents tools panel consumes that policy evaluation. Move those unchanged helper bodies to the page owner and call the canonical profile resolver directly, deleting its redundant wrapper.
This is older loading-boundary debt exposed by accumulated startup growth, not a claim that one recent feature caused the entire overage. Recent initial-graph additions since the last green include missing-session/error rendering (#131823), session usage/roster handling (#132064/#131958), service-worker probes (#132024), first-command-palette loading (#132028), and English strings. The eager policy edge dates to
6c445889b386(Peter Steinberger, February 13, 2026), carried through later UI moves. No policy, catalog, or tool-description source changed since the last budget baseline.No dependency, configuration, protocol, schema, locale memory, stylesheet, budget, tolerance, baseline, or assertion change. Existing route chunking is retained; no additional dynamic import or compatibility path.
User Impact
The initial Control UI payload fits the existing budget again. Agent labels, tool profiles, allow/deny matching, tool toggles, save errors, and navigation retain their behavior. No visible UI or documented behavior change.
The scope of the saving matters: shared catalog/policy still occur in the existing deferred boot group fetched during default Chat. This removes them from the initial HTML/preload graph; it does not claim to remove the catalog from all default-chat downloads. The page-specific matching helpers are emitted only in the lazy Agents page.
Production LOC: +100/-102 (net -2), mostly byte-identical moves. Tests: +0/-0. Existing canonical budget enforcement is the failing-before/passing-after regression proof; duplicating its byte assertion in a new test would add no independent coverage.
Evidence
AI-assisted implementation; deslop complete; fresh isolated Codex autoreview reports no accepted/actionable P0 findings. Moved matching helper bodies were checked byte-for-byte against pre-fix source. Codex review CLI isolation was checked directly in sibling Codex source (
codex-rs/exec/src/cli.rs:37-44,codex-rs/exec/src/lib.rs:328-333).Canonical production build
pnpm ui:build, followed bynode --import ./scripts/tsx.mjs scripts/check-control-ui-performance.mts --json:The canonical initial gzip saving is 2,296 B, with 1,906 B headroom. Whole-bundle gzip is 244 B larger because chunk compression changes; this is an initial-loading boundary repair, not a whole-bundle-size claim. All 774 finalized sidecars verify. No ineffective dynamic-import warning in the UI build.
Initial chunk gzip composition (before → after):
Build metadata differs between runs; final exact-head CI remains the Linux authority.
Behavioral and owner proof
pnpm test ui/src/lib/agents/display.test.ts ui/src/pages/agents/view.test.ts ui/src/pages/agents/panels-tools-skills.browser.test.ts ui/src/app/control-ui-chunking.test.ts test/scripts/control-ui-performance.test.ts). An initial mistyped test filename was rejected before execution; the corrected command above passed.agent-config-save.e2e.test.tsandagent-model-fallback-ownership.e2e.test.tswith the canonical UI E2E config. Covers tool toggles/config writes, visible rejected saves, inherited skill selection, and agent navigation/model ownership.readsends the same keyed config withdeny: ["read"], rejected saves remain visible, and no page exceptions occur. Both traces record 37 JS requests through Chat readiness. Their raw/gzip transfer totals are 4,006,829/1,167,015 before and 4,005,990/1,166,818 after; these are readiness traces, not a latency benchmark. Only synthetic Gateway fixtures; no live Gateway/provider/credentials used.Before (production bundle, synthetic tool-toggle/save-error state):
After (same scenario):
The unrelated GitHub identity warning in both captures comes from the synthetic fixture lacking that response, not a connected account or product change. Captures were inspected before upload.
Full
pnpm buildalso passes (6m13.6s), including startup gzip 345,119 B. Completecheck:changedpassed on a dedicated Linux Testbox (13m33.763s command, exit 0; run): guards, Knip, formatting, core-test/UI typechecks, lint and style. Its one-shot lease is verified completed. Exact-head PR CI remains required before landing.Exact-head Linux build is green: startup gzip 345,110 B, 1,927 B below the unchanged347,037 B enforcement limit; all774 finalized sidecars verified (build job). Remaining full-CI checks must pass before merge.