Implement the harness contract and prove it against rein-aharness (GLAS-WP-0001-T02/T03/T04)
All checks were successful
CI Smoke / host-smoke (push) Successful in 1s
CI Smoke / container-smoke (push) Successful in 3s

- src/glas_harness/contract.py: Rein ABC (start_session/dispatch_tool/
  end_session), SandboxHandle/ToolCall/ToolResult, per docs/harness-contract.md.
- reins/rein_aharness.py: adapter around the rein-aharness CLI. Collapses
  a whole `agent-harness run` into one dispatch_tool call for now (no
  per-tool hooks yet — tracked in rein-aharness HARNESS-WP-0002-T03);
  verifies success via new-commit detection, mirroring rein-aharness's
  own success signal.
- gateway.py + cli.py: resolves a sand-boxer sandbox, runs one task
  through a rein, tears the sandbox down.
- registry/reins/*.yaml (rein-aharness implemented, rein-openweights
  planned) and profiles/harness.agent-dev{,-local}.yaml, pairing with
  sand-boxer's profile.agent-dev and the new profile.bwrap-local.

Tested against a real local git repo + mocked SandboxManager/CLI
subprocess (10 tests, all passing). A real live run against the actual
Claude Code CLI is deliberately left for a human-triggered follow-up —
not executed autonomously since it spends real API credits/credentials.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
tegwick 2026-07-26 13:02:59 +02:00
parent 97a50fc780
commit 5681fce787
16 changed files with 556 additions and 4 deletions

42
src/glas_harness/cli.py Normal file
View file

@ -0,0 +1,42 @@
"""glas-harness CLI — minimal gateway invocation (GLAS-WP-0001-T04)."""
from __future__ import annotations
import argparse
import json
import sys
def main(argv: list[str] | None = None) -> int:
parser = argparse.ArgumentParser(prog="glas-harness")
sub = parser.add_subparsers(dest="command", required=True)
run = sub.add_parser("run", help="Run one task through a rein inside a sand-boxer sandbox")
run.add_argument("--sandbox-profile", required=True, help="e.g. profile.bwrap-local")
run.add_argument("--repo", required=True, help="Local repo path to mirror into the sandbox")
run.add_argument("--title", required=True)
run.add_argument("--description", required=True)
run.add_argument("--actor", default="agt")
run.add_argument("--project", default="glas-harness")
args = parser.parse_args(argv)
if args.command == "run":
from glas_harness.gateway import run_task_through_rein
result = run_task_through_rein(
sandbox_profile=args.sandbox_profile,
repo=args.repo,
title=args.title,
description=args.description,
actor=args.actor,
project=args.project,
)
print(json.dumps(result, indent=2))
return 0 if result["tool_ok"] else 1
return 1
if __name__ == "__main__":
sys.exit(main())