The custom apply_patch grammar allows an Update File operation containing only a rename:
# src/agents/sandbox/capabilities/tools/apply_patch_tool.py
update_hunk: "*** Update File: " filename LF change_move? change?
Because change is optional, the tool grammar tells the LLM that a move-only update is valid:
*** Begin Patch
*** Update File: foo.py
*** Move to: bar.py
*** End Patch
However, _parse_update_file() rejects it because no diff lines are present:
# src/agents/sandbox/capabilities/tools/apply_patch_tool.py
if not diff_lines:
raise ValueError(f"Update File patch for {path} must include a hunk")
This creates a grammar/runtime contract mismatch for a legitimate file operation and wastes a tool call.
Note: This issue was identified by an automated testing tool for academic research and manually verified. If you have any concerns about this type of reporting, please let me know, and I will adjust my workflow accordingly.
The custom apply_patch grammar allows an Update File operation containing only a rename:
Because change is optional, the tool grammar tells the LLM that a move-only update is valid:
However, _parse_update_file() rejects it because no diff lines are present:
This creates a grammar/runtime contract mismatch for a legitimate file operation and wastes a tool call.