Skip to content

fix(plugins): include memory slot plugin in primary wiki CLI scope#67063

Closed
sahilsatralkar wants to merge 2 commits into
openclaw:mainfrom
sahilsatralkar:fix/issue-66082-memory-wiki-bridge-scope
Closed

fix(plugins): include memory slot plugin in primary wiki CLI scope#67063
sahilsatralkar wants to merge 2 commits into
openclaw:mainfrom
sahilsatralkar:fix/issue-66082-memory-wiki-bridge-scope

Conversation

@sahilsatralkar

@sahilsatralkar sahilsatralkar commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Describe the problem and fix in 2–5 bullets:

If this PR fixes a plugin beta-release blocker, title it fix(<plugin-id>): beta blocker - <summary> and link the matching Beta blocker: <plugin-name> - <summary> issue labeled beta-blocker. Contributors cannot label PRs, so the title is the PR-side signal for maintainers and automation.

  • Problem: openclaw wiki status/doctor could report bridgePublicArtifactCount: 0 and bridge-artifacts-missing even when memory artifacts existed.
  • Why it matters: users saw a false unhealthy bridge state and misleading remediation guidance.
  • What changed: primary-command scoped CLI plugin loading now appends the configured memory slot plugin id (unless slot is none) with deduped deterministic ordering.
  • What did NOT change (scope boundary): no hardcoded memory-core special case, no full-loader behavior change when primary planning returns no plugin match, no protocol/config contract changes.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

Root Cause (if applicable)

For bug fixes or regressions, explain why this happened, not just what changed. Otherwise write N/A. If the cause is unclear, write Unknown.

  • Root cause: command-scoped plugin loading for primary: "wiki" loaded memory-wiki but did not also load the active memory slot plugin that owns public artifact export capability.
  • Missing detection / guardrail: no regression test for “primary command scope + memory slot dependency” in CLI loader behavior.
  • Contributing context (if known): scoped loading is intentionally narrow for startup, but memory-wiki bridge status depends on runtime memory capability registration from the active memory slot plugin.

Regression Test Plan (if applicable)

For bug fixes or regressions, name the smallest reliable test coverage that should catch this. Otherwise write N/A.

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
    • Target test or file: src/plugins/cli.test.ts
    • Scenario the test should lock in: for primary: "wiki", loader scope includes both planned command owner plugin ids and configured
      plugins.slots.memory plugin id.
    • Why this is the smallest reliable guardrail: bug is in scope-construction logic before runtime execution; unit coverage on the loader contract is direct and stable.
    • Existing test that already covers this (if any): existing “no primary match keeps full loading” test (kept and validated).
    • If no new test is added, why not: N/A (new tests added).

User-visible / Behavior Changes

List user-visible changes (including defaults/config).
If none, write None.

  • openclaw wiki status --json in bridge mode now reports non-zero bridgePublicArtifactCount when artifacts exist.
  • openclaw wiki doctor --json no longer emits false bridge-artifacts-missing in that scenario.

Diagram (if applicable)

For UI changes or non-trivial logic flows, include a small ASCII diagram reviewers can scan quickly. Otherwise write N/A.

Before:
[wiki primary scoped load] -> [loads memory-wiki only] -> [no active memory runtime capability] -> [artifact count 0 + false warning]

After:
[wiki primary scoped load] -> [loads memory-wiki + configured memory slot plugin] -> [memory public artifacts registered] -> [correct count + no false warning]

Security Impact (required)

  • New permissions/capabilities? (Yes/No) No
  • Secrets/tokens handling changed? (Yes/No) No
  • New/changed network calls? (Yes/No) No
  • Command/tool execution surface changed? (Yes/No) Yes
  • Data access scope changed? (Yes/No) No
  • If any Yes, explain risk + mitigation: scoped CLI loading may include one additional plugin (configured memory slot) during primary command
    execution; mitigation is strict config-driven inclusion only when primary scope is already active, none is respected, ids are deduped/sorted, and regression tests cover scope boundaries.

Repro + Verification

Environment

  • OS: macOS (local dev machine)
  • Runtime/container: Node + pnpm workspace (pnpm openclaw ...)
  • Model/provider: N/A
  • Integration/channel (if any): memory-wiki bridge + memory-core slot
  • Relevant config (redacted): temp config with plugins.slots.memory="memory-core", memory-wiki bridge enabled, workspace containing MEMORY.md,
    memory/day-1.md, memory/.dreams/events.jsonl

Steps

  1. Run OPENCLAW_CONFIG_PATH=/tmp/openclaw-issue-66082/openclaw.json pnpm openclaw wiki status --json.
  2. Run OPENCLAW_CONFIG_PATH=/tmp/openclaw-issue-66082/openclaw.json pnpm openclaw wiki doctor --json.
  3. Run targeted tests: pnpm test src/plugins/cli.test.ts src/plugins/activation-planner.test.ts extensions/memory-wiki/src/status.test.ts.

Expected

  • Bridge artifact count reflects existing artifacts (> 0) and no false bridge-artifacts-missing warning.

Actual

  • Before fix: count 0 and warning present.
  • After fix: count 3 and warning absent; doctor healthy.

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: manual CLI repro before/after with same fixture config; root-cause script (loadOpenClawPlugins scoped/full) showing 0 vs >0; targeted and full src/plugins/cli.test.ts runs.
  • Edge cases checked: slot=none does not append; dedupe when planned ids already include slot plugin; no-primary-match keeps full loading behavior.
  • What you did not verify: live remote environments/channels beyond local CLI + tests.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? (Yes/No) Yes
  • Config/env changes? (Yes/No) No
  • Migration needed? (Yes/No) No
  • If yes, exact upgrade steps: N/A

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.

  • Risk: additional plugin load in primary-scoped CLI path could widen initialization work for some commands.
    • Mitigation: only applies when primary planning returns non-empty scope; adds only configured memory slot plugin; none disabled path
      preserved; dedupe and deterministic ordering; regression tests added in src/plugins/cli.test.ts.

Built with Codex

@greptile-apps

greptile-apps Bot commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a false-negative wiki bridge health report where bridgePublicArtifactCount could show 0 and bridge-artifacts-missing could be emitted even when memory artifacts existed. The fix extends resolvePrimaryCommandPluginIds to append the configured memory slot plugin id (when non-empty and non-"none") to the activation-planner result for primary-scoped CLI loads, with deduplication and deterministic sort. Three focused regression tests are added to src/plugins/cli.test.ts.

Confidence Score: 5/5

Safe to merge; all findings are non-blocking style observations.

The fix is logically correct: the early-return on empty pluginIds preserves existing full-loading behavior, the "none" sentinel and dedup via Set are handled properly, and the new tests cover the primary edge cases. The only observation is a minor mismatch between the PR title ("wiki scope") and the implementation (all primary scopes), which is an intentional design choice documented in the PR description but worth a code comment for future readers.

No files require special attention.

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

Comment:
**Slot injection scope is broader than wiki**

`withPrimaryMemorySlotPluginId` is applied unconditionally to every non-empty primary-scoped load, not just `wiki`. Any command whose activation planner returns a non-empty list (e.g., `send`, `memory`, etc.) will also pick up the configured memory slot plugin when this path runs. The PR description acknowledges this as intentional ("primary-command scoped CLI plugin loading now appends the configured memory slot plugin id"), but the PR title ("primary wiki CLI scope") and the linked issue suggest the intent was wiki-specific. Worth a clarifying comment if general injection is the deliberate long-term direction, so future readers don't treat it as a wiki-only guard.

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

Reviews (1): Last reviewed commit: "fix(plugins): include memory slot plugin..." | Re-trigger Greptile

Comment thread src/plugins/cli-registry-loader.ts

@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: 69dfbe4501

ℹ️ 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/cli-registry-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: 073e8d5857

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

workspaceDir: context.workspaceDir,
env: context.env,
});
return withPrimaryMemorySlotPluginId(plannedPluginIds, context.activationSourceConfig);

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 Restrict memory slot injection to memory-dependent primaries

resolvePrimaryCommandPluginIds now unconditionally appends the configured/default memory slot plugin whenever any primary command matches activation planning, so scoped loads for unrelated plugin commands (for example a non-memory primary) now include memory-core or a custom memory slot plugin. This widens command-scoped loading and makes unrelated commands pay memory-plugin startup cost or surface memory-plugin load failures even when the command does not use wiki/memory bridging; the slot append should be gated to memory-dependent primaries (or to plans that already include memory-bridge owners).

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ignoring this P2 issue for now, unless Maintainers deem it necessary

@iannwu

iannwu commented Apr 19, 2026

Copy link
Copy Markdown

Adding a repro datapoint from a separate install because this looks very close to the bug I just traced on OpenClaw 2026.4.15 (macOS, npm global install).

What I saw locally:

  • openclaw wiki status / doctor reported Bridge: enabled (0 exported artifacts)
  • the workspace definitely had MEMORY.md, many memory/*.md, and memory/.dreams/events.jsonl
  • plugins.slots.memory was unset, so the memory slot still defaulted to memory-core

The useful runtime probe was:

  • full plugin load -> memoryCapabilityPlugin = memory-core, listActiveMemoryPublicArtifacts() returns 94 artifacts
  • wiki-only/scoped load -> memoryCapabilityPlugin = null, artifact count 0

So this matches the theory in this PR very closely: the wiki command path can load narrowly enough that the active memory slot plugin does not register its capability before bridge status/import asks for public artifacts. From this repro, it does not look like bad bridge config or missing files on disk.

@prtags

prtags Bot commented Apr 23, 2026

Copy link
Copy Markdown

Related work from PRtags group sure-glider-nin4

Title: Open PR duplicate: memory-wiki CLI loads memory runtime for artifacts

Number Title
#67063* fix(plugins): include memory slot plugin in primary wiki CLI scope
#69952 fix(wiki): load memory-core plugin runtime before bridge artifact import

* This PR

@clawsweeper

clawsweeper Bot commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Codex automated review: keeping this open.

Keep this PR open. Current main still does not include the proposed primary-scope memory slot append or its regression tests, and Memory Wiki bridge/status paths still depend on an active memory public-artifact capability. The PR remains relevant to a reproduced bug, but the patch is stale and needs maintainer reconciliation with overlapping fixes, especially the open maintainer PR #72615.

Best possible solution:

Keep this PR open as a related implementation candidate. Rebase it against current main, either narrow the memory-slot append to memory-dependent primary scopes or adopt the Gateway RPC direction from #72615, and require regression coverage for openclaw wiki status, openclaw wiki doctor, and openclaw wiki bridge import before landing or closing as superseded.

What I checked:

  • Current primary CLI scope still omits the memory slot: resolvePrimaryCommandPluginIds returns only resolveManifestActivationPluginIds(...); there is no configured/default memory slot append on current main. (src/plugins/cli-registry-loader.ts:56, e962381dbf1e)
  • PR regression tests are absent on main: Searches for the PR helper/test names returned no matches, while the existing tests only cover selected primary scoping and no-match fallback. (src/plugins/cli.test.ts:366, e962381dbf1e)
  • Memory Wiki still reads active memory artifacts in-process: runWikiStatus, runWikiDoctor, and runWikiBridgeImport call local sync/status helpers; bridge sync and status count artifacts through listActiveMemoryPublicArtifacts, so a CLI process without the memory capability still sees zero artifacts. (extensions/memory-wiki/src/cli.ts:252, e962381dbf1e)
  • Missing capability still yields an empty artifact list: listActiveMemoryPublicArtifacts reads memoryPluginState.capability?.capability.publicArtifacts?.listArtifacts(...) ?? []; absent capability still returns an empty list. (src/plugins/memory-state.ts:274, e962381dbf1e)
  • Loader behavior makes the PR patch stale: Current loader snapshots and restores previousMemoryCapability around activate:false registrations, and CLI command registry loading uses activate: false; merely including memory-core in onlyPluginIds may not leave a fresh CLI process with an active public-artifact capability. (src/plugins/loader.ts:3059, e962381dbf1e)
  • Docs confirm the behavior remains product-relevant: Memory Wiki bridge mode is documented as reading public artifacts from the active memory plugin through SDK seams, and wiki bridge import is documented as importing public memory artifacts from the active memory plugin. Public docs: docs/plugins/memory-wiki.md. (docs/plugins/memory-wiki.md:78, e962381dbf1e)

Remaining risk / open question:

Codex Review notes: model gpt-5.5, reasoning high; reviewed against e962381dbf1e.

@vincentkoc

Copy link
Copy Markdown
Member

ProjectClownfish could not safely update this branch, so it opened a narrow replacement PR instead.

Replacement PR: #72615
Source PR: #67063
Contributor credit is preserved in the replacement PR body and changelog plan.

@vincentkoc vincentkoc closed this Apr 27, 2026
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.

[Bug]: memory-wiki bridge mode reports 0 exported artifacts even though memory-core has MEMORY.md / memory/*.md available

3 participants