mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-08 13:12:08 +00:00
test(prompt-size): cover resolved-toolset parity and blank-slate minimal count
Regression tests from PR #51586: the inspection agent must receive the platform-resolved enabled_toolsets and agent.disabled_toolsets, and a Blank Slate profile's prompt-size must count exactly the 6 file/terminal tool schemas.
This commit is contained in:
parent
fe8d02cec7
commit
21a012b6ac
1 changed files with 53 additions and 0 deletions
|
|
@ -1,11 +1,14 @@
|
|||
"""Tests for the ``hermes prompt-size`` diagnostic (issue #34667)."""
|
||||
|
||||
import json
|
||||
import sys
|
||||
from types import SimpleNamespace
|
||||
|
||||
import pytest
|
||||
|
||||
from hermes_cli.prompt_size import (
|
||||
_SKILLS_BLOCK_RE,
|
||||
_build_inspection_agent,
|
||||
compute_prompt_breakdown,
|
||||
render_breakdown,
|
||||
)
|
||||
|
|
@ -70,6 +73,56 @@ def test_runs_offline_without_credentials(isolated_home, monkeypatch):
|
|||
assert data["system_prompt"]["bytes"] > 0
|
||||
|
||||
|
||||
def test_inspection_agent_uses_resolved_platform_toolsets(monkeypatch):
|
||||
"""Inspection must match real CLI tool resolution, including disables."""
|
||||
captured = {}
|
||||
|
||||
class FakeAIAgent:
|
||||
def __init__(self, **kwargs):
|
||||
captured.update(kwargs)
|
||||
|
||||
cfg = {
|
||||
"model": {"default": "test/model"},
|
||||
"agent": {"disabled_toolsets": ["memory"]},
|
||||
}
|
||||
|
||||
monkeypatch.setitem(
|
||||
sys.modules,
|
||||
"run_agent",
|
||||
SimpleNamespace(AIAgent=FakeAIAgent),
|
||||
)
|
||||
monkeypatch.setattr("hermes_cli.config.load_config", lambda: cfg)
|
||||
monkeypatch.setattr(
|
||||
"hermes_cli.tools_config._get_platform_tools",
|
||||
lambda passed_cfg, platform: {"terminal", "file"},
|
||||
)
|
||||
|
||||
_build_inspection_agent("cli")
|
||||
|
||||
assert captured["model"] == "test/model"
|
||||
assert captured["platform"] == "cli"
|
||||
assert captured["enabled_toolsets"] == ["file", "terminal"]
|
||||
assert captured["disabled_toolsets"] == ["memory"]
|
||||
|
||||
|
||||
def test_blank_slate_prompt_size_counts_only_minimal_tools(isolated_home):
|
||||
"""Blank Slate prompt-size should report file + terminal schemas only."""
|
||||
from hermes_cli.config import save_config
|
||||
from hermes_cli.setup import (
|
||||
_blank_slate_minimal_toolsets,
|
||||
_blank_slate_minimize_config,
|
||||
)
|
||||
|
||||
cfg = {"model": {"default": "MiniMax-M2.7"}}
|
||||
_blank_slate_minimal_toolsets(cfg)
|
||||
_blank_slate_minimize_config(cfg)
|
||||
save_config(cfg)
|
||||
|
||||
data = compute_prompt_breakdown("cli")
|
||||
|
||||
assert data["tools"]["count"] == 6
|
||||
|
||||
|
||||
def test_skills_index_reflects_installed_skills(isolated_home):
|
||||
"""Installing a skill makes the skills-index block non-empty.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue