mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 19:08:27 +00:00
fix: preserve inter-session input provenance (thanks @anbecker)
This commit is contained in:
@@ -92,6 +92,27 @@ describe("readFirstUserMessageFromTranscript", () => {
|
||||
expect(result).toBe("First user question");
|
||||
});
|
||||
|
||||
test("skips inter-session user messages by default", () => {
|
||||
const sessionId = "test-session-inter-session";
|
||||
const transcriptPath = path.join(tmpDir, `${sessionId}.jsonl`);
|
||||
const lines = [
|
||||
JSON.stringify({
|
||||
message: {
|
||||
role: "user",
|
||||
content: "Forwarded by session tool",
|
||||
provenance: { kind: "inter_session", sourceTool: "sessions_send" },
|
||||
},
|
||||
}),
|
||||
JSON.stringify({
|
||||
message: { role: "user", content: "Real user message" },
|
||||
}),
|
||||
];
|
||||
fs.writeFileSync(transcriptPath, lines.join("\n"), "utf-8");
|
||||
|
||||
const result = readFirstUserMessageFromTranscript(sessionId, storePath);
|
||||
expect(result).toBe("Real user message");
|
||||
});
|
||||
|
||||
test("returns null when no user messages exist", () => {
|
||||
const sessionId = "test-session-4";
|
||||
const transcriptPath = path.join(tmpDir, `${sessionId}.jsonl`);
|
||||
|
||||
Reference in New Issue
Block a user