← Back to library

Cron announce“假失败”修复:Discord DM 已送达但作业状态被标记 error

问题/场景:cron job 使用 delivery.mode=announce 向 Discord DM 发送成功,但 run state 记录 cron announce delivery failed。前置条件:sessionTarget=isolated + payload.kind=agentTurn + Discord DM announce。实施步骤:复现并保留 run history → 核对 message 实际送达与错误状态分叉 → 修正 announce 返回值/异常处理语义,避免把“无回执”误判为失败 → 回归检查 consecutiveErrors 不再增长。关键配置:delivery.channel=discord + delivery.to。验证:run history 与实际投递结果一致。风险:若依赖错误状态触发补偿逻辑,假失败会导致重复消息。来源:Issue #21041。

GITHUBDiscovered 2026-02-20Author jeanlescure
Prerequisites
  • Cron scheduler is enabled and isolated agentTurn jobs are allowed.
  • Discord DM target ID is valid and bot can deliver messages to that user.
Steps
  1. Create a minimal cron job using announce delivery to a Discord DM and trigger run immediately.
  2. Check DM inbox and compare with cron run state (lastStatus/lastError/consecutiveErrors).
  3. Patch delivery result handling so successful send without extra metadata does not become error.
  4. Re-run and confirm successful sends keep job status healthy and error counters unchanged.
Commands
openclaw cron run --job-id <jobId>
openclaw gateway status
Verify

Discord DM arrives and cron run status is success (no false `cron announce delivery failed`).

Caveats
  • Different channel plugins may return heterogeneous send receipts; normalize before status mapping.
  • Historical failed runs remain in history and may skew alerting until manually acknowledged(需验证).
Source attribution

This tip is aggregated from community/public sources and preserved with attribution.

Open original source ↗
Visit original post