Skip to content

perf(ui): load expanded tool details on demand - #174866

Merged
steipete merged 5 commits into
mainfrom
solid2/w-perf-tool-details
Oct 17, 2026
Merged

steipete merged 5 commits into
mainfrom
solid2/w-perf-tool-details

Conversation

@steipete

@steipete steipete commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Collapsed chat tool rows loaded the full expanded tool and diff renderer to show a summary and change counts.

User Impact

Chat boot downloads 6,455 B less gzip JavaScript and 70 B less gzip CSS, with no extra boot requests. Expanded cards keep the same content, controls, and host tags; their renderer loads on first expansion. Initially expanded cards load it immediately.

Why This Change Was Made

Keep raw-output/status hosts and small diff-stat chips eager; move the full tool renderer behind a local Solid loading boundary. Existing callers and registered tags share that renderer. Separate diff-stat chips from the full diff presentation so collapsed rows do not import it. The raw-output disclosure now uses local Solid state instead of querying and changing its own DOM.

The final simplification removes an unnecessary fragment and an intermediate default-value constant. There are no new owners or dependencies. New Session's small 128 B increase and startup's 98 B increase are import-reference changes from regrouping; both remain within existing budgets.

Evidence

Same machine/toolchain. Gzip totals include build-metadata variance. Comparison merge base: 02d223bd10cfc27c224bdcd25ae96f2ce7728d31; head: da7bece1d71789775dd883fb7aa77105edfa5165.

Metric Base Head Change
Startup JS gzip 340,552 B 340,650 B +98 B
Chat boot JS gzip 1,624,347 B 1,617,892 B -6,455 B
New Session JS gzip 1,312,642 B 1,312,770 B +128 B
Startup / chat / new JS requests 7 / 30 / 27 7 / 30 / 27 0
Startup CSS requests 1 1 0
Chat CSS gzip 131,210 B 131,140 B -70 B
New Session CSS gzip 108,600 B 108,600 B 0
  • Base/head production builds and strict comparison: pass, zero violations.
  • Canonical cold/warm boot-manifest generation: pass; the expanded tool and full diff renderer leave the captured boot module list.
  • pnpm tsgo:ui: pass.
  • New delayed-import regression, existing tool-card tests, and inline-diff tests: 41 cases pass. The raw-output assertion now waits for Solid's commit; only that initially failing case was rerun after correction.
  • The delayed-import test verifies collapsed cards do not load details, collapsing during loading stays closed, and reopening displays current content.
  • Focused Solid/syntax lint, formatting, and git diff --check: pass.
  • pnpm deadcode:knip: pass.
  • Independent Codex review: no actionable P0–P2 findings. Final simplification is the equivalent fragment/default-constant removal.
  • Full UI proof selected with ci:full. No stylesheet or final rendered-content changes; screenshots are not applicable.
Scoped count Before After
Production TypeScript/TSX LOC 2,954 2,953
Generated manifest LOC 2,677 2,676
createEffect / createRenderEffect 3 / 0 3 / 0
untrack / owner capture 4 / 1 4 / 1
Own-DOM query 1 0
Native listeners / production flush 3 / 0 3 / 0
Existing class-token joins 2 2

The existing diff-fetch/highlighter effects and per-file source/presentation lifetimes are unchanged. Diff-panel edits only change its stats import; this PR adds no effect, subscription, or owner capture.

Final-head verification

f4b1617d2a55 incorporates current main and regenerates the only conflict, the boot manifest, with the canonical capture tool. Runtime renderers merge cleanly. UI types, production Knip, the production build, and strict performance check pass: startup 340,973 B gzip, chat 1,593,217 B / 30 requests, New Session 1,285,877 B / 27 requests, one startup CSS request, zero violations. These integrated totals include other landed optimizations; the paired table above isolates this renderer change.

The widget raw-details menu computes its next label before requesting the queued Solid toggle. Two canvas fixtures now supply a test-owned ApplicationContext while pending imports settle. All 79 message tests pass without unhandled errors, and the 39 targeted correction tests pass. No assertions were removed or weakened.

Full CI run 38993017434 passes every selected UI unit, Control UI E2E, browser-extension, and real-Gateway job. The only failed root job is the mock-export ratchet: src/cli/update-cli/update-command-service-maintenance-native.test-support.ts:52, mocking ./update-command-database-context.js. Latest scheduled main run 38991549274 fails the identical case. The complete update-cli tree, checker, and baseline are byte-identical between the actual CI main parent and tested merge. Landing uses the authorized native inherited-failure route; failed CI is not claimed green.

@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.

@steipete
steipete marked this pull request as ready for review October 17, 2026 00:05
@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-17T01:59:53.011056Z f4b1617 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:feature Preliminary submission classification; full source review pending. 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
@clawsweeper

clawsweeper Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR defers expanded chat tool details and full diff rendering until a tool card is expanded.

Example: Open Chat with collapsed exec and file-edit tool rows.

  • Before: Chat boot loads the expanded tool and full diff renderer.
  • After: Those renderers load on expansion; the PR reports 6,499 fewer gzip JavaScript bytes at chat boot.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The measured optimization has clear value, but two source-established UI regressions and affected test failures block merge.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor-proof gate; its body reports production boot captures and bundle comparisons, while supplied tests exercise delayed loading without an inspectable browser interaction artifact.
Patch quality 🦪 silver shellfish (2/6) 3 actionable review findings remain.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Collapsed chat tool rows download detail-rendering code before the user opens them.
Reason: The maintainer-authored direction reduces measured chat boot bytes through the existing expansion boundary without adding configuration or dependencies.

Merge readiness

⛔ Needs changes before merge - 3 items remain

Keep this useful, maintainer-authored performance PR open; repair the widget-menu regression, frozen diff-stat visibility, and affected asynchronous test assertions before merging.

Priority: P2
Reviewed head: 090d98b6366c925fb57eda82b1b266ea287c178a

Before merge

  • Synchronize the widget menu with deferred disclosure state (P2) - Changing RawOutputToggle to a signal defers its aria-expanded update. handleWidgetExportAction in widget-card-view.tsx clicks this button and immediately reads that attribute to select the next menu caption, so opening raw details leaves the menu saying Show raw details and closing them selects Hide raw details. Exact-head CI confirms this at chat-message.mcp-app.test.ts:75. Update the widget caller to consume the disclosure's committed state or explicit next state; also await committed state in the affected raw-output assertions.
  • Keep the outer diff-stat condition reactive (P2) - The extracted component evaluates its outer ternary once in the component body, whereas the previous fragment kept the condition inside JSX. SessionDiffPanel retains its summary across refreshes and supplies totals with modified: 0. If it initially has no changes, this function returns null permanently; adding a file and refreshing updates the file list but never shows summary counts. Restore the fragment expression or use Show so zero-to-nonzero transitions remain reactive.
  • Await lazy details in existing expansion tests (P2) - The new import makes detail rendering asynchronous, but existing expansion tests still assert after a click or the parent updateComplete alone. Exact-head CI fails chat-transcript-recovery.test.ts:148 with missing terminal output and chat-tool-turn-outcome.e2e.test.ts:358 with zero offset labels. Update those tests to await the actual expanded content through their existing settling or polling helpers while retaining their assertions.

Findings

  • [P2] Synchronize the widget menu with deferred disclosure state — ui/src/pages/chat/components/chat-tool-content.solid.tsx:28-29
  • [P2] Keep the outer diff-stat condition reactive — ui/src/pages/chat/components/chat-diff-stat.solid.tsx:5-6
  • [P2] Await lazy details in existing expansion tests — ui/src/pages/chat/components/chat-tool-content.solid.tsx:15-16

Tests

  • Missing end-to-end proof: No inspectable shipped-browser expansion trace is supplied, and the delayed-import regression is not shown failing on the base.
Agent review details

How this fits together

The Control UI converts tool-call records into compact transcript rows and expanded details; this change separates eager summaries from dynamically imported detail rendering.

flowchart TD
  A[Tool call records] --> B[Chat tool rows]
  B --> C[Eager summaries and diff counts]
  B --> D[Expansion boundary]
  D --> E[Lazy detail renderer]
  E --> F[Output and full diffs]
Loading

Technical review

Best possible solution:

Retain the lazy renderer split while preserving reactive diff-stat visibility, synchronizing widget disclosure labels, and awaiting asynchronous content in affected tests.

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

Source establishes both runtime regressions, and exact-head CI independently confirms the widget-label failure; no target code was executed during this read-only review.

Is this the best way to solve the issue?

Deferring the existing renderer at expansion is a focused performance improvement, but removing the reactive fragment and changing disclosure commit timing require corresponding contract repairs.

Full review comments:

  • [P2] Synchronize the widget menu with deferred disclosure state — ui/src/pages/chat/components/chat-tool-content.solid.tsx:28-29
    Changing RawOutputToggle to a signal defers its aria-expanded update. handleWidgetExportAction in widget-card-view.tsx clicks this button and immediately reads that attribute to select the next menu caption, so opening raw details leaves the menu saying Show raw details and closing them selects Hide raw details. Exact-head CI confirms this at chat-message.mcp-app.test.ts:75. Update the widget caller to consume the disclosure's committed state or explicit next state; also await committed state in the affected raw-output assertions.
    Confidence: 0.99
  • [P2] Keep the outer diff-stat condition reactive — ui/src/pages/chat/components/chat-diff-stat.solid.tsx:5-6
    The extracted component evaluates its outer ternary once in the component body, whereas the previous fragment kept the condition inside JSX. SessionDiffPanel retains its summary across refreshes and supplies totals with modified: 0. If it initially has no changes, this function returns null permanently; adding a file and refreshing updates the file list but never shows summary counts. Restore the fragment expression or use Show so zero-to-nonzero transitions remain reactive.
    Confidence: 0.98
  • [P2] Await lazy details in existing expansion tests — ui/src/pages/chat/components/chat-tool-content.solid.tsx:15-16
    The new import makes detail rendering asynchronous, but existing expansion tests still assert after a click or the parent updateComplete alone. Exact-head CI fails chat-transcript-recovery.test.ts:148 with missing terminal output and chat-tool-turn-outcome.e2e.test.ts:358 with zero offset labels. Update those tests to await the actual expanded content through their existing settling or polling helpers while retaining their assertions.
    Confidence: 0.97

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 4a790aea80ae.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test ui/src/pages/chat/components/chat-message.mcp-app.test.ts ui/src/pages/chat/components/chat-tool-output.test.ts ui/src/pages/chat/components/chat-transcript-recovery.test.ts ui/src/pages/chat/components/chat-tool-expanded-lazy.test.tsx ui/src/pages/chat/components/chat-tool-cards.test.tsx --maxWorkers=1
  • pnpm tsgo:ui
  • Verify a retained session-diff summary shows counts after refreshing from zero changes to one added line.
  • Run the existing chat-tool-turn-outcome E2E scenario and verify expanded content assertions await lazy rendering.
  • git diff --check

What I checked:

  • Reviewed introduction: The pinned introduction moves the existing expanded renderer, extracts diff-stat chips, and changes raw disclosure state; current main retains the eager renderer. (ui/src/pages/chat/components/chat-tool-content.solid.tsx:9, 090d98b6366c)
  • Widget regression confirmed by CI: The widget action clicks the disclosure and immediately reads aria-expanded to choose its next label; exact-head CI reports Show raw details where Hide raw details is expected. (ui/src/pages/chat/components/widget-card-view.tsx:459, 090d98b6366c)
  • Frozen visibility condition: DiffStatChips now evaluates its outer condition in the component body; the retained session-diff summary supplies reactive totals that can change from zero to nonzero after refresh. (ui/src/pages/chat/components/chat-diff-stat.solid.tsx:5, 090d98b6366c)
  • Lazy-render test failures: Exact-head CI finds missing expanded content at chat-transcript-recovery.test.ts:148 and chat-tool-turn-outcome.e2e.test.ts:358; both assert immediately after expansion without awaiting the newly asynchronous detail renderer. (ui/src/pages/chat/components/chat-transcript-recovery.test.ts:148, 090d98b6366c)
  • CI attribution limits: The exact-head CI run failed. Metadata-observation RPC-count failures and message-test context errors remain unattributed; job-log retrieval was blocked by the artifact host allowlist, so they are not assigned to the author as established patch defects. (090d98b6366c)
  • Policy and source limitations: Read the complete root and UI AGENTS files and applicable Solid/test guidance; no nested UI AGENTS or maintainer-notes directory exists. Installed Solid documentation is absent, so its pinned upstream cheatsheet was read instead. Some historical blob searches encountered unavailable objects. (ui/AGENTS.md:7, 090d98b6366c)

PR surface

Source -2, Tests +64. Total +62 across 10 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 7 496 498 -2
Tests 3 66 2 +64
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 562 500 +62

Labels

Label changes:

  • add P2: This is a bounded chat-loading improvement with repairable UI regressions and no demonstrated data loss or core-runtime outage.
  • 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:

  • P2: This is a bounded chat-loading improvement with repairable UI regressions and no demonstrated data loss or core-runtime outage.
  • 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.

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 16, 2026, 8:22 PM ET / October 17, 2026, 00:22 UTC.

@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: 77ad7551aa

ℹ️ 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 on lines +15 to +16
<Loading>
<ExpandedContent {...props} />

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.

P2 Badge Handle lazy detail loading within the tool card

When the detail chunk is slow or fails to load, expanding a card immediately reports it as open while this boundary renders no pending fallback; a rejection then escapes to the application-wide ShellLoader error boundary and replaces the entire workspace. An optional detail action should instead show a local loading state and contain import failures with a card-level error/retry path, including the existing stale-chunk recovery behavior.

AGENTS.md reference: AGENTS.md:L81-L81

Useful? React with 👍 / 👎.

…tails

# Conflicts:
#	ui/config/control-ui-boot-modules.json
@steipete
steipete enabled auto-merge (squash) October 17, 2026 00:56
@steipete
steipete disabled auto-merge October 17, 2026 01:07
@steipete
steipete merged commit 2212a9c into main Oct 17, 2026
106 of 109 checks passed
@steipete
steipete deleted the solid2/w-perf-tool-details branch October 17, 2026 02:20
@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 17, 2026
* perf(ui): load expanded tool details on demand

* fix(ui): settle deferred tool rendering before observation

* test(ui): provide application context for lazy canvas fixtures
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. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XL 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