Skip to content

[Bug]: memory-core dreaming: narrative session cleanup fails with missing scope operator.admin #67029

@xiaobu1112

Description

@xiaobu1112

Bug Report: memory-core Dreaming Cleanup Fails

Summary

The memory-core plugin's dreaming feature successfully writes dream diary entries, but fails to clean up narrative sessions due to a missing RBAC scope (operator.admin).

Environment

  • OpenClaw Version: 2026.4.14 (commit after 2026.3.31)
  • OS: Windows 11 (NT 10.0.26200 x64)
  • Node: v24.14.1
  • Agent: data (workspace: D:\Openclaw\workspace-data)

Steps to Reproduce

  1. Configure memory-core plugin with dreaming enabled:
{
  "memory-core": {
    "enabled": true,
    "config": {
      "dreaming": {
        "enabled": true,
        "frequency": "0 3 * * *",
        "timezone": "Asia/Singapore"
      }
    }
  }
}
  1. Wait for the cron job to fire at 03:00 Asia/Singapore
  2. Observe gateway logs

Expected Behavior

  • Dream diary entries are written (works)
  • Narrative session cleanup completes successfully (fails)

Actual Behavior

Gateway logs show:

03:21:17 [plugins] memory-core: dream diary entry written for light phase [workspace=D:\Openclaw\workspace-data].
03:21:17 [plugins] memory-core: narrative session cleanup failed for light phase: missing scope: operator.admin
03:21:55 [plugins] memory-core: dream diary entry written for rem phase [workspace=D:\Openclaw\workspace-data].
03:21:55 [plugins] memory-core: narrative session cleanup failed for rem phase: missing scope: operator.admin

Analysis

  • Diary writing: Works fine (data is not lost)
  • Session cleanup: Fails because the dreaming module does not have the required operator.admin RBAC scope to delete/archive sessions
  • This appears to be a regression introduced by the 3.31 security framework (RBAC scopes for session management)

Impact

Aspect Severity Notes
Data loss None Dream diary entries are written successfully
Disk usage Low Old narrative sessions accumulate over time
System stability None Non-fatal error, gateway remains stable

Suggested Fix

The dreaming module should either:

  1. Request the operator.admin scope when performing session cleanup
  2. Use a different mechanism (e.g., self-cleanup via its own session context)
  3. Skip cleanup when the scope is not available (graceful degradation)

Config Reference

Full memory-core config:

{
  "memory-core": {
    "enabled": true,
    "config": {
      "dreaming": {
        "enabled": true,
        "frequency": "0 3 * * *",
        "timezone": "Asia/Singapore",
        "verboseLogging": false,
        "storage": {
          "mode": "inline",
          "separateReports": false
        }
      }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    clawsweeperTracked by ClawSweeper automation

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions