Repository navigation
[apply-patch] Add binary to path - #2626
Closed
dylan-hurd-oai wants to merge 2 commits into
Closed
dylan-hurd-oai wants to merge 2 commits into
dylan-hurd-oai wants to merge 2 commits into
Conversation
dylan-hurd-oai
commented
Aug 23, 2025
| if (rgDir) { | ||
| additionalDirs.push(rgDir); | ||
| } | ||
| // 2) Ensure an `apply_patch` helper exists in $CODEX_HOME/<version>/ and add that directory to PATH. |
Contributor
Author
There was a problem hiding this comment.
Very open to moving this logic into core rust package, curious for thoughts!
Contributor
There was a problem hiding this comment.
presumably this logic will not work when installed via brew?
bolinfest
requested changes
Aug 24, 2025
| use std::process::ExitCode; | ||
|
|
||
| fn main() -> ExitCode { | ||
| // Expect exactly one argument: the full apply_patch payload. |
Collaborator
There was a problem hiding this comment.
This is not quite right: if zero arguments are specified, it is supposed to read from stdin.
| } | ||
|
|
||
| const binaryPath = path.join(__dirname, "..", "bin", `codex-${targetTriple}`); | ||
| const pkgRoot = path.join(__dirname, ".."); |
Collaborator
There was a problem hiding this comment.
While this scheme would work for codex installed via npm, it would not work for someone who installs via brew or someone who downloads from GitHub Releases.
Building this into https://github.com/openai/codex/blob/main/codex-rs/arg0/src/lib.rs would solve this problem.
Collaborator
|
New approach in #2646. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Infrequently, certain models will try to use apply_patch as a real bash command. This should decrease dramatically with #2539 and #2576, but I'm opening this as a potential additional fix just in case. Dropping apply_patch as a binary on the PATH will help us reliably catch cases outlined in #2235, without going down the rabbit hole of trying to catch every invocation at the tool call level
Testing
WIP