Summary
Cron jobs with sessionTarget: "main" enqueue system events to session key "main", but Telegram heartbeats run in session key "agent:main:main". The queued event is never drained.
Steps to reproduce
- Create a cron job with
sessionTarget: "main" and wakeMode: "now"
- Wait for the cron to fire
- Observe that the systemEvent is queued but never delivered to the agent
Expected behavior
The cron system event should be delivered to the active agent session and processed on the next heartbeat.
Actual behavior
- Cron fires and calls
enqueueSystemEvent(text) with no sessionKey → defaults to "main"
- Heartbeats run under session key
"agent:main:main" (for Telegram provider)
drainSystemEvents("agent:main:main") returns empty because events are queued under "main"
- The cron shows
lastStatus: "ok" and lastDurationMs: 1 (it completed instantly) but the task never executes
Evidence from sessions.json
{
"main": { "sessionId": "fbeab70b-..." },
"agent:main:main": { "sessionId": "72690105-...", "lastProvider": "telegram" }
}
The cron enqueues to "main" but heartbeats drain from "agent:main:main".
Environment
- Clawdbot version: 2026.1.7 (built from source)
- OS: macOS Darwin 24.6.0 (arm64)
- Install method: pnpm build with ALLOW_ADHOC_SIGNING=1
Suggested fix
Either:
- Cron service should resolve the correct session key for the target agent (e.g.,
agent:main:main)
- Or
drainSystemEvents should check both "main" and the provider-specific session key
- Or heartbeat processing should always drain
"main" in addition to the current session
Summary
Cron jobs with
sessionTarget: "main"enqueue system events to session key"main", but Telegram heartbeats run in session key"agent:main:main". The queued event is never drained.Steps to reproduce
sessionTarget: "main"andwakeMode: "now"Expected behavior
The cron system event should be delivered to the active agent session and processed on the next heartbeat.
Actual behavior
enqueueSystemEvent(text)with no sessionKey → defaults to"main""agent:main:main"(for Telegram provider)drainSystemEvents("agent:main:main")returns empty because events are queued under"main"lastStatus: "ok"andlastDurationMs: 1(it completed instantly) but the task never executesEvidence from sessions.json
{ "main": { "sessionId": "fbeab70b-..." }, "agent:main:main": { "sessionId": "72690105-...", "lastProvider": "telegram" } }The cron enqueues to
"main"but heartbeats drain from"agent:main:main".Environment
Suggested fix
Either:
agent:main:main)drainSystemEventsshould check both"main"and the provider-specific session key"main"in addition to the current session