Skip to content

fix(tools): name the patch action that references a missing file - #6371

Merged
VascoSch92 merged 3 commits into
OpenHands:mainfrom
yftx293:fix/apply-patch-missing-file-label
Nov 5, 2026
Merged

VascoSch92 merged 3 commits into
OpenHands:mainfrom
yftx293:fix/apply-patch-missing-file-label

Conversation

@yftx293

@yftx293 yftx293 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

HUMAN:

Fixed the missing-file error label from #6348. I reviewed the diff and the test; an update to a missing file must not be reported as a delete.


AGENT:

Why

load_files converted every FileNotFoundError into a "Delete File Error: Missing File" DiffError, so an update of a file that does not exist was reported as a delete — the wrong action, and misleading to both the agent and the user reading the observation.

Summary

  • Let load_files skip a missing path instead of raising its own hard-coded Delete File Error. The parser already reports a path that is absent from the loaded files as Update File Error: Missing File or Delete File Error: Missing File, matching the action that references it, so no extra parsing is needed.
  • Port the pinned test test_update_missing_file_error_names_update from the worktree-test-edge-cases branch (commit f2fcf6e) without its xfail(strict=True) marker, per the [Bug]: Edge-case tests expose ~70 bugs across the SDK, agent server, tools and workspaces #6348 menu's acceptance criteria.

Issue Number

Part of #6348 (menu sub-item: "Update of a missing file is reported as 'Delete File Error'")

How to Test

uv run pytest tests/tools/apply_patch/test_apply_patch_executor.py -k "missing_file"

Before this change the update case fails ('Delete File' is contained here); after, it passes and the existing delete case still reports Delete File Error. The full tests/tools/apply_patch/ suite is 14 passed. ruff check/format on the touched files are clean.

Type

  • Bug fix

Notes

The load_files signature is unchanged, and process_patch is its only caller.

The parser already raises "Update File Error: Missing File" and
"Delete File Error: Missing File" for a path absent from the loaded
files, so load_files only needs to skip a missing path instead of
raising its own hard-coded Delete error. This replaces the second pass
over the patch text and the action_labels keyword.
@VascoSch92

Copy link
Copy Markdown
Member

Thanks for this one. It conflicts with main now, because #6372 changed the same load_files block in apply_patch/core.py and the same test file. I checked and the bug is still there on main (an Update of a missing file still reports "Delete File Error"), so the fix is still needed.

Could you rebase on main? When resolving, please keep the OSError/UnicodeDecodeError branch that #6372 added and only turn the FileNotFoundError case into your continue. I'll take another look once it's green.

@VascoSch92
VascoSch92 merged commit e6c074f into OpenHands:main Nov 5, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants