refactor: drain traditional agent streams

This commit is contained in:
jxxghp
2026-08-24 00:50:24 +08:00
parent 8cbb91ecbe
commit 2e5dd2cf0a
3 changed files with 69 additions and 2 deletions
+3 -1
View File
@@ -2221,9 +2221,11 @@ async def _web_agent_stream_impl(
return
yield ": heartbeat\n\n"
except asyncio.CancelledError:
return
finally:
if not collection_task.done():
collection_task.cancel()
return
await asyncio.gather(collection_task, return_exceptions=True)
assistant_message = _build_web_agent_display_message_from_events(events)
display_messages.append(assistant_message)