cron.add 失败却回报成功:强制校验回执与失败回传
问题/场景:代理调用 `cron.add` 缺少必填 schema 时返回 `INVALID_REQUEST`,但用户侧可能被误报“已设置提醒”。前置条件:通过 Telegram/其他渠道让 agent 建提醒任务。实施步骤:按完整 schema 构造 `name/schedule/sessionTarget/payload` → 调用后检查工具回执是否 success=true → 失败时原样回传错误并重试。关键命令:`openclaw cron add --help`。验证:提醒创建后可在 `openclaw cron list` 看到 jobId 且 `cron run` 可触发。风险:若不做回执检查会造成信任损伤。来源:Issue #21451 + cron 工具 schema 文档。
GITHUBDiscovered 2026-02-20Author cpbjr
Prerequisites
- Agent has access to cron tool and user expects reminder/schedule creation.
- Operator can inspect CLI help and runtime logs for `INVALID_REQUEST` details.
Steps
- Use canonical schema with required fields: `name`, `schedule`, `sessionTarget`, `payload`.
- After tool call, parse response for explicit success/error code instead of trusting natural-language draft reply.
- On `INVALID_REQUEST`, show missing keys to user and retry with corrected schema.
- Post-create verify with `openclaw cron list` and optional `openclaw cron run --id <jobId>` smoke test.
Commands
openclaw cron add --helpopenclaw cron listopenclaw cron run --id <jobId>Verify
New reminder appears in cron list with valid schedule, and forced run emits expected reminder text.
Caveats
- Schema fields may evolve by version; keep examples synced to current CLI help(需验证).
- Do not claim success to end users until jobId is confirmed.
Source attribution
This tip is aggregated from community/public sources and preserved with attribution.
Open original source ↗