fix(doctor): treat configured honcho as available
Doctor-only override so honcho shows as available when configured, even outside a live agent session. Runtime tool gate unchanged. Cherry-picked from PR #962 by PeterFile, rebased onto current main (post-#736 merge) with conflict resolution. Fixes #961 Co-authored-by: PeterFile <PeterFile@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
"""Tests for hermes doctor helpers."""
|
||||
|
||||
from types import SimpleNamespace
|
||||
|
||||
import hermes_cli.doctor as doctor
|
||||
from hermes_cli.doctor import _has_provider_env_config
|
||||
|
||||
|
||||
@@ -15,3 +18,50 @@ class TestProviderEnvDetection:
|
||||
def test_returns_false_when_no_provider_settings(self):
|
||||
content = "TERMINAL_ENV=local\n"
|
||||
assert not _has_provider_env_config(content)
|
||||
|
||||
|
||||
class TestDoctorToolAvailabilityOverrides:
|
||||
def test_marks_honcho_available_when_configured(self, monkeypatch):
|
||||
monkeypatch.setattr(doctor, "_honcho_is_configured_for_doctor", lambda: True)
|
||||
|
||||
available, unavailable = doctor._apply_doctor_tool_availability_overrides(
|
||||
[],
|
||||
[{"name": "honcho", "env_vars": [], "tools": ["query_user_context"]}],
|
||||
)
|
||||
|
||||
assert available == ["honcho"]
|
||||
assert unavailable == []
|
||||
|
||||
def test_leaves_honcho_unavailable_when_not_configured(self, monkeypatch):
|
||||
monkeypatch.setattr(doctor, "_honcho_is_configured_for_doctor", lambda: False)
|
||||
|
||||
honcho_entry = {"name": "honcho", "env_vars": [], "tools": ["query_user_context"]}
|
||||
available, unavailable = doctor._apply_doctor_tool_availability_overrides(
|
||||
[],
|
||||
[honcho_entry],
|
||||
)
|
||||
|
||||
assert available == []
|
||||
assert unavailable == [honcho_entry]
|
||||
|
||||
|
||||
class TestHonchoDoctorConfigDetection:
|
||||
def test_reports_configured_when_enabled_with_api_key(self, monkeypatch):
|
||||
fake_config = SimpleNamespace(enabled=True, api_key="honcho-test-key")
|
||||
|
||||
monkeypatch.setattr(
|
||||
"honcho_integration.client.HonchoClientConfig.from_global_config",
|
||||
lambda: fake_config,
|
||||
)
|
||||
|
||||
assert doctor._honcho_is_configured_for_doctor()
|
||||
|
||||
def test_reports_not_configured_without_api_key(self, monkeypatch):
|
||||
fake_config = SimpleNamespace(enabled=True, api_key=None)
|
||||
|
||||
monkeypatch.setattr(
|
||||
"honcho_integration.client.HonchoClientConfig.from_global_config",
|
||||
lambda: fake_config,
|
||||
)
|
||||
|
||||
assert not doctor._honcho_is_configured_for_doctor()
|
||||
|
||||
Reference in New Issue
Block a user