fix(channels): preserve explicit compaction feedback and silent delivery
This commit is contained in:
1 parent
0b402d0414
commit
7644d845b4
13 files changed
+96
-37
No files matched your search
@@ -2,7 +2,7 @@ import asyncio
|
||||
from datetime import timedelta
|
||||
from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import AsyncMock
|
||||
from unittest.mock import AsyncMock, Mock
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -3298,20 +3298,26 @@ async def test_compaction_terminal_phase_edits_started_notice_in_place() -> None
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_automatic_compaction_is_received_but_not_sent() -> None:
|
||||
@pytest.mark.parametrize("phase", ["started", "succeeded", "failed", "cancelled"])
|
||||
async def test_automatic_compaction_is_received_but_not_sent(phase) -> None:
|
||||
channel = TelegramChannel(
|
||||
TelegramConfig(enabled=True, token="123:abc", allow_from=["*"]),
|
||||
MessageBus(),
|
||||
)
|
||||
_install_ready_app(channel)
|
||||
channel._app.bot.send_message = AsyncMock()
|
||||
channel._stop_typing = Mock()
|
||||
channel._remove_reaction = AsyncMock()
|
||||
|
||||
await channel.send(OutboundMessage(
|
||||
channel="telegram", chat_id="999", content="Compressing context…",
|
||||
event=ContextCompactionEvent(compaction_id="c1", phase="started"),
|
||||
metadata={"message_id": "42"},
|
||||
event=ContextCompactionEvent(compaction_id="c1", phase=phase),
|
||||
))
|
||||
|
||||
channel._app.bot.send_message.assert_not_awaited()
|
||||
channel._stop_typing.assert_not_called()
|
||||
channel._remove_reaction.assert_not_awaited()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in new issue
Block a user