Skip to content

fix(cron): keep system monitor convergence responsive - #140260

Merged
steipete merged 6 commits into
mainfrom
codex/cron-absent-delivery-fields
Sep 6, 2026
Merged

steipete merged 6 commits into
mainfrom
codex/cron-absent-delivery-fields

Conversation

@steipete

@steipete steipete commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

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 undefined optional 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

  • Native normalization/Doctor coverage: 153 passing tests; representative actual-Zod characterization preserved 171 input/schema outcomes. The synthetic 13,130-job seed avoids 52,520 failed parses of absent fields.
  • Native reconciliation coverage: 150 passing tests, including 13 regressions that fail on the pre-fairness source. Covers I/O progress, row failures, duplicate/upsert/stale phases, and stop/configuration replacement/supersession guards.
  • Existing rejected/noop reload successor cases exposed an early assertion after the retry timer fired. Both failures reproduce on 3353ae2e3757; f4ec6af980cc waits 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.
  • Changed-path production types, test types, lint and guards completed across the retained native runs and successful standard PR merge-ref type jobs. Earlier test-type and style failures were corrected and their failed checks rerun. Final-head CI and CodeQL are green for ec668abd96c4.
  • Independent reviews found no actionable P2-or-higher issue in the combined change or final test correction.

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.list requests, 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 (tree 96c6a27233ed55124bce720d48f5f42b125631d6), compiled from carrier 53ad5bab78808e13509bff1d3d71a6fe916891bf. All 38,692 tracked entries were independently checked. The native reload candidate tree matches f4ec6af980cc exactly. Final head ec668abd96c4 additionally picks up the already-landed test-only docs-route correction from 96bf3652adab (#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.

@clawsweeper

clawsweeper Bot commented Sep 6, 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 commands Command implementations size: S maintainer Maintainer-authored PR labels Sep 6, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 2:17 PM ET / 18:17 UTC.

ClawSweeper review

What this changes

The 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
Reviewed head: ec668abd96c4b347e42ad697669e8f62a0a09905

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with useful runtime observations, relevant regression coverage, and no remaining actionable finding.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The captured body reports actual Gateway cron.list requests during large-store reconciliation, with four successful after-fix responses and unchanged workload/deadlines. The proven production source matches this head; the result is bounded synthetic responsiveness proof, not a general latency guarantee.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured body reports actual Gateway cron.list requests during large-store reconciliation, with four successful after-fix responses and unchanged workload/deadlines. The proven production source matches this head; the result is bounded synthetic responsiveness proof, not a general latency guarantee.
Evidence reviewed 7 items Verified introduced production changes: The merge-base comparison confirms the production changes are limited to optional-field parsing and four scheduling/currentness checkpoints; endpoint drift was not treated as PR-owned work.
Current-main and release comparison: Fetched main retains unconditional optional-field parsing and lacks the added reconciliation yields. The v2026.9.2 parser also retains unconditional parsing. The supplied merged related PR concerns only the docs-route test and does not supersede the responsiveness repair.
Existing lifecycle and mutation fences: The Gateway serializes reconciliation, checks the epoch and accepted config identity, and handles supersession. The patch checks that same guard after yielding and retains the guards passed into cron mutations; it does not create or transfer a new authority capability.
Findings None None.
Security None None.

How this fits together

Gateway 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
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +14, Tests +351. Total +365 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 3 17 3 +14
Tests 7 360 9 +351
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 377 12 +365

Review metrics

Metric Value Why it matters
Production growth justification Production net +14 lines; tests net +351 lines Production growth adds scheduling and currentness checkpoints within existing owners, without a parallel queue or new abstraction.
Configured Gateway response proof 4 of 4 responses in 2.344–3.463 seconds The supplied combined-build run meets the unchanged 20-second deadline that baseline and field-only builds missed.

Technical review

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The captured body reports actual Gateway cron.list requests during large-store reconciliation, with four successful after-fix responses and unchanged workload/deadlines. The proven production source matches this head; the result is bounded synthetic responsiveness proof, not a general latency guarantee.

Label justifications:

  • P2: This is a bounded responsiveness repair for large cron stores during startup and reload.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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 captured body reports actual Gateway cron.list requests during large-store reconciliation, with four successful after-fix responses and unchanged workload/deadlines. The proven production source matches this head; the result is bounded synthetic responsiveness proof, not a general latency guarantee.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured body reports actual Gateway cron.list requests during large-store reconciliation, with four successful after-fix responses and unchanged workload/deadlines. The proven production source matches this head; the result is bounded synthetic responsiveness proof, not a general latency guarantee.

Evidence

What I checked:

  • Verified introduced production changes: The merge-base comparison confirms the production changes are limited to optional-field parsing and four scheduling/currentness checkpoints; endpoint drift was not treated as PR-owned work. (src/cron/heartbeat-monitor.ts:173, ec668abd96c4)
  • Current-main and release comparison: Fetched main retains unconditional optional-field parsing and lacks the added reconciliation yields. The v2026.9.2 parser also retains unconditional parsing. The supplied merged related PR concerns only the docs-route test and does not supersede the responsiveness repair. (src/cron/delivery-field-schemas.ts:56, 3d602cd4172f)
  • Existing lifecycle and mutation fences: The Gateway serializes reconciliation, checks the epoch and accepted config identity, and handles supersession. The patch checks that same guard after yielding and retains the guards passed into cron mutations; it does not create or transfer a new authority capability. (src/gateway/server-cron.ts:1570, ec668abd96c4)
  • Configured Gateway observations resolve prior request: The complete captured PR body reports a Linux Node 26.7.0 Gateway run with 65 agents and 13,130 disabled jobs. Baseline and field-only builds exceeded the first 20-second request deadline; combined production source returned four exact authorized result sets in 2.739, 3.463, 2.421, and 2.344 seconds. It preserves the initial shutdown-observation failure and reports natural exit under the unchanged shipped supervisor budget. These are supplied runtime observations, not reviewer-executed tests. (3353ae2e3757)
  • Proof revision remains representative: No production differences exist between the recorded Gateway-proof revision and the reviewed head across the three changed production owners. Later changes affect only reload-test synchronization and the docs-route assertion. The latter matches the merged correction at fix(test): accept release subpages in docs route shape #140337. (src/gateway/server-reload-handlers.test.ts:2685, ec668abd96c4)
  • Regression coverage and preserved behavior: Reviewed coverage exercises progress after failed rows, stale-pass rejection, and stop/config replacement/supersession across both monitor families. The reload correction observes the same persisted results with fake time fixed. Present values still pass through existing schemas, and explicit null clearing remains in normalization. (src/gateway/server-cron.test.ts:685, ec668abd96c4)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: 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 (5 earlier review cycles)
  • reviewed 2026-09-06T16:12:38.335Z sha 3788413 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-06T16:25:10.440Z sha 3788413 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-06T16:44:35.837Z sha 3788413 :: blocked before merge. :: none
  • reviewed 2026-09-06T17:17:13.932Z sha 4a342d6 :: blocked before merge. :: none
  • reviewed 2026-09-06T17:28:46.726Z sha 3353ae2 :: blocked before merge. :: none

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.
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: M and removed size: S labels Sep 6, 2026
@steipete steipete changed the title fix(cron): avoid slow normalization of missing delivery fields fix(cron): keep system monitor convergence responsive Sep 6, 2026
@steipete steipete self-assigned this Sep 6, 2026
Pick up the already-landed test correction from 96bf365 (#140337) to repair the inherited merge-target CI failure. Production source is unchanged.
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 6, 2026
@steipete
steipete merged commit b51d8c6 into main Sep 6, 2026
187 of 188 checks passed
@steipete
steipete deleted the codex/cron-absent-delivery-fields branch September 6, 2026 18:26
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
* 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations gateway Gateway runtime maintainer Maintainer-authored PR 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: M 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