feat: add versioned execution profiles
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s

This commit is contained in:
tegwick 2026-08-21 00:21:53 +02:00
parent 641e85f5a8
commit 1cd890d871
34 changed files with 2087 additions and 471 deletions

View file

@ -5,6 +5,7 @@ from unittest.mock import MagicMock, patch
import pytest
from glas_harness.contract import Rein, SandboxHandle, ToolCall
from glas_harness.profiles import ProfileCatalog
from glas_harness.reins.rein_aharness import ReinAharness, ReinAharnessNotInstalled
@ -27,7 +28,7 @@ def test_start_session_writes_task_file_and_captures_head(tmp_path) -> None:
rein = ReinAharness()
sandbox = SandboxHandle(sandbox_id="abc", host="localhost", reachability={"workspace_dir": str(repo)})
session = rein.start_session(
profile={"id": "harness.agent-dev-local"},
profile=ProfileCatalog().resolve("harness.agent-dev-local@1.0.0")[0],
inputs={"title": "t", "description": "d"},
sandbox=sandbox,
)
@ -47,7 +48,11 @@ def test_start_session_requires_resolvable_target_repo() -> None:
def test_dispatch_tool_invokes_agent_harness_cli() -> None:
rein = ReinAharness()
rein = ReinAharness(
model="claude-sonnet-4-6",
tool_profile="green-commit-only",
budget_tokens=1234,
)
session = {"task_file": "/tmp/task.json"}
fake_result = MagicMock(returncode=0, stdout="ok", stderr="")
@ -57,6 +62,9 @@ def test_dispatch_tool_invokes_agent_harness_cli() -> None:
argv = run.call_args.args[0]
assert argv[:3] == ["/usr/bin/agent-harness", "run", "--task-file"]
assert argv[argv.index("--model") + 1] == "claude-sonnet-4-6"
assert argv[argv.index("--tool-profile") + 1] == "green-commit-only"
assert argv[argv.index("--budget-tokens") + 1] == "1234"
assert result.ok is True
assert result.output == "ok"
@ -88,8 +96,9 @@ def test_end_session_detects_new_commit(tmp_path) -> None:
subprocess.run(["git", "commit", "-q", "--allow-empty", "-m", "task"], cwd=repo, check=True)
summary = rein.end_session({"target_repo": str(repo), "head_before": head_before})
assert summary["committed"] == "True"
assert summary["commit_sha"] != head_before
assert summary.committed is True
assert summary.outcome == "succeeded"
assert summary.commit_sha != head_before
def test_end_session_no_new_commit(tmp_path) -> None:
@ -104,7 +113,8 @@ def test_end_session_no_new_commit(tmp_path) -> None:
head = git_head(str(repo))
summary = rein.end_session({"target_repo": str(repo), "head_before": head})
assert summary["committed"] == "False"
assert summary.committed is False
assert summary.outcome == "failed"
def test_dispatch_tool_streams_events_when_enabled() -> None: