Skip to content

perf(ui): stop idle diagnostic capture and hidden minute ticks - #158533

Merged
steipete merged 2 commits into
mainfrom
perf/l30-ui-event-ingest
Sep 26, 2026
Merged

steipete merged 2 commits into
mainfrom
perf/l30-ui-event-ingest

Conversation

@steipete

@steipete steipete commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

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.

Diagnostics Before After Raw entries retained
Closed 79.5 ms 3.4 ms 250 → 0
Subscribed 83.5 ms 77.3 ms 250 → 250

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:

File under ui/src/ Tests Wall time Environment
app/gateway-store.event-log.test.ts 24 1.473 s Testbox
app/gateway-store.test.ts 60 40.57 s Saturated local host
pages/activity/activity-page.test.ts 26 2.118 s Testbox
pages/chat/chat-pane-suspension.test.ts 2 2.773 s Testbox
app/gateway-store.observers.test.ts 15 1.461 s Testbox
lit/poll-controller.test.ts 5 1.368 s Testbox
pages/chat/chat-pane-connection-lifecycle.test.ts 20 2.858 s Testbox

The 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 --check pass. Codex autoreview through P2 is scoped-clean, with no accepted/actionable findings.

Heavy-validation limitation: provider blacksmith-testbox, lease tbx_01m3djc6ebf5ykbtx9gsnr0jpq, lease run. Focused remote tests passed with verified candidate file hashes. A subsequent native sync selected 1,494 files and timed out before node scripts/check-changed.mjs or pnpm ui:check-performance:base 31a5754546a0854ca85abf44bf57134e182d5b20 could execute. One diagnostic retry stalled in the same checksum sync; the box is confirmed stopped. Hosted CI, including control-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.ts passes all 3 browser scenarios with node 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, and git diff --check pass.

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.

@clawsweeper

clawsweeper Bot commented Sep 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: S labels Sep 26, 2026
@steipete
steipete marked this pull request as ready for review September 26, 2026 01:27
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. labels Sep 26, 2026
@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 25, 2026, 10:10 PM ET / September 26, 2026, 02:10 UTC (Revision 2).

ClawSweeper review

What this changes

The 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
Reviewed head: 440103f8c018d0c56b8d5686429fafe79f0779b5
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused implementation and credible browser-path measurements support a good patch; the diagnostic lookback choice remains for a Control UI owner.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR reports before/after Chromium measurements through the application Gateway event callback with Live Activity attached, plus browser Activity navigation proof and a hidden-tab timer check. The observed closed-diagnostics callback median fell from 79.5 ms to 3.4 ms per 100,000 injected events; network and rendering were outside that benchmark. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR reports before/after Chromium measurements through the application Gateway event callback with Live Activity attached, plus browser Activity navigation proof and a hidden-tab timer check. The observed closed-diagnostics callback median fell from 79.5 ms to 3.4 ms per 100,000 injected events; network and rendering were outside that benchmark. No stored-data contract changes.
Evidence reviewed 11 items Current main behavior: Current main records each accepted Gateway event into the raw log without checking for a diagnostic subscriber, so opening Debug can show earlier events.
Introduced capture condition: The PR skips raw recording when no event-log listener exists.
Introduced retention change: Removing the last diagnostic subscriber clears the in-memory raw history.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Decision needed

Question Recommendation
Should Debug intentionally lose its pre-open 250-event raw lookback to gain the measured idle-event performance improvement? Accept fresh-window diagnostics: Explicitly approve capture only while Debug is open and keep the updated documentation and empty-state explanation.

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

  • Resolve merge risk (P1) - After an upgrade, opening Debug following an incident will no longer show the preceding raw Gateway events. The existing 250-event lookback is replaced by a fresh window, and the supplied discussion does not explicitly accept that operator tradeoff.
  • Complete next step (P2) - Obtain an explicit Control UI owner decision on the loss of pre-open raw Debug history before merge.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
Agent review details

Security

None.

PR surface

Source -7, Tests +73, Docs +1. Total +67 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 5 32 39 -7
Tests 5 82 9 +73
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 115 48 +67

Review metrics

Metric Value Why it matters
Closed-diagnostics callback benchmark 79.5 ms → 3.4 ms per 100,000 synthetic events Nine reported Chromium trials quantify the browser-side hot path affected by the retention decision.

Merge-risk options

Maintainer options:

  1. Accept the fresh history window (recommended)
    A Control UI owner can explicitly accept the loss of pre-open raw events in exchange for lower idle browser work.
  2. Keep lightweight lookback
    Preserve a bounded metadata-only lookback and verify that idle event ingestion remains cheap.

Technical review

Best 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.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded Control UI performance improvement with a limited diagnostic behavior tradeoff.
  • merge-risk: 🚨 compatibility: Existing operators lose the raw event lookback they previously had when opening Debug after an incident.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR reports before/after Chromium measurements through the application Gateway event callback with Live Activity attached, plus browser Activity navigation proof and a hidden-tab timer check. The observed closed-diagnostics callback median fell from 79.5 ms to 3.4 ms per 100,000 injected events; network and rendering were outside that benchmark. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR reports before/after Chromium measurements through the application Gateway event callback with Live Activity attached, plus browser Activity navigation proof and a hidden-tab timer check. The observed closed-diagnostics callback median fell from 79.5 ms to 3.4 ms per 100,000 injected events; network and rendering were outside that benchmark. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Shakker: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Record the Control UI owner's decision on the loss of pre-open raw Debug events.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-26T01:34:17.687Z sha 0e69ef9 :: blocked before merge. :: none

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.
@steipete
steipete merged commit 9b6e895 into main Sep 26, 2026
125 checks passed
@steipete
steipete deleted the perf/l30-ui-event-ingest branch September 26, 2026 02:51
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 26, 2026
…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.
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 docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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