Skip to content

Commit 9c8bbd9

Browse files
authored
Merge pull request #242 from GitHubSecurityLab/p--fix-cleanup
fix: Yield to give mcp_session_task a chance to finish
2 parents 8df221e + 250fc10 commit 9c8bbd9

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/seclab_taskflow_agent/runner.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,9 @@ async def deploy_task_agents(
462462
continue
463463
except Exception:
464464
logging.exception("Exception in mcp server cleanup task")
465+
# Yield to give mcp_session_task a chance to finish after being
466+
# signalled, especially when there are no servers to clean up.
467+
await asyncio.sleep(0)
465468
# If the MCP session task is still running (e.g. all servers were
466469
# already disconnected and the cleanup loop above never entered)
467470
# cancel it explicitly so a dangling task can't keep the event

0 commit comments

Comments
 (0)