fix(ralph-loop): ignore synthetic idle replays

This commit is contained in:
YeonGyu-Kim
2026-05-12 15:28:46 +09:00
parent 07797e1975
commit 9ffef79dbb
6 changed files with 104 additions and 4 deletions
@@ -58,6 +58,29 @@ describe("detectCompletionInSessionMessages", () => {
// #then
expect(detected).toBe(true)
})
test("#when sinceMessageIndex equals current message count #then should NOT rescan old DONE", async () => {
// #given
const messages = [
{
info: { role: "assistant" },
parts: [{ type: "text", text: "Old completion <promise>DONE</promise>" }],
},
]
const ctx = createPluginInput(messages)
// #when
const detected = await detectCompletionInSessionMessages(ctx, {
sessionID: "session-123",
promise: "DONE",
apiTimeoutMs: 1000,
directory: "/tmp",
sinceMessageIndex: messages.length,
})
// #then
expect(detected).toBe(false)
})
})
describe("#given no sinceMessageIndex (backward compat)", () => {