mirror of
https://github.com/open-webui/open-webui.git
synced 2026-08-25 17:21:00 -05:00
[PR #21841] [MERGED] fix: resolve valve priority for actions and filters via class instantiation #129954
Reference in New Issue
Block a user
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/21841
Author: @Classic298
Created: 2/24/2026
Status: ✅ Merged
Merged: 2/24/2026
Merged by: @tjbck
Base:
dev← Head:valve-instantiation📝 Commits (1)
3a6672bfix: resolve valve priority for actions and filters via class instantiation📊 Changes
2 files changed (+19 additions, -8 deletions)
View changed files
📝
backend/open_webui/utils/filter.py(+9 -5)📝
backend/open_webui/utils/models.py(+10 -3)📄 Description
fix: resolve valve priority for actions and filters via class instantiation
The priority sorting for action buttons and filter execution order read valve data directly from the database JSON column using Functions.get_function_valves_by_id(). This returns only explicitly saved values — when a developer defines priority as a class default in their Valves definition (e.g. priority: int = 5) without ever opening the Valves UI to persist it, the database column remains empty. Every function then resolves to priority 0, and the preceding set() deduplication produces non-deterministic iteration order that the stable sort preserves — resulting in random button placement on every page load.
The fix instantiates the Valves class with database values as keyword overrides: Valves(**(db_valves or {})). This merges any persisted overrides onto the code-defined defaults, matching the pattern already established in the action execution handler, filter processing pipeline, and tool module initialization. A secondary sort key (the function ID) ensures fully deterministic ordering even when multiple functions share the same priority value.
Affected locations:
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.