fix(codex): avoid stale actor peer in MCP proxy (#4400)

Signed-off-by: Axiomoth <alearner@splrad.com>
This commit is contained in:
Axiomoth
2026-08-27 18:33:20 +08:00
committed by GitHub
parent 206054cf15
commit cf5cc308ca
11 changed files with 196 additions and 5 deletions
@@ -41,6 +41,30 @@ export function defaultCredentialPaths(env = process.env) {
].filter(Boolean);
}
/**
* Resolve the actor peer header for a long-lived MCP proxy process.
*
* MCP servers may start in the plugin directory rather than the active
* workspace, so their process cwd is not a reliable peer identity. Broad
* recall intentionally spans the authenticated user's peer workspaces and
* therefore leaves the actor header unset. Actor-scoped recall requires an
* explicit peer so isolation never depends on the proxy launch directory.
*/
export function resolveMcpActorPeerId({
peerId = "",
recallPeerScope = "all",
} = {}) {
if (recallPeerScope !== "actor") return "";
const explicitPeerId = String(peerId || "").trim();
if (explicitPeerId) return explicitPeerId;
throw new Error(
"OpenViking MCP actor-scoped recall requires an explicit peer ID. "
+ "Set actor_peer_id in ovcli.conf or OPENVIKING_PEER_ID in the MCP environment.",
);
}
function uniq(values) {
return [...new Set(values.filter(Boolean))];
}