[PR #24679] fix: always apply model default tools on chat open (#24677) #115084

Open
opened 2026-05-18 16:01:58 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/24679
Author: @Classic298
Created: 5/13/2026
Status: 🔄 Open

Base: devHead: fix/default-tools-persist-existing-chats


📝 Commits (1)

  • c7a26a2 fix: always apply model default tools on chat open (#24677)

📊 Changes

1 file changed (+6 additions, -17 deletions)

View changed files

📝 src/lib/components/chat/Chat.svelte (+6 -17)

📄 Description

Previously the chat-open flow was if (storageChatInput) restore from draft; else setDefaults() — mutually exclusive. Because MessageInput's $: onChange reactive fires saveDraft on every state change (including the selectedToolIds = [] reset performed inside navigateHandler before loadChat completes), the per-chat sessionStorage entry could end up with selectedToolIds: [] whenever the 500ms saveDraft debounce beat the subsequent setDefaults-triggered save (e.g. a slow getChatById, quick re-navigation, or anything that delays setDefaults beyond the timer). Once that empty state was persisted, every subsequent visit took the restore branch and never re-applied the model's defaults — default tools silently disappeared for that chat.

Decouple the two concerns: setDefaults() now always runs on chat open, so tools/filters/features are driven by the current model config. The sessionStorage draft only restores the user-typed prompt and uploaded files (the genuine "draft" state).

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/24679 **Author:** [@Classic298](https://github.com/Classic298) **Created:** 5/13/2026 **Status:** 🔄 Open **Base:** `dev` ← **Head:** `fix/default-tools-persist-existing-chats` --- ### 📝 Commits (1) - [`c7a26a2`](https://github.com/open-webui/open-webui/commit/c7a26a2b3c1b837b409bc43a7a816d51139c6c2d) fix: always apply model default tools on chat open (#24677) ### 📊 Changes **1 file changed** (+6 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `src/lib/components/chat/Chat.svelte` (+6 -17) </details> ### 📄 Description Previously the chat-open flow was `if (storageChatInput) restore from draft; else setDefaults()` — mutually exclusive. Because MessageInput's `$: onChange` reactive fires saveDraft on every state change (including the `selectedToolIds = []` reset performed inside navigateHandler before loadChat completes), the per-chat sessionStorage entry could end up with `selectedToolIds: []` whenever the 500ms saveDraft debounce beat the subsequent setDefaults-triggered save (e.g. a slow getChatById, quick re-navigation, or anything that delays setDefaults beyond the timer). Once that empty state was persisted, every subsequent visit took the restore branch and never re-applied the model's defaults — default tools silently disappeared for that chat. Decouple the two concerns: setDefaults() now always runs on chat open, so tools/filters/features are driven by the current model config. The sessionStorage draft only restores the user-typed prompt and uploaded files (the genuine "draft" state). ### 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-18 16:01:58 -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#115084