mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-10-27 05:30:39 +00:00
* fix(gateway): close pooled MCP sessions on shutdown The Gateway lifespan closes the browser session manager on the way out but never closed MCPSessionPool, so every pooled MCP session was abandoned when the worker exited: the owner task's transport __aexit__ never ran and a stdio MCP server or SSE/HTTP connection had no orderly teardown. MCPSessionPool.close_all() already existed for exactly this and had no production caller -- only the config-retirement path used close_all_sync(). The async form is the right one here: close_all_sync()'s own docstring directs callers running inside a live event loop to await close_all() instead of signalling and returning. Wired into lifespan shutdown with the same bounded, best-effort shape as the neighbouring browser-session hook. * fix(gateway): close MCP sessions after run drain --------- Co-authored-by: Willem Jiang <willem.jiang@gmail.com>