openclaw - 💡(How to fix) Fix [Bug] memory-core dreaming cron system-event does not trigger before_agent_reply hook (deliveryStatus: not-requested) [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#62296Fetched 2026-04-08 03:06:28
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

Root Cause

In dreaming-CnlsXIYM.js, registerShortTermPromotionDreaming() registers a before_agent_reply hook:

api.on("before_agent_reply", async (event, ctx) => {
  return await runShortTermDreamingPromotionIfTriggered({...});
});

When the cron triggers, it sends a system-event to session: main. However:

  • system-event delivered to session → session does NOT generate a reply
  • before_agent_reply hook only fires when there IS a reply
  • Without a reply, the hook never runs → 4ms completion time
  • The deliveryStatus: "not-requested" confirms no agent turn was created

Fix Action

Workaround

Use session: isolated instead of session: main with an explicit message:

openclaw cron add \
  --name "Memory Dreaming" \
  --cron "0 9 * * *" \
  --tz "Asia/Shanghai" \
  --message "Please run the memory dreaming promotion flow..." \
  --session isolated \
  --timeout-seconds 300 \
  --no-deliver

With this workaround, the cron properly triggers an isolated agent turn that executes the dreaming logic (~59 seconds).

Code Example

api.on("before_agent_reply", async (event, ctx) => {
  return await runShortTermDreamingPromotionIfTriggered({...});
});

---

openclaw cron add \
  --name "Memory Dreaming" \
  --cron "0 9 * * *" \
  --tz "Asia/Shanghai" \
  --message "Please run the memory dreaming promotion flow..." \
  --session isolated \
  --timeout-seconds 300 \
  --no-deliver

---

action: "finished"
status: "ok"
durationMs: 4
deliveryStatus: "not-requested"
summary: "__openclaw_memory_core_short_term_promotion_dream__"

---

action: "finished"
status: "ok"  
durationMs: 58685
deliveryStatus: "not-delivered"
summary: "梦境巩固完成..."
RAW_BUFFERClick to expand / collapse

Bug Description

The managed dreaming cron job created by memory-core at startup does not actually trigger the dreaming promotion logic. The cron runs but completes in ~4ms with deliveryStatus: "not-requested" — it appears to do nothing.

Steps to Reproduce

  1. Install openclaw v2026.4.5
  2. Enable dreaming: openclaw config set plugins.entries.memory-core.config.dreaming.enabled true
  3. Ensure plugins.slots.memory is NOT explicitly set (default behavior)
  4. Restart gateway: openclaw gateway restart
  5. After restart, observe: openclaw cron list shows managed "Memory Dreaming Promotion" cron job
  6. Wait for cron to trigger (or manually trigger: openclaw cron run <job-id>)
  7. Check: openclaw cron runs --id <job-id> shows status: ok, durationMs: 4, deliveryStatus: "not-requested"

Expected: dreaming promotion runs for ~30-60 seconds, scans short-term recall, promotes memories
Actual: 4ms, nothing happens

Root Cause Analysis

In dreaming-CnlsXIYM.js, registerShortTermPromotionDreaming() registers a before_agent_reply hook:

api.on("before_agent_reply", async (event, ctx) => {
  return await runShortTermDreamingPromotionIfTriggered({...});
});

When the cron triggers, it sends a system-event to session: main. However:

  • system-event delivered to session → session does NOT generate a reply
  • before_agent_reply hook only fires when there IS a reply
  • Without a reply, the hook never runs → 4ms completion time
  • The deliveryStatus: "not-requested" confirms no agent turn was created

Workaround

Use session: isolated instead of session: main with an explicit message:

openclaw cron add \
  --name "Memory Dreaming" \
  --cron "0 9 * * *" \
  --tz "Asia/Shanghai" \
  --message "Please run the memory dreaming promotion flow..." \
  --session isolated \
  --timeout-seconds 300 \
  --no-deliver

With this workaround, the cron properly triggers an isolated agent turn that executes the dreaming logic (~59 seconds).

Environment

  • macOS 26.4 (arm64)
  • Node v25.9.0
  • OpenClaw v2026.4.5
  • memory-core plugin

Additional Context

The same cron job created manually with --system-event + --session main exhibits identical broken behavior (4ms, no action). This confirms the issue is in how memory-core's managed cron delivers its trigger to the session, not in the cron system itself.

Logs from manual trigger:

action: "finished"
status: "ok"
durationMs: 4
deliveryStatus: "not-requested"
summary: "__openclaw_memory_core_short_term_promotion_dream__"

vs. workaround (isolated session):

action: "finished"
status: "ok"  
durationMs: 58685
deliveryStatus: "not-delivered"
summary: "梦境巩固完成..."

extent analysis

TL;DR

The managed dreaming cron job can be fixed by using an isolated session with an explicit message instead of the default main session.

Guidance

  • The issue arises because the before_agent_reply hook is not triggered when the cron job sends a system-event to the main session, as this does not generate a reply.
  • To verify the issue, check the cron job's delivery status and duration; a status of "not-requested" and a short duration indicate the problem.
  • The workaround involves creating a new cron job with an isolated session and an explicit message, which triggers the dreaming promotion logic correctly.
  • To mitigate the issue, update the existing cron job to use an isolated session, or create a new cron job with the correct configuration.

Example

openclaw cron add \
  --name "Memory Dreaming" \
  --cron "0 9 * * *" \
  --tz "Asia/Shanghai" \
  --message "Please run the memory dreaming promotion flow..." \
  --session isolated \
  --timeout-seconds 300 \
  --no-deliver

Notes

This solution assumes that the issue is specific to the managed dreaming cron job and the memory-core plugin. The workaround may not apply to other cron jobs or plugins.

Recommendation

Apply the workaround by creating a new cron job with an isolated session and an explicit message, as this correctly triggers the dreaming promotion logic. This approach avoids modifying the existing cron job or the memory-core plugin, reducing the risk of introducing new 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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING