mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:40:44 +00:00
fix(cli): upgrade legacy mcp session reuse
This commit is contained in:
@@ -178,6 +178,37 @@ describe("cli-session helpers", () => {
|
||||
).toEqual({ invalidatedReason: "mcp" });
|
||||
});
|
||||
|
||||
it("falls back to legacy MCP config hashes when stored resume hashes are absent", () => {
|
||||
const binding = {
|
||||
sessionId: "cli-session-1",
|
||||
authProfileId: "anthropic:work",
|
||||
authEpoch: "auth-epoch-a",
|
||||
extraSystemPromptHash: "prompt-a",
|
||||
mcpConfigHash: "mcp-config-a",
|
||||
};
|
||||
|
||||
expect(
|
||||
resolveCliSessionReuse({
|
||||
binding,
|
||||
authProfileId: "anthropic:work",
|
||||
authEpoch: "auth-epoch-a",
|
||||
extraSystemPromptHash: "prompt-a",
|
||||
mcpConfigHash: "mcp-config-a",
|
||||
mcpResumeHash: "mcp-resume-a",
|
||||
}),
|
||||
).toEqual({ sessionId: "cli-session-1" });
|
||||
expect(
|
||||
resolveCliSessionReuse({
|
||||
binding,
|
||||
authProfileId: "anthropic:work",
|
||||
authEpoch: "auth-epoch-a",
|
||||
extraSystemPromptHash: "prompt-a",
|
||||
mcpConfigHash: "mcp-config-b",
|
||||
mcpResumeHash: "mcp-resume-a",
|
||||
}),
|
||||
).toEqual({ invalidatedReason: "mcp" });
|
||||
});
|
||||
|
||||
it("clears provider-scoped and global CLI session state", () => {
|
||||
const entry: SessionEntry = {
|
||||
sessionId: "openclaw-session",
|
||||
|
||||
@@ -152,7 +152,7 @@ export function resolveCliSessionReuse(params: {
|
||||
return { invalidatedReason: "system-prompt" };
|
||||
}
|
||||
const storedMcpResumeHash = normalizeOptionalString(binding?.mcpResumeHash);
|
||||
if (storedMcpResumeHash || currentMcpResumeHash) {
|
||||
if (storedMcpResumeHash && currentMcpResumeHash) {
|
||||
if (storedMcpResumeHash !== currentMcpResumeHash) {
|
||||
return { invalidatedReason: "mcp" };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user