Robustness
These guarantees keep a weak local model productive where it would otherwise fail on the mechanics. Each one targets a specific failure mode.
Never an empty patch
Every exit path (done, max turns, wall clock, or an error mid-run) salvages the working git diff before returning. A model that edits a file and then crashes or runs out of turns still hands back the change.
Edit-apply resilience
A model retyping an anchor it only ever saw as tokens gets it slightly wrong: a dropped trailing space, re-flowed indentation, a smart quote, or the N: line numbers copied out of the listing. Each of those is retried with a comparison that ignores exactly that difference. What is never relaxed is the requirement that one site and only one site matches, so a looser comparison can widen what matches but can never pick between candidates, and an inexact application is reported back rather than applied quietly.
When an anchor keeps missing on the same file, the agent is sent back to read_file to copy a longer unique region — a failed anchor means its copy no longer matches the file, so re-reading addresses the cause. It used to be pointed at a full-file write_file rewrite, which was backwards: a whole-file rewrite is the largest thing a model can emit, so the recovery path fed directly into the output-token truncation described below. A line-addressed editor was tried in between and removed: a stale line range still applies cleanly, so a wrong edit reported success.
Stall detection
Turns of reading with no edit, or a repeated response, trip a nudge: make one small, testable change, then run the tests. Progress is measured by what changed in the repository and what the tests report, not by the text, so the agent can't appear active without making changes.
Format robustness
ANSI escapes are stripped from tool output before the model sees them. A tool call the model wrote as text rather than as a structured call is recovered into a real one, in any of the eight on-the-wire formats the open-weight families use: Hermes and Qwen tags, Gemma-4 call: syntax, Mistral [TOOL_CALLS], Laguna key/value pairs, LFM2.5 Pythonic calls, gpt-oss harmony, and plain JSON. The same matchers back the BFCL evaluator, so a format that scores correctly is a format the agent can run.
Fabricated tool results
A small quantized model will sometimes write a tool call and then write its own plausible answer to it, and keep reasoning on top of the invention. The stream is cut at the first token of the fabricated result and the text after it is discarded, so the server stops generating and the fiction never reaches the transcript as if it were an observation. The call itself is kept: it is real, only the answer to it was not.
Bounded & resumable
Per-tool timeouts stop a hung command, an optional wall-clock cap stops a run that is not converging, and the trajectory is append-only across context resets, so long runs stay coherent.
Transient-failure retry
A server still warming up (a Metal kernel compiling on the first request) or a transient blip is retried, not counted as a model failure.
A worked example
Here is a real run on a planted off-by-one bug (adjacent intervals [1,2] and [2,3] should merge to [1,3]), driven by a local 27B:
⏺ search(glob='**/*.py')
⏺ read_file(path='intervals/__init__.py')
⎿ 12 lines
⏺ edit_file # strict < → <= so touching intervals merge
⎿ auto-verify after edit → intervals/__init__.py parses
⏺ run_tests
⎿ 1 passed, 0 failed
⏺ done: Fixed the off-by-one, touching intervals now merge.
stop: done turns: 5 tests: 1 passed / 0 failedThe agent grounded the change by reading the file, made one targeted edit, the harness checked that the edited file still parses, and the agent ran the tests itself before declaring done. Nothing ran before the agent asked: there is no unprompted test run at session start. When a test run does fail, the same command is run once against the untouched HEAD in a throwaway worktree and each failure is labelled pre-existing or new, so the agent does not chase failures it did not cause.