Repository navigation
perf(ui): defer detailed tool rendering from chat boot - #181052
Conversation
|
🦞👀 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 258e9d7f88
ℹ️ 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".
| : resolveToolRowText(card(), view(), outcome()) | ||
| } | ||
| onClick={toggle} | ||
| <ChatImportBoundary |
There was a problem hiding this comment.
Share stale-chunk recovery across tool rows
When a Gateway update makes the new lazy row chunk stale and a transcript contains multiple tool cards, this mounts a separate ChatImportBoundary for every card even though all cards share one global recovery in stale-chunk-reload.ts. If any failed row is removed or its identity changes while automatic recovery is pending, that boundary's cleanup calls cancelStaleChunkRecovery(), aborting the shared recovery while the other failure surfaces remain mounted and do not re-arm it; users are then left with per-row errors requiring manual reload. Keep one recovery owner for the shared import, or make cancellation reference-counted/source-specific rather than letting each row retire global recovery.
AGENTS.md reference: AGENTS.md:L20-L20
Useful? React with 👍 / 👎.
|
Codex review: needs changes before merge. What this changesThis PR lazily loads detailed chat tool rows, standalone tool summaries, and expanded-tool English copy. Example: Open Chat with a transcript containing no visible tools.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 2 items remain Keep this PR open: it provides a useful, measured boot reduction, but shared recovery cancellation and one remaining test-readiness failure need focused repairs. Priority: P2 Before merge
Findings
Agent review detailsHow this fits togetherThe Control UI turns transcript messages and tool cards into summaries and expandable output; this change moves detailed presentation behind lazy imports while retaining existing permission, plugin, and transcript owners. flowchart TD
A[Transcript messages] --> B[Message preparation]
B --> C[Eager tool facade]
C --> D[Permission and plugin views]
C --> E[Chat import boundary]
E --> F[Lazy detailed rows]
F --> G[Expanded tool output]
Technical reviewBest possible solution: Retain the lazy split, fix sibling recovery retirement in the existing recovery owner, and make the duration test await the resolved summary. Do we have a high-confidence way to reproduce the issue? Current-main imports establish the eager-loading path, source establishes shared cancellation, and current-head CI records the summary-readiness failure; this review executed no target code. Is this the best way to solve the issue? The split reuses existing presentation and import owners without introducing a competing renderer, but recovery retirement must account for multiple failed rows. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a6c561f954c4. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +151, Tests +216, Other +31. Total +398 across 31 files. Added test files: 2. View PR surface stats
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 October 22, 2026, 7:18 PM ET / 23:18 UTC. |
|
Merged via squash.
|
* perf(ui): defer detailed tool rows from chat boot * perf(ui): ratchet chat boot budget after tool split * test(ui): await loaded tool rows before interaction * test(ui): await deferred work disclosure content * perf: ratchet integrated chat tool boot budget
What Problem This Solves
Chat downloads detailed tool-argument parsing and formatting before it can show a transcript, even when the first visible messages contain no tools.
User Impact
The current integrated build transfers 12,013 fewer Chat gzip bytes (0.85%) with the same 24 critical requests. Startup shrinks by103 bytes; New Session changes by−15 bytes, within build variance. Tool rows preserve their existing layout while their detailed summary loads; import failures offer Reload without disabling the composer.
Why This Change Was Made
Move the detailed tool-row renderer and standalone tool-message summary behind the existing
ChatImportBoundary. The eager facade still owns plugin replacements, permissions, progress receipts, approvals, browser previews, and expanded-body selection. Shared chrome stays in a leaf module, so the lazy row does not import back into its facade. Fourteen expanded-tool English strings load with the existing output/expanded views.The resolved label/icon identity is now a small shared leaf; full tool-display parsing no longer runs during every message's eager preparation. Ten modules leave the chat boot graph:
tool-call-view,tool-call-patch,tool-display,tool-display-common,tool-display-exec,tool-display-exec-shell,chat-command-highlight(component and helper),chat-diff-stat, anddedupe-by-key. Three lightweight leaves enter:chat-tool-card-chrome,tool-display-identity, andtool-display-name. The original top-30 and full feature attribution is recorded in #180852; module-level gzip is diagnostic and non-additive.Evidence
Current integrated comparison: baseline source
87a94c4b4236ccaded2cd75790032122037d5a66, integrated source18fce985d1c926824cd163c325c081ddce8fbd79(merges current maincba956feca63b163119f81a704c1f99f84077344). The intervening main commit changes no UI inputs. Both builds use identical explicit build identity, timestamp, and prepared native plugin distributions; all four previously missing native packages were copied from the baseline before the candidate build. The fixed build stamp is intentionally shared for comparison and is not source provenance. Full module attribution is retained for both bundles.Strict performance comparison passed with no violations. The Chat cap is ratcheted from main's1,469,628 to1,457,159 B (
floor(1469628*1403881/1415894), the same relative headroom). The earlier canonical--update-baseline --reasonstartup reduction to315,881 B is retained; the integrated fixed-stamp measurement does not raise that budget. Main's tighter New Session929,032 B and request caps are retained. The cap-only follow-up changes no bundle input. This is a focused saving toward the campaign target, not a claim that the full15% Chat target is reached.The original runtime comparison used base
013240515205573248c27ab6b8eec7303f0da1a8and runtime head258e9d7f88cb34c555150b87e7db9e89d916f360: startup315,953→315,881 B, Chat1,417,608→1,405,648 B, New953,730→953,730 B; requests7/24/19 unchanged. The following timing measures those original exact bundles. Main integration and the cap conflict resolution do not change this PR's runtime implementation; timing remains prior-runtime evidence, not a fresh integrated-head timing claim.Cold HTTP-cache reloads used the same exact base/head bundles, an untraced production preview, and the committed comparison driver
66ac6866a2d(SHA-256cc7ad23fdfdd76451c59a0e5dd3a5b31bd34f7afe820b7956e8fcc95ce19d991). Observed Testbox hardware was 4 usable CPUs and 16.6 GB RAM. Owned Testbox workflow.The first 10 pairs missed the gate (transcript median +6.10%, p95 +19.10%; composer +6.19%, +19.12%). One additional 10-pair batch on the same live lease resolved the noisy result (transcript +0.33%, −17.98%; composer +0.32%, −17.95%). Every sample from both batches is included above; acceptance was unchanged at median no more than +5% and p95 no worse. Before sampling, a missing locked package in the hydrated candidate required a frozen install; the original comparison driver also needed the committed cold-cache support. Those setup attempts produced no timing samples. No measured batch was discarded.
Original-runtime validation passed UI and tooling typechecks, targeted lint/format, production Knip, locale verification, and the affected Markdown/tool lifecycle/lazy-loading tests. Current integrated validation passes UI typecheck and the strict byte comparison; production Knip has the same nine findings as the matched base, as detailed below. Lazy loading covers retry, stale identity retirement, current props, retained row DOM, and both row shapes. Fresh isolated review found no actionable P0–P2 issue.
CI run 39867426608 exposed four tests that observed the disabled loading row before the real control arrived: persisted tool-step reasoning, oversized transcript recovery, bubble tool activity, and legacy tool-card focus retention. The repair waits for actual row/output readiness without weakening the ordering, full-output, or retained-focus assertions. All 44 tests across those four files pass locally; UI typecheck, formatting, and a fresh isolated P0–P2 review pass. No production changes were needed for these failures. The previous auto-merge intent was confirmed cancelled before pushing the repair.
The replacement run 39868742696 exposed one further readiness assertion in
chat-transcript-duration.test.ts(work disclosure after parent rerender). It now waits for the actual tool name before checking the unchanged open/close behavior. All 8 tests in that file pass; fresh isolated review is clean. No production change was needed. The only remaining E2E failure wasNative plugin UI ownership > loads without asset grants for auth:none and preserves canonical chat admission and view recovery(composer fade/padding assertions); the exact same test and assertions also fail in the latest completed scheduled main run 39865398397, headb409de26a2f5187c1f34eec8ae3cac6a9755ca58. Both exact job logs are retained. All other UI, E2E, browser-extension, and real-Gateway shards in run 39868742696 passed. Final exact-head run 39871128519 at18844f4797f5f6c4b9cbb935243487d953757b5cis fully green, including all UI unit, Control UI E2E, browser-extension, and real-Gateway shards. That is prior-head CI evidence. The current-main integration is now covered by the green exact-head run 39873882783; the older runs remain historical evidence.Production TS/TSX in the changed scope: 6,911 → 7,105 lines (+194); tests/support in the final changed-file scope: 2,560 → 2,776 (+216). Most of the diff moves existing row rendering. Added code supplies loading placeholders, boundary wiring, shared leaves, and optional-copy registration; it adds no state owner. Touched chat code keeps the same effect, untrack, cleanup, and signal counts; two lazy boundaries are added. The cap-only follow-up changes two existing files with +4/−4 lines.
All screenshots use synthetic data at 1280×900. Normal rows and standalone summaries retain the same 25.5 px height before, while loading, and after resolution.
Before, loading, after, and failed-import recovery UI
Main integration resolved only the performance-cap conflict: retained main’s tighter New Session/request limits and the existing lower startup baseline, then applied the current matched Chat ratchet. Fresh isolated review found no actionable P0–P2 issue; UI typecheck passed. Production Knip reports the same nine findings as the matched base, byte-for-byte (four unused-export groups and five unused-type groups); no new finding. Current exact-head full CI 39873882783 is green at
b4f110dfd3d0e10ecded1786135afe77b8bb1492: all nine Control UI E2E shards, both real-Gateway shards, all three UI unit shards, types, lint, performance, andopenclaw/ci-gatepassed.Combined main checkpoint — 2026-10-23 UTC
Measured source:
4f8cf06b18925ff494a305ac364cdbb8271227fe, after the emoji deferral and other intervening main changes. This is a current-main census, not additional savings attributed to this PR. The PR-specific before/after, screenshots and timing above remain unchanged.Module gzip is diagnostic and nonadditive: each module’s generated ranges are independently compressed. These weights neither allocate actual chunk transfer nor predict bytes removable by a deferral. Route totals include startup. Full generated-range attribution covers 1,829 unique emitted modules (1,734 Chat, 1,219 New Session); every module belongs to one feature group. Mapped plus unmapped raw ranges reconcile exactly with emitted JS. All 36 relevant assets and 1,680 tracked source files match the pinned source and sourcemaps, with no hash mismatches. The sole missing disk source is Vite’s virtual browser external. All 29 prepared plugin input hashes match the shared baseline.
The HTML deliberately retains the fixed comparison metadata naming
87a94c4b4236ccaded2cd75790032122037d5a66; that is not this census’s source commit. This uses the existing matched production build; no new timing result is claimed. The full emoji table/plugin and New Session MarkdownIt are now absent, as are syntax-highlighter, math and diagram runtimes. Online and person-card PRs are not included in these figures.Chat top 30 generated modules and first-paint assessment
Chat top 30 modules
ui/src/i18n/locales/en.tsnode_modules/markdown-it/dist/markdown-it.mjsnode_modules/entities/dist/generated/decode-data-html.jsnode_modules/dompurify/dist/purify.es.mjsui/src/i18n/locales/en-chat-session.tsnode_modules/@solidjs/web/dist/web.jsnode_modules/@tanstack/virtual-core/dist/esm/index.jsnode_modules/@solidjs/signals/dist/prod/store/store.jsui/src/lib/chat/composer-draft-store.runtime.tsnode_modules/remend/dist/index.jsui/src/pages/chat/chat-pane-render.tsui/src/pages/chat/components/chat-composer-view.tsxui/src/i18n/locales/en-chat-composer.tsui/src/i18n/locales/en-session-organization.tsui/src/components/icon-data.tsui/src/pages/chat/chat-pane-sidebar-view.tsxnode_modules/@openclaw/uirouter/dist/index.jsui/src/components/select-picker-view.tsxui/src/app/app-shell-view.tsxui/src/components/icon-data-tools.tsui/src/app/app-root.tsxui/src/pages/chat/chat-pane-header.tsnode_modules/@zag-js/menu/dist/menu.machine.mjsui/src/pages/chat/chat-view.tsxui/src/pages/chat/components/chat-composer-controls.tsxui/src/components/app-sidebar-render.tsxui/src/pages/chat/chat-pane-lifecycle.tsui/src/pages/chat/components/chat-transcript-projection.tsui/src/pages/chat/chat-pane-layout-render.tssrc/logging/redact-patterns.tsNew top 30 generated modules and first-paint assessment
New top 30 modules
ui/src/i18n/locales/en.tsnode_modules/@solidjs/web/dist/web.jsnode_modules/@solidjs/signals/dist/prod/store/store.jsui/src/lib/chat/composer-draft-store.runtime.tsui/src/i18n/locales/en-chat-composer.tsui/src/components/icon-data.tsui/src/pages/new-session/composer.tsxnode_modules/@openclaw/uirouter/dist/index.jsui/src/components/select-picker-view.tsxui/src/app/app-shell-view.tsxui/src/components/icon-data-tools.tsui/src/app/app-root.tsxnode_modules/@zag-js/menu/dist/menu.machine.mjsui/src/pages/chat/components/chat-composer-controls.tsxui/src/components/app-sidebar-render.tsxui/src/i18n/locales/en-new-session-setup.tssrc/logging/redact-patterns.tsui/src/components/app-sidebar-rail.tsxui/src/components/app-sidebar-session-row-render.tsxui/src/api/gateway.tsui/src/pages/chat/components/chat-effort-picker.tsxpackages/gateway-protocol/src/session-agent-status.tsui/src/components/solid/session-presentation.tsxui/src/pages/new-session/draft-submission-flow.tsui/src/pages/new-session/new-session-page.tsxui/src/lib/sessions/index.tsui/src/app/bootstrap.tsui/src/app/app-host.tsxui/src/app/gateway-store.tsui/src/components/app-sidebar-session-navigation.tsAll 49 feature groups above 10,000 B and first-paint assessment