open-webui/backend/open_webui
Claude ae8ef975ea
fix: apply custom model fallback before the base-model access check
With ENABLE_CUSTOM_MODEL_FALLBACK enabled, chatting with a custom
workspace model whose base model was removed still failed with "Model
not found" for non-admin users. The access check ran before the
fallback resolution and walked the preset's base_model_id chain;
has_base_model_access treats a base model without a model-table row as
admin-only, so regular users were rejected before the fallback to the
default (Selected) model could ever apply. Admins bypass the access
check by default, which is why the fallback only appeared to work for
them.

Resolve the fallback model first, and when one applies, skip the
missing base-model hop on the requested preset and enforce access on
the fallback model that will actually serve the chat instead.
check_model_access gains a check_base_model flag for this; all other
callers keep the default chain enforcement.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sc922g12Yp16TdcCt74AWi
2026-08-12 11:38:16 +00:00
..
data refac: mv backend files to /open_webui dir 2024-09-04 16:54:48 +02:00
internal perf: route native JSON columns through JSONCodec instead of stdlib json (#28396) 2026-08-10 19:39:49 -05:00
migrations refac 2026-08-10 23:22:08 -06:00
models refac 2026-08-11 01:15:05 -06:00
retrieval refac 2026-08-10 23:40:31 -06:00
routers refac 2026-08-11 01:15:05 -06:00
socket refac 2026-08-10 23:13:10 -06:00
static refac 2026-07-27 19:39:36 -04:00
storage refac 2026-07-31 17:41:14 -04:00
tools refac 2026-08-10 20:13:03 -06:00
utils fix: apply custom model fallback before the base-model access check 2026-08-12 11:38:16 +00:00
__init__.py refac 2026-07-27 19:39:36 -04:00
alembic.ini fix: Alembic CLI commands from failing 2025-08-15 04:17:47 -04:00
config.py refac 2026-08-11 01:15:05 -06:00
constants.py refac 2026-07-27 19:39:36 -04:00
env.py fix: make the aiodns resolver opt-in and pin aiodns to 3.6.1 (#28242) 2026-08-10 19:52:29 -06:00
events.py refac 2026-08-10 23:13:10 -06:00
functions.py perf: build debug log messages lazily so disabled debug logs cost nothing (#27834) 2026-07-31 19:09:01 -05:00
main.py fix: apply custom model fallback before the base-model access check 2026-08-12 11:38:16 +00:00
tasks.py refac 2026-07-31 17:41:14 -04:00