Repository navigation
perf(gateway): publish health only when status changes - #175390
Conversation
Keep cached diagnostics fresh while suppressing unchanged health events. Preserve full hello and RPC snapshots, and seed caretaker health once per connection so pre-existing faults remain visible.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 289362b1a7
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesSuppress unchanged health broadcasts while retaining fresh diagnostic snapshots and initializing caretaker health per connection. Example: Eighteen connected viewers receive 60 refreshes with unchanged health status.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this maintainer-authored PR open: it provides a useful traffic reduction, and source review found no actionable introduced defect. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Gateway health owner collects channel and system diagnostics, caches complete snapshots for RPC consumers, and publishes health events to connected clients. flowchart TD
A[Health collector] --> B[Health state owner]
B --> C[Fresh diagnostic cache]
B --> D[Normalized status comparison]
D --> E[Full health event]
C --> F[Health RPC]
E --> G[Connected clients]
F --> H[Caretaker initial read]
Technical reviewBest possible solution: Publish full health events for material changes while keeping diagnostic RPCs fresh and seeding caretaker health per connection. Do we have a high-confidence way to reproduce the issue? Current main unconditionally advances the health version and broadcasts each completed public collection; this path was verified in source without executing target code. Is this the best way to solve the issue? The existing health owner is the appropriate comparison boundary, and the caretaker initialization closes the initial-state gap created by suppressing unchanged events. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a1c134d1f91e. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +113, Tests +238, Docs +6. Total +357 across 10 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 17, 2026, 5:52 AM ET / 09:52 UTC. |
The health digest introduced by #175390 requires the complete collector contract. The shared Gateway fixture returned only ok/stub, making public health requests throw and reddening auth, reconnect and probe tests. Return a fresh HealthSummary constrained by the real collector signature. Preserve every authorization assertion and the production health digest. Explain fixture isolation and remove its obsolete exact mock-baseline row. Before: trusted-proxy scope test fails at health RPC (165.46s wall). After: all seven reported files plus health-state and mock tests pass, 123 tests in 264.99s wall with --maxWorkers=1. Gateway server/root type checks, focused lint, format and mock-export ratchet pass. P2 review clean.
* perf(gateway): publish health only when status changes Keep cached diagnostics fresh while suppressing unchanged health events. Preserve full hello and RPC snapshots, and seed caretaker health once per connection so pre-existing faults remain visible. * fix(ui): recover initial caretaker health reads and align fixtures
…#175460) The health digest introduced by openclaw#175390 requires the complete collector contract. The shared Gateway fixture returned only ok/stub, making public health requests throw and reddening auth, reconnect and probe tests. Return a fresh HealthSummary constrained by the real collector signature. Preserve every authorization assertion and the production health digest. Explain fixture isolation and remove its obsolete exact mock-baseline row. Before: trusted-proxy scope test fails at health RPC (165.46s wall). After: all seven reported files plus health-state and mock tests pass, 123 tests in 264.99s wall with --maxWorkers=1. Gateway server/root type checks, focused lint, format and mock-export ratchet pass. P2 review clean.
…176726) Follow-up to #175390. Exclude channel busy/run diagnostics from material health changes and require one minute of sampler-observed event-loop degradation before independent publication. Preserve complete diagnostic snapshots and immediate material channel/recovery events. Proof: two regressions fail on the base; all 18 focused tests pass with the fix. Changed-file formatting/lint, core typecheck, independent review, and exact-head PR CI pass. Two concurrent CPU-swapped synthetic publication replays reduce routine health traffic from 60 to 0 frames per socket per simulated hour, preserving every expected material transition. This is publication-boundary proof, not a full live-provider Gateway observation.
…penclaw#176726) Follow-up to openclaw#175390. Exclude channel busy/run diagnostics from material health changes and require one minute of sampler-observed event-loop degradation before independent publication. Preserve complete diagnostic snapshots and immediate material channel/recovery events. Proof: two regressions fail on the base; all 18 focused tests pass with the fix. Changed-file formatting/lint, core typecheck, independent review, and exact-head PR CI pass. Two concurrent CPU-swapped synthetic publication replays reduce routine health traffic from 60 to 0 frames per socket per simulated hour, preserving every expected material transition. This is publication-boundary proof, not a full live-provider Gateway observation.
What Problem This Solves
A connected operator receives a complete health snapshot every minute even when only timestamps and diagnostic readings changed. At roughly 17.7 KB per snapshot, this repeats substantial idle WebSocket traffic across multiple viewers.
User Impact
Health changes still arrive on the next refresh, using the existing full event payload. Explicit health/probe RPC responses and native hello snapshots remain unchanged. Tick and transport ping/pong continue to provide liveness.
The caretaker reads initial health once per active connection/identity and retries failed initial reads on the existing tick, so a fault that predates its connection remains visible even when no new health event occurs.
Why This Change Was Made
The existing health-state owner now compares a normalized snapshot before publishing or advancing the health version. It still refreshes the diagnostic cache every time. The comparison ignores collection timing, ordinary channel/session activity, auth age, and event-loop sample noise while retaining lifecycle timestamps, failures, degraded states, and plugin-owned status. There is no new timer, subscription protocol, configuration, or schema.
The complete cutover requires a small production addition: the normalized comparison and the caretaker's scoped initial read. The full snapshot contract remains intact rather than introducing a second event shape. Production delta is +113 lines (118 added / 5 removed across the caretaker modules and health owner); this growth preserves initial-client state and the existing full-payload contract.
Evidence
Four concurrent, exclusively locked A/B pairs on a 128-core Linux host, with separate 16-core CPU halves swapped each pair. Eighteen synthetic operator sockets; roughly 17.7 KB full frames; session counts/recent keys and diagnostic readings change every refresh.
Every paired B-minus-A difference was −19,114,884 bytes. Initial-plus-periodic traffic fell 98.41%. At the production 60-second cadence this is 19.1 MB/hour of avoided steady-state traffic. All six channel down/up, provider error/recovery, and event-loop degradation/recovery transitions reached all 18 peers on the next refresh; all 1,080 tick frames remained. Prometheus event/byte counters exactly matched the received WebSocket frames.
Measurement limits: an accelerated 60-refresh replay through the actual health owner, broadcaster, WebSocket sender, and Prometheus exporter with synthetic collector/admission adapters. This is a publication-boundary measurement, not an hour-long observation, full Gateway boot, real provider test, or CPU speedup claim. Ambient CPU load was recorded per pair. No production state or multi-GB fixtures were used; the small benchmark sandbox was removed.
Validation: baseline regression failed as intended (duplicate broadcasts); final health-state and caretaker tests passed 67 tests across 3 files, plus the maintenance sibling file passed 22 tests. Changed-file formatting/lint, export-name collision guard, and both required import/PR-wrapper closure files passed (22 closure tests; 75.62 s wall time). Independent Codex autoreview: scoped-clean through P2. Final focused command wall time: 104.63 s (health file 77.05 s including worker preparation, two UI files 7.60 s). Full typecheck/build/suites are delegated to PR CI; no Testbox/Crabbox leases used.
Consumer audit: the web caretaker consumes health errors; Debug uses health RPC. Apple chat consumes health status and already polls health from tick; macOS HealthStore polls RPC. Android treats health as a refresh nudge and already has tick plus dedicated question/progress events. CLI/TUI have no periodic-health liveness dependency. No rendering or layout changes.
PR CI found two test-fixture omissions: the credential-rotation mock needed the shared health route, and the shared request input needed the callable Vitest
Mocktype instead of genericReturnType<typeof vi.fn>(which also includes constructors). Both are repaired without production changes. The four affected UI files passed 74 tests in 5.95 s. Local file-scoped lint reports only the pre-existing 1,013-line limit incustodian-page.test.ts; this repair preserves its line count, and hosted CI treats size limits as advisory. Production repair lint/format and independent Codex autoreview through P2 passed; exact-head PR CI passed, including all previously failing UI/typecheck jobs.Review follow-up: a failed initial caretaker health RPC now retries on the next existing tick. Successful and in-flight reads remain deduplicated; newer events and connections supersede old failures. The focused recovery regression failed before the repair and passed afterward. This does not change Gateway publication or the measured payload result.
Final CI: run 39022461089 on
18d68363dbd19e768b2ccb7a3933ab19cc352ce4; all required gates passed, no failing or pending checks.