Skip to content

fix(sandbox): require apply_patch update hunks - #4470

Merged
seratch merged 1 commit into
openai:mainfrom
li2631026381-alt:codex/require-apply-patch-update-hunk
Aug 17, 2026
Merged

seratch merged 1 commit into
openai:mainfrom
li2631026381-alt:codex/require-apply-patch-update-hunk

Conversation

@li2631026381-alt

Copy link
Copy Markdown
Contributor

Summary

The custom apply_patch grammar currently allows an Update File operation without any diff lines, even though the runtime parser rejects that input. This pull request requires at least one change after the optional Move to directive and aligns the model-facing EBNF description with the runtime contract.

It also adds regression coverage that:

  • compares the complete update_hunk production so the old change? rule cannot pass
  • verifies the converter forwards the validated grammar definition
  • confirms empty and move-only updates retain the runtime rejection

Test plan

  • env NO_PROXY=localhost,127.0.0.1 no_proxy=localhost,127.0.0.1 UV_DEFAULT_INDEX=https://pypi.org/simple bash .agents/skills/code-change-verification/scripts/run.sh
  • All formatting, lint, type checking, and test steps passed on Python 3.12.

Issue number

Closes #4468

Checks

  • I've added new tests, if relevant
  • I've run .agents/skills/code-change-verification/scripts/run.sh
  • I've confirmed all verification steps pass
  • If using Codex, I've run /review before submitting this PR

@seratch seratch added this to the 0.21.x milestone Aug 17, 2026
@seratch seratch changed the title fix: require apply_patch update hunks fix(sandbox): require apply_patch update hunks Aug 17, 2026

@seratch seratch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inconsistency has existed since the sandbox feature was introduced in v0.14.0: the executable grammar permits a move-only update, while the accompanying description requires one or more hunks, and both the parser and programmatic editor reject updates without a diff. Move-only updates have therefore never been a working SDK capability.

Supporting them now would introduce a new cross-provider filesystem contract covering metadata, symlinks, read-only grants, existing destinations, cross-filesystem behavior, and partial failures. The reported issue does not demonstrate a concrete user requirement that justifies this additional surface.

The narrower fix resolves the confirmed grammar/runtime mismatch at its owning boundary, preserves the established runtime behavior, and avoids introducing unsupported rename semantics.

@seratch
seratch merged commit 37a7aa2 into openai:main Aug 17, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

apply_patch grammar accepts empty updates that the runtime parser rejects

2 participants