mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-08 04:16:03 -05:00
[PR #21649] fix: graceful fallback when history.currentId points to an orphan node (infinite spinner) #65038
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/21649
Author: @ephb
Created: 2/20/2026
Status: 🔄 Open
Base:
dev← Head:fix/resilient-currentid-fallback📝 Commits (1)
4db72ebfix(Messages): graceful fallback for invalid history.currentId, closes #15189📊 Changes
1 file changed (+31 additions, -10 deletions)
View changed files
📝
src/lib/components/chat/Messages.svelte(+31 -10)📄 Description
Pull Request Checklist
devbranch.dev.fix:Changelog Entry
Description
Fixes a long-standing bug (reported in #15189) where a chat shows an infinite loading spinner and never renders, caused by
history.currentIdpointing to a partial "orphan" message node that has norole.This happens when the browser or network drops while OpenWebUI is generating follow-up questions: the backend writes a
followUpsplaceholder intohistory.messagesand updateshistory.currentIdto point at it, before the node hasrole,content,parentId, orchildrenIds. The node looks like:Messages.svelte's reactive block starts athistory.currentIdand walks the tree viaparentId. Starting from a node with norolemeans the walk produces nothing,messages = []on every tick, and the chat spins forever. No console errors appear, making it hard to diagnose.We confirmed this in production on two separate chats on a deployment, and it matches the exact data structure reported in #15189.
Fixed
Messages.svelte: add a guard before the tree-walk that validateshistory.currentIdresolves to a node with arole. If it does not, fall back to the most recent valid terminal message (hasrole,childrenIdsis[]) sorted by timestamp. Aconsole.warnis emitted so the recovery is visible in DevTools.Added
Changed
src/lib/components/chat/Messages.svelte: +31 / -10 lines in the reactive$: if (history.currentId)block.Deprecated / Removed / Security / Breaking Changes
Additional Information
currentIdis already invalid. Normal chats are completely unaffected.console.erroris emitted and the chat renders empty - the same visible outcome as before.How to Reproduce (before fix)
Alternatively, import the malformed JSON from issue #15189 - it reliably triggers the bug.
Testing performed
Tested with a locally-built Docker image (
openwebui-debug:v0.8.3-fix):currentId, node with onlyfollowUps, norole).v0.8.3): chat spins forever. Bug confirmed.Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.