Repository navigation
perf(ui): stop idle diagnostic capture and hidden minute ticks - #158533
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: blocked before merge. Reviewed September 25, 2026, 10:10 PM ET / September 26, 2026, 02:10 UTC (Revision 2). ClawSweeper reviewWhat this changesThe Control UI captures raw Gateway events only while diagnostics subscribes, keeps Live Activity summaries separately, and pauses chat minute refreshes in hidden tabs. Merge readiness⛔ Blocked before merge - 3 items remain Keep this PR open. The performance evidence and focused coverage are credible, but the loss of pre-open Debug history remains an unresolved operator tradeoff identified in the earlier review. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI Gateway store receives event frames and supplies raw history to Debug and reduced summaries to Live Activity. Chat presentation separately uses a minute timer for relative labels. flowchart LR
A[Gateway events] --> B[Control UI Gateway store]
B --> C{Diagnostics subscribed?}
C -->|Yes| D[Bounded raw history]
C -->|No| E[No raw capture]
B --> F[Live Activity summaries]
G[Browser visibility] --> H[Chat minute refresh]
Decision needed
Why: The code and proof establish the tradeoff, but whether operators need prior raw events for incident diagnosis is a product choice that the earlier review left unresolved. Before merge
Agent review detailsSecurityNone. PR surfaceSource -7, Tests +73, Docs +1. Total +67 across 11 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Record the Control UI owner's choice on fresh-window diagnostics and make the empty Debug state explain when capture begins; if pre-open context is required, retain lightweight bounded breadcrumbs without full idle payload capture. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source records accepted events without a diagnostic subscriber, and the branch adds a subscriber condition; this read-only review did not execute the browser benchmark. Is this the best way to solve the issue? Unclear pending the retention choice. The patch uses the existing Gateway store and visibility-aware polling owner, but its fresh-window Debug behavior needs explicit product acceptance. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5ab2318969b8. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Correct the two Activity navigation scenarios that still expected idle raw-event retention. Require an empty raw log while preserving visible Activity history across navigation and session changes.\n\nThe focused browser suite passes all three scenarios; targeted formatting, lint, and independent review pass.
|
Merged via squash.
|
…law#158533) * perf(ui): capture diagnostic events only while observed * test(ui): align activity flow with observed diagnostic capture Correct the two Activity navigation scenarios that still expected idle raw-event retention. Require an empty raw log while preserving visible Activity history across navigation and session changes.\n\nThe focused browser suite passes all three scenarios; targeted formatting, lint, and independent review pass.
What Problem This Solves
Control UI browsers allocate and retain a 250-event raw log on every inbound event even when diagnostics is closed, and hidden chat panes keep waking for minute-only presentation updates.
User Impact
Chat event ingestion does less work while diagnostics is closed. Raw history is captured only while a diagnostic view subscribes and released after the last subscriber leaves; opening diagnostics starts a fresh history window. Live Activity keeps its independently reduced history across navigation and same-account reconnects. Hidden tabs stop minute presentation ticks and refresh once when visible again.
Why This Change Was Made
The Gateway store now skips raw logging when unobserved. Activity already starts before the connection and owns its reduced history, so its redundant raw-log replay/subscription and reducer wrapper are removed. Connection/account retirement and reentrant observer ownership remain guarded. The chat timer uses the existing visibility-aware PollController. No Gateway protocol, config option, SQLite schema, or dependency changes.
Evidence
Nine interleaved before/after trials in Chromium 153, following two warm-up rounds, against base
31a5754546a0854ca85abf44bf57134e182d5b20. Each trial delivers 100,000 synthetic chat delta events with a 4 KiB payload through the actual application Gateway callback with Live Activity attached. Network, JSON parsing, and rendering are excluded. Shared-host wall times are medians, not a Gateway end-to-end latency claim.The closed-diagnostics path is about 23.4× faster in this component benchmark. Fake-clock pane proof removes all 10 minute ticks during ten hidden minutes and catches up once on return.
All 152 focused tests pass. Commands use
node scripts/run-vitest.mjs <file> --maxWorkers=1; measured per-file wall times:ui/src/app/gateway-store.event-log.test.tsapp/gateway-store.test.tspages/activity/activity-page.test.tspages/chat/chat-pane-suspension.test.tsapp/gateway-store.observers.test.tslit/poll-controller.test.tspages/chat/chat-pane-connection-lifecycle.test.tsThe three regression cases fail on the original production files for the expected retention/timer defects (7.286 s total) and pass after the change. The first candidate Gateway-store run exposed three older tests that expected raw logs without a diagnostic subscriber; the corrected fixtures now all pass. Its local test body consumed under one second; the larger wall time is setup/transformation and shared-host contention.
Production: +32/−39 = −7 LOC. Tests: +78/−4 = +74 LOC. Docs: +1 LOC. Diff-scoped deslop, oxfmt, and
git diff --checkpass. Codex autoreview through P2 is scoped-clean, with no accepted/actionable findings.Heavy-validation limitation: provider
blacksmith-testbox, leasetbx_01m3djc6ebf5ykbtx9gsnr0jpq, lease run. Focused remote tests passed with verified candidate file hashes. A subsequent native sync selected 1,494 files and timed out beforenode scripts/check-changed.mjsorpnpm ui:check-performance:base 31a5754546a0854ca85abf44bf57134e182d5b20could execute. One diagnostic retry stalled in the same checksum sync; the box is confirmed stopped. Hosted CI, includingcontrol-ui-performance, is authoritative; startup-budget verification passed in the completed exact-head hosted run below. No full Gateway build or swarm rerun was needed for this browser-local component change.The overlap check of the latest 200 open PRs found no other PR touching these production files. This changes background work and capture lifetime, with no appearance/layout change.
Landing CI correction: run 36208482595 failed two existing Activity navigation cases because they still required 250 raw events with diagnostics closed. The fixture now requires an empty raw log while preserving the assertions that both Activity summaries remain visible after navigation and session changes. This is the intended capture-lifetime contract; no production change or retry suppression was added. The other cancelled checks were stopped by CI fail-fast after this failure.
The corrected
ui/src/e2e/activity-summaries.e2e.test.tspasses all 3 browser scenarios withnode scripts/run-vitest.mjs ui/src/e2e/activity-summaries.e2e.test.ts --maxWorkers=1: 138.74 s wall including cold browser-bundle build and runner cleanup, 22.40 s test bodies on the shared local host. The existing full-browser cases protect app boot, Gateway delivery, routing, and visible retained Activity together; no new browser case or boot was added. Targeted oxfmt, oxlint, andgit diff --checkpass.Independent Codex autoreview of the landing correction is scoped-clean through P2, with no accepted/actionable findings.
Exact-head CI run 36210435554 is green for
440103f8c018d0c56b8d5686429fafe79f0779b5, including Control UI performance and all UI E2E shards. The corrected Activity suite takes 4.678 s for its 3 tests in CI. No CI rerun was requested; the fresh run followed the reviewed fixture-fix commit.