Repository navigation
perf(ui): defer startup error graph and rich toast styles - #193385
Conversation
Keep redacted connection summaries and scope guidance available when optional chunks cannot load. Preserve protocol exports through narrow error modules, and retain a visible toast fallback with Retry and Dismiss while deferring the rich notification styles.
Move the unchanged error stringifier to a leaf module and retain its existing exports. Narrow startup consumers so the full cause graph no longer shares the connection entry chunk, and preserve scope recovery wording without allocating a lookup map.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs changes before merge. What this changesThis PR defers detailed connection diagnostics and rich toast styles while preserving readable offline recovery controls. Example: The production Control UI cannot download the toast renderer while offline.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 2 items remain Keep this PR open: the startup reduction is useful, but extracting the stringifier breaks PR-tooling bootstrap and leaves the coercion guard registered against its old location. Priority: P2 Before merge
Findings
Agent review detailsHow this fits togetherThe Control UI converts Gateway and browser failures into redacted messages; its existing lazy toast renderer presents notifications, while shared normalization helpers also serve extracted maintainer tooling. flowchart TD
A[Gateway and browser failures] --> B[Connection summary]
B --> C[Immediate redacted guidance]
B --> D[Lazy detailed formatter]
E[Toast owner] --> F[Lazy renderer and rich styles]
E --> G[Eager recovery controls]
Technical reviewBest possible solution: Retain the leaf extraction and existing UI owners, then update the wrapper inventory and canonical-helper registrations together. Do we have a high-confidence way to reproduce the issue? Source inspection establishes both incomplete cutovers, and exact-head CI independently records the extracted-wrapper module failure; no local execution was performed. Is this the best way to solve the issue? Deferring optional diagnostics and styles through existing owners is appropriate, provided the helper move also updates its extraction and guard consumers. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7ec1d3e861ce. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +85, Tests +98, Config +8, Other +2. Total +193 across 31 files. Added test files: 2. View PR surface stats
Preflight sourceSource 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
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 5, 2026, 5:18 AM ET / 10:18 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…93385) * perf(ui): defer connection diagnostics and rich toast styles Keep redacted connection summaries and scope guidance available when optional chunks cannot load. Preserve protocol exports through narrow error modules, and retain a visible toast fallback with Retry and Dismiss while deferring the rich notification styles. * perf(ui): isolate transport coercion from diagnostic graph Move the unchanged error stringifier to a leaf module and retain its existing exports. Narrow startup consumers so the full cause graph no longer shares the connection entry chunk, and preserve scope recovery wording without allocating a lookup map. * fix(ui): complete startup error leaf integration * test(ui): keep offline toast fixture within allocation * test(ui): stabilize phone session fixture ordering * test(ui): select regular Chromium scope explicitly * test(ui): prepare inline history adapter before browser assertions
What Problem This Solves
Connection error handling pulled the full cause-graph formatter and protocol detail registry into the initial Control UI bundle. Rich toast styling also loaded before any toast appeared. Related: #192419, #192057.
User Impact
Startup downloads less JavaScript and CSS. Network failures and access guidance remain readable offline. If the lazy toast renderer fails, its message, Retry, and Dismiss controls remain visible instead of collapsing into a blank card.
Why This Change Was Made
Keep a synchronous, redacted connection summary available before optional chunks load, and defer full native error formatting. Preserve the public protocol exports while extracting narrow discriminants and the missing-scope reader. The remaining eager graph came from low-level transports importing a one-line stringifier from the full error module; give that unchanged helper a leaf entry and migrate all three Gateway client callers, preserving the original re-exports.
Load rich toast styles with the existing lazy renderer and retain its minimal fallback layout in startup CSS. Native completion remains owned by the existing pending-request map, so late formatting cannot revive a cancelled request. No new dependencies or user configuration options. No asset caps or baselines are raised.
Evidence
Same-machine production builds compare
ef81b2545c8cwith this head, with build metadata pinned identically. The strict base comparison passes. The full error-graph module is absent from the initial chunk; only its one-line coercion leaf remains there.The absolute total-CSS and route caps already failed on the base. All these surfaces shrink; no cap or baseline was raised. Startup JS also returns below its absolute enforcement limit.
All 360/360 observations passed: 20 interleaved base/head/A–A sets for cold and warm boot at local, 100 ms, and 250 ms latency. Headless Chromium used production bundles, a synthetic Gateway, and renderer thread CPU counters. Warm boot is a same-context reload; request routing disables HTTP cache, so this is application-state warmth rather than an HTTP-cache benchmark.
Readiness medians move by at most 0.5%. Warm local p95 moves +1.2% and warm 250 ms p95 +3.1%; the unchanged local A/A control moves +14.0%, demonstrating host noise. Per the noisy-host rule, the CPU and structural evidence qualify the result: head/base median script CPU ranges −1.0% to +2.1%, median task CPU −1.5% to +0.7%; no CPU cell approaches the 5% band. Warm 250 ms script/task p95 improve 3.5%/2.1%. Startup request counts remain unchanged. This is a byte reduction with readiness preserved, not a claimed latency speedup.
Validation: UI typecheck; scoped lint/format; controller guard; production Knip; normalization package build; 42 error-formatting tests, 34 native authorization tests, existing failed-import toast recovery, the real-browser fallback-layout regression, 86 normalization/request/handshake assertions, and 44 Vite-config assertions. The browser regression initially failed at Vitest mock setup; it now throws from the isolated renderer and passes, while the existing Node test and production capture cover actual chunk rejection.
The before/after screenshots use only synthetic data, in headless Chromium at 1440 px and 390 px. Normal toast geometry is unchanged. Offline fallback height changes from a blank 24 px card to a readable 52 px card; dismissal works and no page errors occur. Captures block both the toast chunk and the stale-asset HEAD probe to represent an actually offline browser.
Touched-file LOC: production 8,173 → 8,244 (+71); tests 2,589 → 2,689 (+100); tooling/config 8,686 → 8,716 (+30). Most CSS moves unchanged. In the two touched Solid views: effects, cleanup hooks, listeners, DOM queries, flushes, and owner APIs remain 0 → 0; memos remain 5 → 5 and lazy boundaries 1 → 1.
CSS attribution
The historical 2.8 KB growth spans components (~1,226 B gzip, including ~808 B of toast rules), mobile layout (~683 B), base styles (~558 B), and controls. Substitution estimates are not additive. Mobile header and control styles are needed for first paint; this change defers the rich toast subset. All 716 inspected selector/declaration entries remain represented.
CI and review
Independent review covered the full change and each substantive follow-up, with no remaining P0–P2 findings. CI caught missing canonical/wrapper inventory entries after moving the stringifier, a missing severity in the browser fixture, and two stale fixture assumptions. These are fixed: the toast fixture stays within its original line allocation, phone-session rows use equal fixed timestamps, and the browser-config test selects a named normal Chromium file instead of filesystem discovery order.
Additional focused proof: coercion guard and affected test-typecheck; 23 wrapper-closure assertions; the 16 provisioning cases initially failing in CI; 40 session-view tests; seven browser-config tests. The production bundle is unchanged by these test/tooling follow-ups.
A separate Darwin-only provisioning test (
materializes full cold/warm PR siblings, then preserves native sparse transitions) timed out at its existing 120-second limit both on this change and untouched baseef81b2545c8c. That remains recorded as a failed local check; no timeout was raised.CI run 42016335435 completed with 137 successful jobs, 20 skipped jobs, and two failed test jobs plus the aggregate gate. The Gateway case
preserves restricted Goal returns and cancels revoked returns before further effectsreproduces with the same assertion on untouched baseef81b2545c8c; its test and policy inputs also match the actual CI base and tested merge.The initial Incognito timeout passed on the one CI retry, as well as focused local runs on the original base, actual CI base, and PR head. That retry exposed a different failure: Slack inline identity exhausted its existing 30-second assertion window while its in-process Gateway spent 28 seconds loading the persisted-history adapter. Prepare that adapter after fixture seeding, before Gateway startup. This test-only change does not start a worker/read a database early, send a warm-up RPC, or change assertions/timeouts. Its focused test, matching test typecheck, lint, formatting and independent review pass. Final exact-head CI run 42024449568 completed with 139 successful jobs and 20 skipped. Both real-Gateway shards (including Slack and Incognito), all remaining UI checks, and
security-fastpassed. The only test failure is the exactly reproduced inherited Gateway assertion above, plus its aggregate gate. Landed through native inherited-failure recovery asdfbd7d5cc2f3b258a9a2cc2233c8d5863c6e5d65, with current checkout, unchanged-input, and baseline evidence; failed CI is not described as green.