Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions tests/test_tui_gateway_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -10955,7 +10955,14 @@ def fake_resolve(**kwargs):
)
monkeypatch.setattr(
server,
"_load_fallback_model",
# _resolve_runtime_with_fallback consults the policy-filtered chain.
# _load_effective_fallback_model() only reaches the raw loader when
# the ambient fallback_policy is not "off" — on a host whose config
# sets "off" it short-circuits to [], this stub is never consulted,
# and the test fails for a reason that has nothing to do with it.
# Patch what the code calls so the case under test is the one that
# runs, on any host.
"_load_effective_fallback_model",
lambda: [
{
"provider": "deepseek",
Expand Down Expand Up @@ -11007,7 +11014,7 @@ def fake_resolve(**kwargs):
)
monkeypatch.setattr(
server,
"_load_fallback_model",
"_load_effective_fallback_model",
lambda: [
{"provider": "anthropic"},
{"provider": "openrouter", "model": "z-ai/glm-5.2"},
Expand Down Expand Up @@ -11044,7 +11051,7 @@ def fake_resolve(**kwargs):
)
monkeypatch.setattr(
server,
"_load_fallback_model",
"_load_effective_fallback_model",
lambda: [
{
"provider": "openrouter",
Expand Down Expand Up @@ -11072,9 +11079,13 @@ def fake_resolve(**kwargs):
)
monkeypatch.setattr(
server,
"_load_fallback_model",
"_load_effective_fallback_model",
lambda: [{"provider": "deepseek", "model": "deepseek-v4-pro"}],
)
# The exhaustion message names the active policy, which is read from
# ambient config. Pin it so this asserts the "any" wording it means to
# assert instead of whatever policy the host happens to have.
monkeypatch.setattr(server, "_load_cfg", lambda: {"fallback_policy": "any"})
import pytest

with pytest.raises(AuthError, match="No credentials for openai-codex") as exc_info:
Expand All @@ -11101,7 +11112,7 @@ def fake_resolve(**kwargs):
)
monkeypatch.setattr(
server,
"_load_fallback_model",
"_load_effective_fallback_model",
lambda: [
"invalid-string-entry",
{"provider": "anthropic", "model": "claude-sonnet-4-6"},
Expand Down
Loading