feat: add versioned execution profiles
This commit is contained in:
parent
641e85f5a8
commit
1cd890d871
34 changed files with 2087 additions and 471 deletions
|
|
@ -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_openweights import ReinOpenWeights, ReinOpenWeightsNotInstalled
|
||||
|
||||
|
||||
|
|
@ -27,7 +28,7 @@ def test_start_session_writes_task_file_and_captures_head(tmp_path) -> None:
|
|||
rein = ReinOpenWeights()
|
||||
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-openweights-local@1.0.0")[0],
|
||||
inputs={"title": "t", "description": "d"},
|
||||
sandbox=sandbox,
|
||||
)
|
||||
|
|
@ -63,7 +64,12 @@ def test_dispatch_tool_invokes_rein_openweights_cli() -> None:
|
|||
|
||||
|
||||
def test_dispatch_tool_passes_model_when_set() -> None:
|
||||
rein = ReinOpenWeights(model="meta-llama/llama-3.1-70b-instruct")
|
||||
rein = ReinOpenWeights(
|
||||
model="meta-llama/llama-3.1-70b-instruct",
|
||||
max_turns=8,
|
||||
budget_tokens=1234,
|
||||
tool_profile="green-commit-only",
|
||||
)
|
||||
session = {"task_file": "/tmp/task.json"}
|
||||
fake_result = MagicMock(returncode=0, stdout="ok", stderr="")
|
||||
|
||||
|
|
@ -74,6 +80,9 @@ def test_dispatch_tool_passes_model_when_set() -> None:
|
|||
argv = run.call_args.args[0]
|
||||
assert "--model" in argv
|
||||
assert "meta-llama/llama-3.1-70b-instruct" in argv
|
||||
assert argv[argv.index("--max-turns") + 1] == "8"
|
||||
assert argv[argv.index("--budget-tokens") + 1] == "1234"
|
||||
assert argv[argv.index("--tool-profile") + 1] == "green-commit-only"
|
||||
|
||||
|
||||
def test_dispatch_tool_reports_failure() -> None:
|
||||
|
|
@ -102,5 +111,6 @@ 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue