INNER CODE UNIT · TypeScript

readingWhatThePatchAlreadyRemoved

totec448-spec/chat-on-steroids · src/main/codex/apply-patch/index.ts:544

function readingWhatThePatchAlreadyRemoved(context: string): ApplyPatchError {
  return ApplyPatchError.io(context, new Error('an earlier hunk in this patch removed it'));
}

/**
 * `try_verify_apply_patch_args`: resolves every hunk and works out what it would do.
 *
 * This is a dry run against the real filesystem, so a delete of a missing file or an update whose
 * context cannot be located fails here, before any file is touched. Codex reports those failures
 * to the model as `apply_patch verification failed: {error}` rather than as a patch that ran and
 * exited non-zero.
 *
 * One deviation from upstream, and it is the whole of `pending`. Upstream refuses a patch whose
 * hunks name one path twice — `multiple operations target …` — while upstream's own applier does
 * no such thing: `apply_hunks_to_files` walks the hunks in order and writes each one before it
 * reads the next, so a file updated twice, or deleted and re-added, applies exactly as written.
 * The refusal exists because this verifier was built for an approval UI, where `changes` is keyed
 * by path and a repeat would silently drop an entry from the list shown to the user. Nothing in

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…