fix(chat): restore forked context
Agent CI/CD / docker-image (push) Successful in 1m38s
Agent CI/CD / deploy-fallback-log (push) Has been skipped

This commit is contained in:
2026-06-08 19:33:13 +08:00
parent 15c3263369
commit 801f611ce5
4 changed files with 44 additions and 61 deletions
+16
View File
@@ -4,6 +4,7 @@ import {
buildPromptWithLearningContext,
extractLatestFrontendTurn,
generateSessionTitle,
shouldRestoreConversationForRuntime,
shouldGenerateSessionTitle,
} from "../../src/routes/chatSession.js";
import { type SessionTurnRecord } from "../../src/sessions/transcriptStore.js";
@@ -161,6 +162,21 @@ describe("buildPromptWithLearningContext", () => {
expect(prompt).not.toContain("[Previous conversation context]");
expect(prompt).toBe("基于刚才结果继续分析");
});
it("restores copied fork context when metadata exists but runtime has no conversation", () => {
expect(
shouldRestoreConversationForRuntime({
hadExistingSessionRecord: true,
runtimeHasConversation: false,
}),
).toBe(true);
expect(
shouldRestoreConversationForRuntime({
hadExistingSessionRecord: true,
runtimeHasConversation: true,
}),
).toBe(false);
});
});
describe("extractLatestFrontendTurn", () => {