Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

fix(dsh): respect broad MCP recall scope (#5346)

dvd23337390e6d71fb
diff --git a/examples/dsh-memory-plugin/mcp-env.mjs b/examples/dsh-memory-plugin/mcp-env.mjs
index 70eed3b5b..378988f71 100644
--- a/examples/dsh-memory-plugin/mcp-env.mjs
+++ b/examples/dsh-memory-plugin/mcp-env.mjs
@@ -21,6 +21,7 @@ export function buildMcpConfig(config) {
// standalone Node binary. This tells Electron to run the proxy script as
// Node instead of attempting to launch a second Desktop instance.
const env = { ELECTRON_RUN_AS_NODE: "1", ...forwardConnectionEnv(config) };
+ if (config.recallPeerScope) env.OPENVIKING_RECALL_PEER_SCOPE = config.recallPeerScope;
if (config.timeoutMs) env.OPENVIKING_TIMEOUT_MS = String(config.timeoutMs);
return {
transport: "stdio",
diff --git a/examples/dsh-memory-plugin/mcp.test.mjs b/examples/dsh-memory-plugin/mcp.test.mjs
index 347317894..254af7163 100644
--- a/examples/dsh-memory-plugin/mcp.test.mjs
+++ b/examples/dsh-memory-plugin/mcp.test.mjs
@@ -78,6 +78,7 @@ test("credentials resolved by the plugin reach the proxy through the child env",
OPENVIKING_USER: "casey",
OPENVIKING_PEER_ID: "workspace-peer",
OPENVIKING_AUTH_MODE: "trusted",
+ OPENVIKING_RECALL_PEER_SCOPE: "all",
OPENVIKING_TIMEOUT_MS: "10000",
});
@@ -90,7 +91,23 @@ test("credentials resolved by the plugin reach the proxy through the child env",
assert.equal(proxy.account, "acme");
assert.equal(proxy.user, "casey");
assert.equal(proxy.sendIdentityHeaders, true);
- assert.equal(proxy.peerId, "workspace-peer");
+ // The default is broad recall: the child still receives the runtime peer
+ // for possible actor-scoped use, but the shared mapper must not put it on
+ // the wire and hide memories from other workspaces.
+ assert.equal(proxy.peerId, "");
+
+ const actorConfig = resolveConfig({
+ endpoint: "http://ov.example.com/",
+ apiKey: "secret",
+ account: "acme",
+ user: "casey",
+ peerId: "workspace-peer",
+ recallPeerScope: "actor",
+ }, files, dir);
+ const actorEnv = buildMcpConfig(actorConfig).env;
+ assert.equal(actorEnv.OPENVIKING_RECALL_PEER_SCOPE, "actor");
+ const actorProxy = readProxyConfig(actorEnv, dir);
+ assert.equal(actorProxy.peerId, "workspace-peer");
});
});
@@ -176,6 +193,7 @@ test("an anonymous local server forwards no key or identity", () => {
OPENVIKING_USER: "",
OPENVIKING_PEER_ID: "",
OPENVIKING_AUTH_MODE: "api_key",
+ OPENVIKING_RECALL_PEER_SCOPE: "all",
OPENVIKING_TIMEOUT_MS: "10000",
});
});
diff --git a/examples/dsh-memory-plugin/servers/mcp-proxy.mjs b/examples/dsh-memory-plugin/servers/mcp-proxy.mjs
index 453ea16be..a41466fb4 100644
--- a/examples/dsh-memory-plugin/servers/mcp-proxy.mjs
+++ b/examples/dsh-memory-plugin/servers/mcp-proxy.mjs
@@ -21,11 +21,10 @@ export function readProxyConfig(env = process.env, cwd = process.cwd()) {
const cfg = resolveConfig({}, env, cwd);
return toMcpProxyConfig(cfg, {
env,
- // Not gated through `resolveMcpActorPeerId` like the other proxies: DSH's
- // parent process resolves the peer per session and hands it over in the
- // child env. Empty means it has none, and deriving one from wherever DSH
- // launched this process would send a peer the runtime does not.
- peerId: String(env.OPENVIKING_PEER_ID || "").trim(),
+ // The child env carries the runtime's resolved peer, but the shared mapper
+ // still decides whether the proxy may send it. In broad recall mode the
+ // actor header must stay unset; otherwise a process launched in workspace A
+ // narrows MCP searches for a session whose runtime is serving workspace B.
debug: Boolean(env.OV_DEBUG_LOG),
debugLogPath: env.OV_DEBUG_LOG || "",
});