Skip to content

fix(plugins): exempt dreaming engine from memory slot fast-path in loader#65411

Merged
vincentkoc merged 5 commits into
openclaw:mainfrom
pradeep7127:fix/loader-dreaming-engine-slot-bypass
Apr 12, 2026
Merged

fix(plugins): exempt dreaming engine from memory slot fast-path in loader#65411
vincentkoc merged 5 commits into
openclaw:mainfrom
pradeep7127:fix/loader-dreaming-engine-slot-bypass

Conversation

@pradeep7127

Copy link
Copy Markdown
Contributor

Summary

  • Commit 5e2136c6ae fixed channel-plugin-ids.ts so that memory-core (the dreaming engine) is included in gateway startup plugin IDs when dreaming is enabled — but the loader had three independent slot-policy fast-paths that still blocked memory-core from loading when plugins.slots.memory is set to a different plugin (e.g. memory-lancedb).
  • This PR exempts DEFAULT_MEMORY_DREAMING_PLUGIN_ID (memory-core) from all three slot-policy exclusion checks in loadOpenClawPlugins and loadOpenClawPluginCliRegistry — but only when dreaming is actually enabled in config.
  • Result: memory-core and memory-lancedb now coexist correctly, completing what 5e2136c6ae intended.

Test plan

  • pnpm build passes
  • pnpm test src/plugins/loader.test.ts src/plugins/channel-plugin-ids.test.ts — all 87 tests pass
  • Gateway with plugins.slots.memory = "memory-lancedb" and plugins.entries.memory-lancedb.config.dreaming.enabled = true starts with 8 plugins including memory-core
  • Gateway with dreaming disabled (false) still starts without memory-core (slot-only mode unchanged)

🤖 Generated with Claude Code

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d23d01b239

ℹ️ 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".

Comment thread src/plugins/loader.ts
@greptile-apps

greptile-apps Bot commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR exempts DEFAULT_MEMORY_DREAMING_PLUGIN_ID (memory-core) from all three slot-policy fast-paths in loadOpenClawPlugins and the single path in loadOpenClawPluginCliRegistry, completing the fix started in commit 5e2136c6ae so memory-core can load alongside a different slot plugin (e.g. memory-lancedb) when dreaming is enabled.

The primary fix target (memorySlot = \"memory-lancedb\" + dreaming enabled) is handled correctly. There is a narrow regression: when memory-core is the explicitly configured slot (plugins.slots.memory = \"memory-core\") and dreaming is also enabled, the pluginId !== dreamingEngineId guard in path 2 skips updating memorySlotMatched, which can produce a false-positive "memory slot plugin not found" diagnostic on loadModules: false load paths. No new tests were added to cover the new exemption behavior.

Confidence Score: 5/5

Safe to merge; all remaining findings are P2 and limited to narrow edge cases or missing tests.

The primary fix (dreaming engine coexistence with a different slot plugin) is logically correct. The two findings are P2: a false-positive diagnostic in an edge case requiring an explicit redundant plugins.slots.memory = "memory-core" config entry plus dreaming enabled plus a non-default loadModules: false load path, and missing test coverage for the new exemption behavior. Neither blocks the intended use case.

src/plugins/loader.ts — path-2 (!shouldLoadModules) exemption block may not set memorySlotMatched when the dreaming engine is also the configured slot.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/plugins/loader.ts
Line: 1522-1546

Comment:
**`memorySlotMatched` not set when dreaming engine IS the configured slot**

When `memorySlot === dreamingEngineId` (e.g., user has explicitly set `plugins.slots.memory = "memory-core"` and also enabled dreaming), the `pluginId !== dreamingEngineId` guard skips the entire path-2 block. In the `!shouldLoadModules` code path (used by tooling that calls `loadOpenClawPlugins` with `loadModules: false`), execution then hits the `continue` at line 1563–1566 before the module-loading path (line 1668) can update `memorySlotMatched`. This leaves `memorySlotMatched = false`, triggering the false-positive diagnostic at line 1790: `"memory slot plugin not found or not marked as memory: memory-core"`.

The issue doesn't affect the primary fix target (`memorySlot = "memory-lancedb"`, dreaming enabled), but it is a regression for the edge case where `memory-core` is the explicit slot. A simple guard would resolve it:

```
if (!shouldLoadModules && registrationMode === "full") {
  if (pluginId === dreamingEngineId && hasKind(record.kind, "memory") && memorySlot === pluginId) {
    selectedMemoryPluginId = record.id;
    memorySlotMatched = true;
    record.memorySlotSelected = true;
  } else if (pluginId !== dreamingEngineId) {
    // ... existing logic unchanged
  }
}
```

The same pattern applies to path 3 (around line 1672) if both paths can be reached with `memorySlot === dreamingEngineId`.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: src/plugins/loader.ts
Line: 1293-1299

Comment:
**No tests cover the new dreaming-engine exemption behavior**

The three-path exemption logic (plus the CLI-registry path) is non-trivial, yet no new test cases were added to `loader.test.ts`. The test plan verifies existing tests still pass but doesn't add coverage for the targeted scenario or for the regression guard. Consider adding tests for at least these two cases:

- `memory-lancedb` as slot + dreaming enabled at `memory-lancedb`'s config → both `memory-core` and `memory-lancedb` appear in the loaded registry, `memory-lancedb` has `memorySlotSelected: true`, `memory-core` does not.
- Same config with dreaming disabled → `memory-core` is absent (slot-policy exclusion still applies).

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(plugins): exempt dreaming engine fro..." | Re-trigger Greptile

Comment thread src/plugins/loader.ts
Comment thread src/plugins/loader.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aa1f1c9ffd

ℹ️ 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".

Comment thread src/plugins/loader.ts
@vincentkoc
vincentkoc force-pushed the fix/loader-dreaming-engine-slot-bypass branch from aa1f1c9 to 3228f68 Compare April 12, 2026 15:35
@vincentkoc vincentkoc self-assigned this Apr 12, 2026
@vincentkoc
vincentkoc merged commit 5fde14b into openclaw:main Apr 12, 2026
7 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 38c0516fc8

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/plugins/loader.ts
Comment on lines +150 to +154
const dreamingConfig = resolveMemoryDreamingConfig({
pluginConfig: resolveMemoryDreamingPluginConfig(params.cfg),
cfg: params.cfg,
});
return dreamingConfig.enabled ? DEFAULT_MEMORY_DREAMING_PLUGIN_ID : null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate slot owner before enabling dreaming sidecar

resolveDreamingSidecarEngineId enables the memory-core exemption based only on dreaming.enabled and a non-none/non-memory-core slot string, but it never checks that the configured slot plugin actually exists and is a memory plugin. Because later slot checks are skipped for that id, a stale config like plugins.slots.memory = "memory-lancedb" with plugins.entries.memory-lancedb.config.dreaming.enabled = true will load memory-core even when memory-lancedb is missing or not memory-kind, which breaks fail-closed slot behavior and can silently route memory operations to the wrong backend.

Useful? React with 👍 / 👎.

@pradeep7127
pradeep7127 deleted the fix/loader-dreaming-engine-slot-bypass branch April 12, 2026 16:42
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
…ader (openclaw#65411)

* fix(plugins): exempt dreaming engine from memory slot fast-path in loader

* fix(plugins): handle dreaming engine as slot + add tests for slot coexistence

* fix(plugins): narrow dreaming sidecar loading

* Update CHANGELOG.md

* Update CHANGELOG.md

---------

Co-authored-by: Vincent Koc <[email protected]>
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
…ader (openclaw#65411)

* fix(plugins): exempt dreaming engine from memory slot fast-path in loader

* fix(plugins): handle dreaming engine as slot + add tests for slot coexistence

* fix(plugins): narrow dreaming sidecar loading

* Update CHANGELOG.md

* Update CHANGELOG.md

---------

Co-authored-by: Vincent Koc <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
…ader (openclaw#65411)

* fix(plugins): exempt dreaming engine from memory slot fast-path in loader

* fix(plugins): handle dreaming engine as slot + add tests for slot coexistence

* fix(plugins): narrow dreaming sidecar loading

* Update CHANGELOG.md

* Update CHANGELOG.md

---------

Co-authored-by: Vincent Koc <[email protected]>
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request May 13, 2026
…ader (openclaw#65411)

* fix(plugins): exempt dreaming engine from memory slot fast-path in loader

* fix(plugins): handle dreaming engine as slot + add tests for slot coexistence

* fix(plugins): narrow dreaming sidecar loading

* Update CHANGELOG.md

* Update CHANGELOG.md

---------

Co-authored-by: Vincent Koc <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
…ader (openclaw#65411)

* fix(plugins): exempt dreaming engine from memory slot fast-path in loader

* fix(plugins): handle dreaming engine as slot + add tests for slot coexistence

* fix(plugins): narrow dreaming sidecar loading

* Update CHANGELOG.md

* Update CHANGELOG.md

---------

Co-authored-by: Vincent Koc <[email protected]>
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
…ader (openclaw#65411)

* fix(plugins): exempt dreaming engine from memory slot fast-path in loader

* fix(plugins): handle dreaming engine as slot + add tests for slot coexistence

* fix(plugins): narrow dreaming sidecar loading

* Update CHANGELOG.md

* Update CHANGELOG.md

---------

Co-authored-by: Vincent Koc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants