fix(memory-core): downgrade cleanup warning to debug when missing operator.admin scope#68087
fix(memory-core): downgrade cleanup warning to debug when missing operator.admin scope#68087nightq wants to merge 1 commit into
Conversation
…rator.admin scope Fixes openclaw#68074 Root cause: The dreaming cron job runs in the main session which lacks operator.admin scope, causing narrative session cleanup to fail with a warning log every 4 hours. Fix: When deleteSession() fails due to missing operator.admin scope, log at debug level instead of warn since this is expected behavior and cleanup is best-effort. 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
Greptile SummaryDowngrade the Confidence Score: 5/5Safe to merge — the change is a targeted log-level adjustment for expected behavior with full test coverage. No P0/P1 findings. The string-matching approach is a minor pragmatic trade-off in a catch block, and the regression direction (if the message ever changes) is toward more logging rather than silently suppressing warnings. All paths are covered by existing and new tests. No files require special attention. Reviews (1): Last reviewed commit: "fix(memory-core): downgrade cleanup warn..." | Re-trigger Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6e52c21807
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| // Missing operator.admin scope is expected when running in main session; | ||
| // treat as best-effort cleanup and log at debug level only. | ||
| if (errMsg.includes("missing scope: operator.admin")) { | ||
| params.logger.debug( |
There was a problem hiding this comment.
Guard optional debug logger call during cleanup
PluginLogger.debug is optional in this codebase, but this new branch calls params.logger.debug(...) unconditionally. In environments/tests that provide only info/warn/error, hitting the expected "missing scope: operator.admin" cleanup error will throw a TypeError from inside finally, turning a best-effort cleanup path into a hard failure for generateAndAppendDreamNarrative and potentially aborting the parent dreaming flow.
Useful? React with 👍 / 👎.
|
Related work from PRtags group Title: Open PR duplicate: [Bug]: memory-core: narrative session cleanup fails with "missing scope: operator.admin"
|
|
Closing this as duplicate or superseded after Codex automated review. Close #68087 as duplicate/superseded. Current main has not merged this PR's log-level branch, but the same memory-core dreaming cleanup warning is already tracked by the canonical open maintainer/member PR #68020, and this contributor PR has an unresolved implementation risk around Best possible solution: Close this duplicate contributor PR and keep the remaining memory-core cleanup-warning fix on the canonical maintainer-owned #68020/#68252 path, preserving the existing security invariant that fallback background plugin calls do not receive What I checked:
So I’m closing this here and keeping the remaining discussion on the canonical linked item. Codex Review notes: model gpt-5.5, reasoning high; reviewed against d54d2d6b9b8a. |
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 requiresoperator.adminpermission, 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 atdebuglevel instead ofwarnsince this is expected behavior. Other cleanup failures still log atwarnlevel.Changes
dreaming-narrative.ts: Check error message for 'missing scope: operator.admin' and uselogger.debuginstead oflogger.warndreaming-narrative.test.ts: Add test coverage for the new behavior and adddebugmock tocreateMockLoggerTest Plan
Closes #68074