Skip to content

[Bug] Cron announce delivery reports 'failed' despite successful Discord DM delivery #21041

@jeanlescure

Description

@jeanlescure

Problem

Cron jobs with delivery.mode: "announce" targeting Discord DMs are marked as "error": "cron announce delivery failed" in job state, but the messages ARE successfully delivered to the user.

Symptoms

  • Job runs successfully (status in run history shows completion)
  • Message is delivered to Discord DM
  • Main session receives the message via system message relay
  • BUT: Job state shows lastStatus: "error" with lastError: "cron announce delivery failed"
  • consecutiveErrors counter increments despite successful delivery

Reproduction

  1. Create a cron job with:
{
  "schedule": { "kind": "cron", "expr": "0 6 * * *", "tz": "America/Costa_Rica" },
  "sessionTarget": "isolated",
  "payload": { "kind": "agentTurn", "message": "..." },
  "delivery": {
    "mode": "announce",
    "channel": "discord",
    "to": "1797***********912"
  }
}
  1. Wait for job to execute (or run manually via cron run <jobId>)

  2. Observe:

    • ✅ Message appears in Discord DM
    • ✅ Summary delivered to main session
    • ❌ Job state shows "error": "cron announce delivery failed"

Expected Behavior

If the message was successfully delivered, lastStatus should be "ok" with no error.

Actual Behavior

{
  "state": {
    "lastStatus": "error",
    "lastError": "cron announce delivery failed",
    "consecutiveErrors": 2
  }
}

...but the message WAS delivered successfully.

Impact

  • False error reporting in cron status
  • consecutiveErrors incorrectly increments
  • Monitoring/alerting based on cron status produces false positives

Hypothesis

Delivery validation check may be running before Discord API confirms message send, causing a race condition where the validation fails but the message still goes through.

Environment

  • OpenClaw version: 2026.2.17
  • Delivery mode: announce
  • Channel: Discord (DM)
  • Job type: isolated agentTurn
  • Duration: 7-35s (well under 60s timeout)

Logs

From cron runs <jobId>:

{
  "ts": 1771515791272,
  "status": "error",
  "error": "cron announce delivery failed",
  "summary": "**Spam Cleanup Report...**",
  "runAtMs": 1771515756498,
  "durationMs": 34772,
  "model": "claude-sonnet-4-5",
  "usage": { "total_tokens": 16129 }
}

Message delivered to Discord successfully despite the error status.

Workaround

None needed functionally (messages are delivered), but error reporting is misleading.

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions