Files
hermes-agent/tests/tools/test_terminal_tool_requirements.py
teknium1 df7a86f041 fix: restore terminal and file tools in worktrees
Root cause: terminal availability checks still imported minisweagent for the
local backend even though local/singularity now use Hermes wrappers directly.
In git worktrees, the local submodule path may also be an empty placeholder,
so direct path insertion could miss the populated mini-swe-agent checkout.

This change:
- adds a helper to discover mini-swe-agent from the current checkout or the
  main checkout behind a worktree
- uses that helper in terminal_tool and mini_swe_runner
- stops requiring minisweagent for the local backend requirements check
- adds regression tests and validates terminal/file tool resolution again
2026-03-13 23:05:49 -07:00

29 lines
1.0 KiB
Python

"""Tests for terminal/file tool availability in local dev environments."""
import importlib
from model_tools import get_tool_definitions
terminal_tool_module = importlib.import_module("tools.terminal_tool")
class TestTerminalRequirements:
def test_local_backend_does_not_require_minisweagent_package(self, monkeypatch):
monkeypatch.setattr(
terminal_tool_module,
"_get_env_config",
lambda: {"env_type": "local"},
)
assert terminal_tool_module.check_terminal_requirements() is True
def test_terminal_and_file_tools_resolve_for_local_backend(self, monkeypatch):
monkeypatch.setattr(
terminal_tool_module,
"_get_env_config",
lambda: {"env_type": "local"},
)
tools = get_tool_definitions(enabled_toolsets=["terminal", "file"], quiet_mode=True)
names = {tool["function"]["name"] for tool in tools}
assert "terminal" in names
assert {"read_file", "write_file", "patch", "search_files"}.issubset(names)