Skip to content

Cron consecutiveErrors increments on gateway-restart interruptions, masking real agent-failure rate (post-#50414) #77298

Description

@aderius

Summary

#50414 (closed completed 2026-04-25) fixed the original bug where cron jobs interrupted by gateway restart were silently marked completed. The current behavior in 2026.5.2 (8b2a6e5) flipped to the opposite problem: interrupted jobs are correctly marked failed, but state.consecutiveErrors increments on every restart-induced interruption — making the metric useless for monitoring real agent health when the gateway gets restarted normally.

Evidence

Job state observed today after a sequence of routine gateway restarts:

"state": {
  "lastRunStatus": "error",
  "lastError": "cron: job interrupted by gateway restart",
  "consecutiveErrors": 4,
  "lastDeliveryError": "cron: job interrupted by gateway restart"
}

All four "errors" came from openclaw config set triggering hot-reloads during config tuning, not from agent failures. The job ran successfully in every case where the gateway didn't restart mid-run.

Expected behavior

gateway-restart interruptions should:

  • Be distinguishable from agent-turn failures (e.g. lastRunStatus: "interrupted", separate lastInterruptionReason: "gateway-restart").
  • Not increment consecutiveErrors, or increment a separate consecutiveInterruptions counter.

Suggested fix

In the cron runner, detect SIGUSR1/SIGTERM-driven shutdown and emit a distinct interruption status. Or expose a --reset-errors flag on openclaw cron edit for operators to clear the counter manually.

Environment

  • OpenClaw 2026.5.2 (8b2a6e5)
  • Linux x86_64
  • Cron job: kind: every, everyMs: 600000, sessionTarget: isolated

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper-recovery-stuckclawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.staleMarked as stale due to inactivity

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions