mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
Systematic prune per AGENTS.md test policy, one pass over every major test tree (gateway, hermes_cli, tools, agent, run_agent, plugins, cli, cron, tui_gateway, honcho/openviking, root-level): - DELETE: source-reading tests (read_text/getsource on prod files), change-detector tests (exact catalog counts, model-name snapshots, config version literals), mock-echo tests (assert a mock returns what it was told), assertion-free/trivial tests, near-duplicate parametrizations (boundaries + one representative kept), async/sync twin duplicates, cosmetic within-file variations. - KEEP (mandatory): security/redaction/approval guards, message-role alternation invariants, prompt-caching/deterministic-call-id invariants, issue-number regression tests (deduped), E2E tests. - 6 test files deleted outright (script-style/no-assert or fully redundant); conftest.py, fakes/, fixtures/ untouched. - tests/acp/conftest.py added: autouse fixture stubs the live models.dev/GitHub/Copilot/Anthropic inventory fetches that ACP server tests performed on every session create — test_server.py 147s → 3.4s, and the tests are now genuinely hermetic. - Sleep-based slowness shrunk where safe (codex_ttfb_watchdog, compression_concurrent_fork, etc.); no wall-clock assertion tightened. Verification: full hermetic suite via scripts/run_tests.sh — 2439 files, 31,130 tests passed, 0 failed, 0 flaky retries, 315s wall (baseline: 583s wall, 13,564s subprocess CPU).
57 lines
2.3 KiB
Python
57 lines
2.3 KiB
Python
"""Tests for honcho_profile's empty-card hint (#5137 follow-up)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
from unittest.mock import MagicMock
|
|
|
|
from plugins.memory.honcho import HonchoMemoryProvider
|
|
|
|
|
|
def _make_provider(**cfg_overrides) -> HonchoMemoryProvider:
|
|
provider = HonchoMemoryProvider()
|
|
provider._manager = MagicMock()
|
|
provider._manager.get_peer_card.return_value = [] # empty card
|
|
provider._session_key = "agent:main:test"
|
|
provider._session_initialized = True # bypass the lazy _ensure_session() gate
|
|
provider._cron_skipped = False
|
|
|
|
cfg = MagicMock()
|
|
# Defaults match HonchoClientConfig defaults
|
|
cfg.user_observe_me = cfg_overrides.get("user_observe_me", True)
|
|
cfg.user_observe_others = cfg_overrides.get("user_observe_others", True)
|
|
cfg.ai_observe_me = cfg_overrides.get("ai_observe_me", True)
|
|
cfg.ai_observe_others = cfg_overrides.get("ai_observe_others", True)
|
|
cfg.message_max_chars = 25000
|
|
provider._config = cfg
|
|
|
|
provider._dialectic_cadence = cfg_overrides.get("dialectic_cadence", 1)
|
|
provider._turn_count = cfg_overrides.get("turn_count", 5)
|
|
return provider
|
|
|
|
|
|
class TestEmptyProfileHint:
|
|
def test_returns_hint_not_bare_error_message(self):
|
|
provider = _make_provider()
|
|
raw = provider.handle_tool_call("honcho_profile", {})
|
|
payload = json.loads(raw)
|
|
assert payload["result"] == "No profile facts available yet."
|
|
assert "hint" in payload
|
|
assert "not an error" in payload["hint"].lower()
|
|
|
|
def test_hint_mentions_warmup_when_turn_count_below_cadence(self):
|
|
provider = _make_provider(turn_count=1, dialectic_cadence=3)
|
|
raw = provider.handle_tool_call("honcho_profile", {})
|
|
payload = json.loads(raw)
|
|
assert "turn" in payload["hint"].lower()
|
|
assert "cadence" in payload["hint"].lower()
|
|
|
|
|
|
def test_populated_card_returns_card_without_hint(self):
|
|
"""Regression: a populated card should NOT trigger the hint path."""
|
|
provider = _make_provider()
|
|
provider._manager.get_peer_card.return_value = ["Fact 1", "Fact 2"]
|
|
raw = provider.handle_tool_call("honcho_profile", {})
|
|
payload = json.loads(raw)
|
|
assert payload["result"] == ["Fact 1", "Fact 2"]
|
|
assert "hint" not in payload
|