Repository navigation
fix(cron): webhook automations POST skip text when a run skips before it starts - #200032
Conversation
… it starts The primary webhook skipped deferred admissions through a scheduling predicate that ignores runs with a trigger result, so a deferral after a fired trigger, and other skips before execution such as an empty scratch, were POSTed with their skip text as the summary. Skip every result that is skipped with executionStarted false. Closes openclaw#200030
|
🦞👀 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. What this changesSuppress webhook delivery for runs explicitly skipped before execution while retaining their skip reasons in history. Example: An automation uses skipIfScratchEmpty=true and webhook delivery with empty scratch.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it provides a minimal fix for a current webhook delivery bug, with useful regression coverage and no actionable findings. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe cron runner receives execution outcomes, decides whether primary webhook delivery is requested, and passes execution and delivery facts to run finalization. flowchart TD
A[Scheduled or manual run] --> B[Cron execution]
B --> C[Execution outcome]
C --> D[Primary webhook decision]
D --> E[HTTP receiver]
D --> F[Run finalization and history]
Technical reviewBest possible solution: Use explicit pre-execution skip facts at the existing webhook boundary while preserving scheduling, history, actual output, and error delivery. Do we have a high-confidence way to reproduce the issue? Current-main source establishes both paths: fired-trigger outcomes bypass the scheduling predicate, and empty-scratch skips do not qualify as admission deferrals; the contributor also supplies concrete Gateway receiver results. Is this the best way to solve the issue? This is the smallest complete repair: change the delivery decision in its existing owner, retain the scheduling predicate for scheduling, and cover suppression plus output/error controls without new machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 60c112a1bfa9. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource 0, Tests +85. Total +85 across 2 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
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 HistoryReview history (1 earlier review cycle)
Reviewed November 16, 2026, 9:06 AM ET / 14:06 UTC (Revision 2). |
…fires Covers the cases a too-broad skip check would drop: a fired trigger followed by real output, and an error from a run that never started.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
… it starts (openclaw#200032) * fix(cron): webhook automations POST skip text when a run skips before it starts The primary webhook skipped deferred admissions through a scheduling predicate that ignores runs with a trigger result, so a deferral after a fired trigger, and other skips before execution such as an empty scratch, were POSTed with their skip text as the summary. Skip every result that is skipped with executionStarted false. Closes openclaw#200030 * test(cron): webhook still delivers output and errors after a trigger fires Covers the cases a too-broad skip check would drop: a fired trigger followed by real output, and an error from a run that never started.
… it starts (#200032) * fix(cron): webhook automations POST skip text when a run skips before it starts The primary webhook skipped deferred admissions through a scheduling predicate that ignores runs with a trigger result, so a deferral after a fired trigger, and other skips before execution such as an empty scratch, were POSTed with their skip text as the summary. Skip every result that is skipped with executionStarted false. Closes #200030 * test(cron): webhook still delivers output and errors after a trigger fires Covers the cases a too-broad skip check would drop: a fired trigger followed by real output, and an error from a run that never started. (cherry picked from commit 7b0a97a) Co-authored-by: RomneyDa <[email protected]>
…"did not start" notices (#202390) Root cause: src/cron/service/timer-execution.ts:220 (and its twin in src/cron/session-run.ts:224) returns `status: "skipped"` when `skipIfScratchEmpty` finds an explicitly empty checklist, and every skipped run is a failure downstream: `resolveCronCompletionStatus` maps skipped to `completionStatus: "failed"`, run storage records it as failed, it counts toward skipped-run alerts, and the Gateway posts "did not start" for any skipped run without an admission-deferral reason. Fixes #202350. Thanks @herosuncy for the clear report and repro. ## What Problem This Solves A heartbeat-style automation with "Skip empty scratch" on and the default comments-only checklist skips every interval, as intended. But each skip is recorded as a failed run, and the owner conversation gets `Automation "heartbeat-main" did not start: Automation scratch is explicitly empty. Check automation history, resolve the cause, then run it again.` every 30 minutes. An idle heartbeat looks broken, and the only workaround was disabling it. ## User Impact An empty checklist now completes quietly: run history shows `status: "ok"`, `completionStatus: "succeeded"` and the same summary `Automation scratch is explicitly empty`, the model is still not called, no "did not start" notice is posted, and it no longer counts toward skipped-run alerts. Real start failures (for example a model that is not configured) still record a failed run and still post the notice. ## Why This Change Was Made The skip is a deliberate "nothing to do" decision, not a failed start. The cron outcome model has no non-failure skipped state, but it already has one for a run that completes with nothing to deliver: `status: "ok"` with a delivery suppression reason (the same outcome a heartbeat turn with nothing to report records). Both empty-scratch producers now return that outcome with the existing `"empty"` suppression reason, so completion, storage, failure alerts and the conversation notice all treat it as a quiet completion through their existing rules. The primary webhook already ignored skips that never started (#200032); its guard now ignores any non-error run that never started, so the empty-checklist summary is still not POSTed as output. No new status, field, wording or stored shape. Behavior notes: `lastRunStatus` for these ticks is `ok` instead of `skipped`, and `consecutiveSkipped` no longer grows. A one-shot (`at`) job with `deleteAfterRun` and an empty checklist is now deleted like any other succeeded one-shot instead of being kept disabled; it was already consumed and never replayed. History: the skipped return came with the Doctor heartbeat migration (ec5d369, #179387). It predates the "did not start" notice, and #194276 only kept the empty-scratch notice as an untouched control while fixing active-hours/busy deferrals, so recording it as a failure was never a product decision. ## Evidence Real Gateway from source (`ocx src`), isolated state, deterministic local Responses provider that logs every model request, and a process-local Gateway clock stepped past each due time (the system clock is untouched). Job from the issue: every 30 min, `sessionTarget: session:agent:main:main`, `skipIfScratchEmpty: true`, scratch = the issue's comments-only template. | | main e99e848 | this PR 0519148 | | --- | --- | --- | | 2 scheduled ticks of heartbeat-main | `skipped` / `failed` x2 | `ok` / `succeeded` x2, same summary | | job state | `consecutiveSkipped: 2` | `consecutiveSkipped: 0` | | "did not start" notices in the session | 0 -> 2 | 0 -> 0 | | model requests during the ticks | 1 -> 1 | 1 -> 1 | | control: checklist with a real item | runs the turn (`ok`/`succeeded`, model called) | same | | control: model override on an unconfigured provider | `error`/`failed` + "did not start" notice | same | Observed output: #202390 (comment) - `src/cron/service.runs-one-shot-main-job-disables-it.test.ts`: the existing scratch-empty one-shot case now asserts `ok`/`succeeded` history and no skip counter; it fails on main and passes here. - `src/cron/service.trigger-eval.test.ts`: the existing webhook case still proves no POST for the empty checklist. - Production: +7/-4 lines in three files. Tests: +9/-4 (the one regression). Merge danger: two-way door. Nothing is migrated; a revert restores skipped/failed recording for later ticks, and rows written meanwhile stay `ok`/`succeeded`. Blast radius: automations with `skipIfScratchEmpty` and an empty checklist (run history status, completion, notices, skip alerts, `deleteAfterRun` one-shots). Co-authored-by: Ayaan Zaidi <[email protected]>
…"did not start" notices (openclaw#202390) Root cause: src/cron/service/timer-execution.ts:220 (and its twin in src/cron/session-run.ts:224) returns `status: "skipped"` when `skipIfScratchEmpty` finds an explicitly empty checklist, and every skipped run is a failure downstream: `resolveCronCompletionStatus` maps skipped to `completionStatus: "failed"`, run storage records it as failed, it counts toward skipped-run alerts, and the Gateway posts "did not start" for any skipped run without an admission-deferral reason. Fixes openclaw#202350. Thanks @herosuncy for the clear report and repro. ## What Problem This Solves A heartbeat-style automation with "Skip empty scratch" on and the default comments-only checklist skips every interval, as intended. But each skip is recorded as a failed run, and the owner conversation gets `Automation "heartbeat-main" did not start: Automation scratch is explicitly empty. Check automation history, resolve the cause, then run it again.` every 30 minutes. An idle heartbeat looks broken, and the only workaround was disabling it. ## User Impact An empty checklist now completes quietly: run history shows `status: "ok"`, `completionStatus: "succeeded"` and the same summary `Automation scratch is explicitly empty`, the model is still not called, no "did not start" notice is posted, and it no longer counts toward skipped-run alerts. Real start failures (for example a model that is not configured) still record a failed run and still post the notice. ## Why This Change Was Made The skip is a deliberate "nothing to do" decision, not a failed start. The cron outcome model has no non-failure skipped state, but it already has one for a run that completes with nothing to deliver: `status: "ok"` with a delivery suppression reason (the same outcome a heartbeat turn with nothing to report records). Both empty-scratch producers now return that outcome with the existing `"empty"` suppression reason, so completion, storage, failure alerts and the conversation notice all treat it as a quiet completion through their existing rules. The primary webhook already ignored skips that never started (openclaw#200032); its guard now ignores any non-error run that never started, so the empty-checklist summary is still not POSTed as output. No new status, field, wording or stored shape. Behavior notes: `lastRunStatus` for these ticks is `ok` instead of `skipped`, and `consecutiveSkipped` no longer grows. A one-shot (`at`) job with `deleteAfterRun` and an empty checklist is now deleted like any other succeeded one-shot instead of being kept disabled; it was already consumed and never replayed. History: the skipped return came with the Doctor heartbeat migration (b2a65a8, openclaw#179387). It predates the "did not start" notice, and openclaw#194276 only kept the empty-scratch notice as an untouched control while fixing active-hours/busy deferrals, so recording it as a failure was never a product decision. ## Evidence Real Gateway from source (`ocx src`), isolated state, deterministic local Responses provider that logs every model request, and a process-local Gateway clock stepped past each due time (the system clock is untouched). Job from the issue: every 30 min, `sessionTarget: session:agent:main:main`, `skipIfScratchEmpty: true`, scratch = the issue's comments-only template. | | main 704d0b3 | this PR 0519148 | | --- | --- | --- | | 2 scheduled ticks of heartbeat-main | `skipped` / `failed` x2 | `ok` / `succeeded` x2, same summary | | job state | `consecutiveSkipped: 2` | `consecutiveSkipped: 0` | | "did not start" notices in the session | 0 -> 2 | 0 -> 0 | | model requests during the ticks | 1 -> 1 | 1 -> 1 | | control: checklist with a real item | runs the turn (`ok`/`succeeded`, model called) | same | | control: model override on an unconfigured provider | `error`/`failed` + "did not start" notice | same | Observed output: openclaw#202390 (comment) - `src/cron/service.runs-one-shot-main-job-disables-it.test.ts`: the existing scratch-empty one-shot case now asserts `ok`/`succeeded` history and no skip counter; it fails on main and passes here. - `src/cron/service.trigger-eval.test.ts`: the existing webhook case still proves no POST for the empty checklist. - Production: +7/-4 lines in three files. Tests: +9/-4 (the one regression). Merge danger: two-way door. Nothing is migrated; a revert restores skipped/failed recording for later ticks, and rows written meanwhile stay `ok`/`succeeded`. Blast radius: automations with `skipIfScratchEmpty` and an empty checklist (run history status, completion, notices, skip alerts, `deleteAfterRun` one-shots). Co-authored-by: Ayaan Zaidi <[email protected]>
… it starts (openclaw#200032) * fix(cron): webhook automations POST skip text when a run skips before it starts The primary webhook skipped deferred admissions through a scheduling predicate that ignores runs with a trigger result, so a deferral after a fired trigger, and other skips before execution such as an empty scratch, were POSTed with their skip text as the summary. Skip every result that is skipped with executionStarted false. Closes openclaw#200030 * test(cron): webhook still delivers output and errors after a trigger fires Covers the cases a too-broad skip check would drop: a fired trigger followed by real output, and an error from a run that never started. (cherry picked from commit 7b0a97a) Release adaptation: None. Apply before 4b0d39b for easy cron review, though files do not overlap. Co-authored-by: RomneyDa <[email protected]>
…"did not start" notices (#202390) Root cause: src/cron/service/timer-execution.ts:220 (and its twin in src/cron/session-run.ts:224) returns `status: "skipped"` when `skipIfScratchEmpty` finds an explicitly empty checklist, and every skipped run is a failure downstream: `resolveCronCompletionStatus` maps skipped to `completionStatus: "failed"`, run storage records it as failed, it counts toward skipped-run alerts, and the Gateway posts "did not start" for any skipped run without an admission-deferral reason. Fixes #202350. Thanks @herosuncy for the clear report and repro. ## What Problem This Solves A heartbeat-style automation with "Skip empty scratch" on and the default comments-only checklist skips every interval, as intended. But each skip is recorded as a failed run, and the owner conversation gets `Automation "heartbeat-main" did not start: Automation scratch is explicitly empty. Check automation history, resolve the cause, then run it again.` every 30 minutes. An idle heartbeat looks broken, and the only workaround was disabling it. ## User Impact An empty checklist now completes quietly: run history shows `status: "ok"`, `completionStatus: "succeeded"` and the same summary `Automation scratch is explicitly empty`, the model is still not called, no "did not start" notice is posted, and it no longer counts toward skipped-run alerts. Real start failures (for example a model that is not configured) still record a failed run and still post the notice. ## Why This Change Was Made The skip is a deliberate "nothing to do" decision, not a failed start. The cron outcome model has no non-failure skipped state, but it already has one for a run that completes with nothing to deliver: `status: "ok"` with a delivery suppression reason (the same outcome a heartbeat turn with nothing to report records). Both empty-scratch producers now return that outcome with the existing `"empty"` suppression reason, so completion, storage, failure alerts and the conversation notice all treat it as a quiet completion through their existing rules. The primary webhook already ignored skips that never started (#200032); its guard now ignores any non-error run that never started, so the empty-checklist summary is still not POSTed as output. No new status, field, wording or stored shape. Behavior notes: `lastRunStatus` for these ticks is `ok` instead of `skipped`, and `consecutiveSkipped` no longer grows. A one-shot (`at`) job with `deleteAfterRun` and an empty checklist is now deleted like any other succeeded one-shot instead of being kept disabled; it was already consumed and never replayed. History: the skipped return came with the Doctor heartbeat migration (ec5d369, #179387). It predates the "did not start" notice, and #194276 only kept the empty-scratch notice as an untouched control while fixing active-hours/busy deferrals, so recording it as a failure was never a product decision. ## Evidence Real Gateway from source (`ocx src`), isolated state, deterministic local Responses provider that logs every model request, and a process-local Gateway clock stepped past each due time (the system clock is untouched). Job from the issue: every 30 min, `sessionTarget: session:agent:main:main`, `skipIfScratchEmpty: true`, scratch = the issue's comments-only template. | | main e99e848 | this PR 0519148 | | --- | --- | --- | | 2 scheduled ticks of heartbeat-main | `skipped` / `failed` x2 | `ok` / `succeeded` x2, same summary | | job state | `consecutiveSkipped: 2` | `consecutiveSkipped: 0` | | "did not start" notices in the session | 0 -> 2 | 0 -> 0 | | model requests during the ticks | 1 -> 1 | 1 -> 1 | | control: checklist with a real item | runs the turn (`ok`/`succeeded`, model called) | same | | control: model override on an unconfigured provider | `error`/`failed` + "did not start" notice | same | Observed output: #202390 (comment) - `src/cron/service.runs-one-shot-main-job-disables-it.test.ts`: the existing scratch-empty one-shot case now asserts `ok`/`succeeded` history and no skip counter; it fails on main and passes here. - `src/cron/service.trigger-eval.test.ts`: the existing webhook case still proves no POST for the empty checklist. - Production: +7/-4 lines in three files. Tests: +9/-4 (the one regression). Merge danger: two-way door. Nothing is migrated; a revert restores skipped/failed recording for later ticks, and rows written meanwhile stay `ok`/`succeeded`. Blast radius: automations with `skipIfScratchEmpty` and an empty checklist (run history status, completion, notices, skip alerts, `deleteAfterRun` one-shots). Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit ccc83c7) Operator-requested 2026.11.10 stable backport (Dallin, 2026-11-24 04:15). Clean apply. Later main mentions: none. Co-authored-by: RomneyDa <[email protected]>
Closes #200030
What Problem This Solves
Fixes: an automation with webhook delivery POSTs a "finished" event carrying skip text ("Automation admission deferred by its current window or foreground activity", "Automation scratch is explicitly empty") as its summary when the run skipped before it started, most visibly when a trigger fires while the agent is busy.
User Impact
Webhook receivers get a POST only when a run actually executed (or failed). A run that skipped before execution, with or without a fired trigger, sends nothing and records
deliveryStatus: "not-requested". Skip reasons stay in automation history.Behavior change: skipped runs no longer POST to the job's primary webhook (
delivery.mode: "webhook"). Integrations that need skip events can read them from run history (openclaw automations runsorcron.runs), setfailureAlert.includeSkipped: trueto get a failure alert after repeated skips, or use announce delivery with adelivery.completionDestinationwebhook, which this change does not affect.Why This Change Was Made
The primary webhook already skips deferred admissions, but its check reuses a scheduling predicate that ignores any run with a trigger result (a fired trigger spends the occurrence, so scheduling must not retry it). That is right for scheduling and wrong for delivery: the run still has no output. The webhook skips every result that is
skippedwithexecutionStarted: false. That covers the trigger case and other skips before execution, such as an empty scratch. Scheduling and run finalization keep using the existing predicate unchanged.Evidence
Tests in
src/cron/service.trigger-eval.test.ts, run against the real cron service harness:skippedwithtriggerFired: true, and the trigger counts once.ok), or fails before it starts (errorwithexecutionStarted: false): one webhook call carrying that status and its summary or error.Without the change, the first two fail at
sendCronWebhookbeing called once (withstatus: "skipped"and the skip text assummary). With it, all pass. The third guards against a check that is too broad: without theskippedstatus condition the error case fails, and skipping every run after a fired trigger fails both cases. Output and error delivery without a trigger are covered by the existing optional-output cases in the same file and the busy-deferral tests insrc/cron/service.session-payload.test.ts, which deliver the run's output once the agent is idle.Nearby cron suites with the change: 14 files, 218 tests pass (trigger evaluation, session payload, restart delivery, persisted delivery status, failure alerts, delivery plan, manual delivery, cross-tick admission, jobs, timer outcomes, webhook interruption, batch finalization, trigger timer, command timeout).
src/cron/cron-delivery-outcomes.e2e.test.tspasses 5 of 6: "applies threshold and cooldown once before transporting execution failure alerts" fails the same way on unmodified main (2 of 2 runs), on failure-alert message text for an errored run, which this change does not touch.Typecheck (
tsconfig.core.jsonand the cron test config), oxlint, oxfmt,git diff --checkand the test-line budget (+85 of 400) on the touched files pass.Live run on an isolated local Gateway (built from main d275ff6, then with this change), with a throwaway HTTP receiver as the webhook target (allowed through
cron.webhookSsrfPolicy.allowedHostnames: ["127.0.0.1"]). One isolated agent-turn automation withskipIfScratchEmpty: trueand webhook delivery, created withcron.add, scratch emptied withcron.scratch.set, run withcron.runinforcemode:POST /hookwithstatus: "skipped",summary: "Automation scratch is explicitly empty"deliveryStatus: "delivered"skipped, same summary,deliveryStatus: "not-requested"POST /hookwithstatus: "ok",summary: "Build queue is clear."deliveryStatus: "delivered"The third row shows a run that executes still delivers its output. The trigger-fires-while-busy deferral is covered by the first regression test: reproducing it on a Gateway needs the agent to turn busy between the preflight check and the run start.