Repair: an agent for a stopped or failed run that fixes the cause and carries the run on #222
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
When a run fails or is stopped there are two moves: redo the step, or start the run over. A failure whose cause is outside the step has no remedy in Braid. Run 88 finished its work and failed at
git.pr.mergebecause another run's pull request had merged into the base in the meantime (#221 is the graph fix for that case). Nothing in Braid could resolve the conflict and carry the run on; the merge had to be fixed outside it. Braid has a full coding agent for exactly this kind of problem, but it only talks to a step that is running.The next failure will be a different one, so the fix should not be one more special case in the graph.
Wanted
A Repair agent: one per run, active whenever the run is stopped or failed.
apptool, that appends the same events the Resume, Redo and Accept buttons do: read the graph and each step's state, resume the run, redo a step, and mark a failed step done by hand. It goes through the engine's own paths, so checkpoints, attempt counts and the rules of those verbs apply.The hazard to design first
A retry of a scripted step rolls the worktree back to the step's entry checkpoint (an agent step that continues is the exception). If Repair merges the base into the branch, pushes, and then resumes at
git.pr.merge, the rollback can undo Repair's commits. Repair must end its work with a checkpoint that becomes the baseline for the next attempt, or its resume must skip the rollback; either way there needs to be a test for exactly this scenario.Not in this issue
The live-run "Ask" mode and the stuck-run nudge are a separate issue that builds on this one.
Shipped on main (
098c8af), archived as2026-10-19-repair-agent.repairtool:status,resume,redo,accept. Each goes through the route the buttons use, with Repair as the actor. It has no action for a gate.repairedorby handmarker on the steps it touched, and a spine entry for each session.Verified by unit tests, 358 browser specs, a live test against opencode 2.0.30, and a simulated run (
repair-carries-a-failed-run-on) in which a failed run is repaired and merges. The simulated run found that opencode refuses a prompt id not startingmsg_; the route now normalises it.Not in this change: asking a question of a live run without interrupting it, and a nudge for a stuck run (braid#223). Repair's text appears as each part settles rather than streaming. Its "cannot answer a gate" rule is enforced by the tool and its instructions, not by the API, so it is as strong as the agent shell's isolation (braid#201, braid#203).