Answer architecture round 2: 1 🔴, 5 🟡; return a gone checkout's git failure as a value, derive a round's seconds from its stamp, let claude_reply own the flags it parses, test the uncovered paths, warn to sandbox the replay, decline injecting the shell's filesystem
This commit is contained in:
@@ -102,7 +102,8 @@ def chunk_rounds(checkout: str, chunk: pathlib.Path) -> list[Round]:
|
||||
return []
|
||||
found = []
|
||||
for meta in sorted(chunk.glob("session/*/subagents/*.meta.json")):
|
||||
if json.loads(meta.read_text(encoding="utf-8")).get("agentType") != REVIEWER:
|
||||
described = json.loads(meta.read_text(encoding="utf-8"))
|
||||
if not isinstance(described, dict) or described.get("agentType") != REVIEWER:
|
||||
continue
|
||||
entries = read_transcript(str(meta.with_name(meta.name.removesuffix(".meta.json") + ".jsonl")))
|
||||
if not isinstance(entries, Failure) and (one := round_from(checkout, stamp_seconds(began["timestamp"]), entries)):
|
||||
@@ -150,6 +151,7 @@ def findings_found(found: Round, code: Code, rung: Rung, anchor: Rung, effects:
|
||||
return matched
|
||||
|
||||
|
||||
# The shell: it makes and removes the clone itself, and the tests run it on a temporary home, as judge-replay's do; rounds.py's core takes the filesystem as an argument.
|
||||
def review(found: Round, code: Code, rung: Rung, effects: Effects) -> str | Failure | Limited:
|
||||
clone = tempfile.mkdtemp(prefix="stability-replay-")
|
||||
try:
|
||||
@@ -161,7 +163,7 @@ def review(found: Round, code: Code, rung: Rung, effects: Effects) -> str | Fail
|
||||
):
|
||||
if isinstance(ran := git(effects, found.root, *command), Failure):
|
||||
return ran
|
||||
args = ["-p", "--agent", REVIEWER, *rung.flags(), "--no-session-persistence", "--output-format", "json", "--permission-mode", "bypassPermissions"]
|
||||
args = ["--agent", REVIEWER, *rung.flags()]
|
||||
reply = claude_reply(effects.claude, args, clone, found.prompt.replace(code.path, clone), "claude")
|
||||
if isinstance(reply, Failure | Limited):
|
||||
return reply
|
||||
@@ -178,7 +180,7 @@ def match(findings: tuple[str, ...], replay_report: str, root: str, rung: Rung,
|
||||
"A finding it raises only as 🟢 or ❓, or not at all, is not listed.\n\n"
|
||||
f"The findings:\n{numbered}\n\nThe other report:\n{replay_report}"
|
||||
)
|
||||
args = ["-p", "--json-schema", json.dumps(MATCH_SCHEMA), *rung.flags(), "--no-session-persistence", "--output-format", "json", "--permission-mode", "bypassPermissions", "--tools", ""]
|
||||
args = ["--json-schema", json.dumps(MATCH_SCHEMA), *rung.flags(), "--tools", ""]
|
||||
reply = claude_reply(effects.claude, args, root, prompt, "claude")
|
||||
if isinstance(reply, Failure | Limited):
|
||||
return reply
|
||||
@@ -190,5 +192,8 @@ def match(findings: tuple[str, ...], replay_report: str, root: str, rung: Rung,
|
||||
|
||||
|
||||
def git(effects: Effects, cwd: str, *args: str) -> str | Failure:
|
||||
ran = effects.git(list(args), cwd)
|
||||
try:
|
||||
ran = effects.git(list(args), cwd)
|
||||
except OSError as failure:
|
||||
return Failure(f"git {' '.join(args)} could not start in {cwd}: {failure.strerror}")
|
||||
return ran.stdout if ran.returncode == 0 else Failure(f"git {' '.join(args)}: {ran.stderr.strip()}")
|
||||
|
||||
Reference in New Issue
Block a user