mirror of
https://github.com/andrewyng/openworker.git
synced 2026-09-11 06:30:25 +00:00
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:
@@ -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();
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user