open-webui/backend/open_webui/test
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
..
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