mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 23:21:44 -05:00
[PR #24799] fix: recover structurally-malformed chat history nodes on load #115163
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/24799
Author: @Classic298
Created: 5/15/2026
Status: 🔄 Open
Base:
dev← Head:fix/recover-malformed-chat-history-on-load📝 Commits (1)
eef3610fix: recover structurally-malformed chat history nodes on load📊 Changes
1 file changed (+43 additions, -1 deletions)
View changed files
📝
src/lib/components/chat/Chat.svelte(+43 -1)📄 Description
A lost assistant placeholder can be persisted with only its completion fields (content/done/output/usage), missing id/role/parentId, while still existing under its map key and being referenced by its parent's childrenIds. The existing #24424 sanitizer only repairs currentId when it points to a missing node, so an "exists but malformed" node slips through: the frontend parent-walk dead-ends, Messages keeps the pagination loader visible, and the chat is stuck on "Loading..." forever with no console error and no failed request.
Reconstruct the graph fields in place during the load-time sanitize pass: derive id from the map key, parentId from the back-reference in the tree (null if none), childrenIds to an array, and role from parent alternation with a completion-field fallback. Also widen the currentId guard so an unusable current node falls back to the latest valid leaf.
Strict no-op for well-formed chats (a node whose id matches its key, has a role and an explicit parentId is skipped). Pure frontend and standalone: retroactively un-bricks every already-corrupted chat the moment it is opened, independent of the backend prevention in #24617.
Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.