Root cause of persistent CI failure on `test_custom_endpoint_uses_model_config_api_key_for_model_discovery`:
The helper `_available_models_with_full_cfg` and the failing test itself both do:
```python
try:
_cfg._cfg_mtime = stat().st_mtime
except Exception:
pass # ← leaves _cfg_mtime at stale value from a prior test
```
On CI (no `~/.hermes/config.yaml`), `stat()` raises `OSError`. `get_available_models()` then sees `_current_mtime=0.0 != _cfg_mtime=<stale from prior test>`, calls `reload_config()`, overwrites the test's in-memory `cfg`, `api_key` disappears, `urlopen` is never called, `captured['auth']` raises `KeyError`.
**Fix:** The `except` clause now sets `_cfg._cfg_mtime = 0.0` (matching what `get_available_models()` will see when `stat()` also fails), so the reload guard becomes a no-op and the test's `cfg` mutation survives. Same pattern already used correctly in `test_custom_provider_display_name.py` and `test_ttl_cache.py`.
Verified with `HERMES_CONFIG_PATH=/tmp/nonexistent` to reproduce the CI no-config condition locally. 1747/1747 full suite.
20 KiB
20 KiB