diff --git a/hermes_cli/doctor.py b/hermes_cli/doctor.py index cba4ebcdd3..e2eb598ae6 100644 --- a/hermes_cli/doctor.py +++ b/hermes_cli/doctor.py @@ -320,7 +320,11 @@ def run_doctor(args): known_providers.add("custom:" + name.lower().replace(" ", "-")) canonical_provider = provider - if provider and _resolve_provider_full is not None and provider != "auto": + if ( + provider + and _resolve_provider_full is not None + and provider not in ("auto", "custom") + ): provider_def = _resolve_provider_full(provider, user_providers, custom_providers) canonical_provider = provider_def.id if provider_def is not None else None diff --git a/tests/hermes_cli/test_doctor.py b/tests/hermes_cli/test_doctor.py index 37cad85164..ee673035fc 100644 --- a/tests/hermes_cli/test_doctor.py +++ b/tests/hermes_cli/test_doctor.py @@ -308,6 +308,43 @@ def test_run_doctor_accepts_named_provider_from_providers_section(monkeypatch, t assert "model.provider 'volcengine-plan' is not a recognised provider" not in out +def test_run_doctor_accepts_bare_custom_provider(monkeypatch, tmp_path): + home = tmp_path / ".hermes" + home.mkdir(parents=True, exist_ok=True) + (home / "config.yaml").write_text( + "model:\n" + " provider: custom\n" + " default: local-model\n" + " base_url: http://localhost:8000/v1\n", + encoding="utf-8", + ) + + monkeypatch.setattr(doctor_mod, "HERMES_HOME", home) + monkeypatch.setattr(doctor_mod, "PROJECT_ROOT", tmp_path / "project") + monkeypatch.setattr(doctor_mod, "_DHH", str(home)) + (tmp_path / "project").mkdir(exist_ok=True) + + fake_model_tools = types.SimpleNamespace( + check_tool_availability=lambda *a, **kw: ([], []), + TOOLSET_REQUIREMENTS={}, + ) + monkeypatch.setitem(sys.modules, "model_tools", fake_model_tools) + + try: + from hermes_cli import auth as _auth_mod + monkeypatch.setattr(_auth_mod, "get_nous_auth_status", lambda: {}) + monkeypatch.setattr(_auth_mod, "get_codex_auth_status", lambda: {}) + except Exception: + pass + + buf = io.StringIO() + with contextlib.redirect_stdout(buf): + doctor_mod.run_doctor(Namespace(fix=False)) + + out = buf.getvalue() + assert "model.provider 'custom' is not a recognised provider" not in out + + def test_run_doctor_termux_does_not_mark_browser_available_without_agent_browser(monkeypatch, tmp_path): home = tmp_path / ".hermes" home.mkdir(parents=True, exist_ok=True)