openclaw - 💡(How to fix) Fix memory-core: dream narrative cleanup warns missing operator.admin after nightly dreaming [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#72554Fetched 2026-04-28 06:34:36
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Participants
Timeline (top)
closed ×1commented ×1cross-referenced ×1subscribed ×1

memory-core nightly dreaming can leave repeated warning noise after dream narrative generation, because detached narrative subagent runs either time out or finish, then cleanup calls subagent.deleteSession({ sessionKey }) from the plugin path without sufficient gateway scope. The cleanup failure is logged as:

memory-core: narrative session cleanup failed for <phase> phase: missing scope: operator.admin

This appears to be an upstream plugin/runtime scope bug rather than a local configuration problem.

Error Message

On nightly dreaming runs, memory promotion itself completes, but log noise remains from narrative generation/cleanup.

Root Cause

memory-core nightly dreaming can leave repeated warning noise after dream narrative generation, because detached narrative subagent runs either time out or finish, then cleanup calls subagent.deleteSession({ sessionKey }) from the plugin path without sufficient gateway scope. The cleanup failure is logged as:

Code Example

memory-core: narrative session cleanup failed for <phase> phase: missing scope: operator.admin

---

{
  "plugins.entries.memory-core.config.dreaming": {
    "enabled": true,
    "frequency": "0 3 * * *",
    "timezone": "Asia/Shanghai",
    "verboseLogging": true
  }
}

---

2026-04-27T03:00:16.523+08:00 [plugins] memory-core: narrative generation ended with status=timeout for light phase.
2026-04-27T03:00:16.523+08:00 [plugins] memory-core: narrative session cleanup failed for light phase: missing scope: operator.admin
...
2026-04-27T03:00:30.611+08:00 [plugins] memory-core: narrative generation ended with status=timeout for rem phase.
2026-04-27T03:00:30.611+08:00 [plugins] memory-core: narrative session cleanup failed for rem phase: missing scope: operator.admin

---

DAY 2026-04-26
7  managed dreaming cron could not be reconciled
0  narrative generation ended with status=timeout
19 narrative session cleanup failed

DAY 2026-04-27
0  managed dreaming cron could not be reconciled
19 narrative generation ended with status=timeout
19 narrative session cleanup failed

---

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;
}
...
finally {
  if (params.subagent) try {
    await params.subagent.deleteSession({ sessionKey });
  } catch (cleanupErr) {
    params.logger.warn(`memory-core: narrative session cleanup failed for ${params.data.phase} phase: ${formatErrorMessage(cleanupErr)}`);
  }
}

---

const detachNarratives = params.trigger === "cron";
...
if (params.detachNarratives) queueMicrotask(() => {
  generateAndAppendDreamNarrative(...).catch(() => void 0);
});
RAW_BUFFERClick to expand / collapse

Summary

memory-core nightly dreaming can leave repeated warning noise after dream narrative generation, because detached narrative subagent runs either time out or finish, then cleanup calls subagent.deleteSession({ sessionKey }) from the plugin path without sufficient gateway scope. The cleanup failure is logged as:

memory-core: narrative session cleanup failed for <phase> phase: missing scope: operator.admin

This appears to be an upstream plugin/runtime scope bug rather than a local configuration problem.

Environment

  • OpenClaw: 2026.4.24 (cbcfdf6)
  • Platform: macOS / Darwin arm64
  • Plugin: memory-core
  • Feature: nightly dreaming / dream narrative generation
  • Relevant config:
{
  "plugins.entries.memory-core.config.dreaming": {
    "enabled": true,
    "frequency": "0 3 * * *",
    "timezone": "Asia/Shanghai",
    "verboseLogging": true
  }
}

Observed behavior

On nightly dreaming runs, memory promotion itself completes, but log noise remains from narrative generation/cleanup.

Examples from ~/.openclaw/logs/gateway.err.log:

2026-04-27T03:00:16.523+08:00 [plugins] memory-core: narrative generation ended with status=timeout for light phase.
2026-04-27T03:00:16.523+08:00 [plugins] memory-core: narrative session cleanup failed for light phase: missing scope: operator.admin
...
2026-04-27T03:00:30.611+08:00 [plugins] memory-core: narrative generation ended with status=timeout for rem phase.
2026-04-27T03:00:30.611+08:00 [plugins] memory-core: narrative session cleanup failed for rem phase: missing scope: operator.admin

Counts from two recent days:

DAY 2026-04-26
7  managed dreaming cron could not be reconciled
0  narrative generation ended with status=timeout
19 narrative session cleanup failed

DAY 2026-04-27
0  managed dreaming cron could not be reconciled
19 narrative generation ended with status=timeout
19 narrative session cleanup failed

Source-level finding

In the installed bundle, dist/dreaming-narrative-*.js contains:

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;
}
...
finally {
  if (params.subagent) try {
    await params.subagent.deleteSession({ sessionKey });
  } catch (cleanupErr) {
    params.logger.warn(`memory-core: narrative session cleanup failed for ${params.data.phase} phase: ${formatErrorMessage(cleanupErr)}`);
  }
}

In dist/dreaming-*.js, cron-triggered dreaming detaches narratives:

const detachNarratives = params.trigger === "cron";
...
if (params.detachNarratives) queueMicrotask(() => {
  generateAndAppendDreamNarrative(...).catch(() => void 0);
});

So the failure chain appears to be:

  1. Managed dreaming cron runs successfully.
  2. It launches detached narrative generation for light/rem/deep phases across workspaces.
  3. Narrative subagent waits only 15 seconds; some runs time out.
  4. The cleanup path calls subagent.deleteSession from a plugin/internal context that lacks operator.admin.
  5. Cleanup failures are logged as warnings, creating recurring noise.

Expected behavior

  • Dreaming narrative cleanup should be best-effort and should not warn repeatedly because an internal plugin caller lacks operator.admin.
  • Internal memory-core cleanup should either have the required scope, use a scoped runtime cleanup API, or downgrade known cleanup permission failures when the artifact is harmless.
  • The 15s narrative timeout should perhaps be configurable, or timeout logs should be less noisy if narrative generation is optional.

Impact

  • Memory promotion itself appears successful (dreaming promotion complete ... failed=0).
  • The problem creates repeated warning noise in gateway.err.log and makes health checks look worse than they are.
  • Potentially leaves narrative temp session metadata/transcripts until scrub/doctor cleanup handles them.

Suggested fix direction

  • Ensure memory-core internal narrative cleanup can delete its own temporary dreaming-narrative-* sessions without requiring an external operator.admin gateway client scope; or
  • Make deleteSession best-effort with explicit handling for missing scope: operator.admin in this plugin path; and
  • Consider making NARRATIVE_TIMEOUT_MS configurable or increasing it for cron/detached narrative generation.

extent analysis

TL;DR

The most likely fix is to modify the memory-core plugin to handle the missing scope: operator.admin error when calling subagent.deleteSession and make the narrative cleanup best-effort.

Guidance

  • Review the dist/dreaming-narrative-*.js file and modify the finally block to catch the missing scope: operator.admin error and log a debug message instead of a warning.
  • Consider adding a check for the operator.admin scope before calling subagent.deleteSession and skip the cleanup if the scope is missing.
  • Evaluate the possibility of increasing the NARRATIVE_TIMEOUT_MS value or making it configurable to reduce the number of timeouts.
  • Investigate the use of a scoped runtime cleanup API to delete the temporary dreaming-narrative-* sessions.

Example

finally {
  if (params.subagent) try {
    await params.subagent.deleteSession({ sessionKey });
  } catch (cleanupErr) {
    if (cleanupErr.message.includes('missing scope: operator.admin')) {
      params.logger.debug(`memory-core: narrative session cleanup skipped for ${params.data.phase} phase due to missing operator.admin scope`);
    } else {
      params.logger.warn(`memory-core: narrative session cleanup failed for ${params.data.phase} phase: ${formatErrorMessage(cleanupErr)}`);
    }
  }
}

Notes

The suggested fix direction is to modify the memory-core plugin to handle the missing scope: operator.admin error and make the narrative cleanup best-effort. However, the exact implementation details may vary depending on the specific requirements and constraints of the system.

Recommendation

Apply the workaround by modifying the memory-core plugin to handle the missing scope: operator.admin error and make the narrative cleanup best-effort. This will reduce the warning noise in the logs and improve the overall system health.

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

  • Dreaming narrative cleanup should be best-effort and should not warn repeatedly because an internal plugin caller lacks operator.admin.
  • Internal memory-core cleanup should either have the required scope, use a scoped runtime cleanup API, or downgrade known cleanup permission failures when the artifact is harmless.
  • The 15s narrative timeout should perhaps be configurable, or timeout logs should be less noisy if narrative generation is optional.

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 - 💡(How to fix) Fix memory-core: dream narrative cleanup warns missing operator.admin after nightly dreaming [1 comments, 2 participants]