← Back to library

隔离 cron 防重复通知:announce 模式下避免主会话二次注入

解决 isolated cron 已发送一次,但主会话再次总结导致 Telegram 重复消息。前置:使用 cron isolated+delivery announce。步骤:明确单一发送责任、禁用重复注入路径、按 jobId+runId 做幂等拦截并压测。关键命令:openclaw cron runs、openclaw cron run。验证:每次 job 仅发送 1 条通知。风险:去重键设计错误会吞掉合法重试。

GITHUBDiscovered 2026-02-15Author su79eu7k
Prerequisites
  • Cron jobs are configured with sessionTarget=isolated and payload.kind=agentTurn.
  • You can inspect run history and downstream Telegram delivery records.
Steps
  1. Audit current delivery path and ensure only one component owns final outbound send.
  2. Remove or disable main-session post-processing that re-sends isolated summaries.
  3. Attach an idempotency key (jobId+runId) and reject duplicate sends in the same run.
  4. Force-run jobs multiple times and compare cron runs with channel message count.
Commands
openclaw cron --help
openclaw gateway status
Verify

For each cron run record, exactly one outbound Telegram message is produced.

Caveats
  • Keep idempotency window bounded; over-broad dedupe can suppress legitimate retries.
  • CLI flags may differ by version; verify with openclaw cron --help before scripting(需验证).
Source attribution

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

Open original source ↗
Visit original post