You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
apply_patch grammar accepts empty updates that the runtime parser rejects #4468
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.
I verified the grammar/parser mismatch on current main. I’m taking a narrow, non-exclusive pass to require a diff hunk after an optional *** Move to: line and add focused regression coverage that a move-only update is rejected consistently. I’ll leave parser behavior and broader patch semantics unchanged.
Activity
samrusani commentedon Aug 17, 2026
I verified the grammar/parser mismatch on current main. I’m taking a narrow, non-exclusive pass to require a diff hunk after an optional
*** Move to:line and add focused regression coverage that a move-only update is rejected consistently. I’ll leave parser behavior and broader patch semantics unchanged.