Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/coding_agent_telegram/router/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,15 @@ async def typing_loop() -> None:
# Give thread-safe Telegram notifications one event-loop turn to run
# before we close the progress channel and finalize the response.
await asyncio.sleep(0)
pending_progress = tuple(progress_state["futures"])
if pending_progress:
try:
await asyncio.wait_for(
asyncio.gather(*(asyncio.wrap_future(future) for future in pending_progress), return_exceptions=True),
timeout=0.1,
)
except asyncio.TimeoutError:
pass
progress_state["closed"] = True
for future in tuple(progress_state["futures"]):
future.cancel()
Expand Down
Loading