[PR #24799] [CLOSED] fix: recover structurally-malformed chat history nodes on load #131519

Closed
opened 2026-05-21 17:07:15 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/24799
Author: @Classic298
Created: 5/15/2026
Status: Closed

Base: devHead: fix/recover-malformed-chat-history-on-load


📝 Commits (1)

  • eef3610 fix: 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

Note

Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/24799 **Author:** [@Classic298](https://github.com/Classic298) **Created:** 5/15/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `fix/recover-malformed-chat-history-on-load` --- ### 📝 Commits (1) - [`eef3610`](https://github.com/open-webui/open-webui/commit/eef36103c6645b949eedce110541cf03cb758e77) fix: recover structurally-malformed chat history nodes on load ### 📊 Changes **1 file changed** (+43 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/lib/components/chat/Chat.svelte` (+43 -1) </details> ### 📄 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 <!-- 🚨 DO NOT DELETE THE TEXT BELOW 🚨 Keep the "Contributor License Agreement" confirmation text intact. Deleting it will trigger the CLA-Bot to INVALIDATE your PR. Your PR will NOT be reviewed or merged until you check the box below confirming that you have read and agree to the terms of the CLA. --> - [x] By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. > [!NOTE] > Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-21 17:07:15 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#131519