Skip to content

feat(replay-verify): iterative in-sandbox fix loop with real-output feedback (opt-in) - #78

Merged
drewstone merged 1 commit into
mainfrom
r3/patch-synthesis
Aug 3, 2026
Merged

feat(replay-verify): iterative in-sandbox fix loop with real-output feedback (opt-in)#78
drewstone merged 1 commit into
mainfrom
r3/patch-synthesis

Conversation

@drewstone

Copy link
Copy Markdown
Contributor

What this is

The counterfactual patch-synthesis pursue: --fix loop --fix-attempts k — attempt 1 is byte-identical to the shipped one-shot (test-asserted); on failure, attempt n+1 is prompted with the failed command's actual sandbox stdout/stderr, executed against a FRESH sandbox with the full replayed prefix (a flip always proves the corrected step against recorded state, never against a prior attempt's wreckage). Retries may emit ≤5-command scripts run as one arm. Default --fix generate unchanged; the loop is opt-in.

Proof of mechanics (live, real sandbox + real glm-5.2)

Smoke on a case one-shot could not fix: three genuine feedback-chained attempts — a1 missing cargo env (exit 1, 27s) → a2 located cargo, drove a real build to an openssl-sys failure (exit 101, 398s) → a3 tried the missing package manager (exit 127). Exhausted honestly. 30 new tests (601/601 suite): flip@1 degeneration, flip@3, exhaustion, script cap, LLM-failure retry, per-attempt sandbox isolation.

Measurement status — honest

The pre-registered @1-vs-@3 comparison is not yet answerable: both full-batch attempts (run3, run4) hit z.ai seat degradation (28/33 and 29/33 call failures — 429 request-limits + long-reasoning aborts; run3 additionally overlapped another batch after an operator mutex error, ledgered). run4's surviving denominator (2/2 flips, both @1) is too small to claim anything. The canonical one-shot floor remains run2's 9/11. Cross-day replay stability is itself a finding: 16/22 (run2) vs 13/22 (run3, run4) replayable — 3 cases flip day-to-day; recorded for the replayability doc.

The comparison reruns on a healthy seat window with the committed command; the code is merge-ready independent of that readout.

Battery: typecheck clean, 601/601, build + package checks green, merge-tree clean.

…eedback

--fix loop replaces the one-shot counterfactual fix with up to --fix-attempts
attempts per case. Attempt 1 is byte-identical to the one-shot prompt; failed
arms (nonzero exit or persistent signature) and failed model calls feed every
prior command and its real executed stdout/stderr into the next prompt.
Retries may answer with a short script (<=5 commands) executed as one /bin/sh
unit. Every attempt runs in its own fresh sandbox with the same replayed
prefix, so a flip always proves the corrected step against the recorded
prefix state.

The report adds fixFlipAttempt1 (one-shot-comparable), flipsByAttempt, the
per-attempt trail on each case row, and armB-attempt<N>-result.json artifacts.
@drewstone
drewstone merged commit f561aa4 into main Aug 3, 2026
1 check passed
@drewstone
drewstone deleted the r3/patch-synthesis branch August 3, 2026 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant