fix: stop sending context compaction notifications

This commit is contained in:
Arthur K. authored and Xubin Ren committed 2026-09-30 13:44:42 +08:00
1 parent fbe9b4fd72
commit 0b402d0414
31 files changed
+157 -38

No files matched your search

+5 -2
View File
@@ -1245,6 +1245,7 @@ class Consolidator:
runtime: LLMRuntime,
max_suffix: int = 0,
events: EventSink = NO_EVENTS,
notify: bool = False,
) -> str | None:
"""Replace archived history with a summary checkpoint.
@@ -1267,7 +1268,7 @@ class Consolidator:
compaction_id = uuid4().hex
await events.emit(
ContextCompactionEvent(compaction_id=compaction_id, phase="started"),
ContextCompactionEvent(compaction_id=compaction_id, phase="started", notify=notify),
)
last_active = session.updated_at
archive_end = archive_start + len(messages_to_archive)
@@ -1288,12 +1289,13 @@ class Consolidator:
ContextCompactionEvent(
compaction_id=compaction_id,
phase="cancelled" if isinstance(exc, asyncio.CancelledError) else "failed",
notify=notify,
),
)
raise
if not summary:
await events.emit(
ContextCompactionEvent(compaction_id=compaction_id, phase="failed"),
ContextCompactionEvent(compaction_id=compaction_id, phase="failed", notify=notify),
)
return None
@@ -1301,6 +1303,7 @@ class Consolidator:
ContextCompactionEvent(
compaction_id=compaction_id,
phase="succeeded",
notify=notify,
),
)