-
-
Notifications
You must be signed in to change notification settings - Fork 52.5k
Closed
Description
Bug Description
Cron jobs configured with delivery.announce mode send the same message twice:
- Once via
delivery.announce(automatic delivery to configured channel) - Once via System Message to the main agent (causing the agent to manually forward it again)
This causes duplicate messages in the target channel.
Expected Behavior
When a cron job has delivery.announce configured:
- ✅ Deliver the result to the configured channel via
delivery - ❌ Do NOT send a System Message to the main agent (since the result has already been sent)
When a cron job does NOT have delivery configured:
- ✅ Send a System Message to the main agent so it can forward the result manually
Current Behavior
Currently, both happen:
- Result is delivered via
delivery.announce✅ - System Message is sent to the main agent ❌
- Main agent receives the System Message and forwards it again ❌
Result: Duplicate messages in the target channel
Use Case
This is particularly important in multi-agent environments with bindings.
Scenario:
User says in tech-group chat: "Create a cron job to send news every day at 9am"
↓
tech-group agent receives message (via bindings)
↓
tech-group creates the cron job
↓
But cron jobs are created in the main agent (OpenClaw limitation)
↓
At the scheduled time, the job executes in the main agent
↓
❓ Where should the result go?
- If no `delivery` → the main agent receives a System Message, but where to forward?
- If `delivery.to` is configured → the main agent delivers to the tech group
The delivery configuration is necessary to route the result to the correct group.
Reproduction Steps
- Create a cron job with
delivery.announceconfiguration:
{
"delivery": {
"mode": "announce",
"channel": "telegram",
"to": "123456789"
}
}-
Wait for the cron job to execute
-
Observe that the message appears twice in the target channel:
- First: Automatic delivery via
delivery - Second: Manual forward from the agent after receiving the System Message
- First: Automatic delivery via
Suggested Fix
// In the cron job completion handler
if (task.delivery?.mode === 'announce') {
// Result has been delivered via delivery.announce
// Do not send System Message to the main agent
return;
}
// Only send System Message for jobs without delivery
sendSystemMessage(task.result);Temporary Workaround
In the agent's logic (AGENTS.md), when receiving a System Message:
- Extract
jobIdfromsessionId(format:agent:main:cron:{jobId}:run:...) - Read
/Users/hong/.openclaw/cron/jobs.json - Check if the job has
deliveryconfiguration - If
delivery.mode === 'announce'→ Reply withNO_REPLY(already delivered) - If no
delivery→ Process normally (forward manually)
Environment
- OpenClaw version: 2026.2.24
- Gateway mode: local
- Agent configuration: Multiple agents with bindings (main, tech-group, invest-group)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels