openclaw - ✅(Solved) Fix Bug: cron delivery with `channel: "last"` silently fails in isolated sessions [1 pull requests, 1 participants]

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…
GitHub stats
openclaw/openclaw#57392Fetched 2026-04-08 01:50:13
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×1referenced ×1

Cron jobs configured with delivery.channel: "last" silently fail to deliver results when running in isolated sessions. No error is logged, no fallback is attempted — the cron job completes successfully but the output is never delivered to the user.

Error Message

Cron jobs configured with delivery.channel: "last" silently fail to deliver results when running in isolated sessions. No error is logged, no fallback is attempted — the cron job completes successfully but the output is never delivered to the user. 3. The result is never delivered. No error in cron run logs. The run shows as completed.

  1. Validation at creation time: When a cron job uses --agent (which runs in isolated sessions), warn that channel: "last" will not work and suggest specifying an explicit channel.

Root Cause

channel: "last" resolves the delivery channel from the session's most recent inbound message context. But cron jobs run in isolated sessions that have no prior inbound message — there is no "last" channel to resolve. The delivery silently becomes a no-op.

Fix Action

Fixed

PR fix notes

PR #57420: fix(cron): warn when channel='last' is used with isolated sessions

Description (problem / solution / changelog)

Summary

Cron jobs configured with delivery.channel: "last" silently fail to deliver results when running in isolated sessions. No error is logged, no fallback is attempted — the cron job completes successfully but output is never delivered.

Changes

  1. Warning at job creation time: When an isolated session uses channel="last" (or defaults to it via announce mode), logs a warning advising to set an explicit channel.
  2. Improved error message: The delivery-time error now includes actionable guidance (openclaw cron edit <id> --delivery-channel <channel>).

Root Cause

channel: "last" resolves the delivery channel from the session's most recent inbound message context. Isolated cron sessions have no prior inbound message, so resolution silently becomes a no-op.

Fixes #57392

Changed files

  • openclaw-2026-03-30.log (added, +618/-0)
  • src/cron/isolated-agent/delivery-target.ts (modified, +5/-1)
  • src/cron/service/initial-delivery.ts (modified, +14/-0)

Code Example

openclaw cron add \
  --name "my-daily-job" \
  --schedule "0 23 * * *" \
  --agent builder \
  --prompt "Run daily check and report" \
  --delivery-channel last \
  --delivery-to 123456789

---

Cron delivery failed: channel "last" could not be resolved (no prior session context). 
   Set an explicit delivery channel with `openclaw cron edit <id> --delivery-channel telegram`.
RAW_BUFFERClick to expand / collapse

Summary

Cron jobs configured with delivery.channel: "last" silently fail to deliver results when running in isolated sessions. No error is logged, no fallback is attempted — the cron job completes successfully but the output is never delivered to the user.

Environment

  • OpenClaw: 2026.3.24 / 2026.3.28
  • OS: Linux (Ubuntu)
  • Channels: Telegram

Steps to Reproduce

  1. Create a cron job with delivery.channel: "last":
openclaw cron add \
  --name "my-daily-job" \
  --schedule "0 23 * * *" \
  --agent builder \
  --prompt "Run daily check and report" \
  --delivery-channel last \
  --delivery-to 123456789
  1. The cron triggers and runs successfully (visible in openclaw cron runs).

  2. The result is never delivered. No error in cron run logs. The run shows as completed.

Root Cause

channel: "last" resolves the delivery channel from the session's most recent inbound message context. But cron jobs run in isolated sessions that have no prior inbound message — there is no "last" channel to resolve. The delivery silently becomes a no-op.

Expected Behavior

  1. Validation at creation time: When a cron job uses --agent (which runs in isolated sessions), warn that channel: "last" will not work and suggest specifying an explicit channel.

  2. Runtime fallback: If "last" resolution fails (no prior context), fall back to the agent's default configured channel, or at minimum log a warning:

    Cron delivery failed: channel "last" could not be resolved (no prior session context). 
    Set an explicit delivery channel with `openclaw cron edit <id> --delivery-channel telegram`.
  3. Documentation: Note in the cron docs that "last" only works for persistent/main sessions, not isolated cron sessions.

Impact

  • Cron jobs appear to run successfully but produce no visible output — users think the feature is broken or the job didn't run
  • Particularly confusing because some cron jobs do deliver (those that happen to run in sessions with prior context), making the failure intermittent and hard to diagnose
  • We had 4 cron jobs silently not delivering for days before discovering the issue through manual log inspection

extent analysis

Fix Plan

To fix the issue, we need to implement the following steps:

  • Validate the delivery channel at creation time and warn if channel: "last" is used with --agent.
  • Implement a runtime fallback to the agent's default configured channel if "last" resolution fails.
  • Update the documentation to note that "last" only works for persistent/main sessions.

Example Code Changes

# Validate delivery channel at creation time
def create_cron_job(args):
    if args.agent and args.delivery_channel == "last":
        print("Warning: 'channel: last' will not work with --agent. Please specify an explicit channel.")
        # Optionally, exit or prompt for confirmation

# Implement runtime fallback
def deliver_results(cron_job):
    if cron_job.delivery_channel == "last":
        try:
            # Resolve "last" channel
            channel = resolve_last_channel()
        except Exception:
            # Fallback to default channel
            channel = get_default_channel()
            print("Cron delivery failed: channel 'last' could not be resolved. Using default channel.")
    # Deliver results using the resolved channel
    deliver(cron_job, channel)

# Update documentation
def update_docs():
    # Add note to cron job documentation
    print("Note: 'channel: last' only works for persistent/main sessions, not isolated cron sessions.")

Verification

To verify the fix, create a new cron job with --delivery-channel last and --agent, and check that a warning is printed at creation time. Then, run the cron job and check that the results are delivered using the default channel. Additionally, update the documentation and verify that the note is added.

Extra Tips

  • Consider adding a configuration option to specify a fallback channel for isolated sessions.
  • Review other areas of the code where channel: "last" is used to ensure that similar issues are not present.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING