fix(coding-agent): restore compaction summary and dedupe edit errors

This commit is contained in:
Mario Zechner
2026-03-27 04:00:21 +01:00
parent a0734bd162
commit f456a7a4db
4 changed files with 28 additions and 4 deletions

View File

@@ -2,7 +2,7 @@ import { describe, expect, test, vi } from "vitest";
import { InteractiveMode } from "../src/modes/interactive/interactive-mode.js";
describe("InteractiveMode compaction events", () => {
test("rebuilds chat without appending a duplicate compaction summary", async () => {
test("rebuilds chat and appends a synthetic compaction summary at the bottom", async () => {
const fakeThis = {
isInitialized: true,
footer: { invalidate: vi.fn() },
@@ -44,7 +44,14 @@ describe("InteractiveMode compaction events", () => {
expect(fakeThis.chatContainer.clear).toHaveBeenCalledTimes(1);
expect(fakeThis.rebuildChatFromMessages).toHaveBeenCalledTimes(1);
expect(fakeThis.addMessageToChat).not.toHaveBeenCalled();
expect(fakeThis.addMessageToChat).toHaveBeenCalledTimes(1);
expect(fakeThis.addMessageToChat).toHaveBeenCalledWith(
expect.objectContaining({
role: "compactionSummary",
tokensBefore: 123,
summary: "summary",
}),
);
expect(fakeThis.flushCompactionQueue).toHaveBeenCalledWith({ willRetry: false });
});
});