Q9: chat wakes carry every new message and the latest history

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-08 03:29:59 -04:00
1 parent 2a7b17a47a
commit abe9534350
2 files changed
+48 -26

No files matched your search

+21
View File
@@ -173,4 +173,25 @@ describe("chat wake context", () => {
expect(last.role === "user" && last.text).toContain("Stop — use Postgres instead.");
h.connection.close();
});
test("a long thread keeps every new message and the most recent history", async () => {
const h = await founderLine();
const threadId = h.say("Message 0", null);
await h.runWake();
for (let index = 1; index <= 30; index += 1) h.say(`Message ${index}`, threadId);
await h.runWake();
for (let index = 31; index <= 55; index += 1) h.say(`Message ${index}`, threadId);
await h.runWake();
const prompt = h.wakePrompts[2];
const earlier = prompt.slice(prompt.indexOf("Earlier in this thread"), prompt.indexOf("New since your last reply"));
const fresh = prompt.slice(prompt.indexOf("New since your last reply"));
const lineEnds = (block: string, text: string) => block.split("\n").some((line) => line.endsWith(text));
for (let index = 31; index <= 55; index += 1) expect(lineEnds(fresh, `: Message ${index}`)).toBe(true);
expect(lineEnds(earlier, ": Reply 2.")).toBe(true);
expect(lineEnds(earlier, ": Message 12")).toBe(true);
expect(lineEnds(earlier, ": Message 11")).toBe(false);
expect(earlier).toContain("13 earlier messages in this thread are not shown.");
h.connection.close();
});
});