Repository navigation
perf(cron): reuse the selected diagnostic partition and startup refresh - #180875
Conversation
Pass the Gateway-owned cron partition through health diagnostics and retain the lifecycle-owned projection refresh at startup and restart. Live provisioning refreshes remain active; standalone readers continue to resolve their own partition. Count regressions cover removed selection SQL and duplicate startup requests, with committed-update, restart, warning, and runtime-owner replacement proof.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
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: 2aecb6206d
ℹ️ 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".
| audience, | ||
| probe: strength === "probe", | ||
| runtimeSnapshot, | ||
| cronStorePath: opts?.getCronStorePath?.(), |
There was a problem hiding this comment.
Separate health refresh joins by cron partition
When a refresh has already captured the old cron path and a hot reload swaps runtimeState.cronState, a subsequent request with the same audience and strength returns the existing promise at lines 189–191 without consulting getCronStorePath, so that request still reports heartbeat diagnostics from the retired partition. Since this change makes the cron path an answer-changing input, include it in the in-flight identity or invalidate/generate the slot when the cron owner changes.
AGENTS.md reference: AGENTS.md:L69-L69
Useful? React with 👍 / 👎.
|
The in-flight reload overlap is an accepted diagnostic edge for this change: a same-audience request can join a refresh that already captured the previous cron service, and the next refresh reads the current owner. This does not route cron execution or change the existing sensitive-audience separation. The PR now states that case explicitly. Adding another generation/invalidation mechanism for a recoverable diagnostic snapshot would exceed the intended owner-reuse simplification; no change is planned for this finding. |
…sh (openclaw#180875) Use the live cron service partition for health and Automations diagnostics, including config-selected stores. Keep one lifecycle-owned startup/restart projection refresh while preserving live provisioning and standalone selection. Frozen workload: automationProactive.jobs 56 to 36 SQL, 14 to 12 requests; warm causal 45/11/0 unchanged. Exact-head CI, PostgreSQL review, and published-driver update acceptance passed.
Main 784d9ce conflicted in two files. server-methods/health.ts: keep this branch's respondFresh path and runtime-config client filter, and add main's live coreReady (openclaw#180924) to both the cached and the fresh response objects inside the filter. server/health-state.ts: keep this branch's config-key fenced collection loop, and pass main's cronStorePath (openclaw#180875) to its collectGatewayHealthSnapshot call.
What Problem This Solves
Gateway health and the Automations projection now read the cron partition already selected by their live service. Previously each diagnostic request reselected
cron.storefrom persisted machine state and ignored a differentcfg.cron.store, so diagnostics could show a different partition than the cron service. Standalone readers retain their existing partition-selection fallback.Cron startup also refreshed the legacy projection twice. The lifecycle now owns the initial startup and same-service restart refresh; live provisioning continues to refresh after startup. Restart reopens the projection before reading it, and read failures remain visible warnings without disabling cron.
Cost and boundaries
Two alternating frozen v3.1.4 base/candidate pairs confirm 56 → 36 SQL and 14 → 12 requests for
automationProactive.jobs: −20 statements / −2 requests / 0 MAIN per workload. The runner stopped before pair three when host load reached 70.5, above the measurement limit. All four arms completed the full workload and restart. All 36 frozen harness hashes matched.The table reports SQL / requests / MAIN medians [min–max] across the two arms per revision.
Warm causal medians remain 45 [45–48] / 11 [11–12] / 0 [0–0]. Exact-entry facts, actor hydration, projection snapshots, shared row facts, worker environment snapshots, and watermark reads do not increase. Raw totals include background timing variation; two extra candidate
busy_timeoutPRAGMAs occurred during loaded boot/restart in the second pair. They are outside the changed operation.cron.loadMutableis 7 SQL / 7 requests in both bases and the first candidate, and 9 / 9 in the second candidate: both extra calls come from registry-maintenance sweeps (one during first turn, one during restart); the four startup/read call sites remain unchanged. No aggregate or latency improvement is claimed.No schema, SQL syntax, transaction, retention, or authority changes. Health continues reading current receipts. A same-audience diagnostic request may join an in-flight refresh that captured the previous service during reload; the next refresh uses the current owner. This accepted diagnostic staleness does not affect cron execution or sensitive-audience separation.
Evidence
published-driver-updatelane.Nine files: +342/−5 overall; production +17/−5. Release-note context: corrects cron diagnostic partition selection and reduces redundant database work during diagnostics and startup while preserving standalone selection, provisioning, and restart behavior.
Note for #89526: rebase conflict in health-state.ts is mechanical — keep cronStorePath in the reindented snapshot object.