mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-21 00:52:24 -05:00
[PR #21232] [CLOSED] fix: add conditional warning log when SAFE_MODE deactivates functions #49027
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/21232
Author: @Azzeo
Created: 2/7/2026
Status: ❌ Closed
Base:
dev← Head:fix/safe-mode-logging📝 Commits (1)
62780b8fix: add conditional warning log when SAFE_MODE deactivates functions📊 Changes
1 file changed (+18 additions, -6 deletions)
View changed files
📝
backend/open_webui/models/functions.py(+18 -6)📄 Description
Pull Request Checklist
Before submitting, make sure you've checked the following:
devbranch. Not targeting thedevbranch will lead to immediate closure of the PR.Changelog Entry
Description
Improved visibility when
SAFE_MODEis enabled by adding a conditional warning log when functions are deactivated.Added
SAFE_MODEsuccessfully deactivates active functions.Changed
deactivate_all_functionsinFunctionsTableto use a filtered update query. It now calculates the exact number of affected rows and only logs if changes were actually made.Deprecated
Removed
Fixed
SAFE_MODEwould silently disable functions without informing the administrator in the logs.Security
Breaking Changes
Additional Information
Currently, when
SAFE_MODEis enabled, the system runsdeactivate_all_functionssilently. This makes debugging difficult if an administrator forgets the environment variable is set.This PR introduces a check that:
is_active=Truefunctions.row_countof modified functions.This ensures the logs are not spammed on repeated restarts (idempotent logging) but clearly warns the user when the action is taken.
Technical Notes:
synchronize_session=Falsefor the bulk update to ensure performance.Testing:
I have confirmed this works by enabling SAFE_MODE, then toggling functions on, restarting and then see the appropriate number of functions being disabled in the logs. The functions are confirmed to have been disabled.
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.