open-webui/backend/open_webui
natemiller23 8fca110e2d fix: await raw-JSON streaming error upsert so it persists to chat history (open-webui#27074)
When an upstream provider streams a raw JSON error payload without the SSE
`data:` prefix, the streaming handler parses it and attempts to persist it
to the assistant message via Chats.upsert_message_to_chat_by_id_and_message_id.
That coroutine was created without `await`, so the upsert was never executed:
the error was emitted to the client but dropped from the chat history.

Add the missing `await` so the raw-JSON fallback mirrors the normal streaming
error path (which already awaits). Also add a static regression test that fails
if any Chats.upsert_message_to_chat_by_id_and_message_id call site is left
un-awaited.

Refs https://github.com/open-webui/open-webui/issues/27074

--
openjobs.bot
OpenJobs listing: https://openjobs.bot/jobs/2edcdc90-60db-4e64-804e-f5368e7400f3
Job ID: 2edcdc90-60db-4e64-804e-f5368e7400f3
2026-07-16 18:23:41 -07:00
..
data refac: mv backend files to /open_webui dir 2024-09-04 16:54:48 +02:00
internal refac 2026-06-29 12:40:20 -05:00
migrations refac 2026-07-16 01:42:24 -04:00
models refac 2026-07-16 01:42:24 -04:00
retrieval refac 2026-07-14 00:42:47 -04:00
routers refac 2026-07-16 01:34:50 -04:00
socket refac 2026-07-16 00:30:44 -04:00
static chore: format 2026-06-01 14:10:40 -07:00
storage refac: modernize type annotations (PEP 604 / PEP 585) 2026-05-12 17:10:15 +09:00
test/util fix: await raw-JSON streaming error upsert so it persists to chat history (open-webui#27074) 2026-07-16 18:23:41 -07:00
tools refac 2026-07-16 00:58:34 -04:00
utils fix: await raw-JSON streaming error upsert so it persists to chat history (open-webui#27074) 2026-07-16 18:23:41 -07:00
__init__.py refac 2026-06-17 03:01:11 +02:00
alembic.ini fix: Alembic CLI commands from failing 2025-08-15 04:17:47 -04:00
config.py refac 2026-07-14 17:34:00 -04:00
constants.py refac 2026-06-29 05:46:51 -05:00
env.py refac 2026-07-09 17:28:05 -05:00
events.py refac 2026-07-16 01:27:52 -04:00
functions.py fix: don't mutate caller's payload when resolving a pipe base model (#26906) 2026-07-10 13:33:24 -05:00
main.py refac 2026-07-16 02:47:51 -04:00
tasks.py refac: modernize type annotations (PEP 604 / PEP 585) 2026-05-12 17:10:15 +09:00