From e398ba3506c4bcf74b17f18dbd2d6c2e61af8984 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Fri, 24 Jul 2026 07:58:30 +0200 Subject: [PATCH] fix: don't seed non-persistent config keys (oauth.* with flag off) (#26928) seed_defaults inserted a row for every key in DEFAULT_CONFIG regardless of whether the DB is authoritative for it. With ENABLE_OAUTH_PERSISTENT_CONFIG off, the oauth.* keys were seeded from the then-current (often empty) env values. Enabling the flag later made those stale rows override live env vars (e.g. ENABLE_OAUTH_SIGNUP=true stopped taking effect) and further env changes were never picked up. Skip keys where persistent_enabled_for() is false, matching the masking the read paths (get/get_many/get_namespace/get_all) already apply. Claude-Session: https://claude.ai/code/session_01Vr2RCYUTXCtgtV4WMUCK86 Co-authored-by: Claude Opus 4.8 --- backend/open_webui/models/config.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/open_webui/models/config.py b/backend/open_webui/models/config.py index 5d0b2266b7..00fcfc2e00 100644 --- a/backend/open_webui/models/config.py +++ b/backend/open_webui/models/config.py @@ -248,6 +248,10 @@ class Config(Base): now = int(time.time()) new_count = 0 for key, value in defaults.items(): + # Skip keys the DB is not authoritative for (e.g. oauth.* while + # ENABLE_OAUTH_PERSISTENT_CONFIG is off), matching the read paths. + if not Config.persistent_enabled_for(key): + continue if key not in existing_keys: value = _json_value(value) db.add(Config(key=key, value=value, updated_at=now))