Skip to content

perf: reduce Talk tooltip CPU while keeping anchor tracking - #184200

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

steipete merged 3 commits into
mainfrom
solid2/w-perf-talk-tooltip

Conversation

@steipete

@steipete steipete commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Keeping the Stop voice input tooltip open during a Talk session repeatedly reads and formats unchanged cross-root anchor styles on every animation frame.

User Impact

Talk uses less main-thread CPU with its Stop tooltip open. Positioning, keyboard focus, capture, playback, and the existing animation cadence are preserved. This is a measured UI CPU improvement; it does not establish lower whole-renderer CPU, battery drain, or acoustic/provider latency.

Why This Change Was Made

The existing anchor owner now remembers the numeric geometry it last wrote and updates only changed coordinates. Binding metadata is applied when the binding changes, while each frame still samples geometry and detects a move between DOM roots. There is no second positioning owner or new scheduling abstraction.

Related: #184003 and #184132. This completes the measured tooltip follow-up to the Talk caption and hidden-tab work.

Evidence

20 interleaved base/head pairs plus 20 interleaved base/base control pairs; desktop viewport, 4× CPU throttle, synthetic Talk audio, native Tab focus on Stop, two-second requested windows. Each accepted observation requires document focus, trigger focus, and its tooltip to remain open. CDP task/script CPU is normalized by the recorded CDP timestamp interval; process CPU uses its separate Node sampling interval. Delayed CDP responses on this loaded host inflated some Node wall intervals by up to 2.507 seconds, so those wall intervals are not used for CDP rates. No tracing or extra frame probe runs in the CPU windows.

State Main-thread task CPU, base → head (ms/s) Median / p95 change Script CPU, base → head (ms/s) Median / p95 change
Listening 49.779 → 43.568 −12.48% / −11.97% 12.263 → 7.639 −37.70% / −38.10%
Connected idle 42.385 → 35.818 −15.49% / −19.00% 10.544 → 7.804 −25.99% / −24.66%

The 160 accepted observations all passed focus/tooltip invariants. Whole-renderer CPU medians changed +0.18% listening and +0.11% idle. The loaded host produced noisy controls: base/base task medians moved +7.47% listening and +3.37% idle; scripting moved +1.39% and +2.61%. The scoped CPU result supports this change, not a renderer-wide or battery claim.

One original control observation lost document focus, while trigger focus and the tooltip remained unchanged. The entire round, including its passing base/head observations, was excluded and retained as failed evidence. Three replacement rounds used the same committed runner, fixtures, and frozen bundles without relaxing any invariant; the final dataset uses original rounds 0–16 plus those three complete rounds.

Check Result
Chromium + WebKit anchor browser tests 32/32 passed; fractional geometry, hide/reopen, root moves, closing movement
UI and benchmark typechecks; scoped lint and formatting Passed
Controller guard Passed
Production Knip Completed with no findings
Independent source review No actionable findings in owner, combined, or integrated review
Integrated headless fixture smoke 4/4 observations passed on final matched bundles
Production build and strict frozen-bundle comparison Passed
Full PR CI ci:full; current-head run 40276096193, attempt 1, passed

Timing used frozen production bundles whose source maps identify the base and changed anchor owner. After merging main, a fresh matched base/head build verified the final source and size budget. The integrated headless smoke checks fixture integration rather than repeating the timing campaign.

Gzip surface Base Head Change
Startup JavaScript 271,595 B 271,312 B −283 B
Chat JavaScript 1,233,722 B 1,233,436 B −286 B
New Session JavaScript 750,317 B 750,062 B −255 B
Startup CSS 31,981 B / 1 request 31,981 B / 1 request unchanged
Total CSS 305,110 B 305,110 B unchanged

All current strict budgets pass. Production owner: 294 → 314 lines (+20); browser tests: 285 → 306 (+21); benchmark and fixture: 1,458 → 1,574 (+116). Four-file diff: 180 insertions, 23 deletions.

Synthetic before and after are pixel-identical, including the keyboard focus outline and Stop tooltip.

Before:
Talk Stop tooltip before

After:
Talk Stop tooltip after

Prior-head CI investigation

Initial exact-head CI run 40269566386 failed two settings-layout cases and one publication interaction. The publication case was Control UI personal GitHub publication > gates personal publication for a remote workspace: its menu remained closed. The retained timeout artifact recorded pointerdown on the connected trigger, no recorded trigger click, and no overlay admission event. The probe did not record pointerup and cannot establish its absence.

The menu uses sameRoot: true, so the changed cross-root proxy/RAF path is never entered for it. The exact focused test passed locally on the reviewed head and with the only changed production owner restored to its merge-base version (one pass each, headless). These replays do not establish a fix or prove the original failure inherited. The single rerun of UI shard 4 passed in attempt 2; the original pre-admission interaction failure remains in the evidence and is not claimed fixed or inherited.

Completed CI attempt 2 retains exactly two failing cases in settings-layout.e2e.test.ts: aligns every mobile settings page with the topbar content and keeps settings rows, introductions, section headings, and Learn more links on one layout system. Both also fail on the latest completed scheduled main run 40270232777 (db8db987b6786e09625523b614ebc2c290581933). The relevant test, helpers, routes, approvals page and settings shell have identical Git objects on that main run, the CI baseline and the tested merge. Every other non-skipped job passed; the downstream CI gate is red. The prior native inherited-failure admission stopped before dispatch because GitHub mergeability could not settle. Those results remain historical evidence for that exact head.

After repeated pre-dispatch mergeability races, current origin/main was merged without conflicts to force recomputation. Current head: 33173e11d75a3e99327794a685017b096df7b9f0; base: e6b0f044d586ab955b6e2343a2ed78693cab0313. All four changed PR files are byte-identical to reviewed head 86806d42a74c1ad8b90f1983f621c08fc3161cfc; the PR diff remains four files. UI typecheck passed on the integrated head. Fresh matched base/head builds and strict asset checks passed, with the current numbers in the table above. Their source maps match the exact base/head owner. The refreshed four-cell headless focused-Stop integration smoke passed, with stable focus and tooltip, successful native playback, no page errors, and inspected synthetic pixel-identical screenshots. Current-head CI run 40276096193, attempt 1, passed; earlier CI and timing results are retained as exact-head evidence, not relabeled as new-head CI. The old CPU results measure the unchanged owner; the refreshed smoke proves integration only.

@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 🔄 Running since 2026-10-26T05:47:15.958744Z 33173e1 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: M 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: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. 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 maintainer review before merge.

What this changes

This PR avoids repeated style reads and formatting for unchanged overlay anchors while preserving geometry tracking.

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

  • Before: Reported median main-thread task CPU is 49.779 ms/s.
  • After: Reported median main-thread task CPU is 43.568 ms/s, with the tooltip and keyboard focus preserved.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused, useful optimization with production-renderer measurements and preserved geometry contracts; the publication-menu CI failure remains unattributed.
Proof confidence 🐚 platinum hermit (4/6) This maintainer-authored PR is outside the ordinary contributor proof gate; supplied production-bundle Chromium measurements exercise the focused Stop tooltip, and inspected before/after screenshots preserve its appearance and focus outline.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Keeping the Talk Stop tooltip open consumes avoidable main-thread CPU.
Reason: The maintainer-authored direction has measured scoped value, preserves visible behavior, and introduces no competing positioning owner.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR offers a focused, measured CPU improvement with no actionable source findings; one failing E2E scenario still needs attribution.

Priority: P2
Reviewed head: 86806d42a74c1ad8b90f1983f621c08fc3161cfc

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied browser results preserve behavior, but a base-failing/head-passing assertion for the repeated-work reduction is not shown.
Agent review details

How this fits together

The shared overlay anchor owner receives trigger elements and placement bindings, mirrors cross-root geometry into a spatial proxy, and lets native CSS position tooltips and menus.

flowchart LR
  A[Talk Stop button] --> B[Tooltip lifecycle]
  B --> C[Shared anchor owner]
  C --> D[Geometry sampling]
  D --> E[Spatial proxy]
  E --> F[Native CSS positioning]
Loading

Technical review

Best possible solution:

Keep geometry sampling in the existing anchor owner while avoiding repeated reads and formatting of unchanged owner-written styles.

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

Current main visibly repeats coordinate formatting and inline-style reads on every cross-root frame; the supplied production-renderer campaign measures that path, but no target code was executed during this review.

Is this the best way to solve the issue?

The smallest complete change retains the positioning owner, remembers its last numeric writes, and skips unchanged binding metadata; all introduced hunks serve the optimization or its existing proof paths.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Cross-root anchor positioning keeps the original intent (b68c44c: Native overlays use a spatial proxy to preserve CSS positioning across document and shadow roots.)
  • Frame scheduling and same-root behavior keeps the original intent (f68299b: Only presented cross-root bindings need animation-frame sampling; CSS follows same-root anchors.)
  • Talk benchmark and fixture keeps the original intent (4846765: Measure production-renderer CPU with native visibility and explicit workload invariants while separating synthetic audio from provider claims.)
  • Anchor browser coverage keeps the original intent (ce97c81: Consolidate repetitive test scaffolding while retaining distinct behavior contracts.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit b68c44c adds ui/src/components/overlay-anchor.ts:94 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b68c44ca8f3c; files: ui/src/components/overlay-anchor.ts)

PR surface

Source +20, Tests +21, Other +116. Total +157 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 33 13 +20
Tests 1 24 3 +21
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 123 7 +116
Total 4 180 23 +157

Review metrics

Metric Value Why it matters
Production versus validation LOC Production +20 net lines; browser tests and benchmark support +137 net lines. Growth records the last written geometry in the existing owner and extends existing validation for focus, root changes, reopening, and closing.
Diagnostic option One benchmark flag: --focused-stop. Selects the measured tooltip workload without adding a shipped OpenClaw setting or changing defaults.

Labels

Label changes:

  • add P2: A bounded UI CPU improvement for an open Talk tooltip, with no demonstrated message, state, or availability failure.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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:

  • P2: A bounded UI CPU improvement for an open Talk tooltip, with no demonstrated message, state, or availability failure.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rank-up moves

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

  • Establish whether the publication-menu timeout also occurs without this change, or identify and repair a demonstrated PR-caused failure.

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, 12:50 AM ET / 04:50 UTC.

@steipete
steipete enabled auto-merge (squash) October 26, 2026 06:00
@steipete
steipete merged commit be76319 into main Oct 26, 2026
139 of 145 checks passed
@steipete
steipete deleted the solid2/w-perf-talk-tooltip branch October 26, 2026 06:00
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash auto-merge.

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: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: M 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