Skip to content

fix(ui): restore the Control UI startup JavaScript budget - #132124

Merged
steipete merged 1 commit into
mainfrom
fix/ui-lazy-agent-tool-policy
Aug 28, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/ui-lazy-agent-tool-policy

Conversation

@steipete

@steipete steipete commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

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 3f02452df0c3dd2b8573c67356e6507a57824ce0 measures 347,427 B, above 347,037 B. The last passing main build inspected was 993f82e1b36478a555577e85bfc79086b9cdefdf at 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 by node --import ./scripts/tsx.mjs scripts/check-control-ui-performance.mts --json:

Metric Clean main before Candidate after
Initial JS requests 8 8
Initial JS raw bytes 1,147,461 1,137,951
Initial JS gzip bytes 347,427 345,131
Initial JS Brotli bytes 320,430 318,002
Initial CSS requests 1 1
Initial CSS raw / gzip bytes 279,894 / 44,570 279,894 / 44,570
Total JS assets 340 340
Total JS raw / gzip bytes 15,173,865 / 4,534,142 15,173,894 / 4,534,386

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):

Chunk family Before After
Core display/locale 113,058 113,067
Core library 69,804 69,502
Core shell 67,375 67,415
Foundation 78,670 76,627
Gateway 7,740 7,739
Lit 10,026 10,027
Entry 80 80
Rolldown 674 674

Build metadata differs between runs; final exact-head CI remains the Linux authority.

Behavioral and owner proof

  • Focused owner/UI and budget tests: 102/102 (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.
  • Existing real-Chromium mocked-Gateway E2E: 3/3 before, 9/9 after, using agent-config-save.e2e.test.ts and agent-model-fallback-ownership.e2e.test.ts with the canonical UI E2E config. Covers tool toggles/config writes, visible rejected saves, inherited skill selection, and agent navigation/model ownership.
  • Additional real Chromium runs of both production bundles: Chat reaches composer readiness, Agents deep-link opens, toggling read sends the same keyed config with deny: ["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):

Before: unchanged Agents tools panel and visible save failure

After (same scenario):

After: preserved Agents tools panel and visible save failure

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 build also passes (6m13.6s), including startup gzip 345,119 B. Complete check:changed passed 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.

@clawsweeper

clawsweeper Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: M maintainer Maintainer-authored PR labels Aug 28, 2026
@steipete
steipete marked this pull request as ready for review August 28, 2026 21:21
@steipete steipete self-assigned this Aug 28, 2026
@steipete

steipete commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Exact-head CI is green for 8da5f0dc8b6f6fd618806cd658acffd5a9ef0d80: https://github.com/openclaw/openclaw/actions/runs/33212212671. Linux startup gzip is 345,110 B, leaving 1,927 B below the unchanged 347,037 B limit. All 774 finalized sidecars verified. The earlier failing-main measurement and full before/after raw/gzip/chunk table are in the PR body.

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 5b605da389460fd035d9a2031064ed949303b14f and calling the canonical checker with a read-only copy of the original baseline gives 345,136 B, no violations against the original 347,037 B limit. No baseline increase is needed for this repair to pass.

@steipete
steipete merged commit 5b605da into main Aug 28, 2026
218 checks passed
@steipete
steipete deleted the fix/ui-lazy-agent-tool-policy branch August 28, 2026 21:35
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant