compaction: live progress signal + user-message cap

COMPACTING event drives a 'Compacting context…' transient in the GUI.
Cap the compacted block's user-message list at 40 with an honest omitted count.
This commit is contained in:
Rohit C Prasad
2026-07-30 06:24:39 -07:00
parent b303823934
commit f9f51c97c6
9 changed files with 144 additions and 25 deletions
+5
View File
@@ -64,9 +64,14 @@ test("the compacted divider renders mid-session and the transcript stays intact"
await box.fill("compact the context");
await box.press("Enter");
// The transient signal shows while the summarizer runs, then yields to the divider.
await expect(page.getByText("Compacting context…").first()).toBeVisible({
timeout: 10_000,
});
await expect(
page.getByText("Context compacted — earlier turns were summarized").first(),
).toBeVisible({ timeout: 10_000 });
await expect(page.getByText("Compacting context…")).toHaveCount(0);
await expect(
page.getByText("Still on it — continuing where I left off.").first(),
).toBeVisible();
+9 -5
View File
@@ -681,12 +681,16 @@ export async function mockApi(page: import("@playwright/test").Page) {
}, 120);
return;
}
// Auto-compaction (OPE-27): the server compacts mid-run and emits the marker,
// then the turn continues normally — the divider must render inline.
// Auto-compaction (OPE-27): the server signals `compacting` (the transient
// spinner label), summarizes for a beat, then emits the marker and the turn
// continues normally — the divider must render inline.
if (/compact the context/i.test(msg.text)) {
send("compacted", { text: "Context compacted — earlier turns were summarized" });
send("assistant_message", { text: "Still on it — continuing where I left off." });
send("turn_done");
send("compacting", {});
setTimeout(() => {
send("compacted", { text: "Context compacted — earlier turns were summarized" });
send("assistant_message", { text: "Still on it — continuing where I left off." });
send("turn_done");
}, 400);
return;
}
// A turn that dies on a provider error; the follow-up {type:"retry"} recovers.