fix(agent): complete automation cancelled before execution

This commit is contained in:
chengyongru authored and chengyongru committed 2026-09-17 22:18:38 +08:00
1 parent b669c2036c
commit 28d9721bfd
2 files changed
+34 -3

No files matched your search

+3 -3
View File
@@ -1425,7 +1425,9 @@ class AgentLoop:
self._deferred_automation_turns.pop(session_key)
try:
await self._dispatch_one(msg, pending)
except asyncio.CancelledError:
except asyncio.CancelledError as exc:
for coordinator in self._automation_turn_coordinators:
coordinator.complete(msg, error=exc)
raise
except Exception:
logger.exception(
@@ -1515,8 +1517,6 @@ class AgentLoop:
for coordinator in self._automation_turn_coordinators:
coordinator.complete(msg, response=response)
except asyncio.CancelledError:
for coordinator in self._automation_turn_coordinators:
coordinator.complete(msg, error=asyncio.CancelledError())
logger.info("Task cancelled for session {}", session_key)
try:
await delivery.abort_stream()