Skip to content

memory-core: dreaming narrative session cleanup fails with "missing scope: operator.admin" #68252

Description

@omerekin

Summary

In OpenClaw 2026.4.14, every dreaming narrative phase (light + REM) fails to clean up its subagent session with missing scope: operator.admin. The narrative itself is written to DREAMS.md before the cleanup call runs, so user-visible dreaming output is unaffected — but subagent sessions likely accumulate in the session store until the maintenance sweep prunes them.

Repro

Enable memory-core.dreaming and let the scheduled cron fire. On every run, the gateway log shows:

[plugins] memory-core: narrative session cleanup failed for light phase: missing scope: operator.admin
[plugins] memory-core: narrative session cleanup failed for rem phase: missing scope: operator.admin

(Pair per workspace per dreaming run.)

Root cause (from the compiled bundle)

memory-core/dreaming-narrative.ts calls params.subagent.deleteSession({ sessionKey }) in the finally block of generateAndAppendDreamNarrative. That RPC goes through the gateway subagent layer, which enforces scope via gateway-method-policy.ts:

const RESERVED_ADMIN_GATEWAY_METHOD_PREFIXES = [
  "exec.approvals.",
  "config.",
  "wizard.",
  "update."
];
const RESERVED_ADMIN_GATEWAY_METHOD_SCOPE = "operator.admin";

The session-cleanup call appears to resolve to a method matching one of these admin prefixes, so the dreaming subagent — which doesn't carry operator.admin — is rejected.

Suggested fixes

One of:

  1. Grant memory-core's dreaming subagent operator.admin scope for its cleanup calls by default.
  2. Route session cleanup through a non-reserved RPC path.
  3. Exempt session cleanup from the reserved-admin scope check.

Environment

  • OpenClaw 2026.4.14
  • Node.js / Linux x86_64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions