From 95bb9ebe66e1890ec9a7582a8efdf6ec44b06cd5 Mon Sep 17 00:00:00 2001 From: Rod Boev Date: Sat, 13 Jun 2026 14:26:48 -0400 Subject: [PATCH] Keep stale max configs on the supported path --- api/config.py | 14 +++++++------- tests/test_reasoning_effort_model_capabilities.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/config.py b/api/config.py index 32330ae9..6f3c2b75 100644 --- a/api/config.py +++ b/api/config.py @@ -2667,21 +2667,21 @@ def coerce_reasoning_effort_for_model( # both for models KNOWN not to support reasoning AND for models we simply # don't recognize (custom providers, aggregator-rewritten ids, brand-new # releases). Coercion exists to avoid sending a level a KNOWN-incompatible - # model rejects (e.g. openai-codex gpt-5 'max', o1/o3/o4 above 'high') — + # model rejects (e.g. openai-codex gpt-5 'max', o1/o3/o4 above 'high') - # those paths return a NON-empty clamped set, so the degrade ladder below # still applies. When the set is empty we can't tell "unsupported" from - # "unknown", so preserve the user's configured effort verbatim (the prior - # behavior) rather than silently disabling reasoning — the provider stays - # the final authority. Worst case is the same rejected request that master - # already produces, i.e. no regression. (#3505 review) + # "unknown", so preserve the user's configured effort verbatim where it is + # still valid. A stale 'max' value is no longer parser-valid on the WebUI + # side, so degrade that unknown-model case to xhigh instead of silently + # dropping reasoning later in parse_reasoning_effort(). (#3505 review) if not supported: - return "max" if accepts_max_as_xhigh else raw + return "xhigh" if accepts_max_as_xhigh else raw if raw in supported: return "xhigh" if accepts_max_as_xhigh else raw # Degrade to the closest *lower* supported level instead of silently # disabling reasoning. e.g. max -> xhigh -> high, or xhigh -> high when the # target model caps below the configured effort. Never escalate. - ladder = list(VALID_REASONING_EFFORTS) # ascending: minimal..max + ladder = list(VALID_REASONING_EFFORTS) # ascending: minimal..xhigh try: raw_idx = ladder.index(raw) except ValueError: diff --git a/tests/test_reasoning_effort_model_capabilities.py b/tests/test_reasoning_effort_model_capabilities.py index 88387ed0..0657aaa6 100644 --- a/tests/test_reasoning_effort_model_capabilities.py +++ b/tests/test_reasoning_effort_model_capabilities.py @@ -83,7 +83,7 @@ def test_coerce_preserves_effort_for_unrecognized_model(): "max", "brand-new-model-2099", provider_id="some-custom-provider", - ) == "max" + ) == "xhigh" # 'none' / unset still pass through unchanged for unknown models. assert cfg.coerce_reasoning_effort_for_model( "none", "some-unknown-model-xyz", provider_id="custom"