Repository navigation
perf(ui): keep Activity Live responsive during event bursts - #186132
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs changes before merge. What this changesThis 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.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete 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 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe 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]
Technical reviewBest 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:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 24e16034180f. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +41, Tests +123. Total +164 across 4 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 27, 2026, 1:08 PM ET / 17:08 UTC. |
…y-live-round3 # Conflicts: # config/test-lines-baseline.txt # ui/src/pages/chat/chat-view.test.ts
|
Merged via squash.
|
…#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
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 headc5eb21eecc0532be4211b98e042353e7e0bf7bfb. Current replacement head7a6976e42fc0cc9be679d30783441a3a12c7c4ddpreserves 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.
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.
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, ormeasureTextwork 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:
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.
pnpm tsgo:uiProduction 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.
Integrated CI repairs
Current head:
7a6976e42fc0cc9be679d30783441a3a12c7c4dd, incorporating main5949887220258626159b602e1f6ada8962bac885. 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:
noneimage 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.