openclaw - 💡(How to fix) Fix Dream diary narrative generation times out every night — DREAMS.md not updating [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#74541Fetched 2026-04-30 06:23:15
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
2
Timeline (top)
closed ×1commented ×1cross-referenced ×1

Error Message

params.logger.warn(memory-core: narrative generation ended with status=${result.status} for ${params.data.phase} phase.); 3. The operator.admin scope error on cleanup after timeout should be handled gracefully

Root Cause

NARRATIVE_TIMEOUT_MS is hardcoded at 15 seconds (15e3) in dreaming-narrative-*.js:

const NARRATIVE_TIMEOUT_MS = 15e3;
// ...
const result = await params.subagent.waitForRun({
    runId,
    timeoutMs: NARRATIVE_TIMEOUT_MS
});
if (result.status !== "ok") {
    params.logger.warn(`memory-core: narrative generation ended with status=${result.status} for ${params.data.phase} phase.`);
    return;  // <-- silently returns, no DREAMS.md write
}

The subagent needs to: start a session, load context, run model inference, and return — all within 15 seconds. For cloud-hosted models with ~600ms+ TTFT alone, this is insufficient. The result is that every narrative generation times out and appendNarrativeEntry() is never called.

Code Example

memory-core: narrative generation ended with status=timeout for light phase.
memory-core: narrative generation ended with status=timeout for rem phase.
memory-core: narrative generation ended with status=timeout for deep phase.
memory-core: narrative session cleanup failed for light phase: missing scope: operator.admin

---

const NARRATIVE_TIMEOUT_MS = 15e3;
// ...
const result = await params.subagent.waitForRun({
    runId,
    timeoutMs: NARRATIVE_TIMEOUT_MS
});
if (result.status !== "ok") {
    params.logger.warn(`memory-core: narrative generation ended with status=${result.status} for ${params.data.phase} phase.`);
    return;  // <-- silently returns, no DREAMS.md write
}
RAW_BUFFERClick to expand / collapse

Bug

The dream diary narrative generation (generateAndAppendDreamNarrative) consistently times out, causing DREAMS.md to stop receiving new entries. The dreaming phases themselves (light/rem/deep markdown files) continue to be written correctly since those are direct file operations, but the narrative subagent that produces the diary entries fails every time.

Evidence

Every night since ~April 25, all three phases (light, rem, deep) log timeouts:

memory-core: narrative generation ended with status=timeout for light phase.
memory-core: narrative generation ended with status=timeout for rem phase.
memory-core: narrative generation ended with status=timeout for deep phase.
memory-core: narrative session cleanup failed for light phase: missing scope: operator.admin

Before this date, DREAMS.md was receiving daily narrative entries. After, no new entries appear.

Root Cause

NARRATIVE_TIMEOUT_MS is hardcoded at 15 seconds (15e3) in dreaming-narrative-*.js:

const NARRATIVE_TIMEOUT_MS = 15e3;
// ...
const result = await params.subagent.waitForRun({
    runId,
    timeoutMs: NARRATIVE_TIMEOUT_MS
});
if (result.status !== "ok") {
    params.logger.warn(`memory-core: narrative generation ended with status=${result.status} for ${params.data.phase} phase.`);
    return;  // <-- silently returns, no DREAMS.md write
}

The subagent needs to: start a session, load context, run model inference, and return — all within 15 seconds. For cloud-hosted models with ~600ms+ TTFT alone, this is insufficient. The result is that every narrative generation times out and appendNarrativeEntry() is never called.

Impact

  • DREAMS.md receives no new diary entries
  • No fallback is attempted — the function returns silently on timeout
  • The missing scope: operator.admin cleanup errors suggest the subagent session is orphaned after timeout

Suggested Fix

  1. Make NARRATIVE_TIMEOUT_MS configurable (e.g., plugins.entries.memory-core.config.dreaming.narrativeTimeoutMs) or increase the default to at least 60 seconds
  2. Consider a deterministic fallback: if the subagent times out, write a structured summary from the phase data directly instead of skipping the diary entry entirely
  3. The operator.admin scope error on cleanup after timeout should be handled gracefully

Related

  • #67363 — raw verbatim promotion to MEMORY.md (related dreaming output quality issue)
  • #67362 — stale cron capture (fixed in 355c92d69b38)

Environment

  • OpenClaw 2026.4.26
  • Cloud-hosted model (OLLAMA provider with remote inference)

extent analysis

TL;DR

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

Guidance

  • Review the current value of NARRATIVE_TIMEOUT_MS (15 seconds) and consider increasing it to at least 60 seconds to accommodate the cloud-hosted model's longer processing time.
  • Implement a fallback mechanism to write a structured summary from phase data when the subagent times out, ensuring that DREAMS.md receives some form of update.
  • Handle the operator.admin scope error on cleanup after timeout to prevent orphaned subagent sessions.

Example

const NARRATIVE_TIMEOUT_MS = 60e3; // increased timeout value

Alternatively, make NARRATIVE_TIMEOUT_MS configurable through a plugin setting, such as plugins.entries.memory-core.config.dreaming.narrativeTimeoutMs.

Notes

The suggested fix assumes that increasing the timeout value or implementing a fallback mechanism will resolve the issue. However, the root cause may be more complex, and additional debugging may be necessary.

Recommendation

Apply a workaround by increasing the NARRATIVE_TIMEOUT_MS value or making it configurable, as this is a more immediate and reversible solution compared to upgrading to a potentially non-existent fixed version.

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