fix(channels): make automatic compaction notices follow send_progress

Idle auto-compaction emitted "Compressing context…" / "Context compacted."
as standalone messages even when the channel had sendProgress: false, so
routine maintenance kept interrupting Discord chats after scheduled turns.

Gate ContextCompactionEvent notices in the outbound dispatch loop on the
channel's send_progress like other progress text. Two cases stay visible
regardless of the setting: a user-requested /compact (the event now
carries manual=True, set by cmd_compact through compact_idle_session)
and a failed compaction.

Fixes #5719
This commit is contained in:
L4XB authored and chengyongru committed 2026-09-11 11:15:57 +08:00
1 parent d7de5d5344
commit 92f151ae67
6 files changed
+135 -2

No files matched your search

+3
View File
@@ -71,6 +71,9 @@ async def test_compact_emits_one_lifecycle_and_keeps_the_session(loop, command)
assert started.phase == "started"
assert completed.phase == "succeeded"
assert started.compaction_id == completed.compaction_id
# A user-requested compaction is reported even on channels with progress off.
assert started.manual is True
assert completed.manual is True
loop.sessions.invalidate("cli:test")
reloaded = loop.sessions.get_or_create("cli:test")