From a055d5184855702980ba7080f1bf66a56e4c49d0 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Fri, 14 Aug 2026 01:55:48 -0700 Subject: [PATCH] fix(tests): resolve cost-guard fixture collision between pricing distrust and gpt-5.5-pro confusion nudge 54cc39aa15 (distrust foreign pricing for custom providers) tested with openai/gpt-5.5-pro fixtures; 83d373aae6 (salvaged #70324) made that exact id warn unconditionally as a known-confusion model. Each was green alone; together the distrust tests fail on every main run (slice 6). Use a neutral fixture id for the distrust tests and add a regression test pinning the composed behavior: the id-keyed nudge survives custom-provider pricing distrust. --- tests/hermes_cli/test_model_cost_guard.py | 25 +++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/tests/hermes_cli/test_model_cost_guard.py b/tests/hermes_cli/test_model_cost_guard.py index c346f2ef7f21..aeb3b3cd141e 100644 --- a/tests/hermes_cli/test_model_cost_guard.py +++ b/tests/hermes_cli/test_model_cost_guard.py @@ -44,9 +44,13 @@ def test_warns_when_models_dev_input_price_exceeds_threshold(): @pytest.mark.parametrize("provider", ["custom", "custom:routerai", "routerai"]) def test_skips_foreign_models_dev_pricing_for_custom_or_unknown_providers(provider): + # NOTE: deliberately NOT openai/gpt-5.5-pro — that id carries an + # unconditional known-confusion warning (GPT55_PRO_OPENROUTER_ID) that is + # id-keyed and independent of pricing trust, so it would mask what this + # test asserts (foreign models.dev pricing being distrusted). info = ModelInfo( - id="openai/gpt-5.5-pro", - name="openai/gpt-5.5-pro", + id="vendor/priced-model", + name="vendor/priced-model", family="", provider_id="openrouter", cost_input=25.0, @@ -55,7 +59,7 @@ def test_skips_foreign_models_dev_pricing_for_custom_or_unknown_providers(provid assert ( expensive_model_warning( - "openai/gpt-5.5-pro", + "vendor/priced-model", provider=provider, model_info=info, ) @@ -78,7 +82,7 @@ def fake_get_pricing_entry(*_args, **_kwargs): monkeypatch.setattr("agent.usage_pricing.get_pricing_entry", fake_get_pricing_entry) warning = expensive_model_warning( - "openai/gpt-5.5-pro", + "vendor/priced-model", provider="custom:routerai", base_url="https://routerai.example/v1", ) @@ -87,6 +91,19 @@ def fake_get_pricing_entry(*_args, **_kwargs): assert pricing_calls == [] +def test_known_confusing_model_still_warns_on_custom_provider(): + """The gpt-5.5-pro confusion nudge is id-keyed, not pricing-keyed: it must + survive the custom-provider pricing distrust (54cc39aa15 x 83d373aae6).""" + warning = expensive_model_warning( + "openai/gpt-5.5-pro", + provider="custom:routerai", + base_url="https://routerai.example/v1", + ) + + assert warning is not None + assert "did you mean to select openai/gpt-5.5?" in warning.message + + def test_warns_when_pricing_entry_output_price_exceeds_threshold(monkeypatch): monkeypatch.setattr("agent.models_dev.get_model_info", lambda *_args, **_kwargs: None) monkeypatch.setattr(