openclaw - ✅(Solved) Fix [Bug]: Custom session cron jobs do not persist in destination session. [1 pull requests, 1 comments, 2 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#74743Fetched 2026-04-30 06:20:30
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
2
Timeline (top)
labeled ×2commented ×1cross-referenced ×1

When you create a cron job with --session session:custom-id (see docs), responses to the cron prompt appear in the destination channel but not in the session logs for that channel. As a result these injected responses are effectively invisible to the channel agent.

Root Cause

When you create a cron job with --session session:custom-id (see docs), responses to the cron prompt appear in the destination channel but not in the session logs for that channel. As a result these injected responses are effectively invisible to the channel agent.

PR fix notes

PR #11: fix(cron): mirror synthesized text back to session transcript on direct delivery

Description (problem / solution / changelog)

Closes openclaw/openclaw#74743

Problem

When a cron job targets a session via --session session:<sessionId>, the agent turn runs inside that session and delivers its output to the configured channel. However, the delivered text is never written back to the session transcript. On the next turn the agent has no memory of what it last said -- effectively losing the conversation history for cron-driven sessions.

Root cause

deliverViaDirect in src/cron/isolated-agent/delivery-dispatch.ts called deliverOutboundPayloads without the mirror parameter. The mirror param is what triggers appendAssistantMessageToSessionTranscript in src/infra/outbound/deliver.ts (line 819). Without it, delivery succeeds but the session transcript is never updated.

Fix

Pass mirror: { sessionKey: params.agentSessionKey, agentId: params.agentId, text: synthesizedText } to deliverOutboundPayloads when synthesizedText is non-empty. When synthesizedText is empty no delivery occurs at all (the payloadsForDelivery.length === 0 guard returns early), so mirror is correctly omitted in that case.

Tests

Added two tests to delivery-dispatch.double-announce.test.ts:

  • passes mirror param with agentSessionKey and synthesizedText so transcript is updated -- verifies deliverOutboundPayloads receives mirror: { sessionKey, agentId, text } with the correct values
  • skips delivery entirely when synthesizedText is empty (no spurious transcript write) -- verifies that an empty synthesizedText results in zero deliverOutboundPayloads calls (the early-return guard is hit first)

All 13 tests in the file pass.


Generated by Claude Code

<!-- devin-review-badge-begin -->
<a href="https://app.devin.ai/review/suboss87/openclaw/pull/11" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open in Devin Review"> </picture> </a> <!-- devin-review-badge-end -->

Changed files

  • src/cron/isolated-agent/delivery-dispatch.double-announce.test.ts (modified, +33/-0)
  • src/cron/isolated-agent/delivery-dispatch.ts (modified, +9/-0)

Code Example

openclaw cron add \
  --name "Check-in" \
  --cron "0 18 * * *" \
  --session "session:<sessionId>" \
  --message "ask me about my day so far" \
  --wake now \
  --channel "discord" \
  --to "channel:<channelId>"

---

openclaw cron run <jobId>

---

openclaw cron remove <jobId>

---
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

When you create a cron job with --session session:custom-id (see docs), responses to the cron prompt appear in the destination channel but not in the session logs for that channel. As a result these injected responses are effectively invisible to the channel agent.

Steps to reproduce

Get your destination session id

Search through .openclaw/agents/main/sessions/sessions.json to find the sessionId of the session where you want the cron response to appear.

Create a new cron job

openclaw cron add \
  --name "Check-in" \
  --cron "0 18 * * *" \
  --session "session:<sessionId>" \
  --message "ask me about my day so far" \
  --wake now \
  --channel "discord" \
  --to "channel:<channelId>"

After you create the job, the terminal will print the job config. Get the jobId.

Force run the job

openclaw cron run <jobId>

It might take a minute or more for the job to run.

Ask the agent what it JUST sent you...

Mine had no memory of the injected response.

Remove job after testing (optional)

openclaw cron remove <jobId>

Expected behavior

Clawdbot: How is your day going? <--- Injected cron response User: What was your last message to me? Clawdbot: I just asked you how your day was going.

Actual behavior

Clawdbot: How is your day going? <--- Injected cron response User: What was your last message to me? Clawdbot: Message sent before injected cron response

OpenClaw version

2026.4.27

Operating system

Ubuntu 24.04.4 LTS

Install method

npm global

Model

poe-api/claude-haiku-4.5

Provider / routing chain

openclaw > poe-api > claude-haiku-4.5

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

Bottom line: Users expect the agent they are interacting with to remember what it JUST said to them. While a few users are using the wrong setting 1) --session isolated probably shouldn't be the default for announced cron jobs; 2) --session session:custom-id is not meeting expectations either.

Additional information

No response

extent analysis

TL;DR

The issue can be fixed by modifying the cron job configuration to properly log injected responses in the session logs.

Guidance

  • Verify that the --session flag is correctly set to session:custom-id when creating the cron job, and that the sessionId matches the destination session id.
  • Check the OpenClaw documentation to see if there are any specific requirements or limitations for using the --session flag with cron jobs.
  • Test the cron job with a different --session flag, such as --session isolated, to see if the issue is specific to the session:custom-id setting.
  • Review the OpenClaw code to see how cron job responses are handled and logged, to better understand why the injected responses are not being logged in the session logs.

Example

No code snippet is provided as the issue is related to the configuration and usage of the OpenClaw tool, rather than a specific code implementation.

Notes

The issue may be related to the default settings of the --session flag, and changing the default to a different setting may resolve the issue. However, without further information or testing, it is difficult to determine the root cause of the problem.

Recommendation

Apply a workaround by modifying the cron job configuration to use a different --session flag, such as --session isolated, until the issue with --session session:custom-id is resolved. This may require additional testing and verification to ensure that the workaround does not introduce other issues.

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

Clawdbot: How is your day going? <--- Injected cron response User: What was your last message to me? Clawdbot: I just asked you how your day was going.

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 - ✅(Solved) Fix [Bug]: Custom session cron jobs do not persist in destination session. [1 pull requests, 1 comments, 2 participants]