STUPID-2026-0080
Aider's unified-diff coder silently drops the partial-application warning when one hunk succeeds and another fails
Instruction given
None specific to this bug — the defect lives in Aider's unified-diff application logic itself and can trigger during any task where the model proposes multiple hunks in one diff and at least one hunk fails to apply while another succeeds.
Expected behavior
When `UnifiedDiffCoder.apply_edits` writes some hunks to disk successfully and rejects others, Aider should tell the user that a partial edit was applied, so they know the file on disk no longer matches either the original or the model's full intended diff.
Actual behavior
In `aider/coders/udiff_coder.py`, the function collects failed hunks into a list, joins that list into a single string for the error message, and then checks the string's length to decide whether to show the partial-application notice. After the `join`, `errors` is a string, so `len(errors)` measures characters in the error text rather than the number of failed hunks, and the length check for triggering the notice evaluates against the wrong quantity. The practical effect: when one hunk succeeds and another fails, the successful hunk is still written to disk, but the user is not reliably told that only part of the diff was applied.
Damage
Filed as a code-level defect by a reader of the source (yifanxiong272), with the exact file, function, and faulty length comparison identified, and a fix suggested (track the failed-hunk count before the `join` rather than measuring the joined string). No production incident or data loss was reported alongside it. The risk it documents is a user believing their edit either fully applied or fully failed when in fact a partial write landed on disk with no warning — the same silent-partial-success shape as Aider's already-flagged edit-format auto-selection (#5486) and headless exit-code (#5552) issues, this time in the unified-diff apply path. Open and unfixed as of this incident's publication.
Classification
- Agent
- Aider
- Failure mode
- Logic Error
- Root cause
- Logic Error
- Domain
- Backend
- Source
- Github Issue
Related incidents
Get told when an agent breaks something
We document AI agent failures daily, severity-scored against a published scale. When one lands at 7.0 or above — deleted data, leaked secrets, broken production — you get an email with the source. When nothing does, you get nothing.