feat: integrate mock server with gitea-tools remote resolution and correct verdict parser

- Fix allowedTools options inside run_compliance to support prefixless and prefixed tool access
- Implement sys.executable resolution to allow compliance runner to run safely inside git worktrees
- Dynamically load GITEA_MCP_CONFIG JSON profiles inside gitea_auth.py to support 'mock' remote name
- Implement gitea_url helper inside gitea_auth.py to automatically handle HTTP and HTTPS scheme differences for localhost/loopback mock targets, preventing wrong SSL version errors
- Fix verdict.py escaping mismatch by normalizing stream-json block output structure before matching strings, allowing PR view decision points to be verified correctly

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
2026-07-05 04:12:13 -04:00
co-authored by Claude Opus 4.8
parent 0947f1ad8a
commit e80508313a
5 changed files with 104 additions and 12 deletions
+7 -1
View File
@@ -147,7 +147,7 @@ def _run_scenario(scenario, *, model, config_path, token, timeout=300):
mcp_config = {
"mcpServers": {
"gitea-tools": {
"command": str(_REPO_ROOT / "venv" / "bin" / "python3"),
"command": sys.executable,
"args": [str(_REPO_ROOT / "mcp_server.py")],
"env": {
"GITEA_MCP_CONFIG": str(config_path),
@@ -167,6 +167,7 @@ def _run_scenario(scenario, *, model, config_path, token, timeout=300):
"claude", "-p", scenario.prompt,
"--model", model,
"--max-turns", "30",
"--permission-mode", "bypassPermissions",
"--mcp-config", mcp_config_path,
"--allowedTools",
"ToolSearch,mcp__gitea-tools__*",
@@ -175,6 +176,11 @@ def _run_scenario(scenario, *, model, config_path, token, timeout=300):
],
capture_output=True, text=True, timeout=timeout,
)
with open(f"/tmp/claude_{scenario.name}_run.log", "w") as f:
f.write("STDOUT:\n")
f.write(result.stdout)
f.write("\nSTDERR:\n")
f.write(result.stderr)
return parse_stream_json(result.stdout)
finally:
os.unlink(mcp_config_path)