logoalt Hacker News

bob1029today at 3:08 PM0 repliesview on HN

I strongly believe the reason gpt-5.x performs so well on large projects is because of the focused training they've done on their dedicated apply_patch primitive.

The official implementation of apply_patch is well thought out. It is a two-phase process that will not actually make any changes until all files in the change set are not ambiguous. The pre-commit error feedback usually fixes anchoring issues with one or two additional attempts. It generally goes something like:

  Reading file A L1:154
  Reading file B L1:123
  Attempting to apply patch... 
  [anchor errors for both A & B]
  Reading file A L43:67
  Reading file B L50:74
  Attempting to apply patch... 
  Patch succeeded! Running compilation & unit tests...
The anchor error feedback helps massively because in this implementation it also returns the current line numbers where the problem was found.

Techniques that replace the whole file or depend on find-replace are useful in more isolated contexts. However, when you need to refactor 20+ files, something like apply_patch is what you want. Anything that depends on specific line numbers for actual replacement targets is a total dead end for complex edit scenarios.

https://developers.openai.com/api/docs/guides/tools-apply-pa...