Skip to content

perf: pause Talk caption rendering in hidden tabs - #184132

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

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

Conversation

@steipete

@steipete steipete commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Talk captions continue updating invisible DOM while the browser document is hidden.

User Impact

Background Talk sessions skip caption rendering until the document becomes visible, then show every received caption in the retained row. Capture, playback, owner state, and transport remain unchanged.

Why This Change Was Made

The existing document-visibility and parked-projection primitives belong to the caption component's Solid lifecycle. Applying them there avoids publishing each hidden fragment to DOM without introducing another caption owner or timer. The plain conversation owner continues accepting all fragments.

Follow-up to #184003. That PR removed whole-pane caption work and hidden meter polling; this change removes the remaining hidden caption DOM work.

Evidence

Acceptance was set before timing: twenty serial interleaved base/head pairs plus twenty base/base controls, desktop Chromium at 4× CPU, two-second windows with exactly forty Node-delivered chunks at 20 Hz. Compare visible streaming, hidden streaming, and hidden plus reveal task/script CPU. Preserve all chunks, native visibility, existing row identity, neutral tooltip state and reveal latency. CPU uses Chromium thread-clock metrics; report wall timings against the A/A control on this loaded host. Reveal CPU includes restore, DOM catch-up and two visible native animation frames, so deferred work is included.

160/160 observations passed; twenty base/head pairs and twenty identical-base control pairs. All 80 hidden observations recovered every chunk on reveal. The paired campaign ran for 22m46s; one-minute host load ranged 35.78–77.45 (median 55.88).

State / metric Base median / p95 [min–max] Head median / p95 [min–max] Median change
transcribing / taskCpuMsPerSec 99.84 / 109.45 [48.39–115.12] 99.09 / 118.63 [39.00–120.00] -0.76%
transcribing / scriptCpuMsPerSec 20.80 / 23.22 [10.69–23.86] 21.31 / 23.14 [8.72–23.84] +2.46%
hidden-transcribing / taskCpuMsPerSec 27.98 / 31.23 [12.38–32.68] 24.34 / 27.82 [18.05–27.89] -13.01%
hidden-transcribing / scriptCpuMsPerSec 13.62 / 16.27 [4.53–16.74] 8.83 / 10.58 [6.95–11.21] -35.16%
hidden-transcribing / hiddenAndReveal.taskMs 207.92 / 243.87 [175.66–253.51] 198.09 / 229.86 [143.98–232.08] -4.73%
hidden-transcribing / hiddenAndReveal.scriptMs 150.05 / 163.70 [112.91–163.89] 138.13 / 156.73 [105.42–157.80] -7.94%
hidden-transcribing / reveal.observedAfterMs 689.43 / 786.86 [661.95–1067.77] 699.20 / 1017.13 [653.83–1494.34] +1.42%

CPU-per-second values use each actual observation duration. Hidden-plus-reveal values are raw milliseconds across both intervals. Paired median changes are −14.31% hidden task, −32.56% hidden script, −4.78% combined task, and −5.86% combined script. The independent-base control combined-script median moved +1.96%; the CPU win survives reveal accounting.

Timing limitation: visible normalized-task p95 increased 8.38%, and reveal wall p95 increased about 29–31%; strict wall-latency equivalence is not established. Raw visible task-duration p95 moved +6.91% in the comparison versus +9.59% in the identical-base control; visible script, layout and style p95 improved. Identical-base controls show large wall stalls without corresponding CPU growth: one control pair took 1,253.59 vs 702.61 ms to reach the post-reveal frames, while task CPU was 127.96 vs 129.69 ms. In the changed comparison, reveal task median/p95 are 149.10/178.03 → 148.49/177.04 ms; reveal script p95 is +4.17%. The post-DOM two-frame gap improved from median/p95 28.27/50.29 → 23.10/33.96 ms. The campaign’s noisy-host rule therefore uses the twenty-pair CPU metrics and structural counts; the wall tails remain reported, not called a latency win.

Reproduce with committed scripts/bench-control-ui-talk.ts: --bundle-dir <base> --compare-bundle-dir <head> --pairs 20 --aa --duration-ms 2000 --viewport desktop --cpu-throttle 4 --states transcribing,hidden-transcribing --external-transcripts --expect-hidden-parked. Counter/trace smoke is separate; uninstrumented CPU windows do not run a transcript MutationObserver or frame probe.

The separate instrumented smoke passed all four cells: forty chunks displayed in both visible cells; hidden base displayed forty chunks through forty mutation deliveries; hidden head displayed zero through zero mutation deliveries and displayed all forty after reveal. The existing row was retained throughout; hidden analyser reads and interval RAF callbacks were zero. No tooltip opened. Before/after reveal screenshots are byte-identical and use synthetic data only.

Check Result
UI and script typechecks Passed
Scoped UI/script lint, formatting, controller guard Passed
Production Knip Passed
Hidden-caption regression Failed on base; passed on head
Transcript projection file Final candidate: 14 passed; base: 14 passed
Independent Codex review No actionable P0–P2 findings; owner helpers also personally inspected
Production builds and strict asset checks Both passed
Full PR CI 40262095200: 44 jobs passed; only two settings-layout tests and their aggregate gate failed, with the exact same test names failing in scheduled main 40260665877. No cancelled jobs.

One earlier candidate file run passed thirteen tests but failed moves live activity to the current eligible group after replacement and run changes (expected Latest operation…, got no activity). Original-base and restored-identical-candidate file runs both passed all fourteen. No change is claimed to fix that unreproduced failure; it is not classified as inherited. The exact-head full UI unit checks passed; the original local failure remains recorded.

Surface Base Head Delta
Startup JS gzip 271,572 B 271,584 B +12 B
Chat boot JS gzip 1,233,682 B 1,233,575 B −107 B
New-session boot JS gzip 750,274 B 750,259 B −15 B
Total CSS gzip 306,574 B 306,574 B 0
Startup CSS requests 1 1 0

Base source is a5bfe043a403c8af06eaf03a454070347182e96f; head component source is 931424f1b0d3862018d4f309c613142f9b654e49. Queued build labels both retained the base commit, so the source-map component sourcesContent was verified byte-for-byte against the corresponding Git blob. Later changes only extend benchmark reveal metrics and do not change the frozen production bundles.

LOC: production component 53→57 (+4); regression file 701→719 (+18); benchmark plus fixture 1,160→1,458 (+298), including native-hidden delivery, endpoint scans outside the CPU window, reveal accounting, and workload invariants. All refactor-checklist effect/render-effect/untrack/listener/query/flush/owner-API counts in the touched component remain zero.

Synthetic renderer proof does not establish physical-phone, acoustic, provider/network latency or battery-life gains. No audio processing code changes here.

Before - all captions after reveal

After - identical captions after reveal

The two pre-existing failures are settings-layout.e2e.test.ts > Control UI settings layout mocked Gateway E2E > 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 fail on the approvals settings route on this PR and scheduled main. CI tested merge 606ea0ff45b4a50fa545dd9f71a3e98185669793 (parents c1e18a008aab7be7af2bd165df93f69795225a79, bb2bef28110c7e3d48edb6ecb2ea21676eb772db); its real delta is exactly this PR's four files, and the failing settings inputs match the tested main baseline. These failures remain failed and are documented for the native inherited-CI route.

A follow-up audit using the recorded CDP timestamp interval gives hidden task CPU 27.972 → 24.341 ms/s (−12.98%; p95 −10.78%) and hidden script CPU 13.658 → 8.837 ms/s (−35.30%; p95 −34.91%). Hidden-plus-reveal CPU totals are unchanged; visible task p95 remains +8.44%. This corrects small Node response-delay effects in the historical rates above without changing acceptance or the stated limitations.

Retain caption rows while the document is hidden and catch up from the live owner on reveal. Add a document-visibility regression and extend the Talk benchmark with externally paced captions, paired controls, and retained-row assertions. Full performance and CI proof follow in the PR.
@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-26T03:04:40.916443Z bb2bef2 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.

@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-environment 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. 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:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment 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 pauses Talk caption DOM updates while the document is hidden and catches up in retained rows when it becomes visible.

Example: A hidden Talk tab receives 40 caption chunks at 20 Hz.

  • Before: Each chunk updates invisible caption DOM.
  • After: The conversation owner receives every chunk while caption DOM stays parked, then the retained row catches up on reveal.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused implementation with meaningful renderer correctness evidence, but performance acceptance remains incomplete.
Proof confidence 🦐 gold shrimp (3/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: Background Talk sessions spend browser CPU updating captions that users cannot see.
Reason: The reported work-count reduction has clear value, the production implementation reuses existing owners, and maintainer authorship establishes direction.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it addresses remaining hidden-caption rendering on current main with a focused change, and no concrete introduced defect was found.

Priority: P2
Reviewed head: bb2bef28110c7e3d48edb6ecb2ea21676eb772db

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The declared production-browser campaign still lacks completed visible, hidden, and hidden-plus-reveal CPU comparisons and reveal-latency results against its acceptance rule.
Agent review details

How this fits together

The Control UI projects immutable Talk conversation entries into keyed caption rows; document visibility now controls presentation without changing event reception or audio processing.

flowchart LR
  A[Talk transcript events] --> B[Conversation owner]
  B --> C[Caption projection]
  D[Document visibility] --> C
  C --> E[Retained keyed rows]
  E --> F[Visible transcript]
Loading

Technical review

Best possible solution:

Keep the existing conversation owner and visibility primitives, then land the focused presentation change once its performance acceptance and required CI are settled.

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

Current-main source subscribes caption DOM directly to entry updates regardless of document visibility, and the supplied smoke reports 40 hidden mutation deliveries on base; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The production change is the smallest complete fix: park caption presentation through existing lifecycle primitives while preserving immutable owner updates, keyed row identity, and reveal catch-up.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +4, Tests +18, Other +298. Total +320 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 6 2 +4
Tests 1 18 0 +18
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 380 82 +298
Total 4 404 84 +320

Review metrics

Metric Value Why it matters
Benchmark options 2 developer flags --external-transcripts and --expect-hidden-parked support externally paced delivery and hidden-render assertions; neither adds a product setting.

Labels

Label changes:

  • add P2: This removes unnecessary background Talk rendering with limited blast radius and no established urgent user-facing regression.
  • 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:

  • P2: This removes unnecessary background Talk rendering with limited blast radius and no established urgent user-facing regression.
  • 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.

  • Publish the completed paired CPU and reveal-latency results against the declared 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 25, 2026, 11:17 PM ET / October 26, 2026, 03:17 UTC.

@steipete
steipete merged commit 4846765 into main Oct 26, 2026
149 of 154 checks passed
@steipete
steipete deleted the solid2/w-perf-talk-hidden branch October 26, 2026 04:09
@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 26, 2026
* perf: park Talk caption DOM updates in hidden documents

Retain caption rows while the document is hidden and catch up from the live owner on reveal. Add a document-visibility regression and extend the Talk benchmark with externally paced captions, paired controls, and retained-row assertions. Full performance and CI proof follow in the PR.

* fix: satisfy hidden Talk benchmark lint checks

* test: include reveal CPU in hidden Talk measurements
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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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