Skip to content

improve(ui): defer Model Providers copy until Settings opens - #136969

Closed
steipete wants to merge 1 commit into
mainfrom
task59/ui-startup-budget
Closed

steipete wants to merge 1 commit into
mainfrom
task59/ui-startup-budget

Conversation

@steipete

@steipete steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Related: #121497 (Control UI startup JavaScript headroom).

Additional instructions

This is a same-repository task branch that maintainers can update.

What Problem This Solves

Control UI startup was downloading Model Providers settings copy even when the operator only opened New Session or Chat. This maintainer-requested source reduction restores useful startup headroom without raising the existing budget or changing the visible interface.

The upstream JavaScript baseline refresh in #136817 is already merged and is separate from this work. This PR reduces the source-owned startup payload; it does not claim to repair every currently failing main check and contains no installer changes.

Why This Change Was Made

Move 102 unchanged Model Providers strings into the existing lazy Settings English catalog, registering them synchronously when the provider view loads. Keep the empty namespace anchor so complete catalog ordering stays stable; shared navigation, Chat, New Session, onboarding, and authentication copy stay eager. Settings search already owns synchronous catalog registration.

No new loading framework, dependencies, configuration, schema, CSS, baseline, or budget changes. Production LOC: +138/-133 (net +5), of which 133 lines are moved unchanged; the five remaining lines retain the anchor and wire the existing registration boundary. Tests: +63/-0.

User Impact

New Session and Chat download less startup JavaScript. Model Providers settings, controls, error text, and translation fallback retain their existing behavior and appearance. The complete ordered English catalog remains byte-identical: 6,198 strings, 275,704 serialized bytes.

Evidence

Local source proof uses base ddb4207d9211166eaae858a6f124481856808c26 plus this reviewed five-file patch, with Node 24.20.0, pnpm 12.1.0, Vite 8.2.2, and pako 3.0.1 on macOS arm64. Git/build timestamp metadata is handled normally; this is not an environment-identical comparison with Linux CI.

Measurement Before Final
Startup JS gzip 349,573 B 348,137 B
Original enforced JS limit 349,244 B 349,244 B
Startup JS requests 8 8
Startup CSS gzip 46,063 B 46,063 B
Validated finalized sidecars 794 794

Observed reduction: 1,436 B, leaving 1,107 B under the original enforced limit. No limit was changed to obtain this result.

  • pnpm ui:build: the unedited local base fails the original budget; final source passes.
  • node scripts/run-vitest.mjs ui/src/pages/config/settings-search.test.ts: the added cold-catalog assertion fails before the production change because Model Providers copy is eagerly present.
  • node scripts/run-vitest.mjs ui/src/pages/config/settings-search.test.ts ui/src/pages/model-providers ui/src/app/control-ui-chunking.test.ts: 173 tests pass across nine files.
  • OPENCLAW_UI_E2E_RECORD=1 node scripts/run-vitest.mjs ui/src/e2e/model-providers.e2e.test.ts --testNamePattern='loads provider-settings|defers live provider discovery': two selected bundled mock-Gateway Chromium cases pass; five unrelated cases are unselected. The loading case checks actual script response bodies through /new, /chat, and Models settings, plus zero console/page errors and zero failed script requests. The second case preserves Models-to-Setup navigation and refresh behavior.
  • node scripts/check-changed.mjs -- ui/src/i18n/locales/en.ts ui/src/i18n/locales/en-settings.ts ui/src/pages/model-providers/view.ts ui/src/pages/config/settings-search.test.ts ui/src/e2e/model-providers.e2e.test.ts: passes, including core-test/UI typechecks, formatting, i18n, guards, all three dead-export scans, and targeted lint/style checks.
  • Managed Codex review through P0–P2: scoped-clean, no actionable findings. Independent source-and-proof review: scoped-clean.

Full-build qualification: final pnpm build failed before the UI phase when declaration sealing reported Boundary input changed during compilation: ../../../node_modules/@types/events/index.d.ts. The ancestor dependency's ctime changed during compilation; the guard also checks content hashes, so the diagnostic alone does not establish a byte change. No dependency edits or guard bypass were made. An earlier full build passed before the one-line registrar typing correction and is not claimed as final full-build proof. Exact-head hosted CI is still required before landing.

The four attached before/after desktop/mobile screenshots are from the canonical mock-Gateway Chromium harness, were individually inspected, and contain synthetic data only. The existing test names baseline files after-*; the attachment labels below distinguish the actual before and final runs. These are not live-provider or Browser-pane proof.

Before — Models desktop, synthetic mock Gateway

After — Models desktop, synthetic mock Gateway

Before — Models mobile, synthetic mock Gateway

After — Models mobile, synthetic mock Gateway

Move 102 unchanged English strings behind the existing lazy Settings catalog and register them synchronously at the provider view. Preserve startup navigation, New Session, Chat, translation ordering, and fallback behavior without changing budgets or CSS.

Related: #121497 (Control UI startup headroom). The upstream baseline refresh is separate; this change reduces startup payload rather than adjusting enforcement. Local final UI build: 348137 B gzip against the original 349244 B limit; 173 focused tests, two selected Chromium cases, changed checks, and P0-P2 review passed. Final full-build proof remains qualified by an ancestor declaration-input metadata mutation.
@clawsweeper

clawsweeper Bot commented Sep 3, 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 Sep 3, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 3, 2026
@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 3, 2026, 12:18 AM ET / 04:18 UTC.

ClawSweeper review

What this changes

Moves existing Model Providers English strings out of the Control UI startup catalog into the lazy Settings catalog, registers them on Settings search or Models-page evaluation, and adds cold-catalog and browser-route coverage.

Merge readiness

✅ Ready for maintainer review

Keep open. Current main does not contain this registrar/catalog extraction, and source review found no actionable defect in the focused maintainer-owned UI optimization.

Priority: P3
Reviewed head: a92ca843e59a53898b4b1503d45cd778fdba66c9

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A normal-good focused patch: it follows the existing catalog boundary and covers both registration semantics and the affected browser routes.
Proof confidence 🌊 off-meta tidepool Not applicable: Not applicable: Repository State identifies this as a MEMBER-authored PR. The body nevertheless supplies mocked-Gateway Chromium evidence for New Session, Chat, and Models settings, including script-body and error assertions.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Not applicable: Repository State identifies this as a MEMBER-authored PR. The body nevertheless supplies mocked-Gateway Chromium evidence for New Session, Chat, and Models settings, including script-body and error assertions.
Evidence reviewed 5 items Lazy consumer registration: The introduced Models view imports and synchronously invokes the existing Settings-English registrar before any Model Providers translation is rendered.
Startup isolation: The application host keeps the Settings sidebar/search graph behind a dynamic import, and the Models route dynamically imports its page module; both consumers therefore remain off New Session and Chat startup.
Catalog-order contract: The host-only catalog composer merges the Settings registrar catalog, while the introduced empty Model Providers anchor preserves the ordered English catalog shape.
Findings None None.
Security None None.

How this fits together

The Control UI starts New Session and Chat from a small startup graph, while Settings and the Models page load their own UI modules later. English translations are held in a shared map so lazy pages must register their copy before rendering or fallback lookup.

flowchart LR
  A[New Session or Chat] --> B[Startup UI shell]
  C[Settings search] --> D[Lazy Settings catalog]
  E[Models settings route] --> F[Models page module]
  F --> D
  D --> G[Shared English translations]
  G --> H[Models controls and messages]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +5, Tests +63. Total +68 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 3 138 133 +5
Tests 2 63 0 +63
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 201 133 +68

Review metrics

Metric Value Why it matters
Production versus test delta production +138/-133 (net +5; 133-line relocation), tests +63/-0 The small production delta is the empty ordering anchor and registrar wiring; the added tests cover cold translation availability and browser chunk loading.

Root-cause cluster

Relationship: partial_overlap
Canonical: #121497
Summary: The open issue tracks broader Control UI startup headroom; this PR addresses one source-owned payload reduction without changing the budget baseline.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Land this focused use of the established lazy Settings-English registrar once the normal maintainer-owned PR gates complete.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this is an optimization PR rather than an incident report. The supplied mocked-browser harness is a focused validation path, but it was not rerun during this read-only review.

Is this the best way to solve the issue?

Yes. It uses the existing lazy Settings-English registration pattern, preserves the catalog-order anchor, and avoids adding a new loader, dependency, or configuration surface.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against d30f88714e6d.

Labels

Label justifications:

  • P3: This is a bounded startup-payload optimization with no reported functional regression or security impact.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Not applicable: Repository State identifies this as a MEMBER-authored PR. The body nevertheless supplies mocked-Gateway Chromium evidence for New Session, Chat, and Models settings, including script-body and error assertions.

Evidence

What I checked:

  • Lazy consumer registration: The introduced Models view imports and synchronously invokes the existing Settings-English registrar before any Model Providers translation is rendered. (ui/src/pages/model-providers/view.ts:34, a92ca843e59a)
  • Startup isolation: The application host keeps the Settings sidebar/search graph behind a dynamic import, and the Models route dynamically imports its page module; both consumers therefore remain off New Session and Chat startup. (ui/src/app/app-host.ts:205, a92ca843e59a)
  • Catalog-order contract: The host-only catalog composer merges the Settings registrar catalog, while the introduced empty Model Providers anchor preserves the ordered English catalog shape. (scripts/lib/control-ui-i18n-catalog.ts:34, a92ca843e59a)
  • Focused behavior coverage: The added cold-catalog test verifies that Model Providers keys are unavailable before Settings registration and resolve afterward, including fallback from a partial French catalog; the browser test exercises New Session, Chat, and the Models settings route while inspecting loaded script bodies. (ui/src/e2e/model-providers.e2e.test.ts:77, a92ca843e59a)
  • Current-main necessity: The fetched current-main view has no Settings-English registrar import, and the reviewed head is not an ancestor of current main; the change is not already landed or shipped. (ui/src/pages/model-providers/view.ts:17, d30f88714e6d)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-03T04:09:46.478Z sha a92ca84 :: needs maintainer review before merge. :: none

@steipete
steipete marked this pull request as ready for review September 3, 2026 04:12
steipete added a commit that referenced this pull request Sep 4, 2026
Reuse the lazy catalog repair from #136969 to clear the inherited Control UI
startup budget failure while landing #137342. Preserve every English key,
value and catalog ordering; keep shared navigation labels eager.

Verify cold Settings search and English fallback, then exercise New Session,
Chat and Models Settings through Chromium with a production bundle.
steipete added a commit that referenced this pull request Sep 4, 2026
#137342)

* fix(channels): unify quiet progress and tool-log presentation

Use the existing toolProgress setting for quiet progress defaults and the
opt-in tool log. Retain authored text, plan milestones, and independent
approval/failure attention through full plans and activity bursts.

Move Teams onto the shared compositor and keep Matrix and Mattermost event
callbacks active in quiet mode. Give native Slack attention stable event
identities, settle recovery without repeating append-only output, and keep
attention separate from Block Kit activity limits.

Preserve shipped SDK resolver/summary/plain contracts and Slack's explicit
compact fallback. Make Telegram Doctor advice follow the streaming mode.
Retain current-main Slack Markdown and recovery fixes; align docs and hints.

Co-authored-by: Ayaan Zaidi <[email protected]>

* test(slack): separate card and native progress coverage

Move the Block Kit cases into their own suite and share unchanged progress fixtures. Preserve all assertions while keeping both suites within the lint line limit.

* fix(channels): retain reasoning and terminal progress status

Route Teams reasoning deltas and snapshots through the shared compositor,
reset the reasoning burst at its lifecycle boundary, and retain failure
status when a native Slack card finishes with no work rows.

Align quiet-default help and generated metadata, and document Slack's
current compact final delivery after rebasing onto main. Config keys and
counts are unchanged. Preserve explicit tool-log opt-in and SDK contracts.

Co-authored-by: Ayaan Zaidi <[email protected]>

* test(telegram): verify quiet and detailed progress through userbot QA

Exercise omitted and enabled toolProgress with the existing commentary,
exec, and final-response fixture through the Telegram Test Server adapter.
Check every observed message revision, preserve commentary through tool
updates, and correlate the two provider calls with the successful exec.

Accept coalesced drafts and partial commentary. The serve driver exposes
messages and edits, so this scenario makes no deletion-observation claim.

* test(telegram): check credentials before progress proof

* fix(channels): preserve the shipped SDK tool-progress default

Restore the public resolver's omitted default of true and pass the resolved
mode's default explicitly from bundled callers. This keeps existing plugin
callers compatible while bundled progress drafts remain quiet by default.

Add public-barrel regressions for omitted and forwarded undefined arguments,
replace the obsolete internal expectation, and clarify the SDK contract.

Co-authored-by: Ayaan Zaidi <[email protected]>

* test(qa): acknowledge terminal-reply parent fixtures

Return a visible parent acknowledgement after spawning so native requester
settlement can complete. NO_REPLY deliberately retains an implicit
continuation, which prevented this direct-fallback scenario from reaching
its terminal delivery assertions through the real channel driver.

Keep worker silence, completion-agent fallback, and child-session-bound
release ordering unchanged. Five regression cases fail before the fixture
repair; all 284 mock-provider tests pass after it.

Format the Slack trace declaration with the branch's pinned formatter.

Co-authored-by: Ayaan Zaidi <[email protected]>

* perf(ui): defer provider settings copy until its page loads

Reuse the lazy catalog repair from #136969 to clear the inherited Control UI
startup budget failure while landing #137342. Preserve every English key,
value and catalog ordering; keep shared navigation labels eager.

Verify cold Settings search and English fallback, then exercise New Session,
Chat and Models Settings through Chromium with a production bundle.

* test(ui): keep lazy settings coverage within suite limits

* test(ui): capture lazy scripts before browser delivery

* fix(ui): authenticate widgets before sandbox settings load

Keep managed scripted widgets on the authenticated document owner in strict mode, retire prompt authority on policy changes, and preserve inert rendering until scripts are allowed. Cover delayed bootstrap and sandbox lifecycle transitions.

Co-authored-by: Ayaan Zaidi <[email protected]>

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

This optimization and its refreshed browser regression coverage are already on main through #137342, merge commit f804e08. All five refreshed candidate files match that commit byte-for-byte, including synchronous registration in the existing Settings catalog and the pre-delivery response-body capture with handler-draining cleanup. Closing this older PR as incorporated; Peter Steinberger's original work remains linked here.

The independently verified candidate passed 231 unit cases, 19 browser cases across three whole files, all 20 selected repository checks, and a managed Codex review with no actionable P0–P2 findings. Ordinary paired builds on the recorded baseline reduced startup JavaScript from 350,406 to 349,034 gzip bytes (−1,372), keeping the unchanged 350,141-byte limit. Total JavaScript gzip increased 166 bytes as copy moved into the lazy chunk; CSS and startup request count were unchanged. These are the retained candidate measurements, not a new measurement of the broader merged PR.

The original response-observer failure and expected baseline cold-key failure remain in the evidence. The existing 390px subtitle/button overlap was unchanged in the synthetic before/after captures and is a separate layout follow-up.

@steipete steipete closed this Sep 4, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 5, 2026
openclaw#137342)

* fix(channels): unify quiet progress and tool-log presentation

Use the existing toolProgress setting for quiet progress defaults and the
opt-in tool log. Retain authored text, plan milestones, and independent
approval/failure attention through full plans and activity bursts.

Move Teams onto the shared compositor and keep Matrix and Mattermost event
callbacks active in quiet mode. Give native Slack attention stable event
identities, settle recovery without repeating append-only output, and keep
attention separate from Block Kit activity limits.

Preserve shipped SDK resolver/summary/plain contracts and Slack's explicit
compact fallback. Make Telegram Doctor advice follow the streaming mode.
Retain current-main Slack Markdown and recovery fixes; align docs and hints.

Co-authored-by: Ayaan Zaidi <[email protected]>

* test(slack): separate card and native progress coverage

Move the Block Kit cases into their own suite and share unchanged progress fixtures. Preserve all assertions while keeping both suites within the lint line limit.

* fix(channels): retain reasoning and terminal progress status

Route Teams reasoning deltas and snapshots through the shared compositor,
reset the reasoning burst at its lifecycle boundary, and retain failure
status when a native Slack card finishes with no work rows.

Align quiet-default help and generated metadata, and document Slack's
current compact final delivery after rebasing onto main. Config keys and
counts are unchanged. Preserve explicit tool-log opt-in and SDK contracts.

Co-authored-by: Ayaan Zaidi <[email protected]>

* test(telegram): verify quiet and detailed progress through userbot QA

Exercise omitted and enabled toolProgress with the existing commentary,
exec, and final-response fixture through the Telegram Test Server adapter.
Check every observed message revision, preserve commentary through tool
updates, and correlate the two provider calls with the successful exec.

Accept coalesced drafts and partial commentary. The serve driver exposes
messages and edits, so this scenario makes no deletion-observation claim.

* test(telegram): check credentials before progress proof

* fix(channels): preserve the shipped SDK tool-progress default

Restore the public resolver's omitted default of true and pass the resolved
mode's default explicitly from bundled callers. This keeps existing plugin
callers compatible while bundled progress drafts remain quiet by default.

Add public-barrel regressions for omitted and forwarded undefined arguments,
replace the obsolete internal expectation, and clarify the SDK contract.

Co-authored-by: Ayaan Zaidi <[email protected]>

* test(qa): acknowledge terminal-reply parent fixtures

Return a visible parent acknowledgement after spawning so native requester
settlement can complete. NO_REPLY deliberately retains an implicit
continuation, which prevented this direct-fallback scenario from reaching
its terminal delivery assertions through the real channel driver.

Keep worker silence, completion-agent fallback, and child-session-bound
release ordering unchanged. Five regression cases fail before the fixture
repair; all 284 mock-provider tests pass after it.

Format the Slack trace declaration with the branch's pinned formatter.

Co-authored-by: Ayaan Zaidi <[email protected]>

* perf(ui): defer provider settings copy until its page loads

Reuse the lazy catalog repair from openclaw#136969 to clear the inherited Control UI
startup budget failure while landing openclaw#137342. Preserve every English key,
value and catalog ordering; keep shared navigation labels eager.

Verify cold Settings search and English fallback, then exercise New Session,
Chat and Models Settings through Chromium with a production bundle.

* test(ui): keep lazy settings coverage within suite limits

* test(ui): capture lazy scripts before browser delivery

* fix(ui): authenticate widgets before sandbox settings load

Keep managed scripted widgets on the authenticated document owner in strict mode, retire prompt authority on policy changes, and preserve inert rendering until scripts are allowed. Cover delayed bootstrap and sandbox lifecycle transitions.

Co-authored-by: Ayaan Zaidi <[email protected]>

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
@RomneyDa
RomneyDa deleted the task59/ui-startup-budget branch October 22, 2026 00:26
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 P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant