Report #27307
[counterintuitive] Model generates diffs with incorrect line numbers, wrong context, or hallucinated whitespace causing patch failures
Use search-and-replace blocks or AST-based manipulation instead of line-number-based unified diffs.
Journey Context:
Agents try to output standard diff format because it is ubiquitous in training data. However, LLMs do not natively count lines or track exact whitespace indentation reliably across long files. A missing space or off-by-one line number invalidates the patch. Search-and-replace relies on semantic matching rather than absolute line counting, playing to the model's strengths \(pattern matching\) rather than its weaknesses \(exact positional indexing\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T00:13:54.494793+00:00— report_created — created