Skip to content

perf(ui): keep rich tool metadata out of boot - #181636

Closed
steipete wants to merge 8 commits into
mainfrom
solid2/w-perf-presentation-data
Closed

steipete wants to merge 8 commits into
mainfrom
solid2/w-perf-presentation-data

Conversation

@steipete

@steipete steipete commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Chat imported the complete tool display catalog to paint tool names and icons, including action details that those first-render consumers never read. Generate compact presentation and detail projections from the existing canonical catalog, and keep detail-only data on its existing lazy path. Replace two broad capability-catalog imports with type-checked literals for the one capability each caller needs.

User Impact

User impact: Chat and New Session download less JavaScript while retaining the same tool names, icons, and detail behavior.

Why This Change Was Made

The native/shared catalog is unchanged. The detail projection preserves field order, fallback behavior, and explicit empty arrays that suppress fallback; it omits unused action labels and undefined detail entries. No new state owner, dependency, loading boundary, or cache is added.

Byte proof

Matched builds compare exact a7f5566707d367af3f246391a9e87b1477700eaf with revised candidate 4942d8594fd7daa4946e80edf0fbacab78d0d59f (tree 4a53d4bb2c3c250e9139b4585182fc21fa1b65bc), using Node 24.22.1, identical fixed metadata, and all 29 canonical plugin payloads. Gzip values are shipped sidecar bytes.

Surface Base gzip Candidate gzip Delta JS requests
Startup 282,859 B 282,812 B −47 B 7 → 7
Chat 1,273,728 B 1,271,488 B −2,240 B 21 → 21
New Session 769,205 B 767,114 B −2,091 B 16 → 16

All CSS bytes and requests are unchanged; strict performance checks report no violations or warnings. Startup raw JS is unchanged; its Brotli sidecars grow 189 B. The campaign's gzip surface budgets hold. Chat/New Brotli shrink 1,786/1,300 B.

The previously observed tool-rich load also needs detailed metadata. Remapping all 33 additional observed assets, closing their static imports, and including the current static graph gives this built-payload accounting, not fresh browser timing:

Full tool-rich union Base Candidate Delta
JS gzip 1,364,231 B 1,363,835 B −396 B
JS raw 4,372,067 B 4,370,469 B −1,598 B
JS Brotli 1,217,467 B 1,217,408 B −59 B
JS requests 54 54 0

The 2,240 B static saving is not the runtime-union saving. Additional content grows 1,844 B gzip, offset by the static cut. This refinement removes the earlier head's observed net payload growth by omitting metadata unused by the detail resolver.

Chat's cap ratchets to 1,361,269 B, preserving proportional headroom with floor(baseCap × candidateBytes / baseBytes). New Session keeps its stricter existing 802,467 B cap. Startup's cap and baseline are unchanged.

Evidence

Check Result
Matched production build and strict performance comparison Passed
Frozen source/output receipts 3,355 unique consumed inputs; 8,284 emitted files
Canonical projection parity 238 fallback/action cases; zero mismatches; all 8 explicit empty arrays retained
Two relevant UI test files, once each, maxWorkers=1 10 tests passed
pnpm tool-display:check Passed; native snapshot unchanged
pnpm tsgo:ui Passed
Scoped scripts/UI lint, format, diff Passed
Independent P0–P2 review Scoped-clean; no findings; final supplement is only annotation whitespace and tighter cap metadata
pnpm deadcode:knip One unchanged unused-file finding: examples/inline-incident/control-ui.ts, also present in retained exact-base evidence
Full CI at 4942d8594fd7daa4946e80edf0fbacab78d0d59f Passed: run 40011134546
Exact-head cold-load timing Initial batch failed; cumulative 40-observation result also fails both p95 gates
Synthetic screenshots Inspected before/after captures below

After the build, formatting wrapped one type annotation without changing its tokens; cap comments/constants were tightened. No runtime source changed after the measured build.

Timing acceptance

Run ten strictly alternating cold-cache base/candidate pairs through the real bundled Gateway and retain all 20 samples. Both Chat transcript-visible and enabled-composer medians must be ≤1.05× baseline, with neither p95 worse. Static byte savings do not establish this timing result. A failed cell keeps this candidate unready. The coordinator’s standing rule explicitly permits one further ten-pair batch, evaluated cumulatively as described below.

The preceding fa1ac3c5f8b9340b4d3cbdbeaf7c35e95e5f037a head failed its ten-pair timing contract: composer p95 1,381.20→1,461.20 ms (+5.79%). Its actual load also grew 747 B gzip because it retained the full rich catalog alongside the compact projection. That old head will not land. The revised projection’s initial timing is below; the old negative evidence remains recorded here.

Revised-head initial timing (failed)

Run 40013423439 measured exact 4942d859 against a7f55667: ten strict ABAB cold-cache pairs, fixed 240-message fixture, new bundled Gateway/browser process per sample, gzip, no tracing. All 20 observations and 1,080 raw/gzip transport receipts were independently verified; no warnings. Host: four CPUs (affinity 0–3), Node 24.22.1 Linux x64, 16,555,134,976 B RAM.

Metric (ms) Base median Candidate median Base p95 Candidate p95 Result
First nonempty transcript 1,222.30 1,260.60 (+3.13%) 1,471.40 1,514.70 (+2.94%) Fail: p95
First enabled composer 627.50 656.65 (+4.65%) 834.90 775.20 (−7.15%) Pass

Observed application JavaScript is 1,364,231 → 1,363,835 B gzip, 54 → 54 requests. Seven synthetic plugin scripts add the same 1,953 uncompressed bytes on each side. This confirms the small complete-load saving, not a timing win.

The coordinator’s original authorization says: “Going forward, a timing cell is clean if its median regression is ≤5% and p95 isn't worse, or if a rerun of ten more pairs puts it inside that band.” Exactly one additional ten-pair batch was run under that standing rule. The final decision below uses all 40 samples together, with no exclusions. There will be no third batch.

Final decision — closed, timing gate failed

The authorized additional ten-pair batch completed in run 40015295249. Both batches retain their original records and identical source, workload, and asset-manifest identities. The author independently verified all 40 observations and all 2,160 raw/gzip transport receipts; no warnings or exclusions.

All 40 observations, ms Base median Candidate median Base p95 Candidate p95 Gate
First nonempty transcript 1,279.15 1,284.10 (+0.39%) 1,646.00 1,839.40 (+11.75%) Fail: p95
First enabled composer 669.45 666.75 (−0.40%) 846.80 890.00 (+5.10%) Fail: p95

The small complete-load saving (396 B gzip) does not override this result. The measurements do not establish the cause of the tail movement, but they do not satisfy the agreed landing rule. This candidate is closed without merging; its source and original negative evidence remain available. No third timing batch or budget ratchet is applied.

Size

Ten files: 4,195 → 5,551 lines (+1,356). Most growth is generated JSON (presentation and detail projections) produced by the existing generator; the canonical registry remains the sole source. The handwritten changes restrict each consumer to fields it actually reads.

Screenshots

Current-head before/after captures were inspected in full and contain only the synthetic fixture.

Before: synthetic Chat transcript

After: synthetic Chat transcript

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 23, 2026
@chatgpt-codex-connector

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 🔄 Running since 2026-10-23T13:00:47.953705Z 2ee9af2 PR opened
ℹ️ 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 commented Oct 23, 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.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui scripts Repository scripts size: M labels Oct 23, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 23, 2026
@clawsweeper

clawsweeper Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR generates compact tool presentation metadata and removes rich tool and capability catalogs from Control UI boot imports.

Example: Cold-load Chat with an exec tool row.

  • Before: The row shows Exec with its terminal icon; the reported Chat boot transfer is 1,325,120 gzip bytes.
  • After: The row retains the same presentation; the reported transfer is 1,323,233 gzip bytes with the same 22 JavaScript requests.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The patch is focused and source-consistent, but the explicitly required runtime performance proof is unfinished.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Chat and New Session download rich tool metadata when compact presentation needs only labels and icons.
Reason: The maintainer-authored direction removes measurable transfer waste with unchanged runtime behavior and one canonical metadata owner.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-directed optimization removes unnecessary boot data while preserving existing presentation behavior; no actionable code defect was found.

Priority: P3
Reviewed head: 2ee9af2650985756b23c8d9c025cade9b73c3a41

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The recorded ten alternating cold-cache base/head pairs through the production Control UI entry point remain pending, including transcript/composer medians and p95.
Agent review details

How this fits together

The build-time tool catalog generator supplies bundled metadata to Control UI resolvers, which turn tool names into labels and icons while detailed renderers retain the full catalog.

flowchart TD
  A[Canonical tool metadata] --> B[Existing catalog generator]
  B --> C[Compact presentation snapshot]
  B --> D[Full tool catalog]
  C --> E[Boot label and icon resolvers]
  D --> F[Detailed tool renderer]
  E --> G[Control UI]
  F --> G
Loading

Technical review

Best possible solution:

Retain the compact projection in the existing generator and land only after the recorded performance acceptance criteria are satisfied.

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

Current-main compact resolvers directly import the full generated catalog, establishing the unnecessary dependency in source; no runtime reproduction was performed during this read-only review.

Is this the best way to solve the issue?

This is a small, coherent solution: derive presentation-only data from the canonical generator, preserve detailed consumers, and erase capability-table runtime imports without changing their values.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

  • Pinned introduction and current main: Reviewed the merge-base-to-head diff. Fetched main retains the original rich-catalog imports, and its changes since the merge base do not alter these eight paths. (ui/src/lib/chat/tool-display-identity.ts:7, 2ee9af265098)
  • Presentation parity: Independent JSON inspection confirmed that all 73 generated records and the fallback exactly match the icon/title/label projection of the full catalog; normalization, aliases, unknown-tool fallback, and rich argument-detail consumers remain intact. (ui/src/lib/chat/tool-display-presentation.generated.json:1, 2ee9af265098)
  • Board capability equivalence: Both changed board consumers retain the canonical board-widget-put-canvas-doc value, checked against its literal type; capability and operator-access predicates are unchanged. (ui/src/components/board/board-document.tsx:33, 2ee9af265098)
  • Recorded acceptance and evidence: The complete PR body reports matched production-build savings of 1,887 Chat and 1,878 New Session gzip bytes without added requests, but explicitly leaves interleaved cold-reload timing pending and says static bytes alone do not authorize landing. (2ee9af265098)
  • Failed check attribution: The PR context and evidence check rejects the PR-body section headings; its annotations identify no patch-caused runtime failure. This is process validation, not a correctness finding. (2ee9af265098)
  • Policy and inspection limits: Applied the complete root, scripts, and UI policies and the simplification review steps. No maintainer-notes directory exists. The installed Solid cheatsheet is absent, and an oldest-history blob lookup encountered disabled lazy fetching; GitHub commit reads recovered the generator's original implementation. No target code or tests ran, and the checkout remained clean. (AGENTS.md:1, 2ee9af265098)

Likely related people:

  • Peter Steinberger: Raw commit 2c5b726 adds ui/src/lib/chat/tool-display-identity.ts:12 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2c5b726de0e9; files: ui/src/lib/chat/tool-display-identity.ts)

PR surface

Source -3, Generated +300, Other +27. Total +324 across 8 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 5 17 20 -3
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 1 300 0 +300
Other 2 53 26 +27
Total 8 370 46 +324

Review metrics

Metric Value Why it matters
Route JavaScript budget ratchet Chat: 1,373,793 → 1,371,837 B; New Session: 822,617 → 820,718 B Both caps tighten proportionally to the reported matched-build reduction without relaxing request limits.

Labels

Label changes:

  • add P3: A small boot-transfer optimization preserves existing behavior and has no demonstrated urgent user-facing failure.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab 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:

  • P3: A small boot-transfer optimization preserves existing behavior and has no demonstrated urgent user-facing failure.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Supply the queued matched cold-reload results showing that transcript and composer medians and p95 meet the recorded acceptance rule.

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 23, 2026, 9:18 AM ET / 13:18 UTC.

@steipete steipete closed this Oct 23, 2026
@RomneyDa
RomneyDa deleted the solid2/w-perf-presentation-data branch November 30, 2026 20:43
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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts size: XL 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