feat: make context compaction visible in channels (#5656)

* feat: surface context compaction lifecycle

* fix: complete and simplify context compaction notifications
This commit is contained in:
chengyongru authored and GitHub committed 2026-09-05 20:21:54 +08:00
1 parent 455533169d
commit 5229989f28
52 files changed
+1849 -140

No files matched your search

+28
View File
@@ -1678,4 +1678,32 @@ describe("ThreadMessages", () => {
["a3", true],
]);
});
it("keeps compaction notices out of assistant fork selection", () => {
const units = buildDisplayUnits([
{ id: "u1", role: "user", content: "one", createdAt: 1 },
{ id: "a1", role: "assistant", content: "answer", createdAt: 2 },
{
id: "compaction-1",
role: "assistant",
content: "",
kind: "compaction",
createdAt: 3,
compaction: {
id: "compact-1",
phase: "succeeded",
},
},
]);
const flags = assistantForkFlags(units);
expect(units.map((unit, index) => [
unit.type === "message" ? unit.message.id : "activity",
flags[index],
])).toEqual([
["u1", true],
["a1", true],
["compaction-1", false],
]);
});
});