Skip to content

perf(ui): remove redundant first-screen boot work - #182945

Merged
steipete merged 2 commits into
mainfrom
solid2/w-boot-render-less-next
Oct 24, 2026
Merged

steipete merged 2 commits into
mainfrom
solid2/w-boot-render-less-next

Conversation

@steipete

@steipete steipete commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Chat boot still creates avoidable first-screen work and repeatedly collapses displayed pins while their query is replaced.

Related: #182814, #182825. Measured on current main 3df26eebaf4, including #182813.

User Impact

The synthetic desktop chat workload now reaches 136.5 ms median boot long tasks, below the 150 ms target. The final viewport, selectors, retained content, and saved-reader behavior are preserved. Displayed pins remain stable while their authoritative descriptor loads.

Why This Change Was Made

Create pane field signals only when a tracked reader first needs them, preserving synchronous plain-owner reads. Admit cold authenticated avatars in the next task and recheck the existing credential-scoped cache entry before fetching. Remember live displayed pins through the existing connection-scoped descriptor seed; a missing descriptor still removes the row. During hidden transcript fill, measure rows and decide whether to admit the next row in one pass instead of short-circuiting into another render/geometry pass.

No transcript scheduler, new cache, dependency, owner, or public API was added. The pin seed parameter now names only the descriptor fields it already copies.

Evidence

Acceptance recorded before measurement: twenty serial interleaved base/control/head triples; identical production bundles for the A/A control; fresh application storage, warm immutable server assets; 390 sessions, 30 pins, 240 messages, avatars enabled, 1719×1179. Production Gateway HTTP/assets with synthetic WebSocket RPCs and media. Untraced timing with renderer thread CPU; no concurrent local checks or builds. Host load was 60.9–79.1, so the A/A readiness spread is material. The retained head is within the 5% timing/CPU band against the faster control; no cell approaches a 20% regression.

Metric, median / p95 Base Identical control Head
Boot long-task sum, ms 206 / 403 200.5 / 240 136.5 / 246
Composer enabled, ms 327.9 / 491.1 272.4 / 340.8 282.85 / 348.9
Nonempty transcript, ms 690.9 / 871.8 623.4 / 761.9 632.05 / 728.4
Script CPU, ms 586.18 / 630.31 594.07 / 645.84 601.68 / 642.54
Task CPU, ms 1527.45 / 1965.94 1542.86 / 1900.90 1511.22 / 1916.13
Layout CPU, ms 46.32 / 51.25 46.13 / 50.85 42.65 / 47.08
Style CPU, ms 132.11 / 140.02 131.28 / 140.74 132.18 / 139.44
CLS 0.095 / 0.119 0.094 / 0.165 0.080 / 0.082
node --import ./scripts/tsx.mjs scripts/bench-control-ui-cold-load.ts \
  --bundle-dir <base> --compare-bundle-dir <identical-control> \
  --compare-bundle-dir <head> --gateway-http --first-load --face chat \
  --sidebar-avatars --runs 60 --untraced --thread-cpu-time --output <artifacts>

Remaining long-task owners and measured attempts

The following single CPU-profile captures identify owners; profiler overhead inflates their times, so they are not the acceptance timings above. Whole-task times are disjoint; source owners within each task overlap.

Rank Whole-task owners Base profile, ms Head profile, ms Restructuring attempted
1 Shell/sidebar window, Solid bridge, pane layout 220.365 202.885 Lazy field publications; retain live pins in the existing descriptor owner. Retained in the measured combined win.
2 Markdown sanitizer, transcript viewport and completion geometry 122.240 122.529 Progressive overscan and row-task scheduling were measured and rejected for no gain/readiness delay. Retained the smaller measurement-plus-admission change.
3 Authenticated avatars, row indicators and scroll geometry 90.242 65.651 Cold avatar admission crosses a task boundary; warm entries and shared pending requests retain their existing behavior.

Diagnostic layouts: 251 → 243; forced layouts: 125 → 119. No sanitizer or Markdown safety boundary changed.

Rejected prototypes were removed: progressive overscan had 193 → 196.5 ms long tasks; one-row scheduling reached 114.5 ms but delayed transcript readiness by 20.1%; two-row scheduling reached 71.5 ms but delayed it by 11.9%. These were separate paired experiments on the earlier base and are not compared numerically with the current-main run.

Checks, assets, and visual proof

  • Passed pnpm tsgo:ui, focused avatar/field/pin/rail/transcript-geometry tests, scoped oxlint, oxfmt, and the Control UI controller guard. Focused proof was reused across the disjoint main update; final type checking and broad PR CI cover the integrated head.
  • Production Knip reports four unused files outside the UI diff: extensions/codex/src/app-server/protocol-validator-schemas.ts, src/gateway/mcp-app-standalone-host.ts, src/gateway/worker-environments/repository-node-requirement.ts, and src/sessions/runtime-context.ts. The exact same four findings reproduce with the same production Knip command on pinned base 3df26eebaf4; no UI finding or new ignore was added.
  • Fresh independent P0–P2 autoreview: scoped-clean, no accepted/actionable findings.
  • Built base and head on this machine. Strict base/head comparison passes. Startup JS 281,280 → 281,222 B gzip, still 7 JS + 1 CSS request; startup CSS stays 40,097 B. Chat boot 1,270,968 → 1,271,120 B (+152 B), with request counts unchanged. Existing total CSS cap overrun is identical on both sides; this PR adds no CSS.
  • Inspected all 154 before / 161 after filmstrip frames and full screenshots: synthetic data only, unchanged settled viewport, no new blank flash or displacement. Existing transcript/widget settling remains; sidebar progression and CLS improve. The screenshots below are the settled before/after captures.
  • Solid refactor census in touched production files: tracked imperative escape-hatch calls, manual component loaders, component cleanup, and hand-written component construction remain 0 → 0. No new reactive owner mirror.
  • Simplification: discarded the new scheduler/channel machinery. Production LOC 1,376 → 1,395 (+19); test LOC 2,701 → 2,802 (+101) across touched files, including the new focused pin regression and deferred-admission updates to four existing avatar consumer suites.

The first full CI run (40136147144) caught 11 avatar assertions that assumed same-turn request admission across four existing consumer files. Those tests now wait for the observable request; fake clocks admit it before measuring the unchanged 30-second deadline. Authentication, cancellation, pending-preview, sharing, and cache-pressure assertions remain. All four files pass locally under pinned Bun (69 tests); the chat file was first run through the UI package’s Node entrypoint, then corrected to the root default runner for this proof; production code and measured bundles are unchanged by this test repair. These failures were treated as PR-caused, not inherited.

No remote compute lease or Docker was used. ci:full is selected for the shared boot path.

Before: synthetic desktop chat after boot

After: same synthetic desktop chat after boot

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 24, 2026
@clawsweeper

clawsweeper Bot commented Oct 24, 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 24, 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-24T22:13:10.247465Z 89e07a9 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.

@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 24, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 24, 2026
@clawsweeper

clawsweeper Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR defers unnecessary chat boot work, preserves displayed pins during query replacement, and combines transcript measurement with initial-row admission.

Example: Open the synthetic desktop chat with 390 sessions, 30 pins, and 240 messages.

  • Before: Reported median boot long-task time is 206 ms, with 200.5 ms for the identical control.
  • After: Reported median boot long-task time is 136.5 ms with the same settled viewport.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, useful optimization with controlled renderer measurements, inspected visual evidence, retained lifecycle contracts, and green exact-head CI.
Proof confidence 🐚 platinum hermit (4/6) This maintainer-authored PR is outside the contributor-proof gate; supplied production-bundle measurements exercise cold chat rendering through Gateway HTTP/assets with synthetic RPC/media, and inspected screenshots show the preserved settled viewport.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Chat opening performs avoidable main-thread work and temporarily collapses displayed pins during query replacement.
Reason: The maintainer-authored direction has a measured renderer benefit, bounded implementation cost, and explicit acceptance of the reported timing spread.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR provides a measured boot improvement, preserves existing owners, and has no actionable correctness or security findings; the exact-head CI gate is green.

Priority: P2
Reviewed head: 89e07a973a00dd698061a4dffd5a033e8d037981

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied screenshots show settled boot rather than pin query replacement, and a base-red/head-green run of the new pin regression is not documented.
Agent review details

How this fits together

The Control UI projects synchronous pane state, session descriptors, authenticated avatar resources, and transcript geometry into the visible chat interface.

flowchart TD
  A[Gateway session data] --> B[Existing sidebar descriptor owner]
  B --> C[Visible pins]
  D[Synchronous pane state] --> E[Lazy field publications]
  E --> F[Chat interface]
  G[Credential scoped avatar loader] --> F
  H[Transcript measurement and admission] --> F
Loading

Technical review

Best possible solution:

Retain the focused optimization within the existing publication, descriptor, avatar, and transcript owners.

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

Current-main source establishes eager publication and avatar work, while the supplied production-bundle benchmark demonstrates the renderer workload and its measured improvement.

Is this the best way to solve the issue?

The patch uses existing owners, preserves synchronous reads and descriptor authority, and removes redundant work without introducing another scheduler or cache.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Synchronous chat-field publication keeps the original intent (870608b: Publish independent history fields to Solid while preserving synchronous owner reads and retained startup ownership.)
  • Pinned-session descriptor owner keeps the original intent (6443c30: Replace the rendering-controller lifecycle with one connection-scoped synchronous cache, retaining loaded-row precedence and stale-result rejection.)
  • Authenticated avatar admission changes intended behavior with a stated reason (0b715e3: Keep authenticated avatar loading within the existing browser-safe resource contract and lazy presentation boundary.)
  • Initial transcript measurement and admission changes intended behavior with a stated reason (ff2c841: Grow the measured tail until viewport coverage before resuming overscan, while preserving saved-reader restoration.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Verified introduced patch: The pinned merge-base-to-head diff contains focused changes to four existing production owners and their tests. (89e07a973a00)
  • Current-main comparison: Fetched main retains eager field publications, immediate cold-avatar admission, and the previous pin and transcript paths, so the introduced improvement remains distinct. (ui/src/pages/chat/chat-field-projection.ts:20, 0e6e2311fbd6)
  • Deferred avatar context remains current: Cold admission checks that its cache entry remains current before authenticated I/O; context replacement clears entries and aborts existing requests, while publication retains its existing stale-entry check. (ui/src/lib/identity-avatar-loader.ts:78, 89e07a973a00)
  • Existing pin authority retained: Live rows seed the existing connection-scoped descriptor owner; authoritative absence still removes the displayed row without deleting its saved shortcut. (ui/src/components/app-sidebar-personal-navigation.ts:214, 89e07a973a00)
  • Measured renderer improvement and inspected screenshots: The PR records twenty interleaved base/control/head triples through production Gateway HTTP/assets with synthetic WebSocket data; downloaded before/after screenshots preserve the settled layout, and the maintainer explicitly accepts the recorded five-percent timing/CPU band. (89e07a973a00)
  • Exact-head CI gate: Live REST status reports success for openclaw/ci-gate, dependency review, and security-sensitive review on the reviewed head; cancelled auxiliary checks establish no patch-caused failure. (89e07a973a00)

Likely related people:

  • Peter Steinberger: Raw commit 870608b adds ui/src/pages/chat/chat-field-projection.ts:18 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 870608b7a6c3; files: ui/src/pages/chat/chat-field-projection.ts)

PR surface

Source +19, Tests +101. Total +120 across 11 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 4 35 16 +19
Tests 7 136 35 +101
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 171 51 +120

Review metrics

Metric Value Why it matters
Production versus test LOC Production +35/-16, net +19; tests +136/-35, net +101. Growth is bounded to existing owners, focused lifecycle regressions, and consumer assertions updated for deferred request admission.

Labels

Label changes:

  • add P2: This improves normal chat startup responsiveness and pin stability without evidence of an urgent broken core workflow.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: This improves normal chat startup responsiveness and pin stability without evidence of an urgent broken core workflow.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • 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 October 24, 2026, 6:27 PM ET / 22:27 UTC.

@steipete
steipete merged commit 3f1e3f5 into main Oct 24, 2026
115 of 118 checks passed
@steipete
steipete deleted the solid2/w-boot-render-less-next branch October 24, 2026 22:32
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 25, 2026
* perf(ui): remove redundant first-screen boot work

* test(ui): await deferred avatar request admission
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. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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