Skip to content

The agent that grows with you

fix(models): azure-foundry disk-cache fingerprint tracks model.base_url

teknium19a403e52f4c2
diff --git a/hermes_cli/models.py b/hermes_cli/models.py
index 4095cd0a388..62223804356 100644
--- a/hermes_cli/models.py
+++ b/hermes_cli/models.py
@@ -1643,6 +1643,15 @@ def _credential_fingerprint(provider: str) -> str:
except Exception:
pass
+ # Azure Foundry deployments are per-resource and the wizard writes only model.base_url, so a
+ # resource switch under the same key must not serve the previous resource's catalog (#27989).
+ if provider == "azure-foundry":
+ try:
+ from hermes_cli.runtime_provider import _config_base_url_for_provider
+ parts.append(f"effective_base={_config_base_url_for_provider(_get_model_config_dict(), 'azure-foundry')}")
+ except Exception:
+ pass
+
if provider == "ollama":
provider_cfg = _get_provider_config_dict("ollama")
key_env = provider_cfg.get("key_env") or provider_cfg.get("api_key_env") or ""
diff --git a/tests/hermes_cli/test_models.py b/tests/hermes_cli/test_models.py
index 4f890945ac1..de8a592ff64 100644
--- a/tests/hermes_cli/test_models.py
+++ b/tests/hermes_cli/test_models.py
@@ -1607,3 +1607,15 @@ class TestAzureFoundryPickerCatalog:
monkeypatch.setattr("hermes_cli.runtime_provider._resolve_azure_foundry_runtime", raising)
assert _models_mod.provider_model_ids("azure-foundry", force_refresh=True) == []
+
+ def test_disk_cache_fingerprint_tracks_the_configured_resource(self, monkeypatch):
+ """The wizard writes only ``model.base_url``; switching resource with the same key must not
+ serve the previous resource's catalog for the TTL window (same rule as openai's effective_base)."""
+ monkeypatch.delenv("AZURE_FOUNDRY_API_KEY", raising=False)
+ monkeypatch.delenv("AZURE_FOUNDRY_BASE_URL", raising=False)
+ monkeypatch.setattr(_models_mod, "_get_model_config_dict",
+ lambda: {"provider": "azure-foundry", "base_url": "https://a.openai.azure.com/openai/v1"})
+ fp_a = _models_mod._credential_fingerprint("azure-foundry")
+ monkeypatch.setattr(_models_mod, "_get_model_config_dict",
+ lambda: {"provider": "azure-foundry", "base_url": "https://b.openai.azure.com/openai/v1"})
+ assert _models_mod._credential_fingerprint("azure-foundry") != fp_a