open-webui/backend/open_webui
Classic298 0313ea0238
fix: stop every task of a chat when stopping a response without Redis (#29844)
Pressing Stop on a chat that has more than one running task (a multi-model
response, or a follow-up sent from another tab or device while a response
is still streaming) reported success but only cancelled the first task.
The survivors kept streaming and kept executing tool calls until the
iteration limit, which is the runaway reported in the issue.

Without Redis the stop loop iterates the live task-id list of the chat.
Each awaited cancellation runs that task's cleanup, which removes its id
from the same list mid-iteration, so the loop runs out one element early
and the last task is never cancelled. Returning a snapshot of the list to
callers keeps the loop on the ids it started with. Redis deployments
already got a fresh list from the set and were not affected.

Verified against a mock upstream that calls a tool on every turn: with three
tasks on one chat, stop left one or two alive before the change and cancels
all of them after it.

Fixes #29816
2026-09-12 13:55:13 -05:00
..
data refac: mv backend files to /open_webui dir 2024-09-04 16:54:48 +02:00
internal refac 2026-09-06 17:13:32 -04:00
migrations chore: format 2026-08-25 16:53:53 -04:00
models refac 2026-09-09 17:09:53 -04:00
retrieval refac 2026-09-08 23:18:48 -04:00
routers refac 2026-09-09 17:09:53 -04:00
socket perf: stop scanning every socket.io payload for binary data (#28180) 2026-08-31 01:22:06 -04:00
static refac 2026-09-06 17:27:30 -04:00
storage refac 2026-09-06 17:13:32 -04:00
tools feat: sort flags for kb_exec file listings (#29840) 2026-09-09 12:30:47 -04:00
utils fix: sanitize user-typed notification target ids the same way generated ones are (#29947) 2026-09-12 13:50:19 -05:00
__init__.py perf: allow disabling websocket per-message-deflate (#28613) 2026-08-24 18:46:07 -04:00
alembic.ini fix: Alembic CLI commands from failing 2025-08-15 04:17:47 -04:00
config.py refac 2026-09-08 23:18:48 -04:00
constants.py refac 2026-08-29 16:14:32 -04:00
env.py refac 2026-09-09 12:51:59 -04:00
events.py refac 2026-08-16 23:21:00 -07:00
functions.py fix: honor bypass_system_prompt on the pipe route (#28739) 2026-08-19 11:08:02 -07:00
main.py refac 2026-09-06 19:36:17 -04:00
tasks.py fix: stop every task of a chat when stopping a response without Redis (#29844) 2026-09-12 13:55:13 -05:00