fix(matrix): keep typing indicator during progress updates

This commit is contained in:
Alexander Minges
2026-02-21 20:24:46 +01:00
parent fcece3ec62
commit de5104ab2a
2 changed files with 27 additions and 2 deletions

View File

@@ -1141,6 +1141,29 @@ async def test_send_stops_typing_keepalive_task() -> None:
assert client.typing_calls[-1] == ("!room:matrix.org", False, TYPING_NOTICE_TIMEOUT_MS)
@pytest.mark.asyncio
async def test_send_progress_keeps_typing_keepalive_running() -> None:
channel = MatrixChannel(_make_config(), MessageBus())
client = _FakeAsyncClient("", "", "", None)
channel.client = client
channel._running = True
await channel._start_typing_keepalive("!room:matrix.org")
assert "!room:matrix.org" in channel._typing_tasks
await channel.send(
OutboundMessage(
channel="matrix",
chat_id="!room:matrix.org",
content="working...",
metadata={"_progress": True, "_progress_kind": "reasoning"},
)
)
assert "!room:matrix.org" in channel._typing_tasks
assert client.typing_calls[-1] == ("!room:matrix.org", True, TYPING_NOTICE_TIMEOUT_MS)
@pytest.mark.asyncio
async def test_send_clears_typing_when_send_fails() -> None:
channel = MatrixChannel(_make_config(), MessageBus())