openclaw - ✅(Solved) Fix [Feature Request] Cron/scheduled tasks that fail should notify user via channel [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#60608Fetched 2026-04-08 02:49:13
View on GitHub
Comments
0
Participants
1
Timeline
9
Reactions
0
Author
Participants
Timeline (top)
referenced ×6closed ×1cross-referenced ×1locked ×1

Error Message

[diagnostic] lane task error: "FailoverError: LLM request timed out."

Root Cause

  • Users set up cron tasks expecting to receive information (e.g., daily news)
  • Silent failures make it seem like the agent is "thinking" when it's actually stuck
  • Proactive failure notification is fundamental for trust and usability

Fix Action

Fixed

PR fix notes

PR #60622: fix(cron): notify user via primary delivery channel on job failure

Description (problem / solution / changelog)

Summary

When a cron job fails (LLM timeout, tool error, etc.) and has no explicit failureDestination, send the error notification to the job's primary delivery channel — the same channel that receives successful output.

Previously, job failures were only visible in gateway logs. Users running autonomous cron agents (e.g., market scanners, scheduled reports) had no way to know their jobs were silently failing.

Fixes #60608.

Changes

src/gateway/server-cron.ts: In the cron event handler's error path, added a fallback that sends failure notifications via sendFailureNotificationAnnounce() to the primary delivery channel when no explicit failureDestination is configured.

  • Resolves primary delivery plan via existing resolveCronDeliveryPlan()
  • Only fires for mode: "announce" with a valid to target
  • Respects bestEffort opt-out (moved check outside both paths)
  • No double-send: explicit failureDestination takes priority
  • Fire-and-forget pattern matches existing delivery code
  • Message format: ⚠️ Cron job "job-name" failed: error message

Motivation

Running autonomous cron agents on a headless VPS, we experienced multiple consecutive LLM timeouts with zero Telegram notifications. The only way to discover failures was SSH into the server and read logs. This is a common pain point for anyone running scheduled AI agent tasks.

Test plan

  • Existing delivery.failure-notify.test.ts tests still pass
  • Job with delivery: { mode: "announce", channel: "telegram", to: "123" } and no failureDestination → error sends notification to Telegram
  • Job with delivery: { bestEffort: true } → no notification on failure
  • Job with explicit failureDestination → existing behavior preserved, no double-send
  • Job with delivery: { mode: "none" } → no notification

🤖 Generated with Claude Code

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • src/cron/delivery.failure-notify.test.ts (modified, +21/-0)
  • src/cron/delivery.ts (modified, +2/-1)
  • src/gateway/server-cron.ts (modified, +32/-7)
  • src/gateway/server.cron.test.ts (modified, +69/-0)

Code Example

[diagnostic] lane task error: "FailoverError: LLM request timed out."

---

{
     "cron": {
       "notifyOnFailure": true,
       "failureNotificationChannel": "feishu"
     }
   }
RAW_BUFFERClick to expand / collapse

Feature Request

Problem

When a cron/scheduled task fails (e.g., LLM timeout, all model fallbacks exhausted, tool execution error), the user receives no notification. The failure is only visible in gateway logs.

Examples of silent failures observed

  1. LLM Timeout: When minimax/MiniMax-M2.7-highspeed times out and all fallback models (zai-2/glm-5, etc.) also fail, the task is marked as failed in logs but user is never notified:

    [diagnostic] lane task error: "FailoverError: LLM request timed out."
  2. Cron job failures: Daily scheduled tasks (e.g., news briefing) that fail silently leave the user waiting without any feedback.

  3. Tool errors: When critical tools fail (web search rate limits, API timeouts), the agent may continue but produce incomplete results without telling the user.

Expected Behavior

For scheduled/cron tasks:

  • If the task succeeds: normal reply via channel
  • If the task fails: user should receive a notification via the same channel (Feishu message, Telegram message, etc.) indicating the failure and reason

Suggested Implementation

  1. Lifecycle error event → channel notification: When emitAgentEvent emits phase: "error" and no reply is sent within X seconds, trigger a notification to the user via the original channel.

  2. Cron task failure hook: Add a onCronTaskFailure callback that sends a message to the user when a cron job fails.

  3. Config option:

    {
      "cron": {
        "notifyOnFailure": true,
        "failureNotificationChannel": "feishu"
      }
    }
  4. Fallback notification via message tool: When agent completes with an error and no reply, automatically invoke the message tool to notify the user.

Why This Matters

  • Users set up cron tasks expecting to receive information (e.g., daily news)
  • Silent failures make it seem like the agent is "thinking" when it's actually stuck
  • Proactive failure notification is fundamental for trust and usability

Environment

  • OpenClaw version: 2026.4.2
  • Channel: Feishu (websocket)
  • Models: minimax/MiniMax-M2.7-highspeed with zai-2 fallback chain

extent analysis

TL;DR

Implement a notification mechanism for cron task failures to inform users via their original channel, such as Feishu or Telegram, when a scheduled task fails.

Guidance

  • Introduce a onCronTaskFailure callback to send a notification to the user when a cron job fails, ensuring timely feedback.
  • Utilize the emitAgentEvent with phase: "error" to trigger notifications when no reply is sent within a specified timeframe, enhancing error handling.
  • Consider adding a config option like "notifyOnFailure" to control whether failure notifications are sent, allowing for customization.
  • Implement a fallback notification mechanism via the message tool when the agent completes with an error and no reply, ensuring users are always informed.

Example

{
  "cron": {
    "notifyOnFailure": true,
    "failureNotificationChannel": "feishu"
  }
}

This example shows how a config option could be structured to enable failure notifications for cron tasks.

Notes

The implementation details may vary based on the specific requirements and constraints of the OpenClaw version and the channel being used. It's essential to test the notification mechanism thoroughly to ensure it works as expected across different scenarios.

Recommendation

Apply a workaround by implementing the suggested notification mechanisms, as this will provide immediate feedback to users in case of cron task failures, enhancing the overall usability and trust in the system.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING