Skip to content

bug: cron sessions missing delivery target (to) in deliveryContext → repeated announce failures #23322

Description

@dgarson

Summary

Cron sessions are created with incomplete deliveryContext — missing to and accountId fields — even when the cron job config has a valid delivery.to value. This causes repeated delivery failures when sub-agents try to announce back to the parent cron session.

Observed Behavior

Cron job b425e29a ("Overnight Work Queue") is configured with:

"delivery": {"mode": "announce", "channel": "slack", "to": "channel:C0AAP72R7L5"}

But the persistent session agent:tim:cron:b425e29a-... stored in sessions.json has:

"deliveryContext": {"channel": "slack"}

Note the missing to and accountId fields. When sub-agents spawned from this cron session try to announce completion back to the parent, delivery fails:

Error: Delivering to Slack requires target <channelId|user:ID|channel:ID> cached=true

This error fires repeatedly (multiple times per second) as each sub-agent tries to announce.

Affected Jobs / Scope

All cron jobs that run in isolated sessions with delivery.mode = "announce" are affected. The to field from the job config is not propagated to the session deliveryContext when the session is created or updated.

Jobs that were erroring due to this bug:

  • aff385fe — Pre-Bedtime Check (main)
  • 9b51578b — workq Progress Check (tim)
  • 2d8ad3fe — C-Suite Morning Sync (amadeus)
  • a2f73546 — Joey Product Standup (joey)
  • Xavier's "Instruction Triage" cron (active, repeated failures)

Root Cause

When the gateway creates or resumes a cron session, it correctly sets deliveryContext.channel from the job's delivery.channel field, but does not copy delivery.todeliveryContext.to or set deliveryContext.accountId.

The relevant path is likely in the gateway's cron session creation/resume logic.

Expected Behavior

deliveryContext should mirror the job's delivery config:

"deliveryContext": {
  "channel": "slack",
  "to": "channel:C0AAP72R7L5",
  "accountId": "default"
}

Workaround Applied

As a temporary fix, directly patched all sessions.json files across all agent directories to add to: "channel:C0AAP72R7L5" and accountId: "default" to all cron session deliveryContext entries that were missing them (~157 entries across 6 agent directories).

Additionally fixed 2 cron jobs that had channel: "last" (which never resolves for isolated cron sessions):

  • 562e1d76 — Julia Org Health Check
  • 1ae111ea — Context Watchdog

Both updated via openclaw cron edit --channel slack --to "channel:C0AAP72R7L5".

Code Location

Likely in gateway cron session creation/resume logic. The fix should ensure delivery.to is always propagated to session deliveryContext.to when the session is created and on every cron run start.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions