Skip to content

apply_patch hides failure reasons behind generic reread instructions #31

Description

@alexei-ciobanu

Summary

The detailed applicator records each underlying error in ApplyPatchFailure.message, but the model-facing tool result discards those messages. It classifies every failure as requiring a reread and emits Recovery: MUST read ..., even for missing files, permissions, invalid paths, and other errors that rereading cannot fix.

Why this matters

The agent cannot see the actual reason carried in details.result.failures. In the outside-cwd regression from #21, for example, the real Patch path escapes workspace error appeared only as an instruction to reread a file that had already been read. The same misleading behavior remains for unrelated I/O errors even after #21 is fixed.

Expected behavior

The model-facing result should report:

  • whether no files or only some files were applied;
  • the paths that were applied;
  • every failed path, operation, and underlying message.

Recovery advice should either be omitted or narrowly classified. A context mismatch may justify rereading; an ENOENT or permission error does not.

Suggested output

apply_patch partially failed.
Applied files: ok.txt
Failed:
- broken.txt (update): Failed to find expected lines in broken.txt ...

The structured failures and appliedFiles fields already contain the required information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions