Skip to content

perf(ui): stop polling stationary Talk tooltips - #184609

Merged
steipete merged 5 commits into
mainfrom
solid2/w-perf-talk-round2
Oct 26, 2026
Merged

steipete merged 5 commits into
mainfrom
solid2/w-perf-talk-round2

Conversation

@steipete

@steipete steipete commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Talk keeps scheduling geometry work every frame while the Stop tooltip is open, even when the control is stationary.

User Impact

Stationary tooltips use less CPU while retaining their placement, focus, scrolling, and cleanup behavior.

Why This Change Was Made

The cross-root anchor owner now observes position and size changes, ancestor mutations, scrolling, and geometry animations. It requests frames while a geometry animation is running instead of polling throughout the tooltip's lifetime.

The Talk benchmark also waits for completed service-worker precaching and context-wide network quiet, rejects asset traffic inside CPU windows, and distinguishes the gesture-unlock WAV from remote-stream playback in its optional startup probe. Ordinary cells clear incidental tooltips; the focused-Stop workload deliberately keeps one open. The meter canvas is a separate PR.

Accepted edge cases: unannounced pure-scale Web Animations or fully clipped movement can wait for the next invalidation; current callers do not use these patterns. Position observation can trail motion by one frame.

Evidence

Final v4 confirmation: ten serial interleaved A/B and A/A pairs per viewport, 4× CPU, 3-second listening/idle windows, production bundles, focused Stop tooltip, headless throughout. CPU uses Chromium's thread-tick metric interval. No sample is discarded; the A/A control is reported separately.

Task CPU in ms/s (median / p95); percentage changes are paired medians. All 40 matched A/B state pairs improved.

Viewport / state with tooltip Base Head Paired change A/A paired change
Desktop, listening 31.127 / 36.781 2.499 / 9.113 −92.405% −6.703%
Desktop, idle 30.800 / 47.209 1.513 / 2.585 −95.623% −12.061%
Mobile, listening 29.747 / 32.950 4.417 / 10.201 −85.586% +0.255%
Mobile, idle 26.110 / 33.350 2.224 / 3.113 −92.003% +5.580%

All 160 state windows and 80 browser/precache identities validated, with zero asset requests inside measured windows. Script CPU fell 91–92% by paired median.

Other proof Result
Diagnostic callback counts, desktop/mobile 1×/4× Approximately 60 anchor rAF callbacks/s → 0; no recurring mutation/resize/intersection callbacks; analyser stays about 10 Hz
Overlay behavior 19 Chromium and 19 WebKit cases pass, including position, movement, animation, and cleanup
Focused Talk/chat-view proof 186 tests and UI typecheck pass
Scoped lint/format, production Knip Pass
Startup JS gzip 271,312 → 271,570 B (+258 B); five requests
Startup CSS gzip 31,981 B unchanged; one request
Strict asset check Pass; no cap increased
Independent review No actionable P0–P2 findings; source verification passed

The startup increase is accepted for the measured CPU reduction. Raw process CPU has wider endpoints and is not used as a battery-life estimate. The fixture uses native browser audio with synthetic provider data; no hardware, acoustic, or real-provider latency claim is made. The earlier v2 results and adverse unlock-clip tails remain identified separately in report-round2.md; the canvas's remote-stream latency proof is outside this PR.

LOC Before After
Overlay owner 314 526
Overlay regression tests 306 395
Talk benchmark 1,052 1,735
Synthetic fixture 522 737

CI exposed a narrower ES2023 typecheck closure through the new observer import. The observer owner now declares its existing ES2024 collection requirement explicitly; the browser test uses the HTML/SVG-safe class-list API. These fixes do not change emitted application behavior.

The added owner code replaces a perpetual polling loop with invalidation and explicit cleanup. The Solid refactor census adds no effects, render effects, untrack, direct TSX listeners, DOM queries, flush, or owner APIs.

The inspected synthetic desktop before/after screenshots are pixel-identical. They are attached below.

Measured workload

The v4 runner is committed at 82533b0aa364; the current runner retains the same steady-state cache/network and CPU boundaries and adds opt-in startup attribution. Build each production side once with Node 26.12.1 and NODE_DISABLE_COMPILE_CACHE=1 pnpm ui:build, then run:

pnpm exec tsx scripts/bench-control-ui-talk.ts \
  --bundle-dir "$BASE_BUNDLE" --compare-bundle-dir "$HEAD_BUNDLE" \
  --pairs 10 --duration-ms 3000 --viewport both --cpu-throttle 4 \
  --states listening,idle --focused-stop --aa --output "$PROOF_DIR"

A separate one-pair --counters --first-pair-screenshots diagnostic supplies the work counts and images; its timings are not used for the effect size. See report-round2.md for the predeclared acceptance rule and earlier investigations.

Before (synthetic):

Stationary Talk tooltip before

After (synthetic):

Stationary Talk tooltip after

CI follow-up

The initial run 40321704238 exposed formatting, a readonly HTML/SVG test assignment, the narrower ES2023 collection type closure, and the native-play probe’s missing suppression-inventory entry. These are repaired in the follow-up head. The two E2E failures below remain under investigation; neither is classified as inherited. Both exact names pass scheduled main run 40308651607.

  • Filled action foregrounds > keeps action color pairs across every theme, mode, and accent: 120-second timeout, versus 41.1 seconds on main.
  • Control UI catalog bootstrap > real chat route recovers current account state after pending snapshot ordering: Account B text assertion after reload, versus a pass on main.

The catalog picker uses the existing same-root anchor path, which does not start the new cross-root tracker. The action test does exercise cross-root tooltips. This narrows the investigation but is not inherited-failure evidence or a claim that a passing replay repairs a defect.

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 26, 2026
@clawsweeper

clawsweeper Bot commented Oct 26, 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 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-26T13:20:20.953360Z 5b7ad0b 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.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui scripts Repository scripts size: XL labels Oct 26, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 26, 2026
@clawsweeper

clawsweeper Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR replaces continuous cross-root tooltip polling with geometry invalidation and strengthens the Talk benchmark.

Example: Keep the Stop voice input tooltip focused while Talk listens in desktop Chromium at 4× CPU throttle.

  • Before: The supplied diagnostic records about 60 anchor animation callbacks per second.
  • After: The supplied diagnostic records zero recurring anchor animation callbacks while placement and focus remain intact.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Strong production-browser performance evidence supports the change, but a directly attributable CI failure remains.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Supplied production-bundle Chromium runs exercise the shared anchor through native keyboard focus on the Talk Stop tooltip, with desktop/mobile comparisons, callback diagnostics, network-clean CPU windows, and inspected before/after screenshots; Chromium and WebKit behavior suites support movement and cleanup coverage.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Leaving the Stop voice input tooltip open consumes avoidable main-thread CPU even when the control is stationary.
Reason: The maintainer-authored direction has substantial measured benefit, preserves the shared owner, and explicitly accepts its bounded positioning and bundle-size tradeoffs.

Merge readiness

⛔ Needs changes before merge - 1 item remains

This PR delivers a measured CPU improvement worth keeping, but its new playback-probe suppression causes a confirmed CI failure.

Priority: P2
Reviewed head: 2eb1443ae194d8ba3db65e6b1245886273ce8d66

Before merge

  • Reconcile the new suppression with the explicit inventory (P2) - The startup-latency probe introduces a typescript/unbound-method suppression without updating the repository's exact suppression inventory. On this head, checks-node-compact-small-2 fails test/scripts/lint-suppressions.test.ts because scripts/bench-control-ui-talk.ts|typescript/unbound-method|1 is unexpected. Register this narrowly justified capture in the existing inventory, or remove the suppression through a receiver-safe implementation; retain the explicit guard.

Findings

  • [P2] Reconcile the new suppression with the explicit inventory — scripts/bench-control-ui-talk.ts:783-784
Agent review details

How this fits together

The shared overlay anchor owner translates trigger geometry across DOM roots into a spatial proxy consumed by native CSS anchor positioning.

flowchart LR
  A[Tooltip trigger] --> B[Geometry invalidations]
  B --> C[Shared overlay anchor owner]
  C --> D[Cross root spatial proxy]
  D --> E[Native CSS positioning]
  E --> F[Tooltip surface]
Loading

Technical review

Best possible solution:

Keep invalidation in the existing anchor owner and reconcile the justified playback-method capture with the suppression inventory without weakening its guard.

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

Current-main source directly shows perpetual cross-root frame sampling, and the supplied production-browser comparisons demonstrate its stationary-tooltip cost; no target code was executed during this review.

Is this the best way to solve the issue?

Invalidating geometry within the existing shared owner removes the measured waste while retaining positioning responsibilities and explicit cleanup.

Full review comments:

  • [P2] Reconcile the new suppression with the explicit inventory — scripts/bench-control-ui-talk.ts:783-784
    The startup-latency probe introduces a typescript/unbound-method suppression without updating the repository's exact suppression inventory. On this head, checks-node-compact-small-2 fails test/scripts/lint-suppressions.test.ts because scripts/bench-control-ui-talk.ts|typescript/unbound-method|1 is unexpected. Register this narrowly justified capture in the existing inventory, or remove the suppression through a receiver-safe implementation; retain the explicit guard.
    Confidence: 1

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 2988b14f22e6.

Provenance checked

  • Cross-root overlay scheduling changes intended behavior with a stated reason (b68c44c: Native overlays use a sampled spatial proxy across roots; later optimizations limited sampling to cross-root bindings and skipped unchanged writes while preserving tracking.)
  • Talk benchmark measurement boundaries changes intended behavior with a stated reason (b1cb2a0: The benchmark exercises the production renderer with native synthetic audio; this PR explains and corrects background asset contamination and distinguishes unlock playback from remote-stream readiness.)
  • Synthetic Talk fixture keeps the original intent (b1cb2a0: The fixture supplies native browser audio and synthetic provider events; added diagnostics retain that boundary and explicitly separate counterfactual audio suspension from product acceptance.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test test/scripts/lint-suppressions.test.ts --maxWorkers=1
  • node scripts/run-oxlint.mjs --tsconfig tsconfig.scripts.json scripts/bench-control-ui-talk.ts
  • git diff --check

What I checked:

PR surface

Source +204, Tests +85, Docs +505, Other +898. Total +1692 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 212 8 +204
Tests 1 86 1 +85
Docs 1 505 0 +505
Config 0 0 0 0
Generated 0 0 0 0
Other 2 1003 105 +898
Total 5 1806 114 +1692

Review metrics

Metric Value Why it matters
Benchmark options 4 new diagnostic flags Adds compare-script-file, startup-latency, startup-warm-cache, and compare-suspend-native-audio to the development benchmark; these do not change user configuration.

Labels

Label changes:

  • add P2: The PR reduces unnecessary CPU work while a tooltip remains open; the confirmed blocker is a focused CI inventory mismatch.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: The PR reduces unnecessary CPU work while a tooltip remains open; the confirmed blocker is a focused CI inventory mismatch.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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 26, 2026, 8:34 AM ET / 12:34 UTC.

@steipete
steipete enabled auto-merge (squash) October 26, 2026 13:18
@steipete
steipete merged commit 4a97c0a into main Oct 26, 2026
117 of 119 checks passed
@steipete
steipete deleted the solid2/w-perf-talk-round2 branch October 26, 2026 13:21
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash auto-merge.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 27, 2026
* perf(ui): stop polling stationary Talk overlay anchors

* test(ui): wait for Talk benchmark precache completion

* test(ui): distinguish Talk unlock and remote playback latency

* docs: record final Talk tooltip CPU confirmation

* fix(ui): satisfy Talk performance CI contracts
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. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts 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