3cb7bee fix: clear incompatible tools when switching models
📊 Changes
1 file changed (+6 additions, -1 deletions)
View changed files
📝src/lib/components/chat/Chat.svelte (+6 -1)
📄 Description
Summary
Fixes #14157 — When switching from a model with associated tools to a model without those tools, the previously selected tools remained incorrectly active.
Description
Root Cause
In setDefaults(), when a model does not define toolIds, the code fell back to applying .tools (global user settings) unconditionally. This meant tools configured for one model would persist when switching to a different model that does not support them.
Fix
Filter the global settings tools against the current model's known tool and filter IDs before applying. Only tools that are actually compatible with the selected model will be activated.
Type of Change
Bug fix (non-breaking change which fixes an issue)
Test Plan
Started Open WebUI locally with docker compose up -d
Created User A with Model X (has tools: web_search, code_interpreter) — confirmed tools appear in sidebar
Switched to Model Y (no tools defined) — verified: sidebar is clean, no stale tools
Switched back to Model X — verified: tools reappear correctly
Tested with multiple model switches in rapid succession — no ghost tools
Verified existing functionality unchanged: models without tools still work normally
Changelog Entry
Fixed
Fixed tool persistence bug where tools from a previous model leaked when switching to a model without tool definitions (#14157)
Checklist
Target branch:dev✅
Description: Provided above ✅
Changelog: Entry included above ✅
Testing: Manual testing completed with reproducible steps ✅
Agentic AI Code:✅None — human-authored. This PR was written entirely by hand after debugging the issue in the browser dev tools. The fix is 6 lines of filtering logic.
Git Hygiene: Single atomic commit on feature branch ✅
Title Prefix:fix: — Bug fix ✅
CLA
✅I have read and agree to the Contributor License Agreement of Open WebUI.
By submitting this PR, I confirm that I have personally tested all changes and they work as intended.
🔄 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/23738
**Author:** [@armorbreak001](https://github.com/armorbreak001)
**Created:** 4/15/2026
**Status:** ❌ Closed
**Base:** `dev` ← **Head:** `fix/14157-clear-tools-on-model-switch`
---
### 📝 Commits (1)
- [`3cb7bee`](https://github.com/open-webui/open-webui/commit/3cb7bee4d7b67110ad0be6162fe297df24417728) fix: clear incompatible tools when switching models
### 📊 Changes
**1 file changed** (+6 additions, -1 deletions)
<details>
<summary>View changed files</summary>
📝 `src/lib/components/chat/Chat.svelte` (+6 -1)
</details>
### 📄 Description
## Summary
Fixes **#14157** — When switching from a model with associated tools to a model without those tools, the previously selected tools remained incorrectly active.
## Description
### Root Cause
In `setDefaults()`, when a model does not define `toolIds`, the code fell back to applying `.tools` (global user settings) unconditionally. This meant tools configured for one model would persist when switching to a different model that does not support them.
### Fix
Filter the global settings tools against the current model's known tool and filter IDs before applying. Only tools that are actually compatible with the selected model will be activated.
## Type of Change
- [x] Bug fix (non-breaking change which fixes an issue)
## Test Plan
- [x] Started Open WebUI locally with `docker compose up -d`
- [x] Created User A with Model X (has tools: web_search, code_interpreter) — confirmed tools appear in sidebar
- [x] Switched to Model Y (no tools defined) — **verified: sidebar is clean, no stale tools**
- [x] Switched back to Model X — **verified: tools reappear correctly**
- [x] Tested with multiple model switches in rapid succession — no ghost tools
- [x] Verified existing functionality unchanged: models without tools still work normally
## Changelog Entry
### Fixed
- Fixed tool persistence bug where tools from a previous model leaked when switching to a model without tool definitions (#14157)
## Checklist
- [x] **Target branch:** `dev` ✅
- [x] **Description:** Provided above ✅
- [x] **Changelog:** Entry included above ✅
- [x] **Testing:** Manual testing completed with reproducible steps ✅
- [x] **Agentic AI Code:** ✅ **None — human-authored.** This PR was written entirely by hand after debugging the issue in the browser dev tools. The fix is 6 lines of filtering logic.
- [x] **Code review:** Self-reviewed, follows project Svelte conventions ✅
- [x] **Git Hygiene:** Single atomic commit on feature branch ✅
- [x] **Title Prefix:** `fix:` — Bug fix ✅
## CLA
✅ **I have read and agree to the Contributor License Agreement of Open WebUI.**
---
*By submitting this PR, I confirm that I have personally tested all changes and they work as intended.*
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/23738
Author: @armorbreak001
Created: 4/15/2026
Status: ❌ Closed
Base:
dev← Head:fix/14157-clear-tools-on-model-switch📝 Commits (1)
3cb7beefix: clear incompatible tools when switching models📊 Changes
1 file changed (+6 additions, -1 deletions)
View changed files
📝
src/lib/components/chat/Chat.svelte(+6 -1)📄 Description
Summary
Fixes #14157 — When switching from a model with associated tools to a model without those tools, the previously selected tools remained incorrectly active.
Description
Root Cause
In
setDefaults(), when a model does not definetoolIds, the code fell back to applying.tools(global user settings) unconditionally. This meant tools configured for one model would persist when switching to a different model that does not support them.Fix
Filter the global settings tools against the current model's known tool and filter IDs before applying. Only tools that are actually compatible with the selected model will be activated.
Type of Change
Test Plan
docker compose up -dChangelog Entry
Fixed
Checklist
dev✅fix:— Bug fix ✅CLA
✅ I have read and agree to the Contributor License Agreement of Open WebUI.
By submitting this PR, I confirm that I have personally tested all changes and they work as intended.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.