refactor: remove mini-swe-agent dependency — inline Docker/Modal backends (#2804)
Drop the mini-swe-agent git submodule. All terminal backends now use hermes-agent's own environment implementations directly. Docker backend: - Inline the `docker run -d` container startup (was 15 lines in minisweagent's DockerEnvironment). Our wrapper already handled execute(), cleanup(), security hardening, volumes, and resource limits. Modal backend: - Import swe-rex's ModalDeployment directly instead of going through minisweagent's 90-line passthrough wrapper. - Bake the _AsyncWorker pattern (from environments/patches.py) directly into ModalEnvironment for Atropos compatibility without monkey-patching. Cleanup: - Remove minisweagent_path.py (submodule path resolution helper) - Remove submodule init/install from install.sh and setup-hermes.sh - Remove mini-swe-agent from .gitmodules - environments/patches.py is now a no-op (kept for backward compat) - terminal_tool.py no longer does sys.path hacking for minisweagent - mini_swe_runner.py guards imports (optional, for RL training only) - Update all affected tests to mock the new direct subprocess calls - Update README.md, CONTRIBUTING.md No functionality change — all Docker, Modal, local, SSH, Singularity, and Daytona backends behave identically. 6093 tests pass.
This commit is contained in:
@@ -42,11 +42,13 @@ from dotenv import load_dotenv
|
||||
# Load environment variables
|
||||
load_dotenv()
|
||||
|
||||
# Add mini-swe-agent to path if not installed. In git worktrees the populated
|
||||
# submodule may live in the main checkout rather than the worktree itself.
|
||||
from minisweagent_path import ensure_minisweagent_on_path
|
||||
|
||||
ensure_minisweagent_on_path(Path(__file__).resolve().parent)
|
||||
# mini-swe-agent is an optional dependency for this runner.
|
||||
# Install separately: git submodule update --init mini-swe-agent && pip install -e ./mini-swe-agent
|
||||
try:
|
||||
import minisweagent # noqa: F401
|
||||
_HAS_MINISWEAGENT = True
|
||||
except ImportError:
|
||||
_HAS_MINISWEAGENT = False
|
||||
|
||||
|
||||
# ============================================================================
|
||||
@@ -110,7 +112,10 @@ def create_environment(
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
Create an execution environment from mini-swe-agent.
|
||||
Create an execution environment.
|
||||
|
||||
Uses mini-swe-agent environments when available, which requires the
|
||||
mini-swe-agent submodule to be installed separately.
|
||||
|
||||
Args:
|
||||
env_type: One of "local", "docker", "modal"
|
||||
@@ -122,6 +127,12 @@ def create_environment(
|
||||
Returns:
|
||||
Environment instance with execute() method
|
||||
"""
|
||||
if not _HAS_MINISWEAGENT:
|
||||
raise ImportError(
|
||||
"mini-swe-agent is required for mini_swe_runner.py. "
|
||||
"Install it: git submodule update --init mini-swe-agent && pip install -e ./mini-swe-agent"
|
||||
)
|
||||
|
||||
if env_type == "local":
|
||||
from minisweagent.environments.local import LocalEnvironment
|
||||
return LocalEnvironment(cwd=cwd, timeout=timeout)
|
||||
|
||||
Reference in New Issue
Block a user