Repository navigation
fix(cron): show skipped automation tasks as failed - #123787
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 14, 2026, 3:14 PM ET / 19:14 UTC. ClawSweeper reviewWhat this changesThe PR changes cron-to-task projection so skipped automations appear as failed generic tasks with their reason while cron history remains skipped. Merge readinessKeep open: current main still marks skipped cron outcomes as successful tasks, while this head repairs both projection paths and resolves the prior timeout-precedence finding. No blocking patch defect was found. Priority: P2 Review scores
Verification
How this fits togetherCron records a terminal outcome in cron history and projects the same run into the generic Tasks ledger. Gateway and the Control UI consume that task record to show operators a completed, failed, or timed-out automation. flowchart LR
A[Cron automation] --> B[Terminal cron outcome]
B --> C[Cron run history]
B --> D[Shared task projection]
D --> E[Tasks ledger]
E --> F[Gateway task API]
F --> G[Control UI task list]
Decision needed
Why: The protected maintainer context requires an explicit human landing decision even though the code review found no remaining repairable blocker. Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -3, Tests +71. Total +68 across 6 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Land the shared cron-to-task mapping after exact-head CI, preserving cron-specific Do we have a high-confidence way to reproduce the issue? Yes—on current main, a cron terminal entry with Is this the best way to solve the issue? Yes—the shared projector is the right owner because normal history, terminal-only, recovery, and migration paths already use it; the PR also removes the duplicate no-history mapping. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3289e08c3005. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
|
@clawsweeper re-review The PR body now includes redacted after-fix terminal output from a real Gateway cron service run using the actual isolated-agent local-provider preflight. The run made no model request or external send and proves |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review The PR body now includes the requested sanitized Control UI before/after capture. The same Automation card changes from green Completed to red Failed while retaining the local-provider preflight reason. It also retains the real Gateway cron service terminal proof showing |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
ea34e06 to
272a6ef
Compare
|
Merged via squash.
|
* fix(cron): report skipped runs as failed tasks * test(cron): align skipped task expectations * fix(cron): keep skipped tasks failed
…kips ClawSweeper findings on the prior unconditional skipped->cancelled mapping: P1: Not every skipped outcome is an intentional no-op. Failed model/cron preflights, unmet trigger conditions, and released reservations also report skipped and are real failures; mapping all of them to cancelled reversed the failed-task reporting contract from openclaw#123787 (the Gateway test 'reports skipped isolated cron runs as failed tasks' asserts model endpoint unavailability stays failed). Only a heartbeat no-op skip (error prefixed 'heartbeat skipped:', e.g. empty-heartbeat-file or no-pending-event) maps to cancelled. P2: A late skipped outcome must not overwrite an existing operator cancellation reason. The runner can settle cancelled while the task was operator-cancelled; the skipped->cancelled mapping then made the finalize a cancelled-to-cancelled update that the registry accepts, and the skip error replaced 'Cancelled by operator.'. Finalization now checks the existing task's cancellation state and keeps the operator reason; the skip reason still lives in cron history detail. Tests: heartbeat skip stays cancelled; preflight/trigger failures stay failed (both verified to fail on the prior mapping); late skipped outcome preserves the operator cancellation reason (verified to fail on the prior condition). Full cron suites 128/128 + gateway cron 29/29.
…reasons Only an empty heartbeat file or a stale wake with no pending events is an intentional non-execution and maps to a cancelled task. A globally disabled heartbeat remains a failed task so failure monitors still see it, matching the existing heartbeat payload contract and the unsuccessful-skip reporting contract (openclaw#123787).
Closes #123784
Additional instructions
Allow edits from maintainers is enabled. This PR is AI-assisted; the maintainer has reviewed and understands the change.
What Problem This Solves
Fixes an issue where operators inspecting a skipped automation run in Tasks or the Control UI would see it reported as a successful green Completed task, even though
cron.runscorrectly recorded that the action was skipped with a reason.Why This Change Was Made
The cron-owned task projector now maps only cron
okto generic task success. Cronskippedmaps to the existing failed task state with its authoritative reason, while cron history preservesskipped; the no-history finalizer reuses the same projector instead of maintaining duplicate policy. Timeout classification remains limited to real cronerroroutcomes, and cancellation and quiet-trigger semantics are unchanged. There are no protocol, schema, config, or storage changes.User Impact
Skipped automations no longer look successfully completed in task lists, status summaries, or the Control UI. Operators see an unsuccessful task with the actual skip reason and can still inspect the cron-specific
skippedoutcome in automation history.Production LOC: +8/-11 (net -3) | Tests: +78/-7
Evidence
succeededwhile their cron detail/history wasskipped.skippedoutcome carrying watchdog-timeout-shaped text projected astimed_out; after the one-line status-precedence repair, the same 24-test owner file passed.node scripts/run-vitest.mjs src/cron/task-run-history.test.ts src/cron/service/task-runs.test.ts— 41/41 passed.src/cron/service/ops.test.tsandsrc/cron/service/timer.regression.test.ts— 176/176 passed, including true watchdog timeouts, one-shot recovery, and removed-job skip outcomes.node scripts/run-vitest.mjs src/gateway/server.cron.test.ts -t 'reports skipped isolated cron runs as failed tasks'— the same run reportscron.runs: skippedandtasks.list: failedwithmodel endpoint unavailable. The complete Gateway cron suite also passed 25/25.{ "source": "real Gateway cron service + real isolated-agent preflight", "runResult": { "ok": true, "ran": true }, "cronRuns": { "status": "skipped", "error": "local provider preflight failed ... ECONNREFUSED" }, "tasksList": { "runtime": "cron", "status": "failed", "error": "local provider preflight failed ... ECONNREFUSED" } }Before — the skipped automation is incorrectly green Completed:
After — the same automation is red Failed with its preflight reason:
origin/main3289e08c3005515fb8e49379fd18951ef2530507; targeted formatting andgit diff --checkpassed across the exact six-file patch.272a6ef1ce79c230f1aab9f95ac34b8b414327d3: clean, no accepted/actionable findings, confidence 0.99.check:changedreaches the repository environment-variable ratchet and stops on an inherited current-main baseline (OPENCLAW_* count 504 exceeds budget 502). This PR changes no environment/config surface. Exact-head hosted CI remains the landing authority.