openclaw - ✅(Solved) Fix [Bug]: memory-core: narrative session cleanup fails with "missing scope: operator.admin" [3 pull requests, 1 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#68074Fetched 2026-04-18 05:54:05
View on GitHub
Comments
0
Participants
1
Timeline
9
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×4referenced ×3labeled ×2

The memory-core plugin's dreaming feature generates a warning log every time it runs, stating memory-core: narrative session cleanup failed for light/rem phase: missing scope: operator.admin. This occurs because the subagent.deleteSession() method called during narrative session cleanup requires operator.admin permission, but the dreaming cron job runs in the main session which does not have this scope.

Error Message

warn plugins {"subsystem":"plugins"} memory-core: narrative session cleanup failed for light phase: missing scope: operator.admin warn plugins {"subsystem":"plugins"} memory-core: narrative session cleanup failed for rem phase: missing scope: operator.admin 2026-04-17T16:00:56.436+08:00 warn plugins {"subsystem":"plugins"} memory-core: narrative session cleanup failed for light phase: missing scope: operator.admin 2026-04-17T16:01:29.066+08:00 warn plugins {"subsystem":"plugins"} memory-core: narrative session cleanup failed for rem phase: missing scope: operator.admin params.logger.warn( Suggested fix: When deleteSession() fails due to missing operator.admin, the error should be caught and treated as a non-fatal best-effort cleanup (log at debug level instead of warn), since narrative cleanup failures do not impact the core memory promotion functionality.

Root Cause

The memory-core plugin's dreaming feature generates a warning log every time it runs, stating memory-core: narrative session cleanup failed for light/rem phase: missing scope: operator.admin. This occurs because the subagent.deleteSession() method called during narrative session cleanup requires operator.admin permission, but the dreaming cron job runs in the main session which does not have this scope.

Fix Action

Fixed

PR fix notes

PR #68084: fix(memory-core): suppress operator.admin warning in narrative session cleanup

Description (problem / solution / changelog)

Summary

deleteSession() in the dreaming narrative cleanup requires operator.admin scope, which is absent when the dreaming cron runs in a gateway-client context. The resulting error was logged as a warning every 4 hours, polluting logs with a known harmless condition.

Fix

In dreaming-narrative.ts, the deleteSession catch block now checks if the error message contains "operator.admin" and suppresses the warning in that case. All other cleanup errors are still logged as before.

Behavior Change

ScenarioBeforeAfter
operator.admin missing (expected in cron)warn log every 4hsilent
Genuine cleanup failure (unexpected)warn logwarn log (unchanged)

Closes

Closes #68074


Author: WadeY [email protected]

Changed files

  • extensions/memory-core/src/dreaming-narrative.ts (modified, +8/-3)
  • src/agents/run-wait.ts (modified, +44/-0)
  • src/agents/tools/sessions-send-tool.ts (modified, +29/-0)
  • src/logging/subsystem.ts (modified, +2/-2)

PR #68087: fix(memory-core): downgrade cleanup warning to debug when missing operator.admin scope

Description (problem / solution / changelog)

Summary

The memory-core plugin's dreaming feature generates a warning log every 4 hours when narrative session cleanup fails due to missing operator.admin scope. This is expected behavior since the dreaming cron runs in the main session which lacks this scope.

Root Cause

The subagent.deleteSession() method requires operator.admin permission, but the dreaming cron job runs in the main session which does not have this scope. The cleanup is best-effort and the core dreaming/promotion functionality still works correctly.

Fix

When deleteSession() fails with "missing scope: operator.admin", log at debug level instead of warn since this is expected behavior. Other cleanup failures still log at warn level.

Changes

  • dreaming-narrative.ts: Check error message for 'missing scope: operator.admin' and use logger.debug instead of logger.warn
  • dreaming-narrative.test.ts: Add test coverage for the new behavior and add debug mock to createMockLogger

Test Plan

  • Unit tests pass (43 tests in dreaming-narrative.test.ts)
  • New test verifies debug logging for missing scope error
  • New test verifies warn logging is NOT called for missing scope error

Closes openclaw#68074

Changed files

  • extensions/memory-core/src/dreaming-narrative.test.ts (modified, +23/-0)
  • extensions/memory-core/src/dreaming-narrative.ts (modified, +12/-3)

PR #68130: fix: reduce log level for narrative session cleanup scope failures

Description (problem / solution / changelog)

Summary

The memory-core dreaming feature was generating spurious warning logs every time it ran, stating "missing scope: operator.admin". This occurred because narrative session cleanup calls subagent.deleteSession() which requires operator.admin scope, but the dreaming cron runs in the main session without this scope.

Changes

  • Modified error handling in dreaming-narrative.ts to check for expected scope failures
  • Log at debug level for missing operator.admin scope (expected, best-effort cleanup)
  • Preserve warn level for genuine errors

Testing

  • Narrative cleanup now silently skips when scope is missing
  • Actual errors are still surfaced appropriately

Fixes openclaw/openclaw#68074

Changed files

  • extensions/memory-core/src/dreaming-narrative.ts (modified, +12/-3)
  • extensions/ollama/index.test.ts (modified, +118/-8)
  • extensions/ollama/src/provider-models.ts (modified, +1/-1)
  • extensions/ollama/src/stream.ts (modified, +11/-3)
  • src/agents/model-auth-env-vars.test.ts (added, +51/-0)
  • src/agents/model-auth-env-vars.ts (modified, +12/-1)

Code Example

"plugins": {
     "entries": {
       "memory-core": {
         "enabled": true,
         "config": {
           "dreaming": {
             "enabled": true,
             "frequency": "0 */4 * * *"
           }
         }
       }
     }
   }
Wait for the dreaming cron to trigger (runs every 4 hours by default)
Check openclaw logs and observe the warning after each dreaming cycle

### Expected behavior

The narrative session cleanup should either:

Succeed without errors when permissions are sufficient, or
Fail silently without a warning log when operator.admin is missing, since cleanup is best-effort and the core dreaming/promotion functionality still works

### Actual behavior

The following warning appears in logs after every dreaming cycle:

Copy
warn plugins {"subsystem":"plugins"} memory-core: narrative session cleanup failed for light phase: missing scope: operator.admin
warn plugins {"subsystem":"plugins"} memory-core: narrative session cleanup failed for rem phase: missing scope: operator.admin
The core dreaming/promotion functionality works correctly, but orphaned narrative subagent sessions may accumulate over time.

### OpenClaw version

2026.4.15

### Operating system

Ubuntu 24.04.4 LTS 

### Install method

pnpm

### Model

minimax/MiniMax-M2.7

### Provider / routing chain

Embedded agent runtime → memory-core plugin → dreaming-narrative.ts

### Additional provider/model setup details

_No response_

### Logs, screenshots, and evidence
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

The memory-core plugin's dreaming feature generates a warning log every time it runs, stating memory-core: narrative session cleanup failed for light/rem phase: missing scope: operator.admin. This occurs because the subagent.deleteSession() method called during narrative session cleanup requires operator.admin permission, but the dreaming cron job runs in the main session which does not have this scope.

Steps to reproduce

Enable memory-core plugin with dreaming feature:

"plugins": {
  "entries": {
    "memory-core": {
      "enabled": true,
      "config": {
        "dreaming": {
          "enabled": true,
          "frequency": "0 */4 * * *"
        }
      }
    }
  }
}
Wait for the dreaming cron to trigger (runs every 4 hours by default)
Check openclaw logs and observe the warning after each dreaming cycle

### Expected behavior

The narrative session cleanup should either:

Succeed without errors when permissions are sufficient, or
Fail silently without a warning log when operator.admin is missing, since cleanup is best-effort and the core dreaming/promotion functionality still works

### Actual behavior

The following warning appears in logs after every dreaming cycle:

Copy
warn plugins {"subsystem":"plugins"} memory-core: narrative session cleanup failed for light phase: missing scope: operator.admin
warn plugins {"subsystem":"plugins"} memory-core: narrative session cleanup failed for rem phase: missing scope: operator.admin
The core dreaming/promotion functionality works correctly, but orphaned narrative subagent sessions may accumulate over time.

### OpenClaw version

2026.4.15

### Operating system

Ubuntu 24.04.4 LTS 

### Install method

pnpm

### Model

minimax/MiniMax-M2.7

### Provider / routing chain

Embedded agent runtime → memory-core plugin → dreaming-narrative.ts

### Additional provider/model setup details

_No response_

### Logs, screenshots, and evidence

```shell
2026-04-17T16:00:56.436+08:00 warn plugins {"subsystem":"plugins"} memory-core: narrative session cleanup failed for light phase: missing scope: operator.admin
2026-04-17T16:01:29.066+08:00 warn plugins {"subsystem":"plugins"} memory-core: narrative session cleanup failed for rem phase: missing scope: operator.admin

Impact and severity

Root cause traced to:

extensions/memory-core/src/dreaming-narrative.ts:933 — calls subagent.deleteSession() extensions/memory-core/src/dreaming.ts:146 — managed dreaming cron hardcoded with sessionTarget: "main" Main session lacks operator.admin scope, causing all cleanup attempts to fail Related code:

Copy // dreaming.ts:146 — hardcoded sessionTarget function buildManagedDreamingCronJob(config: ShortTermPromotionDreamingConfig): ManagedCronJobCreate { return { sessionTarget: "main", // ← cannot be configured, main session has no operator.admin wakeMode: "now", payload: { kind: "systemEvent", text: DREAMING_SYSTEM_EVENT_TEXT }, }; }

// dreaming-narrative.ts:933 — permission-gated operation try { await params.subagent.deleteSession({ sessionKey }); } catch (cleanupErr) { params.logger.warn( memory-core: narrative session cleanup failed for ${params.data.phase} phase: ${formatErrorMessage(cleanupErr)}, ); } Suggested fix: When deleteSession() fails due to missing operator.admin, the error should be caught and treated as a non-fatal best-effort cleanup (log at debug level instead of warn), since narrative cleanup failures do not impact the core memory promotion functionality.

Additional information

No response

extent analysis

TL;DR

The memory-core plugin's dreaming feature can be fixed by catching the operator.admin permission error in deleteSession() and logging it at the debug level instead of warning.

Guidance

  • Identify the deleteSession() call in dreaming-narrative.ts and modify the error handling to catch permission errors specifically.
  • Log permission errors at the debug level instead of warning to avoid unnecessary warnings.
  • Verify that the warning logs are no longer present after implementing the fix by checking the OpenClaw logs.
  • Consider reviewing the buildManagedDreamingCronJob function in dreaming.ts to determine if the hardcoded sessionTarget can be modified to use a session with the required operator.admin scope.

Example

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

Notes

The suggested fix assumes that the operator.admin permission error is the only error that should be caught and logged at the debug level. Additional error handling may be necessary to ensure that other errors are properly handled.

Recommendation

Apply the workaround by modifying the error handling in deleteSession() to catch permission errors and log them at the debug level. This will prevent unnecessary warnings from being logged while still allowing the core memory promotion functionality to work correctly.

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

The narrative session cleanup should either:

Succeed without errors when permissions are sufficient, or Fail silently without a warning log when operator.admin is missing, since cleanup is best-effort and the core dreaming/promotion functionality still works

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 - ✅(Solved) Fix [Bug]: memory-core: narrative session cleanup fails with "missing scope: operator.admin" [3 pull requests, 1 participants]