agent: propose_patch ergonomics from the phase2-comrak-004 audit

- Standalone-proposal semantics: workspace resets to pristine before
  every apply, so probe patches can't accumulate into a tested tree the
  ledger's patch field doesn't describe.
- Friendly errors: explicit trailing-newline check, and git apply's
  stderr relayed on refusal instead of a generic message.
- Tool docs + task prompt updated to match.
- phase2-comrak-004 audited: honest rejected-bench (median 1.0124,
  CI [1.0011, 1.0267] — real but under the 2% bar), Mutex pre-flagged
  for human review, cumulative-probe state disclosed in the hypothesis.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EcKPWQ3MQD4NdEHwar96u2
This commit is contained in:
Claude
2026-07-10 05:32:08 +00:00
parent 393ca7117f
commit 23ab522445
4 changed files with 61 additions and 16 deletions
+3 -1
View File
@@ -86,7 +86,9 @@ async def run_attempt(target: str, run_id: str, max_turns: int, repo_root: str)
f"3. Read the relevant source with read_target_source — for large files pass "
f"offset/limit and page through in windows (do NOT attempt any shell). State your "
f"hypothesis, then propose_patch (unified diff, a/ b/ prefixes, paths relative to the "
f"target workspace root).\n"
f"target workspace root, trailing newline required). Each proposal is STANDALONE — "
f"the workspace resets to pristine before every apply, so always submit the complete "
f"patch, never an increment on a prior proposal.\n"
f"4. run_verdict with run_id '{run_id}', the class number, and the hotspot string. "
f"It launches a multi-minute pipeline and returns immediately.\n"
f"5. Poll read_verdict('{run_id}') until it returns a verdict (not a 'running' status). "
+6 -3
View File
@@ -50,9 +50,12 @@ def read_target_source(target: str, path: str, offset: int = 0, limit: int = 400
@mcp.tool()
def propose_patch(target: str, diff: str, hypothesis: str) -> str:
"""Submit a unified git diff (a/ b/ prefixes, paths relative to the target workspace)
plus the hypothesis it tests. The harness applies it only after a path-allowlist
check. Returns a patch_id, or an error string if refused."""
"""Submit a unified git diff (a/ b/ prefixes, paths relative to the target
workspace, MUST end with a trailing newline) plus the hypothesis it tests.
Each proposal is STANDALONE: the workspace is reset to pristine before the
diff is applied, so always submit the complete patch — never an increment
on top of an earlier proposal. The harness applies it only after a
path-allowlist check. Returns a patch_id, or an error string if refused."""
return harness.propose_patch(target, diff, hypothesis)