fix: tool prompts time out when the user's tab is on another instance (#31620)

With WEBSOCKET_MANAGER=redis and several instances or workers, an instance only subscribed to Redis once a browser tab had connected to it. Until then, when a tool or Function asked the user something (a confirmation or an input dialog) and the user's tab was connected to another instance, the user's reply never reached the tool and it waited until it timed out. Every instance now subscribes at startup, so the reply arrives whichever instance the tab is on.
This commit is contained in:
Classic298 2026-09-30 17:24:03 +02:00 • committed by GitHub
parent 6d409da9d2
commit 288bf91f73
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -193,6 +193,7 @@ from open_webui.socket.main import (
periodic_session_pool_cleanup,
periodic_usage_pool_cleanup,
redis_event_listener,
sio,
)
from open_webui.socket.main import (
app as socket_app,
@ -398,6 +399,9 @@ async def lifespan(app: FastAPI):
if WEBSOCKET_MANAGER == 'redis':
app.state.redis_event_listener = asyncio.create_task(redis_event_listener())
# socket.io only starts listening on its first connect; event call answers need it earlier
sio.manager_initialized = True
sio.manager.initialize()
app.state.periodic_usage_pool_cleanup = asyncio.create_task(periodic_usage_pool_cleanup())
app.state.periodic_session_pool_cleanup = asyncio.create_task(periodic_session_pool_cleanup())