Skip to content

fix: high Gateway CPU while viewing diagnostics - #147110

Merged
steipete merged 4 commits into
mainfrom
codex/team-vitals-observation
Sep 13, 2026
Merged

steipete merged 4 commits into
mainfrom
codex/team-vitals-observation

Conversation

@steipete

@steipete steipete commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes high Gateway CPU and sluggish chat while the busyness overlay, Connection settings, or Debug page repeatedly requests a full status report.

User Impact

CPU, memory, and event-loop graphs keep updating through a lightweight resource read. Full Debug snapshots refresh on opening, connection or agent changes, and the existing Refresh action; lanes and heartbeat remain live. No database migration or integrity-policy change is required.

Why This Change Was Made

Every full status report performs task-table integrity checks, loads task and delivery records, and reconciles their state. Routine graph polling discarded that report. The graphs now consume the existing system.info request, sharing the same process-counter reader as status. Connection settings uses one resource poll, and Debug no longer repeatedly collects full snapshots.

The existing initial chunk grouping also consolidates startup partitions without pulling in deferred modules. Shared event-loop schemas retain their existing constraints, including integral channel sampling intervals.

The task integrity checks remain in place: they detect stale indexes that can hide records even when SQLite's quick check passes.

Evidence

The original polling regressions fail before the UI cutover: the overlay sends status, Connection settings requests a separate report, and Debug repeats full snapshots during timer ticks. The focused backend, protocol, and UI tests pass. The existing browser E2E passes with live CPU/memory graphs updating while full-status request counts remain unchanged; refresh and reconnect retain their last-good/stale-response contracts. The production UI build passes its performance budgets, and independent P2 review is clean. Core, test, and UI type checks, scoped lint, formatting, unused-export checks, and the remaining protocol/architecture guards pass. CI exposed an adjacent provider-replacement fixture, now corrected through the real initial-load path. The combined source passes 102 focused tests. The build/schema follow-up passes 100 targeted checks, including five bundled Chromium flows; its exact-source comparison reduces startup requests from eight to seven and raw JavaScript by 748 bytes while preserving all 466 initial modules and every published budget.

Live query attribution identified repeated complete task-table scans and integrity checks on the Gateway main thread. This follow-up will receive a separate deployment and live CPU/load comparison after landing.

Synthetic browser proof

Before: full snapshots were repeatedly refreshed in the background.

Debug snapshots before

After: full snapshots use Refresh, while heartbeat and lanes stay live.

Debug snapshots after

The overlay graphs continue updating through the lightweight resource request.

Live resource graphs

@clawsweeper

clawsweeper Bot commented Sep 13, 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 gateway Gateway runtime size: L maintainer Maintainer-authored PR labels Sep 13, 2026
@steipete
steipete marked this pull request as ready for review September 13, 2026 14:58
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 12:03 PM ET / 16:03 UTC (Revision 2).

ClawSweeper review

What this changes

Moves diagnostic graphs onto lightweight Gateway resource reads, keeps full Debug snapshots refresh-driven, adds lifecycle regression coverage, and consolidates initial UI bundle partitions.

Merge readiness

✅ Ready for maintainer review

This remains a useful, bounded fix: current main still repeatedly requests full diagnostics, and the related backend PR addresses complementary work. No blocking correctness or security defect was found.

Priority: P2
Reviewed head: a1b5a2f00acf443a23d86e2c6ba40a3b71710a76

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused implementation with meaningful lifecycle coverage and inspected visual evidence; no blocking defect was identified.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-author exemption applies. Inspected synthetic browser captures show the revised Debug copy and resource graphs, supported by request-count assertions; live Gateway CPU reduction remains explicitly unmeasured.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-author exemption applies. Inspected synthetic browser captures show the revised Debug copy and resource graphs, supported by request-count assertions; live Gateway CPU reduction remains explicitly unmeasured.
Evidence reviewed 9 items Current main retains expensive polling: The fetched main revision still calls loadDiagnostics on each Debug timer tick; its overlay also requests status alongside system.info. The proposed cutover remains absent from this main snapshot.
Shared lightweight production owner: Both status and system.info consume the same process-counter reader. The graph path avoids getStatusSummary, whose task inspection remains intact.
Behavioral regression coverage: The browser scenario changes system.info responses, observes updated CPU and memory graphs, and asserts unchanged status/health/models.list request counts. Page tests cover refresh, reconnect, source replacement, hidden responses, and cancellation. These tests were inspected, not executed during this review.
Findings None None.
Security None None.

How this fits together

The Control UI requests diagnostics from the Gateway to populate activity graphs and operator snapshots. Resource polling now reads process counters without invoking the broader task and session status report.

flowchart TD
  A[Activity graphs] --> B[System information request]
  B --> C[Process counters and cached disk readings]
  C --> A
  D[Open Debug or choose Refresh] --> E[Full diagnostic snapshots]
  F[Debug timer] --> G[Live heartbeat and command lanes]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +10, Tests +281, Docs +2, Other +7. Total +300 across 23 files.

View PR surface stats
Area Files Added Removed Net
Source 12 155 145 +10
Tests 7 329 48 +281
Docs 2 4 2 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 2 8 1 +7
Total 23 496 196 +300

Review metrics

Metric Value Why it matters
Production versus regression coverage Production/tooling net +18 lines; tests net +281 lines Most growth protects polling and lifecycle behavior; production growth supports the shared counter reader and separate live diagnostics.
Protocol extension 2 optional response fields; 0 new request parameters Existing system.info carries process metrics without another RPC or configuration knob.

Technical review

Best possible solution:

Keep resource observation lightweight while preserving explicit full diagnostics, live heartbeat and lanes, and connection-scoped cancellation.

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

Yes for the polling mechanism: current main repeatedly invokes full status collection from diagnostics views. Production CPU impact was not reproduced in this read-only review.

Is this the best way to solve the issue?

Yes. Reusing system.info and one process-counter reader removes unnecessary work without weakening task integrity checks or creating another diagnostics API.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This fixes avoidable Gateway work while diagnostics are open, with a bounded UI and resource-reporting scope.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-author exemption applies. Inspected synthetic browser captures show the revised Debug copy and resource graphs, supported by request-count assertions; live Gateway CPU reduction remains explicitly unmeasured.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The maintainer-author exemption applies. Inspected synthetic browser captures show the revised Debug copy and resource graphs, supported by request-count assertions; live Gateway CPU reduction remains explicitly unmeasured.

Evidence

What I checked:

  • Current main retains expensive polling: The fetched main revision still calls loadDiagnostics on each Debug timer tick; its overlay also requests status alongside system.info. The proposed cutover remains absent from this main snapshot. (ui/src/pages/debug/debug-page.ts:44, ca0746ad8c56)
  • Shared lightweight production owner: Both status and system.info consume the same process-counter reader. The graph path avoids getStatusSummary, whose task inspection remains intact. (src/gateway/server/process-vitals.ts:5, a1b5a2f00acf)
  • Behavioral regression coverage: The browser scenario changes system.info responses, observes updated CPU and memory graphs, and asserts unchanged status/health/models.list request counts. Page tests cover refresh, reconnect, source replacement, hidden responses, and cancellation. These tests were inspected, not executed during this review. (ui/src/e2e/debug-diagnostics.e2e.test.ts:182, a1b5a2f00acf)
  • Inspected synthetic visual evidence: All three prepared images were inspected. They show the before/after Refresh explanation and populated resource graphs. The captured PR body explicitly identifies synthetic browser proof and reserves live CPU/load comparison for deployment; the images do not establish production CPU savings.
  • Compatibility and authorization: The UI policy specifies that Control UI and Gateway ship together without older-version fallbacks. Both status and system.info retain operator.read authorization; the protocol adds optional response fields and preserves integral channel sampling intervals. (ui/AGENTS.md, a1b5a2f00acf)
  • Maintainer proof exemption verified: The live repository permission endpoint identifies steipete as an administrator, resolving the differing association values in the supplied context.

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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-13T15:06:04.324Z sha 5865dbe :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 7f3379c into main Sep 13, 2026
195 checks passed
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@steipete
steipete deleted the codex/team-vitals-observation branch September 13, 2026 16:17
steipete added a commit that referenced this pull request Sep 13, 2026
Merge the current CI baseline and use the shared startup grouping from
#147110. Preserve immediate model invalidation for session events while
the existing lazy client store qualifies command metadata changes.
Ordinary messages skip the full metadata parser.
steipete added a commit that referenced this pull request Sep 13, 2026
Bring in #147110 through normal main history and preserve the reviewed
metadata source. Retain main's CI workflow fixture environment updates.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
* fix: high Gateway CPU while viewing diagnostics

* test: match agent selection observer contract

* test: exercise diagnostics replacement through initial load
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 gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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