fix(lite): keep REASONING_EFFORT_STRENGTH_ORDER importable from router_utils and skip the Codex sync on undecodable debug models output

This commit is contained in:
mateo-berri 2026-10-29 16:24:36 -07:00
parent 62e21014b5
commit 0db4944d0f
3 changed files with 10 additions and 4 deletions

View file

@ -828,7 +828,7 @@ def _codex_debug_models(
encoding="utf-8",
timeout=_CODEX_PREFLIGHT_TIMEOUT_SECONDS,
)
except (OSError, subprocess.TimeoutExpired) as e:
except (OSError, subprocess.TimeoutExpired, UnicodeError) as e:
return ModelSyncSkipped(f"`{name} debug models` failed: {e}")
if completed.returncode == 0:
return completed.stdout

View file

@ -34,7 +34,7 @@ from litellm._logging import verbose_logger
from litellm.litellm_core_utils.core_helpers import as_str_mapping
from litellm.litellm_core_utils.get_supported_openai_params import get_supported_openai_params
from litellm.litellm_core_utils.reasoning_effort_strength import (
REASONING_EFFORT_STRENGTH_RANK,
REASONING_EFFORT_STRENGTH_ORDER,
ReasoningEffortRounding,
nearest_declared_reasoning_effort,
)
@ -136,7 +136,7 @@ def deployment_reasoning_effort_levels(deployment_model_info: object) -> tuple[s
def deployment_rounds_reasoning_effort(deployment_model_info: object) -> bool:
declared: Final = deployment_reasoning_effort_levels(deployment_model_info)
return declared is not None and any(level in REASONING_EFFORT_STRENGTH_RANK for level in declared)
return declared is not None and any(level in REASONING_EFFORT_STRENGTH_ORDER for level in declared)
def with_adaptive_thinking_as_effort(

View file

@ -1271,7 +1271,13 @@ class TestCodexModelSync:
assert result.reason == "`codex debug models` exited 1: no output"
@pytest.mark.parametrize(
"error", [OSError("codex vanished"), subprocess.TimeoutExpired("codex", 10)], ids=["oserror", "timeout"]
"error",
[
OSError("codex vanished"),
subprocess.TimeoutExpired("codex", 10),
UnicodeDecodeError("utf-8", b"\xff", 0, 1, "invalid start byte"),
],
ids=["oserror", "timeout", "undecodable"],
)
def test_unrunnable_preflight_is_reported_not_raised(self, tmp_path, error):
def failing_run(*a, **k):