openclaw - ✅(Solved) Fix [Bug]: memory-core: dreaming cron never registers — startup timing + reconciliation skip bug [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#72841Fetched 2026-04-28 06:31:37
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
labeled ×2commented ×1cross-referenced ×1

memory-core dreaming cron job fails to register at gateway startup and never retries, causing the Memory Dreaming Promotion task to never execute.

Error Message

api.logger.warn("memory-core: managed dreaming cron could not be reconciled (cron service unavailable).");

Root Cause

memory-core dreaming cron job fails to register at gateway startup and never retries, causing the Memory Dreaming Promotion task to never execute.

PR fix notes

PR #73170: fix(memory-core): retry dreaming cron registration after startup deferral [AI-assisted]

Description (problem / solution / changelog)

🤖 AI-assisted (built with Claude Code via Hermes orchestration). Test level: fully tested. Prompt summary available on request.

Summary

  • Problem: The memory-core dreaming cron job fails to register at gateway startup due to a timing race — the gateway_start hook fires before the cron service is available. The runtime reconciliation path only triggers on heartbeat/cron events, creating a deadlock when the cron was never registered.
  • Why it matters: The Memory Dreaming Promotion task never executes, breaking the dreaming feature entirely for affected users.
  • What changed: Added a deferred retry (5-second setTimeout) after the startup deferral so the managed dreaming cron job registers once sidecars have settled.
  • What did NOT change (scope boundary): No changes to core gateway code, no changes to the cron service lifecycle, no changes to the runtime reconciliation logic.

Change Type (select all)

  • Bug fix

Scope (select all touched areas)

  • Plugin / extension

Linked Issue/PR

  • Closes #72841
  • This PR fixes a bug or regression

Root Cause

  • Root cause: The gateway_start hook fires via void hookRunner.runGatewayStart() (fire-and-forget) before sidecars fully start, so getCron() returns null. The existing runtime retry path in before_agent_reply only fires on heartbeat/cron triggers — if the dreaming cron never registered and no heartbeat fires, the reconciliation never runs, creating a deadlock.
  • Missing detection / guardrail: No fallback mechanism to retry cron registration independent of incoming heartbeat/cron events.
  • Contributing context: The fix for #67362 added runtime retry via gatewayContext.getCron() in before_agent_reply, but this path depends on heartbeat/cron triggers that may not fire if dreaming cron never registered.

Regression Test Plan

  • Coverage level that should have caught this:
    • Unit test
  • Target test or file: extensions/memory-core/src/dreaming.test.ts
  • Scenario the test should lock in: When cron service is unavailable at startup but becomes available during the deferred retry window, the managed dreaming cron job is successfully registered.
  • Why this is the smallest reliable guardrail: The unit test mocks the cron service availability timing and verifies the deferred retry path fires and succeeds.
  • Existing test that already covers this (if any): N/A — existing tests only covered the startup success and runtime heartbeat-triggered reconciliation paths.

User-visible / Behavior Changes

  • The Memory Dreaming Promotion cron job now registers successfully even when the cron service is briefly unavailable at gateway startup.

Diagram (if applicable)

N/A

Security Impact (required)

  • New permissions/capabilities? No
  • This fix adds a deferred retry timer within the existing memory-core plugin scope. No new permissions, no security surface changes, no credential handling.

Changed files

  • extensions/memory-core/src/dreaming.test.ts (modified, +107/-0)
  • extensions/memory-core/src/dreaming.ts (modified, +11/-0)

Code Example

Startup log (gateway restart at 20:54:06):
Apr 27 20:54:06 RayStation systemd[232]: Started openclaw-gateway.service - OpenClaw Gateway (v2026.4.25).
Apr 27 20:54:09 RayStation node[111406]: [gateway] loading configuration…
Apr 27 20:54:10 RayStation node[111406]: [gateway] ready (3 plugins: lossless-claw, memory-core, telegram; 6.0s)
Apr 27 20:54:10 RayStation node[111406]: [gateway] starting channels and sidecars...
Apr 27 20:54:26 RayStation node[111406]: [heartbeat] started
Apr 27 20:53:22 RayStation node[111272]: [plugins] memory-core: managed dreaming cron could not be reconciled (cron service unavailable).
Cron jobs.json (~/.openclaw/cron/jobs.json):
{
  "name": "Memory Dreaming Promotion",
  "description": "[managed-by=memory-core.short-term-promotion] Promote weighted short-term recalls into MEMORY.md (limit=10, minScore=0.800, minRecallCount=3, minUniqueQueries=3, recencyHalfLifeDays=14, maxAgeDays=30).",
  "enabled": true,
  "schedule": { "kind": "cron", "expr": "0 3 * * *" },
  "sessionTarget": "isolated",
  "wakeMode": "now",
  "payload": { "kind": "agentTurn", "message": "__openclaw_memory_core_short_term_promotion_dream__", "lightContext": true },
  "delivery": { "mode": "none" }
}
Key buggy code (dreaming-CdZwJUa6.js lines 1533-1538):
if (!cron && config.enabled && !unavailableCronWarningEmitted) 
    if (params.reason === "startup") 
        api.logger.debug?.("memory-core: cron service not yet available at gateway_start; deferring to runtime reconciliation.");
    else {
        api.logger.warn("memory-core: managed dreaming cron could not be reconciled (cron service unavailable).");
        unavailableCronWarningEmitted = true;  // ← only set here, NOT on startup path
    }
Runtime reconciliation skip (dreaming-CdZwJUa6.js lines 1542-1543):
if (now - lastRuntimeReconcileAtMs < RUNTIME_CRON_RECONCILE_INTERVAL_MS && ...) return config;
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

memory-core dreaming cron job fails to register at gateway startup and never retries, causing the Memory Dreaming Promotion task to never execute.

Steps to reproduce

  1. Ensure memory-core plugin is enabled and dreaming is configured (verify Memory Dreaming Promotion job exists in ~/.openclaw/cron/jobs.json with enabled: true)
  2. Start or restart the OpenClaw gateway
  3. Observe logs: memory-core: managed dreaming cron could not be reconciled (cron service unavailable) appears once at startup
  4. Note that no Memory Dreaming Promotion task ever executes, even at the scheduled time (3 AM cron)

Expected behavior

The Memory Dreaming Promotion cron job should register successfully at gateway startup and execute on schedule (daily at 3 AM), as it did in prior versions before v2026.4.25.

Actual behavior

The warning memory-core: managed dreaming cron could not be reconciled (cron service unavailable) is emitted once at gateway startup, and the Memory Dreaming Promotion task never runs. The cron job remains listed as enabled: true in ~/.openclaw/cron/jobs.json but is never executed.

OpenClaw version

v2026.4.25

Operating system

Ubuntu 24.04.4 LTS under WSL2

Install method

npm global

Model

minimax-portal/MiniMax-M2.7 (primary) with kimi/kimi-code (fallback)

Provider / routing chain

openclaw gateway → minimax-portal (baseUrl: https://api.minimaxi.com/anthropic) → HTTP proxy http://127.0.0.1:7897

Additional provider/model setup details

  • lossless-claw context engine enabled (contextThreshold: 0.4, leafChunkTokens: 3000)
  • memory-core plugin enabled with dreaming configured (limit=10, minScore=0.800)
  • Telegram channel as primary interface
  • Gateway running as systemd user service

Logs, screenshots, and evidence

Startup log (gateway restart at 20:54:06):
Apr 27 20:54:06 RayStation systemd[232]: Started openclaw-gateway.service - OpenClaw Gateway (v2026.4.25).
Apr 27 20:54:09 RayStation node[111406]: [gateway] loading configuration…
Apr 27 20:54:10 RayStation node[111406]: [gateway] ready (3 plugins: lossless-claw, memory-core, telegram; 6.0s)
Apr 27 20:54:10 RayStation node[111406]: [gateway] starting channels and sidecars...
Apr 27 20:54:26 RayStation node[111406]: [heartbeat] started
Apr 27 20:53:22 RayStation node[111272]: [plugins] memory-core: managed dreaming cron could not be reconciled (cron service unavailable).
Cron jobs.json (~/.openclaw/cron/jobs.json):
{
  "name": "Memory Dreaming Promotion",
  "description": "[managed-by=memory-core.short-term-promotion] Promote weighted short-term recalls into MEMORY.md (limit=10, minScore=0.800, minRecallCount=3, minUniqueQueries=3, recencyHalfLifeDays=14, maxAgeDays=30).",
  "enabled": true,
  "schedule": { "kind": "cron", "expr": "0 3 * * *" },
  "sessionTarget": "isolated",
  "wakeMode": "now",
  "payload": { "kind": "agentTurn", "message": "__openclaw_memory_core_short_term_promotion_dream__", "lightContext": true },
  "delivery": { "mode": "none" }
}
Key buggy code (dreaming-CdZwJUa6.js lines 1533-1538):
if (!cron && config.enabled && !unavailableCronWarningEmitted) 
    if (params.reason === "startup") 
        api.logger.debug?.("memory-core: cron service not yet available at gateway_start; deferring to runtime reconciliation.");
    else {
        api.logger.warn("memory-core: managed dreaming cron could not be reconciled (cron service unavailable).");
        unavailableCronWarningEmitted = true;  // ← only set here, NOT on startup path
    }
Runtime reconciliation skip (dreaming-CdZwJUa6.js lines 1542-1543):
if (now - lastRuntimeReconcileAtMs < RUNTIME_CRON_RECONCILE_INTERVAL_MS && ...) return config;

Impact and severity

Affected users/systems/channels: All users running OpenClaw v2026.4.25 with memory-core plugin and dreaming feature enabled. Severity: Annoying — the gateway and all other functionality (chat, tools, Telegram integration) work normally, but the Memory Dreaming Promotion task never executes. Frequency: Always (100% of gateway restarts on v2026.4.25). Consequence: Short-term memories are never promoted into MEMORY.md via the scheduled dreaming process. Over time, this means the agent loses the benefit of periodic memory consolidation, and OpenClaw's "AI sleep" capability is effectively disabled.

Additional information

NOT_ENOUGH_INFO

extent analysis

TL;DR

The Memory Dreaming Promotion task fails to execute due to a cron service reconciliation issue at gateway startup, which can be mitigated by modifying the unavailableCronWarningEmitted flag handling.

Guidance

  • Review the dreaming-CdZwJUa6.js code and consider setting unavailableCronWarningEmitted to true when params.reason === "startup" to ensure the warning is not emitted multiple times.
  • Investigate the cron service availability at gateway startup and verify that it is properly initialized before attempting to reconcile the Memory Dreaming Promotion job.
  • Check the RUNTIME_CRON_RECONCILE_INTERVAL_MS value and adjust it if necessary to allow for more frequent runtime reconciliations.
  • Verify that the memory-core plugin is properly configured and enabled, and that the dreaming feature is correctly set up.

Example

if (!cron && config.enabled && !unavailableCronWarningEmitted) 
    if (params.reason === "startup") {
        api.logger.debug?.("memory-core: cron service not yet available at gateway_start; deferring to runtime reconciliation.");
        unavailableCronWarningEmitted = true; // Set the flag to true on startup
    } else {
        api.logger.warn("memory-core: managed dreaming cron could not be reconciled (cron service unavailable).");
        unavailableCronWarningEmitted = true;  
    }

Notes

The provided code snippet suggests that the unavailableCronWarningEmitted flag is not being set correctly, which may cause the warning to be emitted multiple times. However, without further information about the cron service and its initialization, it is difficult to provide a more specific solution.

Recommendation

Apply the workaround by modifying the unavailableCronWarningEmitted flag handling, as shown in the example code snippet, to mitigate the issue until a more permanent

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

The Memory Dreaming Promotion cron job should register successfully at gateway startup and execute on schedule (daily at 3 AM), as it did in prior versions before v2026.4.25.

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]: memory-core: dreaming cron never registers — startup timing + reconciliation skip bug [1 pull requests, 1 comments, 2 participants]