mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
One source fix (web_server category merge) + five test updates that
didn't travel with their feature PRs. All 13 failures on the 04-19
CI run on main are now accounted for (5 already self-healed on main;
8 fixed here).
Changes
- web_server.py: add code_execution → agent to _CATEGORY_MERGE (new
singleton section from #11971 broke no-single-field-category invariant).
- test_browser_camofox_state: bump hardcoded _config_version 18 → 19
(also from #11971).
- test_registry: add browser_cdp_tool (#12369) and discord_tool (#4753)
to the expected built-in tool set.
- test_run_agent::test_tool_call_accumulation: rewrite fragment chunks
— #0f778f77 switched streaming name-accumulation from += to = to
fix MiniMax/NIM duplication; the test still encoded the old
fragment-per-chunk premise.
- test_concurrent_interrupt::_Stub: no-op
_apply_pending_steer_to_tool_results — #12116 added this call after
concurrent tool batches; the hand-rolled stub was missing it.
- test_codex_cli_model_picker: drop the two obsolete tests that
asserted auto-import from ~/.codex/auth.json into the Hermes auth
store. #12360 explicitly removed that behavior (refresh-token reuse
races with Codex CLI / VS Code); adoption is now explicit via
`hermes auth openai-codex`. Remaining 3 tests in the file (normal
path, Claude Code fallback, negative case) still cover the picker.
Validation
- scripts/run_tests.sh across all 6 affected files + surrounding tests
(54 tests total) all green locally.
67 lines
2.6 KiB
Python
67 lines
2.6 KiB
Python
"""Tests for Hermes-managed Camofox state helpers."""
|
|
|
|
from unittest.mock import patch
|
|
|
|
import pytest
|
|
|
|
|
|
def _load_module():
|
|
from tools import browser_camofox_state as state
|
|
return state
|
|
|
|
|
|
class TestCamofoxStatePaths:
|
|
def test_paths_are_profile_scoped(self, tmp_path):
|
|
state = _load_module()
|
|
with patch.object(state, "get_hermes_home", return_value=tmp_path):
|
|
assert state.get_camofox_state_dir() == tmp_path / "browser_auth" / "camofox"
|
|
|
|
|
|
class TestCamofoxIdentity:
|
|
def test_identity_is_deterministic(self, tmp_path):
|
|
state = _load_module()
|
|
with patch.object(state, "get_hermes_home", return_value=tmp_path):
|
|
first = state.get_camofox_identity("task-1")
|
|
second = state.get_camofox_identity("task-1")
|
|
assert first == second
|
|
|
|
def test_identity_differs_by_task(self, tmp_path):
|
|
state = _load_module()
|
|
with patch.object(state, "get_hermes_home", return_value=tmp_path):
|
|
a = state.get_camofox_identity("task-a")
|
|
b = state.get_camofox_identity("task-b")
|
|
# Same user (same profile), different session keys
|
|
assert a["user_id"] == b["user_id"]
|
|
assert a["session_key"] != b["session_key"]
|
|
|
|
def test_identity_differs_by_profile(self, tmp_path):
|
|
state = _load_module()
|
|
with patch.object(state, "get_hermes_home", return_value=tmp_path / "profile-a"):
|
|
a = state.get_camofox_identity("task-1")
|
|
with patch.object(state, "get_hermes_home", return_value=tmp_path / "profile-b"):
|
|
b = state.get_camofox_identity("task-1")
|
|
assert a["user_id"] != b["user_id"]
|
|
|
|
def test_default_task_id(self, tmp_path):
|
|
state = _load_module()
|
|
with patch.object(state, "get_hermes_home", return_value=tmp_path):
|
|
identity = state.get_camofox_identity()
|
|
assert "user_id" in identity
|
|
assert "session_key" in identity
|
|
assert identity["user_id"].startswith("hermes_")
|
|
assert identity["session_key"].startswith("task_")
|
|
|
|
|
|
class TestCamofoxConfigDefaults:
|
|
def test_default_config_includes_managed_persistence_toggle(self):
|
|
from hermes_cli.config import DEFAULT_CONFIG
|
|
|
|
browser_cfg = DEFAULT_CONFIG["browser"]
|
|
assert browser_cfg["camofox"]["managed_persistence"] is False
|
|
|
|
def test_config_version_matches_current_schema(self):
|
|
from hermes_cli.config import DEFAULT_CONFIG
|
|
|
|
# The current schema version is tracked globally; unrelated default
|
|
# options may bump it after browser defaults are added.
|
|
assert DEFAULT_CONFIG["_config_version"] == 19
|