openclaw - ✅(Solved) Fix memory-core Dream Diary narratives time out and leave DREAMS.md stale [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#77094Fetched 2026-05-05 05:52:19
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
2
Author
Timeline (top)
closed ×1commented ×1cross-referenced ×1

Memory-core dreaming phase reports are generated successfully, but Dream Diary narrative entries are not reliably appended to DREAMS.md. The narrative subagent path often times out before usable model output is available, leaving the human-facing dream diary stale even though the underlying dreaming sweep completed.

Error Message

Recent 3am dreaming runs completed successfully:

Root Cause

Memory-core dreaming phase reports are generated successfully, but Dream Diary narrative entries are not reliably appended to DREAMS.md. The narrative subagent path often times out before usable model output is available, leaving the human-facing dream diary stale even though the underlying dreaming sweep completed.

Fix Action

Fixed

PR fix notes

PR #76342: fix(memory-core): raise dreaming narrative timeout to 240s and allow env override

Description (problem / solution / changelog)

Summary

Raises the dreaming narrative subagent timeout from 60 s to 240 s and exposes an OPENCLAW_DREAMING_NARRATIVE_TIMEOUT_MS env override.

Why

Embedded-agent prep (workspace-sandbox + core-plugin-tools + system-prompt + stream-setup) now consistently consumes 13–22 s before the first token streams on hosts with many workspaces. With NARRATIVE_TIMEOUT_MS hardcoded at 60_000, that left under 41 s for the diary subagent to generate multi-paragraph narratives, and every dreaming phase (light/REM/deep) reliably hit the timeout. The MEMORY.md promotion half still succeeded, so dashboards looked healthy while DREAMS.md silently stopped advancing.

Changes

  • extensions/memory-core/src/dreaming-narrative.ts: bump default to 240_000 ms, read OPENCLAW_DREAMING_NARRATIVE_TIMEOUT_MS env var as override, keep the bounded-timeout invariant intact.
  • Updated existing test to match the new default.

Test

npx vitest run extensions/memory-core/src/dreaming-narrative.test.ts
# 47 tests passed

Fixes #76333

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • extensions/memory-core/src/dreaming-narrative.test.ts (modified, +1/-1)
  • extensions/memory-core/src/dreaming-narrative.ts (modified, +22/-7)

Code Example

const NARRATIVE_TIMEOUT_MS = 60_000;
RAW_BUFFERClick to expand / collapse

Summary

Memory-core dreaming phase reports are generated successfully, but Dream Diary narrative entries are not reliably appended to DREAMS.md. The narrative subagent path often times out before usable model output is available, leaving the human-facing dream diary stale even though the underlying dreaming sweep completed.

Observed behavior

Recent 3am dreaming runs completed successfully:

  • 2026-05-02: memory-core: dreaming promotion complete (workspaces=3, candidates=30, applied=1, failed=0)
  • 2026-05-03: memory-core: dreaming promotion complete (workspaces=3, candidates=30, applied=0, failed=0)

Phase report files are present/current under:

  • memory/dreaming/light/YYYY-MM-DD.md
  • memory/dreaming/rem/YYYY-MM-DD.md
  • memory/dreaming/deep/YYYY-MM-DD.md

But DREAMS.md diary narratives are stale/incomplete:

  • Main workspace diary tail was older than the latest phase files.
  • Some workspaces had no recent diary entries even though phase files existed.
  • Logs showed repeated narrative failures such as memory-core: narrative generation ended with status=timeout for light phase.

Diagnosis

The narrative timeout appears to be hardcoded:

const NARRATIVE_TIMEOUT_MS = 60_000;

in extensions/memory-core/src/dreaming-narrative.ts.

In the failing runs, narrative subagent setup consumed most/all of that budget before model output could be read. Example evidence from logs/transcripts:

  • Narrative prep often took ~42–70s.
  • bundle-tools alone often consumed ~32–39s, including repeated tool/MCP startup timeout warnings (notably cua-driver).
  • By the time the subagent reached stream-ready, the parent waitForRun(... timeoutMs: 60000) was nearly expired or already expired.
  • Some transcripts later contained assistant output after the parent path had already recorded timeout or produced no text, suggesting a race/settle issue as well.

Expected behavior

If phase reports are generated successfully, the optional Dream Diary narrative should either:

  1. complete and append to DREAMS.md, or
  2. fail with a clear, non-stale diagnostic without discarding late-but-successful narrative output.

Impact

This does not appear to break core memory promotion/recall. The phase outputs and promotion pass still run. The impact is mostly on the human-facing dream diary / reflective narrative layer, and on any downstream consumers that use DREAMS.md diary text as a source.

Proposed fixes

Possible fixes, in rough order:

  1. Make the narrative timeout configurable, e.g. plugins.entries.memory-core.config.dreaming.narrative.timeoutMs, or at least raise the hardcoded default to ~180–240s.
  2. Separate setup/tool-bundle timeout from model-output timeout, so slow tool loading does not consume the entire narrative budget.
  3. For lightContext dreaming narrative subagents, avoid starting unavailable/irrelevant MCP tools, or cache tool-start failures so each narrative run does not pay the same ~30s cost.
  4. Add a short settle/retry read after successful/late subagent completion before logging produced no text or deleting/ignoring the narrative session.
  5. Add regression coverage around late narrative output and configurable timeout behavior.

Notes

The recurring warning memory-core: managed dreaming cron could not be reconciled (cron service unavailable) appears related but probably not causal: the managed cron exists and runs successfully. The diary append issue is specifically in the narrative-generation subagent path after the dreaming phases complete.

extent analysis

TL;DR

Increase the narrative timeout or make it configurable to prevent timeouts during narrative generation.

Guidance

  • Review the NARRATIVE_TIMEOUT_MS value in extensions/memory-core/src/dreaming-narrative.ts and consider increasing it to 180-240s to accommodate slower narrative generation.
  • Separate setup/tool-bundle timeout from model-output timeout to prevent slow tool loading from consuming the entire narrative budget.
  • Investigate optimizing the narrative subagent setup, such as caching tool-start failures or avoiding unnecessary MCP tools, to reduce the time spent on setup.
  • Consider adding a short settle/retry read after successful subagent completion to ensure late narrative output is not ignored.

Example

// Example of making the narrative timeout configurable
const NARRATIVE_TIMEOUT_MS = process.env.NARRATIVE_TIMEOUT_MS || 180000;

Notes

The proposed fixes focus on addressing the narrative timeout issue, but it's essential to also consider the potential impact of other factors, such as the memory-core: managed dreaming cron could not be reconciled warning, on the overall system behavior.

Recommendation

Apply a workaround by increasing the NARRATIVE_TIMEOUT_MS value or making it configurable, as this is the most direct way to address the timeout issue and prevent narrative generation failures.

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

If phase reports are generated successfully, the optional Dream Diary narrative should either:

  1. complete and append to DREAMS.md, or
  2. fail with a clear, non-stale diagnostic without discarding late-but-successful narrative output.

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 memory-core Dream Diary narratives time out and leave DREAMS.md stale [1 pull requests, 1 comments, 2 participants]