Skip to content

perf(ui): restore Chat byte budgets with browser-floor cleanup - #194203

Merged
steipete merged 3 commits into
mainfrom
solid2/w-perf-chat-budget-followup-1106
Nov 6, 2026
Merged

steipete merged 3 commits into
mainfrom
solid2/w-perf-chat-budget-followup-1106

Conversation

@steipete

@steipete steipete commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Pay back Chat boot growth and restore the tighter budgets after #194135. The matched main build exceeded its Chat and New Session caps; this change removes bytes without changing request counts or moving a lazy boundary.

User Impact

The same Chat controls and layouts load fewer bytes. Browser support remains Safari 26.2+, Chrome 147+, and Firefox 150+.

Why This Change Was Made

Remove unsupported-browser branches for observers, media queries, pointer capture, highlights and visibility; delete 23 unreferenced English keys and six stale aliases; use native hex and base64url encoding; compile existing Node test hooks out of production. Mark four fixed theme-validation RegExp constructors pure so consumers that only need theme branding do not retain unused validation initialization. The validator and all its checks remain intact for its callers.

Consolidate duplicate Dreaming CSS and remove declarations already supplied by the cascade or flex layout. No lazy boundary, request timing, or state ownership changes. This is a deletion proof, not a latency claim.

Evidence

Same-machine Node 26.12.1 production builds, using the generated-name normalization from #193843. Base: 21cd90050fb6b8389cc5c8b81a1ee40230aba901 (includes the Cron boundary change #194165).

Surface Base Head Change Final cap
Chat boot JS gzip 1,288,399 B 1,287,580 B −819 B 1,287,644 B
New Session boot JS gzip 797,452 B 796,696 B −756 B 796,760 B
Initial JS gzip 89,622 B 89,370 B −252 B baseline 89,370 B
Largest JS gzip 560,381 B 559,877 B −504 B 559,941 B
Total CSS gzip 324,665 B 324,620 B −45 B 324,684 B
Total CSS raw 1,675,553 B 1,675,292 B −261 B 1,675,356 B

Every listed size cap is measured head + 64 B; the initial baseline retains its existing growth/variance policy. No ceiling increased. The strict checker passes without a base-over-budget exemption. Requests stay Chat 20 JS / 3 CSS, New Session 15 / 3, initial 3 / 1.

Together with #194135, the two matched deltas reclaim 2,466 B from Chat. After concurrent main changes, final Chat is 2,101 B below the original 1,289,681 B baseline, exceeding the 1.5 KiB goal.

  • UI typecheck, focused type-aware oxlint, stylelint, formatting, production Knip and git diff --check pass.
  • Existing observer/composer/highlight, layout/theme/scroll, media/pointer, translation, tooltip and Gateway tests pass. Highlight also passes in WebKit. Native codec/device identity tests: 35 pass; theme validation: 29 pass.
  • The first full CI run exposed missing JSDOM Highlight/pointer-capture APIs and a Node-only storage test path incorrectly entering browser tests. Missing-only Node fixtures now supply those browser APIs; storage requires both Vite test mode and the original Node VITEST flag. Focused reproducers pass: 59 Node tests, 17 Chromium persistence tests and 2 WebKit persistence tests. No inherited-failure waiver is claimed.
  • CSS equivalence: 48 Chromium/WebKit cases, 2,193 node observations, 5,119,284 computed-property comparisons, zero differences. Includes 320/400/640/641/1280 px, active/idle, normal/reduced motion and centered/overflowing approval pages. Actual production DreamingScene; synthetic content. Element/pseudo-element styles, geometry and scroll sizes are identical.
  • Independent isolated Codex review of the complete final repair scope: scoped-clean, no actionable P0–P2 findings. Simplification preserves existing owners and removes the native hex forwarding wrapper.
  • The next full CI run exposed stale common.health test probes, a Node navigation fixture without matchMedia, a pointer test fabricating capture events without capture state, and missing JSDOM Range geometry. Test-only repairs preserve the original assertions: 60 i18n tests, 25 navigation/leak tests, 29 transcript tests, and the final 26 browser/leak tests pass. Duplicate per-suite font/observer fixtures were removed in favor of central setup.
  • ci:full selects all UI, Control UI E2E, browser-extension and real-Gateway shards.

Touched files: 16,292 → 16,166 LOC (+162/−288, including the JSDOM fixtures). Net test LF growth against the merge base is zero; no test budget allocation or ceiling increase. Solid checklist counts stay unchanged: effects 4, render effects 0, untrack 0, direct listeners 1, DOM queries 0, flush 2, owner APIs 0, cleanup 4, dynamic imports 7. Native observers and events retain their original lifecycles.

Inspected synthetic before/after frames:

Dreaming before Dreaming after
Dreaming before Dreaming after
WebKit approval before WebKit approval after
WebKit approval before WebKit approval after

Remove unsupported-platform branches and compile existing test hooks out of production. Consolidate redundant Dreaming CSS without changing computed styles. Chat falls 335 B normalized gzip from the merged baseline; total CSS returns below both caps. Lower New Session, shared-chunk, raw CSS, and startup baselines without raising Chat.
@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Nov 6, 2026
@clawsweeper

clawsweeper Bot commented Nov 6, 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 Nov 6, 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-11-06T16:31:37.831074Z 5fc7fa9 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 app: web-ui App: web-ui scripts Repository scripts size: M labels Nov 6, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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. labels Nov 6, 2026
@clawsweeper

clawsweeper Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR removes obsolete browser fallbacks and redundant CSS, compiles test hooks out of production, and lowers Control UI byte budgets.

Example: Loading Chat in a supported browser with the matched production build.

  • Before: Chat boot JavaScript measures 1,288,396 B normalized gzip.
  • After: Chat boot JavaScript measures 1,288,061 B, below the existing 1,288,098 B cap.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Measured savings and inspected CSS frames support the change, but the incomplete test-environment cutover leaves required UI checks failing.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; inspected Dreaming and WebKit approval frames support CSS parity, and the body supplies matched production-size measurements, while JavaScript interaction evidence consists of focused tests.
Patch quality 🦪 silver shellfish (2/6) 4 actionable review findings remain.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Chat and CSS asset sizes exceeded the recently lowered budgets.
Reason: The maintainer-authored direction removes measurable bytes without adding abstractions, options, or intended presentation changes.

Merge readiness

⛔ Needs changes before merge - 5 items remain

Keep open: this PR provides useful, owner-approved byte savings, but four test-environment regressions block merge.

Priority: P3
Reviewed head: d9467feabe72cdbe4254c8721f4e0d5f820a99fd

Before merge

  • Provide Highlight APIs in the transcript test environment (P2) - Removing both capability checks makes existing JSDOM transcript tests enter highlighting without CSS.highlights or Highlight. Closing search and disposing rows then throw at registry.delete, producing unhandled errors across all UI shards and interrupting focus/reply assertions. Update the shared DOM/transcript fixture with the required Highlight APIs while retaining real-browser coverage.
  • Keep native storage usable in browser-mode tests (P2) - import.meta.env.MODE is test in Vitest browser projects too. Native localStorage is accessor-backed, so this new condition returns null before reaching the browser path. isCommunityInviteEligible consequently returns false, and the Chromium/WebKit invitation tests fail because their component never renders. Restrict unsafe accessor rejection to the intended Node environment or supply suitable browser-test storage through the existing setup owner.
  • Install matchMedia for the Node settings fixture (P2) - settings.navigation-profile.test.ts explicitly runs in Node and constructs createApplicationTheme without a matchMedia fixture. The now-unconditional subscription throws before either sibling-navigation scenario can execute; CI reports both failures at this line. Add the browser capability to that fixture without restoring a production fallback below the supported browser floor.
  • Update drag fixtures for required pointer capture (P2) - The JSDOM provider-profile and shell-resizer fixtures dispatch synthetic pointer events without installing pointer-capture methods. The unconditional setPointerCapture call now prevents drag startup, matching CI failures where profile translate remains empty and shell resize feedback remains false. Supply setPointerCapture, hasPointerCapture, and releasePointerCapture in the existing test setup while preserving cancellation and cleanup assertions.
  • Complete next step - The PR owner should resolve the reported budget-file conflict with current main, retaining its newer lower caps and verifying the resulting production measurements.

Findings

  • [P2] Provide Highlight APIs in the transcript test environment — ui/src/pages/chat/components/chat-search-highlight.ts:31-32
  • [P2] Keep native storage usable in browser-mode tests — ui/src/local-storage.ts:12-13
  • [P2] Install matchMedia for the Node settings fixture — ui/src/app/bootstrap-theme.ts:38-39

Tests

  • Missing end-to-end proof: The supplied frames cover CSS parity; no shipped Chat interaction run covering the JavaScript cleanup is shown.
Agent review details

How this fits together

The Control UI renders Gateway state through browser-owned observers, media queries, and Solid components; production asset measurements feed the existing performance-budget checker.

flowchart LR
  A[Gateway state] --> B[Control UI owners]
  C[Browser events] --> B
  B --> D[Solid presentation]
  D --> E[Chat and settings]
  F[Production assets] --> G[Performance budgets]
Loading

Technical review

Best possible solution:

Preserve the browser cleanup, repair test-environment compatibility at existing fixture owners, and retain main’s newer lower caps when resolving the conflict.

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

The supplied matched builds establish the byte reduction, while exact-head CI annotations and fixture source establish the test-environment failures; no target code was executed locally.

Is this the best way to solve the issue?

Deleting unsupported-platform branches at existing owners is appropriate, but the cutover must update every affected test environment and preserve native browser storage behavior during browser tests.

Full review comments:

  • [P2] Provide Highlight APIs in the transcript test environment — ui/src/pages/chat/components/chat-search-highlight.ts:31-32
    Removing both capability checks makes existing JSDOM transcript tests enter highlighting without CSS.highlights or Highlight. Closing search and disposing rows then throw at registry.delete, producing unhandled errors across all UI shards and interrupting focus/reply assertions. Update the shared DOM/transcript fixture with the required Highlight APIs while retaining real-browser coverage.
    Confidence: 1
  • [P2] Keep native storage usable in browser-mode tests — ui/src/local-storage.ts:12-13
    import.meta.env.MODE is test in Vitest browser projects too. Native localStorage is accessor-backed, so this new condition returns null before reaching the browser path. isCommunityInviteEligible consequently returns false, and the Chromium/WebKit invitation tests fail because their component never renders. Restrict unsafe accessor rejection to the intended Node environment or supply suitable browser-test storage through the existing setup owner.
    Confidence: 1
  • [P2] Install matchMedia for the Node settings fixture — ui/src/app/bootstrap-theme.ts:38-39
    settings.navigation-profile.test.ts explicitly runs in Node and constructs createApplicationTheme without a matchMedia fixture. The now-unconditional subscription throws before either sibling-navigation scenario can execute; CI reports both failures at this line. Add the browser capability to that fixture without restoring a production fallback below the supported browser floor.
    Confidence: 1
  • [P2] Update drag fixtures for required pointer capture — ui/src/lib/reactive/pointer-drag.ts:51-52
    The JSDOM provider-profile and shell-resizer fixtures dispatch synthetic pointer events without installing pointer-capture methods. The unconditional setPointerCapture call now prevents drag startup, matching CI failures where profile translate remains empty and shell resize feedback remains false. Supply setPointerCapture, hasPointerCapture, and releasePointerCapture in the existing test setup while preserving cancellation and cleanup assertions.
    Confidence: 0.96

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Browser observer, media-query, and pointer fallbacks changes intended behavior with a stated reason (b7b264f: Shared primitives preserve resource pooling, initial delivery, independent cleanup, and browser notification policy; the documented browser floor makes unavailable-API branches obsolete.)
  • Chat search highlighting keeps the original intent (fix(ui): chat search misses formatted text and never marks matches #170434: Highlight visible rendered matches without rewriting transcript DOM, while retaining pane isolation and teardown.)
  • Storage test detection changes intended behavior with a stated reason (0b05530: Avoid unsafe storage access in Vitest while retaining normal browser storage access; the compile-time replacement unintentionally extends accessor rejection into browser tests.)
  • i18n test hook keeps the original intent (24e6d5e: Expose a test-only manager API for locale recovery coverage; compile-time gating preserves the stated test-only intent.)
  • Dreams responsive styling keeps the original intent (fix(ui): keep the Dreams bubble on screen on phones #191227: Keep the phone bubble centered, readable, and clear of the moon; the consolidated rules retain the effective cascade and supplied visual parity.)
  • Hex conversion keeps the original intent (afecea8: Keep lightweight hex conversion outside heavier startup imports; using the native equivalent preserves that boundary.)
  • Performance budgets keeps the original intent (perf(ui): reclaim Chat boot bytes and lower budgets #194135: Ratchet normalized byte ceilings downward after measured savings, retaining bounded toolchain headroom.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm --dir ui test src/app/settings.navigation-profile.test.ts src/app/app-shell-view.test.ts src/pages/model-providers/profiles-view.test.tsx src/pages/chat/chat-view.transcript-search.test.ts src/pages/chat/components/chat-position-rail.test.tsx src/pages/chat/components/chat-transcript-replies.test.ts --maxWorkers=1
  • pnpm --dir ui test src/components/solid/sidebar-community-invite.browser.test.tsx src/pages/chat/components/chat-search-highlight.browser.test.ts --project=browser --maxWorkers=1
  • OPENCLAW_UI_WEBKIT=1 pnpm --dir ui test src/components/solid/sidebar-community-invite.browser.test.tsx --project=webkit --maxWorkers=1
  • pnpm tsgo:ui
  • pnpm ui:build

What I checked:

Likely related people:

  • Holger Gruenhagen: Raw commit d5be7a6 adds ui/src/pages/chat/components/chat-search-highlight.ts:37 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d5be7a6a4293; files: ui/src/pages/chat/components/chat-search-highlight.ts)
  • Vyctor H. Brzezowski: Raw commit fd4334f adds ui/src/styles/dreams.css:637 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: fd4334f20c44; files: ui/src/styles/dreams.css)

PR surface

Source -92, Tests -32, Other -1. Total -125 across 36 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 26 71 163 -92
Tests 8 5 37 -32
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 6 7 -1
Total 36 82 207 -125

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus test LOC Production UI +71/−163; tests +5/−37. The deletion-focused implementation reduces runtime machinery; test reductions predominantly remove unsupported-platform cases.

Labels

Label changes:

  • add P3: This is a small byte-budget improvement without an established user-facing outage or urgent regression.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P3: This is a small byte-budget improvement without an established user-facing outage or urgent regression.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

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.

Reviewed November 6, 2026, 11:11 AM ET / 16:11 UTC.

@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Nov 6, 2026
@steipete
steipete enabled auto-merge (squash) November 6, 2026 16:20
@steipete
steipete disabled auto-merge November 6, 2026 16:27
@steipete
steipete merged commit c4f2ca1 into main Nov 6, 2026
131 of 133 checks passed
@steipete
steipete deleted the solid2/w-perf-chat-budget-followup-1106 branch November 6, 2026 17:04
@steipete

steipete commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with prior CI and scoped validation.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 7, 2026
…law#194203)

* perf(ui): restore chat budgets with browser-floor cleanup

Remove unsupported-platform branches and compile existing test hooks out of production. Consolidate redundant Dreaming CSS without changing computed styles. Chat falls 335 B normalized gzip from the merged baseline; total CSS returns below both caps. Lower New Session, shared-chunk, raw CSS, and startup baselines without raising Chat.

* test(ui): align browser fixtures with the supported platform
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. gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant