[KongchangAI]
Conceptapply_patch 补丁信封

apply_patch

A structured patch format designed by OpenAI for code-editing scenarios. It declares file additions, deletions and modifications through markers such as Begin Patch, Update File and End Patch, removing dependence on line numbers and making it easier for language models to generate reliably.

Timeline (last 90 days)

Oct 18

Codex CLI released version 0.162.0 on October 8, with the changelog stating that existing CRLF line endings are preserved in apply_patch updates, with no extra option needed to enable it.

Unverified50%
Oct 18

Codex PR openai/codex#51203 points out that previously, updating a CRLF file with apply_patch normalized line endings to LF unless preservation was explicitly enabled.

Unverified50%
Oct 18

OpenAI's Codex Prompting Guide recommends the apply_patch format for single-file edits and states that the model has been trained on this diff format, strongly recommending the use of OpenAI's official implementation.

Unverified50%
Oct 18

Codex's apply_patch implementation is open-sourced in the codex-rs/apply-patch crate and uses markers such as *** Begin Patch, *** Add File:, *** Delete File:, *** Update File:, *** Move to:, *** End of File, @@, and *** End Patch, with changed lines starting with - or + and context lines starting with a space and carrying no line numbers.

Unverified50%
Oct 17

The core Syntax Gate module is only 455 lines long and unifies the admission logic of the four disk-writing tools write_file, edit_file, apply_patch and fim_edit.

Unverified50%

All Facts (5)

Source Articles