open-webui/backend
Prometheus 532c60fe8c fix(mcp): remove asyncio.wait_for/shield from MCP cleanup in chat handler
asyncio.wait_for() and asyncio.shield() create new asyncio Tasks which
violate anyio cancel-scope task-ownership rules. The MCPClient's
exit_stack contains anyio resources (streamable_http transport) that
use anyio cancel scopes. When exited from a different task, anyio raises
'Attempted to exit a cancel scope that isn't the current task's current
cancel scope' as a BaseException.

This BaseException propagates through the finally block, discards the
completed response return value, and surfaces as a 500 Internal Server
Error / 'No response returned.' - silently swallowing successful MCP
tool calls and blocking the chat endpoint.

Fix: call client.disconnect() directly in a simple loop. MCPClient.disconnect()
already catches BaseException internally (see prior commit), so no
wrapper is needed.

Co-Authored-By: Circe (Claude Code Sonnet 4.6) <circe@athena-council.org>
Co-Authored-By: Claude <noreply@anthropic.com>
2026-04-26 18:48:55 +02:00
..
data refac: mv backend files to /open_webui dir 2024-09-04 16:54:48 +02:00
open_webui fix(mcp): remove asyncio.wait_for/shield from MCP cleanup in chat handler 2026-04-26 18:48:55 +02:00
.dockerignore fix: litellm config issue 2024-02-24 22:35:11 -08:00
.gitignore refac 2024-09-06 04:59:20 +02:00
dev.sh refac 2026-03-24 19:43:30 -05:00
requirements-min.txt refac 2026-04-24 18:20:10 +09:00
requirements.txt refactor(firecrawl): use v2 API directly (#23934) 2026-04-24 18:32:08 +09:00
start.sh refac 2026-03-24 19:43:30 -05:00
start_windows.bat refac 2026-04-24 15:40:02 +09:00