Skip to content

feat(control-ui): report source-mapped benchmark CPU attribution - #174756

Merged
steipete merged 7 commits into
mainfrom
steipete/coldload-bench-cpu-profile
Oct 17, 2026
Merged

steipete merged 7 commits into
mainfrom
steipete/coldload-bench-cpu-profile

Conversation

@steipete

@steipete steipete commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Cold-load benchmark results could not establish whether a proposed fix exercised live rendering or session reconciliation before measuring it. Campaign evidence recorded 14 visible states over roughly 15 seconds during a signed-in reload of a dashboard deep link. This tooling makes hot-path reproduction reviewable without publishing private captures.

User Impact

Developer tooling only. The previous report exposed 20 reload self-time rows; --cpu-profile now preserves complete source-mapped reload, live-event replay, and optional streaming tables, per run and as medians. --cpu-profile-compare <baseline.json> prints candidate-minus-baseline function deltas.

Use profiling to prove reproduction, then measure application speed in separate unprofiled interleaved runs. Profiling inflates timing; this PR claims no application speedup.

Why This Change Was Made

Extend the existing CDP profiler and source-map owner using Node's existing decoder, with no new dependency. Reports include self time, inclusive function time, and inclusive source-file time. Recursive functions/files count once per sample; missing functions count as zero in medians. Complete phase sets are validated before browser startup.

Function keys exclude runtime-only IDs and normalize filesystem source paths relative to the repository. Identical builds at different output depths therefore compare correctly. Unmapped generated lines retain their original frames instead of borrowing a preceding line's source attribution. Real esbuild-emitted maps cover both path normalization and the unmapped-footer regression.

CPU mode uses the existing ownerProbes: false path, and live capture shares one profiler lifecycle with the default raw capture. Default measurement instrumentation and warm-snapshot metrics remain intact. The script header, benchmark guide, and UI reload-performance instructions document the mode and profiling overhead.

Evidence

Final head: 9425b0b132ede8f9fc28507269a9912af55b2e3c. Independent autoreview is clean through P2, all actionable review findings are resolved, and exact-head CI is green.

AWS c7a.4xlarge, 16 CPUs / 30 GiB, lease cbx_d9151ef1c787; repository Playwright Chromium, synthetic board-dashboard fixture. Fourteen diagnostic reload/live captures produced all six requested source functions, each at one canonical source location. These are sampled inclusive times, not an application before/after speed comparison; IQR is the 25th–75th percentile interval.

Phase Function Median ms IQR ms Captures containing it
Reload IconSvg 58.8 51.5–61.0 14/14
Reload prepareTimestamp 37.5 34.2–40.9 14/14
Live parseSessionChangedEvent 2.1 1.2–2.2 14/14
Live reconcileSessionChangedRow 0.0 0.0–0.8 5/14
Live reconcileChangedEvent 59.3 58.4–61.1 14/14
Live reconcileResult 25.6 22.7–29.3 14/14

Validation:

  • OPENCLAW_VITEST_RUNTIME=node pnpm test test/scripts/control-ui-cold-load-trace.test.ts --maxWorkers=1: 15 passed, 3.67 s wall. The unmapped-footer case fails before the correction under Node and passes afterward.
  • OPENCLAW_VITEST_RUNTIME=node pnpm test ui/src/test-helpers/control-ui-cold-load-probes.browser.test.ts --maxWorkers=1: 2 passed, 5.66 s wall. Scoped lint passed.
  • --cpu-profile --live-events --untraced --runs 14, one fresh-build --cpu-profile-compare, traced/default live capture, streaming capture, and mismatched-phase rejection passed. Comparison matched functions across different output depths and emitted 6,635 reload / 4,181 live function rows. Run: run_46c6763b85b4a70678a3259af5cd978a.
  • Combined --cpu-profile --warm-reload --large-snapshot --probe-dir … --untraced --runs 1 passed: an 80-message / 190,988-byte saved snapshot and 2,834 CPU function rows. Run: run_43b4e9b940230d45cf5ba36c3146c3da. Earlier warm smoke attempts stopped at missing-probe setup; the complete three-probe payload passed.
  • Full UI e2e on the final head: node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts completed in 6,206.76 s (103m27s): 817 files passed, 2 failed, 1 skipped; 3,543 cases passed, 2 failed, 1 skipped. Run: run_47662a667bf639f89b8be2f3e8a7cb15.

Both full-suite failures reproduce on main:

File Failure Main evidence
ui/src/e2e/guest-session-controls.e2e.test.ts Thinking slider detaches during press("End"), then times out at line 212. Identical case, error, and stack on main 6052c9a788df, third bounded attempt after two passes; 37.99 s wall. Run run_f54a2f3ad21717cf556828aeb27998cc. The PR head also passes in isolation; no passing replay is claimed as a fix.
extensions/qa-lab/src/control-ui-automation-management.real-gateway.e2e.test.ts Private mutation boundary is writable by another POSIX principal. Same error on main 98375d4b6245: 1 failed / 1 passed, 304.56 s wall. Run run_43b4e9b940230d45cf5ba36c3146c3da.

The skipped file is ui/src/e2e/desktop-resize.real-gateway.e2e.test.ts. The complete 820-file pass/fail list and logs are retained with the lane's proof. No unrelated CI rerun or update-branch was used to chase these failures.

Scope and Release Context

Six files: scripts/bench-control-ui-cold-load.ts, its Markdown guide, scripts/lib/control-ui-cold-load-trace.ts, its unit test, ui/src/test-helpers/control-ui-cold-load-probes.browser.test.ts, and ui/AGENTS.md.

Requested non-test diff: +330/−27, net +303 including documentation. Tooling TypeScript: +276; application runtime: 0. Growth supplies the requested report/compare contract while reusing the profiler, decoder, and probe switch. The shared mapper cuts over from the extrapolating findOrigin lookup to findEntry; no competing decoder or profiler owner is added.

Release-note context: cold-load tooling can prove that a hot path runs before a performance comparison. The campaign lead reviews and lands this PR; this lane does not merge it.

@clawsweeper

clawsweeper Bot commented Oct 16, 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 16, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR adds opt-in source-mapped CPU reports and baseline comparisons for benchmark reload, live-event, and streaming phases.

Example: Run the benchmark with --cpu-profile --live-events --untraced.

  • Before: Untraced runs omit CPU sampling and provide no separate live-phase CPU tables.
  • After: Reload and live phases produce function and file attribution, per-run reports, and median reports.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused implementation and useful unit contracts, with runtime attribution confidence still limited.
Proof confidence 🦐 gold shrimp (3/6) The body reports focused unit tests and explicitly leaves benchmark attribution pending; ordinary contributor proof gating is exempt for this maintainer-authored PR.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Performance contributors cannot readily establish that benchmark phases exercise the source functions they intend to optimize.
Reason: The established benchmark owner is adding reusable attribution within the existing tooling boundary, with explicit separation between profiling and timing measurements.

Merge readiness

✅ Ready for maintainer review

Keep this useful maintainer-owned experiment open and honor its explicit do-not-merge hold; no definite introduced correctness defect was found.

Priority: P3
Reviewed head: d2229c419bd35b215132c676bbfbd69450b76d92

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied evidence does not yet show the benchmark command producing correctly attributed reload, live, and streaming reports or a baseline comparison.
Agent review details

How this fits together

The developer benchmark drives production Control UI assets against a synthetic Gateway, then converts Chromium CPU samples and adjacent source maps into terminal tables and JSON artifacts.

flowchart LR
  A[Benchmark options] --> B[Production UI and synthetic Gateway]
  B --> C[Chromium CDP profiler]
  C --> D[Existing source map decoder]
  D --> E[CPU accounting and medians]
  E --> F[Terminal tables and JSON reports]
Loading

Technical review

Best possible solution:

Retain the experiment for its owner to validate phase attribution and decide when it is ready.

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

This is a tooling capability addition; source inspection establishes the previous reporting limitation without requiring a product-bug reproduction.

Is this the best way to solve the issue?

Extending the existing CDP profiler and source-map owner is a focused solution, with profiling overhead explicitly separated from performance comparisons.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Source-map coordinate lookup changes intended behavior with a stated reason (5559404: The original benchmark mapped generated CPU frames back to production source for hotspot attribution.)
  • Benchmark profiling lifecycle keeps the original intent (test(control-ui): add a Team-scale cold-load benchmark #170033: The existing benchmark captured reload profiles alongside traces; this PR preserves that path and adds explicit opt-in captures for later phases.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 5559404 adds scripts/lib/control-ui-cold-load-trace.ts:134 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5559404e2da9; files: scripts/lib/control-ui-cold-load-trace.ts)

PR surface

Tests +76, Docs +22, Other +225. Total +323 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 76 0 +76
Docs 2 23 1 +22
Config 0 0 0 0
Generated 0 0 0 0
Other 2 244 19 +225
Total 5 343 20 +323

Review metrics

Metric Value Why it matters
New benchmark options 2 flags --cpu-profile enables phase reports; --cpu-profile-compare accepts a baseline report and implicitly enables profiling.

Labels

Label changes:

  • add P3: This is opt-in developer measurement tooling with no application runtime behavior change.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp 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: This is opt-in developer measurement tooling with no application runtime behavior change.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp 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.

  • Provide a redacted benchmark capture showing mapped hot functions, phase-specific reports, and a baseline comparison.

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, 6:31 PM ET / 22:31 UTC.

@steipete
steipete force-pushed the steipete/coldload-bench-cpu-profile branch from d2229c4 to a9a2fe5 Compare October 16, 2026 22:38
@steipete steipete changed the title experiment(control-ui): source-mapped bench CPU attribution [do not merge] feat(control-ui): report source-mapped benchmark CPU attribution Oct 16, 2026
@steipete
steipete marked this pull request as ready for review October 16, 2026 22:39
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 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-17T06:01:19.288687Z 9425b0b 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.

@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: a9a2fe5386

ℹ️ 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 thread scripts/bench-control-ui-cold-load.ts Resolved
@steipete
steipete force-pushed the steipete/coldload-bench-cpu-profile branch 3 times, most recently from ae63093 to 4c974b9 Compare October 17, 2026 02:09

@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: 4c974b96f7

ℹ️ 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".

@steipete
steipete force-pushed the steipete/coldload-bench-cpu-profile branch 2 times, most recently from e5d3563 to fc5bb9b Compare October 17, 2026 05:39
@steipete

Copy link
Copy Markdown
Contributor Author

L131 coordination: I’m improving the Team-scale query/cron/plugin fixtures, warm sidebar + trimmed v8 snapshot preparation, Online setup, and a bench-versus-sanitized-live fidelity report. I will not duplicate or modify the CPU flag/profiler implementation in this PR. While this remains unmerged, the fidelity report will reuse the campaign’s existing cpuprof2.py analyzer against raw captures; after landing it can consume your complete CPU tables. The bench edits will overlap setup/settle and fixture bindings only.

@steipete
steipete force-pushed the steipete/coldload-bench-cpu-profile branch from fc5bb9b to 9425b0b Compare October 17, 2026 05:58
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Final-head CPU attribution and comparison proof, focused tests, full UI results, and matching main evidence for both inherited UI failures are now documented in the PR body. Independent review is clean through P2. The campaign lead owns landing; this request is for review only.

@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added the clawsweeper:intake:feature Preliminary submission classification; full source review pending. label Oct 17, 2026
@steipete
steipete merged commit ec430f5 into main Oct 17, 2026
127 of 129 checks passed
@steipete
steipete deleted the steipete/coldload-bench-cpu-profile branch October 17, 2026 08:23
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 18, 2026
…ch (openclaw#174756)

Several reload-performance experiments failed because the bench never executed the live hot path, which was only discovered after implementing a fix. Live Team profiling now uses DevTools CPU profiles mapped through the release's source maps; this brings the same attribution into the bench.

`--cpu-profile` records CPU profiles for the measured reload, live-event and streaming phases, maps frames through the built UI's source maps, and prints per-run and median tables (self time, inclusive by source file, inclusive by source function) plus cpu-profile.json; `--cpu-profile-compare <baseline>` diffs a run against a saved report. Default timing runs are unaffected, and profiled timings must not be mixed with unprofiled pairs. ui/AGENTS.md now says to prove the bench executes the live hot function before measuring a fix.

Tooling only: +276 non-test LOC, no application runtime change. Fourteen AWS c7a.4xlarge captures contained all six live hot functions; comparison, streaming and warm-snapshot checks pass. 15 unit + 2 browser tests pass; exact-head CI green; the two full-UI failures reproduce on main.
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 clawsweeper:intake:feature Preliminary submission classification; full source review pending. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: L 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