fix(FN-000): restore memory compaction and log pagination

This commit is contained in:
gsxdsm
2026-04-17 08:43:13 -07:00
parent 2425b6b6bb
commit 2956998eb5
9 changed files with 117 additions and 16 deletions

View File

@@ -3634,6 +3634,26 @@ Task with acceptance criteria
expect(logs.map((entry) => entry.text)).toEqual(["chunk 3", "chunk 4"]);
});
it("returns older agent log pages when offset skips recent entries", async () => {
const task = await createTestTask();
for (let i = 0; i < 5; i++) {
await store.appendAgentLog(task.id, `chunk ${i}`, "text");
}
await expect(store.getAgentLogs(task.id, { limit: 2 })).resolves.toMatchObject([
{ text: "chunk 3" },
{ text: "chunk 4" },
]);
await expect(store.getAgentLogs(task.id, { limit: 2, offset: 2 })).resolves.toMatchObject([
{ text: "chunk 1" },
{ text: "chunk 2" },
]);
await expect(store.getAgentLogs(task.id, { limit: 2, offset: 4 })).resolves.toMatchObject([
{ text: "chunk 0" },
]);
});
it("preserves long entry fields when returning a bounded tail", async () => {
const task = await createTestTask();
const longText = [