Skip to content

perf(ui): keep Activity Live responsive during event bursts - #186132

Merged
steipete merged 11 commits into
mainfrom
solid2/w-perf-activity-live-round3
Oct 27, 2026
Merged

steipete merged 11 commits into
mainfrom
solid2/w-perf-activity-live-round3

Conversation

@steipete

@steipete steipete commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Activity Live can freeze the UI while a burst of Gateway tool events arrives, even after preview reuse and feed rendering improvements.

User Impact

Activity Live yields during event bursts while preserving the final feed, event order, previews, and synchronous delivery to chat and sidebar. No configuration or migration is required.

Why This Change Was Made

Activity was reducing each event inside the synchronous transport delivery task. Its existing owner now admits events synchronously, reduces the queued facts in order in one next-task batch, and publishes once. Direct snapshot reads still drain synchronously. Clear, disposal, and scope changes cancel pending presentation work; subscription transitions flush already accepted facts.

Transport dispatch, sequence/ack semantics, shared observers, and authority checks are unchanged. A zero-delay task avoids the extra display-frame latency that the rejected animation-frame candidate introduced in WebKit.

Related: #185969, #186101.

Evidence

Measured base b92d0bd890fc99a9ef20372954e914af3d1d3094; measured implementation head c5eb21eecc0532be4211b98e042353e7e0bf7bfb. Current replacement head 7a6976e42fc0cc9be679d30783441a3a12c7c4dd preserves the same Activity production code after merging main and repairing the CI fixture/budget. Headless production bundles, synthetic 2,800-event bursts across 20 sessions, 100 retained rows. Final DOM remains 3,107 nodes. All reports remain under the lane's SSD-local .artifacts/activity-live-round3/ directory.

Twenty counterbalanced Chromium 4× base/head/base triplets per case: 180/180 passed. Renderer scripting CPU and longest-task cells are median / p95 ms.

Case Base CPU Head CPU A/A CPU Base longest task Head longest task
Plain 181.27 / 190.96 169.77 / 198.40 178.05 / 188.69 225.50 / 237.00 122.50 / 133.00
Changed 200.87 / 229.07 187.25 / 207.75 195.33 / 220.47 243.50 / 279.00 128.50 / 145.00
Unicode 226.06 / 245.39 227.01 / 251.57 222.58 / 239.22 286.50 / 321.00 177.50 / 192.00

All 60 head samples were below 200 ms; the maximum was 198 ms. Longest-task p95 fell 40–48%. Plain/changed CPU medians fell 6.34%/6.78%; Unicode CPU was +0.42% (p95 +2.52%), so this does not claim a Unicode throughput win. Plain CPU p95 increased 3.90%, despite its lower median. Host one-minute load ranged 9.27–35.56; unchanged A/A medians moved −1.54% to −2.76%. The robust result is splitting the blocking task, not a uniform CPU or wall-time improvement.

Chromium 4× wall Base Head A/A
Plain 364.15 / 379.58 345.72 / 397.69 354.69 / 380.11
Changed 406.57 / 459.72 394.93 / 460.52 395.37 / 448.96
Unicode 697.05 / 776.94 718.33 / 772.17 707.75 / 774.53

The source-mapped diagnostic confirms the split: the final event-delivery/reduction tasks are separate, with longest tasks 137.78/131.22/166.89 ms (plain/changed/Unicode). No Activity-path Intl.Segmenter, TextEncoder, or measureText work was found; preview work is unchanged.

WebKit native wall time, 10 counterbalanced base/head/base triplets per case (90 passed); cells are median / p95 ms:

Case Base Head A/A control
Plain 164.07 / 196.74 163.55 / 167.61 164.58 / 168.07
Changed 172.67 / 181.73 165.58 / 180.15 165.40 / 179.77
Unicode 314.96 / 362.02 314.41 / 346.63 321.94 / 378.90

WebKit shows no material regression; the changed-content improvement also appears in the unchanged control, so no WebKit speedup is claimed. Its host one-minute load ranged 12.04–18.69. The WebKit/Chromium native-speed ratio is not remeasured or claimed closed.

Check Result
pnpm tsgo:ui Pass
Two directly affected unit files, pinned Bun, one worker 39 passed; ordered delivery, one publication, synchronous reads, pending retirement
Scoped lint and canonical test-file growth ratchet Pass; existing Activity test file size unchanged
Production Knip Pass
Production build and strict base/head performance check Pass, no violations
Startup JS gzip / CSS gzip 90,209 → 90,218 B / 32,745 → 32,745 B
Startup JS / CSS requests 3 / 1, unchanged
Independent Codex review and simplification Clean at P0–P2

Production LOC: 189 → 230 (+41). Tests/helpers: 1,474 → 1,597 (+123). No dependency, cache, shared scheduler, or new Solid reactive primitive. Existing owner listener count is unchanged; effects/render effects/untrack/direct DOM queries/Solid flush all remain zero.

These are synthetic production-renderer scenarios, not a live Gateway deployment. Cross-engine search, retained tool updates, expand/collapse, and clear/reconnect checks passed 8/8 in Chromium and WebKit. Full PR CI is requested with ci:full.

Inspected synthetic-only before/after screenshots are attached below; final order and UTF-16 previews are unchanged, with only native timestamps differing.

Before: synthetic Unicode Activity feed

After: same synthetic Unicode Activity feed

Integrated CI repairs

Current head: 7a6976e42fc0cc9be679d30783441a3a12c7c4dd, incorporating main 5949887220258626159b602e1f6ada8962bac885. Activity production code remains byte-identical to the measured implementation.

Main now contains the cold-load handshake repair, the renamed/named-handoff subagent test, the held-startup suggestion test, and the relocated chat-error suite with explicit lazy-content preload. The superseded edit to the old chat-error block was dropped during the merge. The relocated run/request cases pass locally. The cold-load test retains this PR's extra assertion that no unsubscribe is sent before hello.

Two further CI fixture repairs remain in this PR:

  • The first-use mention test now settles the dynamically imported search engine before advancing its existing 150 ms debounce. All 21 file cases pass, with every assertion retained. The narrow pre-fix replay passed locally; the actual cold-load failure is recorded in CI 40555817205, and no deterministic local reproduction is claimed.
  • Four theme cases still expected a translucent composer after main fix(ui): keep composer and floating surfaces opaque #183295 intentionally made it opaque. They now check the painted opaque gradient (including Chromium's lower none image layer), retaining bubble, geometry, media and draft assertions. All four targeted cases pass through the headless production-bundle E2E path. No production style changed here.

The integrated tree measures 6,286,403 test lines, and the ceiling is set to that exact value without headroom. Main's ceiling is 6,286,325; own net test growth is +126. This is a test-budget adjustment, not a startup/runtime-budget exception. UI typecheck, production Knip and the canonical line ratchet pass. Independent reviews of the owner, timer change, fixture repairs, and final integration are clean at P0–P2. Final CI 40559803363, attempt 1 on this exact head, passed all selected checks including every UI E2E and real-Gateway shard.

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

clawsweeper Bot commented Oct 27, 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 27, 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-27T18:27:15.611502Z 7a6976e 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.

@steipete
steipete enabled auto-merge (squash) October 27, 2026 16:53
@steipete
steipete disabled auto-merge October 27, 2026 17:04
@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. labels Oct 27, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 27, 2026
@clawsweeper

clawsweeper Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR batches Activity Live reduction into the next browser task while preserving ordered admission and synchronous snapshot reads.

Example: A burst delivers 2,800 tool events across 20 sessions.

  • Before: The reported Chromium Unicode workload has a 321 ms p95 longest task.
  • After: The reported p95 longest task falls to 192 ms while retaining the final 100-row feed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Scoped browser measurements support the responsiveness improvement, but the deterministic test-budget failure prevents a clean validation verdict and chat E2E failures remain unattributed.
Proof confidence 🐚 platinum hermit (4/6) This maintainer-authored PR is outside the ordinary contributor proof gate; inspected screenshots and reported Chromium/WebKit production-bundle runs exercise Activity rendering, with synthetic Gateway input and no live-deployment claim.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Activity Live blocks browser interaction while processing large bursts of tool events.
Reason: The maintainer-authored direction addresses a measured remaining bottleneck without changing transport delivery, configuration, or persistent state.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep this PR open: it provides a useful performance improvement absent from current main, but its added test lines cause a deterministic CI failure.

Priority: P2
Reviewed head: c5eb21eecc0532be4211b98e042353e7e0bf7bfb

Before merge

  • Fit the added regression coverage within the test-line gate (P2) - This new suite adds 118 lines and the helper changes add another five, producing a +123 test-line delta while the reviewed tree is already above its global ceiling. scripts/check-test-lines-ratchet.mts:118–127 permits an over-ceiling tree only when the change adds no test lines, so this PR deterministically fails the gate; CI job 122330813260 explicitly reports test-lines failed. Keeping activity-page.test.ts unchanged in size does not satisfy that repository-wide check. Consolidate Activity fixtures and lifecycle coverage while retaining the batching, ordering, synchronous-read, and retirement assertions.

Findings

  • [P2] Fit the added regression coverage within the test-line gate — ui/src/pages/activity/live-activity.test.ts:48-49

Tests

  • Missing end-to-end proof: The supplied production-browser evidence uses a synthetic Gateway, and a red-on-base run of the new regression tests is not shown.
Agent review details

How this fits together

The Control UI Activity owner accepts Gateway tool events for its subscribed roster and publishes bounded summaries to the existing Solid projection.

flowchart LR
  Gateway[Gateway events] --> Dispatch[Synchronous observer dispatch]
  Dispatch --> Chat[Chat and sidebar]
  Dispatch --> Activity[Activity admission]
  Activity --> Queue[Next-task event batch]
  Queue --> Reducer[Existing Activity reducer]
  Reducer --> View[Solid feed projection]
Loading

Technical review

Best possible solution:

Retain the focused batching implementation and consolidate Activity test coverage to satisfy the existing test-line gate without weakening its behavioral assertions.

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

Current main reduces and publishes every admitted Activity event synchronously, matching the reported production-browser burst measurements; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The smallest complete runtime fix is the proposed owner-local queue: preserve FIFO reduction, drain direct reads synchronously, and cancel queued presentation when its scope retires.

Full review comments:

  • [P2] Fit the added regression coverage within the test-line gate — ui/src/pages/activity/live-activity.test.ts:48-49
    This new suite adds 118 lines and the helper changes add another five, producing a +123 test-line delta while the reviewed tree is already above its global ceiling. scripts/check-test-lines-ratchet.mts:118–127 permits an over-ceiling tree only when the change adds no test lines, so this PR deterministically fails the gate; CI job 122330813260 explicitly reports test-lines failed. Keeping activity-page.test.ts unchanged in size does not satisfy that repository-wide check. Consolidate Activity fixtures and lifecycle coverage while retaining the batching, ordering, synchronous-read, and retirement assertions.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Activity event reduction and publication changes intended behavior with a stated reason (a9050cd: Own bounded ephemeral Activity summaries independently of raw diagnostic frames.)
  • Visibility-scoped collection and subscriptions keeps the original intent (8279835: Collect only for the open, visible Activity view while sharing authorized session leases.)
  • Reconnect retention and account retirement keeps the original intent (c7d9291: Keep presentation through ordinary reconnects and retire it when the account or recovery scope changes.)
  • Single-consumer publication keeps the original intent (da60d41: Use one lifetime-bound projection callback for this private owner rather than a listener registry.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test ui/src/pages/activity/live-activity.test.ts ui/src/pages/activity/activity-page.test.ts --maxWorkers=1
  • node --import ./scripts/tsx.mjs scripts/check-test-lines-ratchet.mts --base b92d0bd
  • pnpm tsgo:ui
  • git diff --check

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 8279835 adds ui/src/pages/activity/live-activity.ts:103 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 8279835741d0; files: ui/src/pages/activity/live-activity.ts)
  • Shakker: Raw commit a9050cd adds ui/src/pages/activity/live-activity.ts:35 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: a9050cde4e1b; files: ui/src/pages/activity/live-activity.ts)

PR surface

Source +41, Tests +123. Total +164 across 4 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 1 42 1 +41
Tests 3 160 37 +123
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 202 38 +164

Review metrics

Metric Value Why it matters
Production versus test growth Production +41 lines; tests/helpers +123 lines Production growth implements batching and retirement in the existing owner; the distinct regression cases are useful, but their net growth triggers the global test-line gate.

Labels

Label changes:

  • add P2: Activity burst responsiveness is a bounded UI performance improvement, with a focused validation repair needed before landing.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit 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: Activity burst responsiveness is a bounded UI performance improvement, with a focused validation repair needed before landing.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

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 27, 2026, 1:08 PM ET / 17:08 UTC.

@steipete
steipete merged commit 1b50ce5 into main Oct 27, 2026
106 of 108 checks passed
@steipete
steipete deleted the solid2/w-perf-activity-live-round3 branch October 27, 2026 18:58
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 28, 2026
…#186132)

* perf(ui): batch Activity Live presentation per frame

* perf(ui): yield Activity batches without waiting for paint

* test(ui): align cold-load proof with queued handshakes

* test(ui): await lazy error content before checking its display

* test: align the test ceiling with the merged tree

* test(ui): settle the lazy mention engine before its debounce

* test(ui): assert the opaque composer surface layer
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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M 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