openclaw - 💡(How to fix) Fix Bug: agentTurn cron jobs crash on sourceReplyDeliveryMode (v2026.5.22)

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

All cron jobs with payload.kind: "agentTurn" crash during session bootstrap with:

TypeError: Cannot read properties of undefined (reading 'sourceReplyDeliveryMode')

The error occurs at the agent-run level before any agent code executes.

Error Message

TypeError: Cannot read properties of undefined (reading 'sourceReplyDeliveryMode')

Root Cause

Root cause (from source inspection)

The crash appears to be in acp-runtime-backend where event.sourceReplyDeliveryMode is read from the bootstrap event. For cron-triggered agent turns, the event object (or a parent) is undefined because there's no inbound message context to derive sourceReplyDeliveryMode from.

Fix Action

Workaround

Using payload.kind: "systemEvent" with sessionTarget: "main" works — system events inject into the main session and get processed on heartbeat/wake. But this doesn't support isolated task runs, which is the primary use case for agentTurn cron jobs.

Code Example

TypeError: Cannot read properties of undefined (reading 'sourceReplyDeliveryMode')

---

sourceReplyDeliveryMode: event.sourceReplyDeliveryMode,
RAW_BUFFERClick to expand / collapse

Bug: agentTurn cron jobs crash with TypeError: Cannot read properties of undefined (reading 'sourceReplyDeliveryMode')

Version

OpenClaw 2026.5.22 (a374c3a)

Description

All cron jobs with payload.kind: "agentTurn" crash during session bootstrap with:

TypeError: Cannot read properties of undefined (reading 'sourceReplyDeliveryMode')

The error occurs at the agent-run level before any agent code executes.

Reproduction

  1. Create any cron job with payload.kind: "agentTurn"
  2. Trigger it (manually or via schedule)
  3. Job fails immediately (~7s) with the above error

Tested session targets — all fail identically:

  • sessionTarget: "isolated" (default for agentTurn)
  • sessionTarget: "session:<custom-id>"
  • delivery.mode: "announce" with explicit channel, to, accountId
  • delivery.mode: "none"

Root cause (from source inspection)

The crash appears to be in acp-runtime-backend where event.sourceReplyDeliveryMode is read from the bootstrap event. For cron-triggered agent turns, the event object (or a parent) is undefined because there's no inbound message context to derive sourceReplyDeliveryMode from.

Relevant code path in acp-runtime-backend-BPQA8n2I.js:34:

sourceReplyDeliveryMode: event.sourceReplyDeliveryMode,

Workaround

Using payload.kind: "systemEvent" with sessionTarget: "main" works — system events inject into the main session and get processed on heartbeat/wake. But this doesn't support isolated task runs, which is the primary use case for agentTurn cron jobs.

Expected behavior

agentTurn cron jobs should run successfully, with sourceReplyDeliveryMode defaulting to a safe value (e.g., undefined or "normal") when no inbound message context exists.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

agentTurn cron jobs should run successfully, with sourceReplyDeliveryMode defaulting to a safe value (e.g., undefined or "normal") when no inbound message context exists.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Bug: agentTurn cron jobs crash on sourceReplyDeliveryMode (v2026.5.22)