Skip to content

perf(ui): keep validation libraries out of chat boot - #175122

Merged
steipete merged 9 commits into
mainfrom
solid2/w-perf-schema
Oct 17, 2026
Merged

steipete merged 9 commits into
mainfrom
solid2/w-perf-schema

Conversation

@steipete

@steipete steipete commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Chat and New Session load general-purpose validation libraries and cold protocol schemas before they are usable. This change removes TypeBox builders/compiler and Zod from those boot graphs while preserving canonical Gateway schema ownership and the existing frame boundary.

User Impact

Chat downloads 62,396 fewer gzip bytes and two fewer JavaScript requests. New Session downloads 73,945 fewer bytes and two fewer requests. Rendering, frame admission, persisted snapshot semantics, and protocol limits are preserved.

Why This Change Was Made

Generate standalone, CSP-safe checks from the canonical schemas and split them by consumer. Move constants and narrow readers into dependency-free protocol leaves; replace accidental barrel imports. Replace Zod in three persisted snapshot readers and the ClawHub/display-position readers with equivalent narrow readers. Keep cold settings/plugin consumers lazy and retain TypeBox's existing grapheme algorithm for resume handoffs.

The shared UI build owner checks generated freshness before plugin preparation, cache reuse, Vite, or publication. A stale check rejects even a warm cached build while retaining previously published output. Public schema exports and the existing transport frame guards remain intact.

Evidence

Paired production builds on the same host/toolchain, with identical build identity settings. Base: 85cd5b0105ca05b31124490bbe46ff6bb407f656; head: c419080ad4da7a9e4ef4395e5c40b46accae329c.

Surface Base gzip / JS requests Head gzip / JS requests Change
Startup 337,573 / 7 338,302 / 7 +729 B / 0
Chat 1,545,481 / 27 1,483,085 / 25 −62,396 B / −2
New Session 1,118,851 / 22 1,044,906 / 20 −73,945 B / −2
Startup CSS 38,697 / 1 38,697 / 1 unchanged

All 453 startup source blobs are byte-identical by SHA256. The remaining unmapped files are an identical bundler runtime and a 41-byte entry whose sole import hash changes. The small startup increase is generated chunk/preload references; the 339,000-byte startup cap is retained. Chat/New caps are lowered to 1,495,000/1,055,000 B, with under 1% byte headroom and two request slots.

The regenerated boot manifest contains no Zod and no TypeBox schema builders/compiler. No renderer, DOM, CSS, or visual state changed: TSX edits only change imports, and the skill text decoder is extracted unchanged, so screenshots would show no changed state.

Local proof on the final integrated candidate: UI typecheck and production Knip passed without new ignores; generated freshness, production build, and strict paired performance checks passed (zero violations/warnings); independent full-diff P0–P2 review passed both chunks with no actionable findings. Earlier focused proof, reused with unchanged owning inputs, passed all 18 UI builder tests, 22 canonical-schema parity cases, both ClawHub reader cases, the snapshot cases, all 19 wrapper/import-closure cases, script and UI-test typechecks, targeted lint, and formatting. Main integration preserves its bounded snapshot cache and replay-data stripping.

Full CI 39011275366 passed on prior head 35045e6697b1d6d2ae8be07dd27b576f66955f8d: 155 jobs passed and 19 skipped, including every UI unit and Control UI E2E shard, both real-Gateway shards, typechecks, native provisioning, and security-fast.

Main then refactored the board-document owner, causing a header import conflict. The reviewed repair preserves main's Solid imports and owner implementation plus this PR's dependency-free GATEWAY_SERVER_CAPS import. All four board-document tests, UI typecheck, production Knip, generated freshness, production build and strict paired performance check passed on the repaired source. Canonical schemas and generated validator bodies are unchanged. The native prior-success verifier refused the old run because its live nested PR head had advanced, despite its immutable head_sha and successful conclusion matching the prior head. No merge was dispatched or guard changed. Current-head full CI 39013107927 completed with 150 jobs passed and 19 skipped, including all nine UI E2E shards, the other real-Gateway shard, typechecks, provisioning, and security-fast. Its two root failures are independently proven pre-existing and are recorded for native admin admission; prior CI is not claimed as new-head success:

Failed job Exact failure Main evidence
checks-ui (1/3) link-reader-metadata.test.ts cannot resolve the removed ./link-reader-panel.ts import The same command reproduces on the actual CI main parent 5cd2cac82dca11ff2968c09296952070c169bf93; test, replacement panel, and hovercard objects are identical in main and the tested merge.
checks-ui-e2e-real-gateway (2/2) Automation-management owner/admin test: provider.results.has(marker) times out at line 497 The identical test/assertion fails on latest scheduled main 39010956087; test, provider helpers, and harness objects are identical in the tested merge.

The actual tested merge is f82e2cc7c2e10fd479f80bd71ecbefec118eb29a, with ordered parents 5cd2cac82dca11ff2968c09296952070c169bf93 and c419080ad4da7a9e4ef4395e5c40b46accae329c. Its tree was independently reconstructed. Native evidence binds both failed jobs, the downstream CI gate, exact source objects, and the retained logs. No product, security, or review gate is waived.

The preceding full run passed 154 jobs, including every UI unit shard, all nine Control UI E2E shards, all typechecks, one real-Gateway shard, and security-fast. Its sole root failure was the intermittent automation-management provider-result timeout also captured by the same case/assertion on older scheduled main run 39002992814; latest scheduled main had passed. Native inherited recovery stopped before dispatch when main's new performance budget conflicted, prompting this integration and fresh CI. The original CI typing, lint, wrapper-inventory, fixture, and build-freshness findings were fixed before the preceding run.

Size and Simplification

The generated checks replace runtime schema interpretation; one shared snapshot reader replaces three Zod consumers. Handwritten growth is mainly the generator and shared parser. No new dependency or validation owner is introduced.

Touched-file category Before LOC After LOC
Handwritten production/tooling/docs 21,443 22,098
Generated validators 0 5,774
Tests 1,557 2,037
Generated boot manifest 2,594 1,971

Solid checklist counts are unchanged: controller/effect/render-effect/untrack/listener/query/class-string/flush/owner-capture = 0/2/0/1/0/0/0/0/0.

Boot import audit

TypeBox entered through activity/narration/tool-stream payloads, approval projection, placement recovery, runtime restrictions, reactions, Talk voice events, sender identity, snapshot metadata/progress, schema constants, and agent-core/harness/messages → llm-core's validation barrel. These paths now use canonical generated checks or dependency-free constants/readers; the harness imports the existing llm-core/types entry. Shared chunk grouping no longer pulls in cold plugin install schemas.

Zod entered through sidebar/roster/chat snapshot readers and ClawHub recommendation/display-position readers. Replacements preserve stripping, strict envelopes, defaults, safe/finite numbers, Unicode bounds, URL normalization, and identity constraints. Native config bridges remain lazy. Reading pinned skill text no longer imports its upload owner and schema barrel.

Compile boot payload guards from canonical Gateway schemas, keep cold validation libraries lazy, and preserve snapshot parsing contracts. Tighten route budgets from paired production measurements; retain the existing startup ceiling.
@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 17, 2026
@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T07:21:20.667112Z c419080 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime scripts Repository scripts size: XL labels Oct 17, 2026
@steipete
steipete enabled auto-merge (squash) October 17, 2026 05:08
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 17, 2026
@steipete
steipete disabled auto-merge October 17, 2026 05:17
@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR replaces eager validation libraries with generated canonical checks, lightweight snapshot readers, and narrower imports.

Example: A signed-in user opens Chat.

  • Before: The reported paired build requires 1,545,481 gzip bytes across 27 JavaScript requests.
  • After: The reported candidate requires 1,483,085 gzip bytes across 25 JavaScript requests.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful and source-consistent, with canonical parity and focused build evidence; direct production-browser performance evidence remains limited.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; paired production-build measurements and canonical parity tests support the optimization, while the inspected historical screenshots do not demonstrate its browser download path.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Chat and New Session download general validation runtimes and cold schemas before becoming usable.
Reason: The maintainer-authored direction has measurable loading value, preserves existing behavior, and adds no user-facing configuration.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-approved performance improvement remains useful, and the reviewed diff reveals no actionable introduced defect.

Priority: P2
Reviewed head: c419080ad4da7a9e4ef4395e5c40b46accae329c

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: A current production-browser network trace for Chat and New Session would strengthen the reported download measurements; the previous review correctly treated it as optional.
Agent review details

How this fits together

The Control UI admits Gateway payloads and restores browser snapshots before rendering conversations; canonical schemas now generate standalone browser checks during development and build verification.

flowchart TD
  A[Canonical Gateway schemas] --> B[Validator generator]
  B --> C[Standalone browser checks]
  D[Gateway events] --> C
  C --> E[Chat and New Session]
  F[Persisted browser snapshots] --> G[Snapshot readers]
  G --> E
Loading

Technical review

Best possible solution:

Retain canonical schema generation and the smaller boot graphs, then complete native landing admission for the inherited CI failures.

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

This is a performance improvement supported by source import paths and reported paired production measurements; no target code was executed during this review.

Is this the best way to solve the issue?

Generating checks from canonical schemas and moving unchanged constants into dependency-free leaves addresses the import cost while preserving existing public exports and frame admission.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8324bae8896e.

Provenance checked

  • Boot partitioning and cold plugin schemas keeps the original intent (2077fb5: Separate shared and route-specific startup work so unused panels and schemas stay lazy.)
  • Persisted transcript snapshots keeps the original intent (0e7f8c9: Restore recent conversations promptly while preserving best-effort storage and account-scoped invalidation.)
  • Sidebar and boot-roster parsing keeps the original intent (561d92d: Restore a settled display projection without persisting live permissions or activity.)
  • ClawHub recommendation reader keeps the original intent (cfbbbb0: Display Gateway-authored catalog identities and installation facts in actionable recommendation cards.)
  • Transcript display positions keeps the original intent (b3add94: Preserve bounded physical placement of nested tool activity across history reloads without granting execution authority.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 2077fb5 adds ui/config/control-ui-chunking.ts:8 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2077fb504fbc; files: ui/config/control-ui-chunking.ts)

PR surface

Source +5472, Tests +138, Docs +7, Config +2, Generated +342, Other +325. Total +6286 across 80 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 69 6601 1129 +5472
Tests 3 142 4 +138
Docs 1 7 0 +7
Config 1 2 0 +2
Generated 1 342 0 +342
Other 5 334 9 +325
Total 80 7428 1142 +6286

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This reduces routine Chat and New Session loading costs without an established urgent runtime failure.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Optionally attach a redacted production-browser network trace showing Chat and New Session downloads.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (5 earlier review cycles)
  • reviewed 2026-10-17T05:23:00.150Z sha 7cd127c :: needs changes before merge. :: [P1] Include the new protocol leaves in the wrapper inventory | [P2] Write current-version records in the malformed-envelope tests | [P2] Make generated output recognizable to the suppression ratchet | [P2] Narrow indexed values before dereferencing them in the generator
  • reviewed 2026-10-17T05:45:25.791Z sha e9092a9 :: needs changes before merge. :: [P2] Enforce validator freshness in the shared production UI builder
  • reviewed 2026-10-17T06:10:08.306Z sha 9de7aeb :: needs changes before merge. :: none
  • reviewed 2026-10-17T06:25:51.925Z sha 9af099e :: needs maintainer review before merge. :: none
  • reviewed 2026-10-17T06:59:55.742Z sha 35045e6 :: needs maintainer review before merge. :: none

Reviewed October 17, 2026, 3:38 AM ET / 07:38 UTC (Revision 6).

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 17, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e9092a9036

ℹ️ 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".

Comment thread package.json Resolved
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 17, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 17, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 17, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 17, 2026
@steipete
steipete merged commit 9ff9472 into main Oct 17, 2026
260 of 264 checks passed
@steipete
steipete deleted the solid2/w-perf-schema branch October 17, 2026 07:48
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 18, 2026
* perf(ui): defer schema runtimes from chat boot

Compile boot payload guards from canonical Gateway schemas, keep cold validation libraries lazy, and preserve snapshot parsing contracts. Tighten route budgets from paired production measurements; retain the existing startup ceiling.

* chore(ui): distinguish generated validator output during lint

* fix(ui): repair precompiled validator CI boundaries

* fix(build): check protocol validators before UI publication
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 ci:full Keep ordinary native-locale CI selection on the next PR run. docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XL 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