openclaw - 💡(How to fix) Fix memory-core: narrative session cleanup fails with 'missing scope: operator.admin' [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#72048Fetched 2026-04-27 05:35:37
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
1
Timeline (top)
closed ×1commented ×1

Error Message

memory-core: narrative session cleanup failed for deep phase: Error: Unknown memory embedding provider: disabled memory-core: narrative session cleanup failed for rem phase: missing scope: operator.admin memory-core: narrative session cleanup failed for light phase: missing scope: operator.admin

Root Cause

  1. memory-core uses api.runtime.subagent.deleteSession() to clean up narrative session files created during the dreaming process
  2. This call is wrapped via withPluginRuntimePluginIdScope() in loader-DeOtDUYt.js
  3. However, the internal cron/runtime context does not have operator.admin scope
  4. The Gateway shows admin-capable status, but the internal subagent runtime does not inherit this capability

Fix Action

Fix / Workaround

Current Workaround

Code Example

memory-core: narrative session cleanup failed for deep phase: Error: Unknown memory embedding provider: disabled
memory-core: narrative session cleanup failed for rem phase: missing scope: operator.admin
memory-core: narrative session cleanup failed for light phase: missing scope: operator.admin

---

0 5 * * * $HOME/.openclaw/scripts/cleanup-deleted-sessions.sh
RAW_BUFFERClick to expand / collapse

Bug Report: memory-core narrative session cleanup fails due to missing operator.admin scope

Environment

  • OpenClaw Version: 2026.4.23 (a979721)
  • Node.js: v22.22.2
  • OS: Linux 6.8.0-110-generic (x64)
  • Plugin: memory-core (bundled with OpenClaw)

Bug Description

The memory-core plugin's dreaming deep phase calls subagent.deleteSession() to clean up temporary narrative sessions, but this operation fails with a "missing scope: operator.admin" error because the internal cron runtime does not have operator.admin permissions.

Error Log

memory-core: narrative session cleanup failed for deep phase: Error: Unknown memory embedding provider: disabled
memory-core: narrative session cleanup failed for rem phase: missing scope: operator.admin
memory-core: narrative session cleanup failed for light phase: missing scope: operator.admin

Impact

  • Session files are renamed to *.deleted.* but cannot be actually deleted
  • Over time, this causes accumulation of orphaned session files
  • Observed: 1341 session files (264MB) with 465 .deleted.* residual files before manual cleanup

Root Cause Analysis

  1. memory-core uses api.runtime.subagent.deleteSession() to clean up narrative session files created during the dreaming process
  2. This call is wrapped via withPluginRuntimePluginIdScope() in loader-DeOtDUYt.js
  3. However, the internal cron/runtime context does not have operator.admin scope
  4. The Gateway shows admin-capable status, but the internal subagent runtime does not inherit this capability

Code Path

  • Entry point: dreaming-D8xdMBta.js:1061 and dreaming-narrative-CbBD6j4D.js:595
  • subagent.deleteSession({ sessionKey }) → requires operator.admin
  • The deleteSession method goes through loader-DeOtDUYt.js:1343 which uses withPluginRuntimePluginIdScope

Current Workaround

A cleanup script removes .deleted.* files older than 30 days, scheduled via cron:

0 5 * * * $HOME/.openclaw/scripts/cleanup-deleted-sessions.sh

Expected Behavior

The memory-core dreaming cleanup should either:

  1. Have operator.admin scope granted to the internal runtime for delete operations, OR
  2. Handle missing scope gracefully without logging warnings

Additional Context

  • Gateway auth mode: token
  • Gateway bind: lan (0.0.0.0)
  • OpenClaw is running as a systemd user service
  • Active agents: main (heartbeat enabled), stock, invoice, genimg, attendance, finance, dev

Tags

bug, memory-core, operator.admin, scope, session-cleanup

extent analysis

TL;DR

Grant the operator.admin scope to the internal cron/runtime context to fix the memory-core narrative session cleanup issue.

Guidance

  • Review the loader-DeOtDUYt.js file to understand how the withPluginRuntimePluginIdScope() function handles scope inheritance.
  • Verify that the Gateway's admin-capable status is correctly configured and propagated to the internal subagent runtime.
  • Consider modifying the subagent.deleteSession() method to handle missing scope errors gracefully, avoiding warnings and allowing for alternative cleanup mechanisms.
  • Evaluate the current workaround script (cleanup-deleted-sessions.sh) and consider integrating it into the memory-core plugin or enhancing its functionality to handle session cleanup more efficiently.

Example

No code snippet is provided as the issue does not imply a specific code change, but rather a configuration or scope inheritance adjustment.

Notes

The solution may require adjustments to the OpenClaw configuration, plugin settings, or the internal cron/runtime context. The provided workaround script may need to be adapted or integrated into the memory-core plugin for a more robust solution.

Recommendation

Apply a workaround by granting the operator.admin scope to the internal cron/runtime context, as this is the most direct approach to resolving the issue, given the current information.

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

openclaw - 💡(How to fix) Fix memory-core: narrative session cleanup fails with 'missing scope: operator.admin' [1 comments, 2 participants]