360 Secure SkillHub
360 安全技能中心

Cron Delivery Fix

面向 OpenClaw cron 任务:提供诊断、单任务修复、批量修复与恢复脚本,处理投递状态显示已送达但未收到、缺少投递参数、session/payload 组合非法等问题,并给出合法配置模板。依赖 bash/python3 脚本与 openclaw CLI,属 OpenClaw 专属。

shimonxin
shimonxin
热度 40.27
最近更新 2026-05-25 12:47:23
分类:开发依赖:代码执行应用场景:调试排错 / DevOps / 自动化脚本 / 任务管理 ...

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add cron-delivery-fix
Metadata
name
cron-delivery-fix
description
Diagnose and fix OpenClaw cron job delivery failures. Script-based approach to prevent manual config errors. Fixes silent delivery failures, missing delivery params, and invalid session/payload combinations. Triggers: cron not delivering, scheduled task not sending, message not received.

Cron Delivery Fix

Diagnose and fix OpenClaw cron job message delivery failures. Uses scripted operations to prevent manual configuration errors.

Trigger Conditions

  • User reports "didn't receive scheduled task message"
  • Cron status shows delivered but user didn't receive it
  • Cron status shows not-delivered
  • Need to batch-check/fix all cron delivery configs

Core Lessons (Historical Incident Log)

This issue recurred on multiple dates. Each manual fix introduced new problems:

  1. Session context: Isolated session cron jobs lack contextToken, causing silent message failures
  2. Missing params: Some tasks were missing to/channel/accountId, resulting in incomplete delivery
  3. Config wipe: Manual --no-deliver accidentally cleared delivery configs; wrong --session caused invalid combinations

Root cause: Manually running openclaw cron edit one by one easily misses parameters or creates illegal configs.

Solution: Use scripts for unified management. Never manually edit cron session/delivery fields.

Delivery Config Specification

Valid Config Combinations

sessionTarget payload.kind delivery.mode Description
isolated agentTurn announce AI executes + cron auto-delivers summary (requires complete to/channel/accountId)
isolated agentTurn none AI self-delivers via message tool (must include send params in prompt)
main systemEvent none Triggers in main session (no independent delivery)

Invalid Configurations

Combination Error Reason
main + agentTurn Gateway rejects: main cron jobs require payload.kind="systemEvent"
announce + missing to No delivery target, message cannot be sent
announce + missing accountId Multi-account setups deliver to wrong account
none + agent in isolated session AI's message tool lacks contextToken in isolated session

Standard Template for Delivery Tasks

All cron jobs that need to send messages to users must have:

sessionTarget: isolated
payload.kind: agentTurn
delivery.mode: announce
delivery.channel: <your-channel-id>
delivery.to: <your-user-id>
delivery.accountId: <your-account-id>

Standard Template for Silent Tasks

Tasks that don't need to send messages:

sessionTarget: isolated
payload.kind: agentTurn
delivery.mode: none

Operation Flow

Step 1: Diagnose

bash skills/cron-delivery-fix/scripts/diagnose.sh

Outputs delivery status of all cron jobs, flagging problematic ones.

Step 2: Fix

# Fix a single job
bash skills/cron-delivery-fix/scripts/fix-single.sh <job-id> [--announce|--silent]

# Fix all delivery-type jobs
bash skills/cron-delivery-fix/scripts/fix-all.sh

# Restore a broken job (with valid config)
bash skills/cron-delivery-fix/scripts/restore.sh <job-id>

Step 3: Verify

# Run diagnosis again to confirm no issues
bash skills/cron-delivery-fix/scripts/diagnose.sh

# Manual trigger test
openclaw cron run <job-id>

Prohibited Operations

  1. Never manually use openclaw cron edit --session main on agentTurn-type tasks
  2. Never use --no-deliver to clear delivery config then re-add params one by one (easy to miss params)
  3. Never modify cron config without validating the combination is legal
  4. Never fix cron without running diagnose.sh to verify afterwards