

























@@ -18,6 +18,7 @@ describe("cli-session helpers", () => {
18181919setCliSessionBinding(entry, "claude-cli", {
2020sessionId: "cli-session-1",
21+forceReuse: true,
2122authProfileId: "anthropic:work",
2223authEpoch: "auth-epoch",
2324authEpochVersion: 2,
@@ -30,6 +31,7 @@ describe("cli-session helpers", () => {
3031expect(entry.claudeCliSessionId).toBe("cli-session-1");
3132expect(getCliSessionBinding(entry, "claude-cli")).toEqual({
3233sessionId: "cli-session-1",
34+forceReuse: true,
3335authProfileId: "anthropic:work",
3436authEpoch: "auth-epoch",
3537authEpochVersion: 2,
@@ -39,6 +41,31 @@ describe("cli-session helpers", () => {
3941});
4042});
414344+it("force-reuses explicitly attached CLI sessions despite metadata drift", () => {
45+const binding = {
46+sessionId: "cli-session-1",
47+forceReuse: true,
48+authProfileId: "anthropic:work",
49+authEpoch: "auth-epoch-a",
50+authEpochVersion: 2,
51+extraSystemPromptHash: "prompt-a",
52+mcpConfigHash: "mcp-config-a",
53+mcpResumeHash: "mcp-resume-a",
54+};
55+56+expect(
57+resolveCliSessionReuse({
58+ binding,
59+authProfileId: "anthropic:personal",
60+authEpoch: "auth-epoch-b",
61+authEpochVersion: 2,
62+extraSystemPromptHash: "prompt-b",
63+mcpConfigHash: "mcp-config-b",
64+mcpResumeHash: "mcp-resume-b",
65+}),
66+).toEqual({ sessionId: "cli-session-1" });
67+});
68+4269it("keeps legacy bindings reusable until richer metadata is persisted", () => {
4370const entry: SessionEntry = {
4471sessionId: "openclaw-session",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。