Skip to content

fix(memory): respect selected slot in dreaming config#62275

Merged
vignesh07 merged 4 commits into
openclaw:mainfrom
SnowSky1:codex/62098-dreaming-memory-slot
Apr 7, 2026
Merged

fix(memory): respect selected slot in dreaming config#62275
vignesh07 merged 4 commits into
openclaw:mainfrom
SnowSky1:codex/62098-dreaming-memory-slot

Conversation

@SnowSky1

@SnowSky1 SnowSky1 commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • make the dreaming toggle patch the selected memory slot plugin instead of hardcoding memory-core
  • make doctor.memory.status read dreaming config from plugins.slots.memory when present
  • add focused regression coverage for the selected-slot UI patch path and doctor status path

Related #62098

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime extensions: memory-core Extension: memory-core size: M labels Apr 7, 2026
@SnowSky1

SnowSky1 commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@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: 09d76e12cf

ℹ️ 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 on lines +332 to 334
export function resolveMemoryDreamingPluginConfig(
cfg: OpenClawConfig | Record<string, unknown> | undefined,
): Record<string, unknown> | undefined {

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.

P0 Badge Re-export resolveMemoryCorePluginConfig for compatibility

This change removes the resolveMemoryCorePluginConfig export from the host dreaming module by renaming it to resolveMemoryDreamingPluginConfig, but existing callers still import the old symbol (for example via src/plugin-sdk/memory-core.ts and extension imports from openclaw/plugin-sdk/memory-core-host-status). That makes the commit break type-check/build (and can produce missing-export module load failures) for current consumers. Keep a backward-compatible export alias for the old function name before migrating all call sites.

Useful? React with 👍 / 👎.

@greptile-apps

greptile-apps Bot commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR correctly makes dreaming config and UI toggle slot-aware by reading plugins.slots.memory to resolve the active memory plugin ID instead of hardcoding memory-core. The new resolveMemoryDreamingPluginId/resolveMemoryDreamingPluginConfig helpers in src/memory-host-sdk/dreaming.ts and the parallel resolveDreamingPluginId in ui/src/ui/controllers/dreaming.ts are consistent and correct.

  • The first test in src/gateway/server-methods/doctor.test.ts asserts dreaming.enabled: true with an empty mock config ({}), but DEFAULT_MEMORY_DREAMING_ENABLED = false means resolveMemoryDreamingConfig will produce enabled: false, causing the test to fail.

Confidence Score: 4/5

Safe to merge after correcting the incorrect enabled: true assertion in the first doctor.test.ts smoke test.

The slot-aware logic is correct and well-exercised by the new regression tests. A single wrong assertion in the smoke test (enabled: true vs actual enabled: false) would cause a test failure.

src/gateway/server-methods/doctor.test.ts line 121

Comments Outside Diff (1)

  1. src/gateway/server-methods/doctor.test.ts, line 119-122 (link)

    P1 Incorrect enabled: true assertion with empty config

    The test never calls loadConfig.mockReturnValue(...), so loadConfig() returns the hoisted default {}. With an empty config, resolveMemoryDreamingPluginConfig({}) returns undefined, and resolveMemoryDreamingConfig({ pluginConfig: undefined }) normalizes dreaming.enabled against DEFAULT_MEMORY_DREAMING_ENABLED = false, yielding enabled: false. The assertion enabled: true will cause this test to fail.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: src/gateway/server-methods/doctor.test.ts
    Line: 119-122
    
    Comment:
    **Incorrect `enabled: true` assertion with empty config**
    
    The test never calls `loadConfig.mockReturnValue(...)`, so `loadConfig()` returns the hoisted default `{}`. With an empty config, `resolveMemoryDreamingPluginConfig({})` returns `undefined`, and `resolveMemoryDreamingConfig({ pluginConfig: undefined })` normalizes `dreaming.enabled` against `DEFAULT_MEMORY_DREAMING_ENABLED = false`, yielding `enabled: false`. The assertion `enabled: true` will cause this test to fail.
    
    
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/gateway/server-methods/doctor.test.ts
Line: 119-122

Comment:
**Incorrect `enabled: true` assertion with empty config**

The test never calls `loadConfig.mockReturnValue(...)`, so `loadConfig()` returns the hoisted default `{}`. With an empty config, `resolveMemoryDreamingPluginConfig({})` returns `undefined`, and `resolveMemoryDreamingConfig({ pluginConfig: undefined })` normalizes `dreaming.enabled` against `DEFAULT_MEMORY_DREAMING_ENABLED = false`, yielding `enabled: false`. The assertion `enabled: true` will cause this test to fail.

```suggestion
        dreaming: expect.objectContaining({
          enabled: false,
          shortTermCount: 0,
```

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

Reviews (1): Last reviewed commit: "fix(memory): respect memory slot in drea..." | Re-trigger Greptile

@SnowSky1
SnowSky1 force-pushed the codex/62098-dreaming-memory-slot branch from 09d76e1 to c13c73b Compare April 7, 2026 03:47
@openclaw-barnacle openclaw-barnacle Bot removed the extensions: memory-core Extension: memory-core label Apr 7, 2026
@SnowSky1
SnowSky1 force-pushed the codex/62098-dreaming-memory-slot branch from c13c73b to f7fd52f Compare April 7, 2026 03:48

@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: f7fd52fe16

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

return DEFAULT_MEMORY_DREAMING_PLUGIN_ID;
}

export function resolveMemoryDreamingPluginConfig(

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.

P1 Badge Re-export resolveMemoryCorePluginConfig alias

Renaming resolveMemoryCorePluginConfig to resolveMemoryDreamingPluginConfig here removes a previously exported symbol and breaks existing imports that still consume the old API (for example src/plugin-sdk/memory-core.ts re-exports resolveMemoryCorePluginConfig, and extension code imports it). That introduces a compile/runtime compatibility break for current plugin-sdk consumers; keep a backward-compatible alias export so downstream modules continue to load while call sites migrate.

Useful? React with 👍 / 👎.

@SnowSky1
SnowSky1 force-pushed the codex/62098-dreaming-memory-slot branch from f7fd52f to 84a54e8 Compare April 7, 2026 06:19

@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: 84a54e8561

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

}

// Keep the legacy helper name exported until downstream memory plugins migrate.
export const resolveMemoryCorePluginConfig = resolveMemoryDreamingPluginConfig;

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 Preserve memory-core semantics on legacy config helper

resolveMemoryCorePluginConfig previously read only plugins.entries["memory-core"].config, but this alias now points to the slot-aware resolver, so the legacy name silently changes behavior based on plugins.slots.memory. Existing consumers that intentionally target memory-core (for example extensions/memory-wiki/src/bridge.ts when bridge.readMemoryCore is enabled) will now read whichever plugin is selected in the slot and can run memory-core-specific paths against the wrong plugin config. Keep the old export name bound to the memory-core entry and use the new slot-aware helper only where that behavior is intended.

Useful? React with 👍 / 👎.

@vignesh07
vignesh07 force-pushed the codex/62098-dreaming-memory-slot branch from f8d411d to 9e68ce1 Compare April 7, 2026 09:47
@vignesh07
vignesh07 merged commit b21dd9c into openclaw:main Apr 7, 2026
6 checks passed
@vignesh07

Copy link
Copy Markdown
Member

Landed via temp rebase onto latest origin/main.

Targeted gate run:

  • pnpm format -- CHANGELOG.md ui/src/ui/app-render.ts ui/src/ui/controllers/dreaming.test.ts src/memory-host-sdk/dreaming.test.ts src/gateway/server-methods/doctor.test.ts
  • pnpm test src/gateway/server-methods/doctor.test.ts -t "reads lowercase dreams.md when present"
  • pnpm test src/gateway/server-methods/doctor.test.ts -t "reads dreaming config from the selected memory slot plugin"
  • pnpm test src/memory-host-sdk/dreaming.test.ts ui/src/ui/controllers/dreaming.test.ts

Land commit: 9e68ce1
Merge commit: b21dd9c

Thanks @SnowSky1!

@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: 9e68ce1260

ℹ️ 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 on lines +316 to +320
const { pluginId } = resolveConfiguredDreaming(asRecord(state.configSnapshot?.config) ?? null);
const ok = await writeDreamingPatch(state, {
plugins: {
entries: {
"memory-core": {
[pluginId]: {

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.

P1 Badge Skip dreaming patch for unsupported memory slot plugins

updateDreamingEnabled now writes plugins.entries[slotPluginId].config.dreaming.enabled for whichever plugin owns plugins.slots.memory, but not all built-in memory plugins accept a dreaming block (for example extensions/memory-lancedb/openclaw.plugin.json has additionalProperties: false and requires an embedding object). In that valid configuration, toggling Dreams from Control UI sends an invalid patch and config.patch fails validation, so the toggle becomes a persistent runtime error for users on non-dreaming memory providers.

Useful? React with 👍 / 👎.

lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui gateway Gateway runtime size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants