Repository navigation
fix(cron): keep system monitor convergence responsive - #140260
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: needs maintainer review before merge. Reviewed September 6, 2026, 2:17 PM ET / 18:17 UTC. ClawSweeper reviewWhat this changesThe PR keeps Gateway requests responsive during system-monitor reconciliation by yielding between mutations and skipping validation of absent cron fields, with regression coverage and two test corrections. Merge readiness✅ Ready for maintainer review This PR remains useful: current main lacks the responsiveness changes, and the new configured-Gateway observations address the previous review’s proof request. No actionable introduced defect was found. Priority: P2 Review scores
Verification
How this fits togetherGateway startup and configuration reload reconcile heartbeat and Skill Workshop settings into scheduled monitor jobs. This work shares the event loop with incoming Gateway requests and writes through the existing cron service. flowchart TD
A[Startup or config reload] --> B[Plan monitor changes]
C[Existing cron jobs] --> B
B --> D[Yield to pending Gateway I/O]
D --> E{Reconciliation still current?}
E -->|Yes| F[Guarded cron mutation]
E -->|No| G[Stop superseded pass]
F --> D
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +14, Tests +351. Total +365 across 10 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep the existing reconciliation owners and mutation guards while allowing pending I/O to progress between monitor changes. Do we have a high-confidence way to reproduce the issue? Yes: current source exposes repeated settled-promise mutations without an event-loop yield, and the supplied configured-Gateway baseline records the resulting request timeout. This read-only review did not execute a reproduction. Is this the best way to solve the issue? Yes: the patch addresses both measured costs in their existing owners, preserves normalization semantics and reconciliation order, and adds currentness checks at the new scheduling boundaries. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3d602cd4172f. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
Let I/O progress between settled heartbeat and skill-review monitor mutations. Recheck the existing reconciliation guard after each turn, before entering wrappers that can stop owners ahead of the database guard. Preserve duplicate/upsert/stale order and per-row failure isolation. Regression proof: 13 scheduling and lifecycle cases fail before the change; all 150 affected tests pass on Node 26.7 Linux afterward.
|
Merged via squash.
|
* perf(cron): skip validation of absent delivery fields * fix(cron): yield between system job convergence mutations Let I/O progress between settled heartbeat and skill-review monitor mutations. Recheck the existing reconciliation guard after each turn, before entering wrappers that can stop owners ahead of the database guard. Preserve duplicate/upsert/stale order and per-row failure isolation. Regression proof: 13 scheduling and lifecycle cases fail before the change; all 150 affected tests pass on Node 26.7 Linux afterward. * test(cron): use typed convergence fixtures and public reads * test(cron): satisfy convergence test lint rules * test(cron): await scheduled reconciliation results * test: accept release subpages in docs route shape Pick up the already-landed test correction from 4413c7c (openclaw#140337) to repair the inherited merge-target CI failure. Production source is unchanged.
Problem and change
Large configured cron stores can delay Gateway responses while startup or reload converges heartbeat and skill-review monitor jobs. Awaiting an already-settled CRUD promise does not let pending I/O progress, and normalizing absent optional delivery fields repeatedly constructs discarded Zod errors.
Skip parsing only
undefinedoptional fields, and yield one event-loop turn before each system-monitor mutation. Recheck the existing reconciliation guard after every yield, before entering a mutation wrapper. Preserve duplicate removal, upsert and stale removal order, per-row failure isolation, and final mutation guards. Present values, explicit null clears, false and zero retain their existing normalization behavior. No configuration, database, dependency, public API, or shutdown-policy change.Validation
3353ae2e3757;f4ec6af980ccwaits for the same persisted results with fake time fixed. It does not invoke reconciliation or schedule another retry. All 278 reload tests and the explicit changed-file gate pass.ec668abd96c4.Configured Gateway proof
A fresh Linux build using Node 26.7.0 ran the actual Gateway without profiling hooks or observer patches. The unchanged synthetic workload has 65 configured agents, 13,130 disabled jobs, four full/compact
cron.listrequests, and a 20-second deadline per response. Baseline and field-only builds timed out on the first response. The combined build returned all four exact sets of 200 authorized IDs in 2.739, 3.463, 2.421, and 2.344 seconds. Cold-store physical-FD checks, status/readiness checks, source/build identity, and before/after source/dist/runtime/harness seals passed.The original combined run returned all four responses but failed its private 30-second shutdown observation; it then exited cleanly after 30.757 seconds. That failure remains recorded. Source and stable-release inspection established the unchanged shipped supervisor budget of 330 seconds (
TimeoutStopSec=330, 325-second internal stop budget, 315-second active-work drain). Only the private stop observation was corrected to that contract; request deadlines and workload stayed fixed. The corrected run exited naturally after 30.057 seconds, code 0, with no cleanup signal or forced socket close, no remaining process group, and fixture cleanup complete.Gateway proof used
3353ae2e3757(tree96c6a27233ed55124bce720d48f5f42b125631d6), compiled from carrier53ad5bab78808e13509bff1d3d71a6fe916891bf. All 38,692 tracked entries were independently checked. The native reload candidate tree matchesf4ec6af980ccexactly. Final headec668abd96c4additionally picks up the already-landed test-only docs-route correction from96bf3652adab(#140337), after its inherited merge-target CI assertion failed. Both later changes are test-only; the newer GitHub merge target is qualified separately by final-head CI. This is a bounded synthetic responsiveness result, not a production-wide latency claim.A second unchanged-fixture run tested the actual GitHub merge target
1deb9f39adab(add29edb0b64+ec668abd96c4), including main's longer monitor prompts and newer cron cleanup behavior. It returned the four exact 200-ID results in 2.696, 3.474, 2.390, and 2.272 seconds, and exited naturally in 29.569 seconds without cleanup signals. All 38,743 tracked entries, build/runtime identity, cold-FD checks and source/dist/runtime/harness seals passed. The three successful type jobs and the corrected reload/docs test jobs also checked out this exact merge target. Specific inherited cleanup and placement unit/handler tests passed there; the separate placement E2E was not counted as executed.Review follow-through and remaining work
The latest ClawSweeper review's combined-fixture and validation-status requests, including its rank-up move, are addressed above. Individual store mutations and inventory/planning remain synchronous. The two active root requests observed during shutdown were not attributed, and readiness can still report CPU degradation during convergence; those remain measured follow-up work rather than claims solved here. Doctor scratch-monitor reconciliation fairness is also a separate follow-up.
Production delta: +17/-3, net +14 across the existing normalization and two reconciliation owners. The growth is the four necessary scheduling/currentness boundaries and their imports/comments; no queue, cache or parallel implementation is introduced. Tests: +360/-9, net +351 (including the existing main docs-route correction). Release-note context: keep Gateway requests responsive during system-monitor convergence and avoid unnecessary cron delivery validation work. Changelog generation remains release-owned.