Repository navigation
agents on Windows: start, probe and show the .exe a spawn actually finds - #90
Merged
Merged
Conversation
Measured on Windows 11: the shell's `codex` was npm's (0.167.0, a
`codex.cmd` shim first on PATH), `incode --admin` showed npm's path, and
every run incode started was the Codex desktop app's codex.exe, 0.145.0,
further down PATH (each run's version read from codex's own session
file). Discovery took `where`'s first line, which lists every PATHEXT
extension; the spawn was `Command::new("codex")`, which starts only a
`.exe`. So incode named one program and ran another.
Now discovery resolves the `.exe` a spawn of the bare name finds, in PATH
order (exe_on_path), and names it by its absolute path as the command the
run starts (task_run::drive, cli::prepare, acp_agent), the program probed
for its version and the path shown: one program throughout. A `.cmd` shim
is not started in its place: Rust refuses some arguments to a batch file,
newlines among them, and a prompt has newlines. Off Windows, and when no
`.exe` is on PATH, discovery is as before.
Test: the measured layout (npm's codex and codex.cmd first, the desktop
app's codex.exe later) resolves to the desktop app's exe; a .cmd-only agent
resolves to nothing; a name with its extension is taken as written.
Agent tests: 432 pass; clippy clean.
…ows paths) It failed on Linux and macOS CI: there, C:\npm is not a folder path, so join() builds a different path than the test expects. exe_on_path is only called by a Windows build.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Found while verifying #19. On Windows, incode's discovery took
where's first line, which for npm's codex is a shell script orcodex.cmd, but the spawn (Command::new("codex")) starts only a.exe. Measured: the shell'scodexwas npm's 0.167.0 and--adminshowed npm's path, yet every run started the Codex desktop app'scodex.exe0.145.0, further down PATH (each run's version read from codex's own session files).Now discovery resolves the
.exea spawn finds, in PATH order, and uses that absolute path for the run, the version probe and the display. It's one program throughout. A.cmdshim isn't started in its place, because Rust refuses some batch-file arguments (newlines) and prompts have newlines. Off Windows, or when no.exeis on PATH, discovery works as before.Test: the measured layout resolves to the desktop app's exe, a
.cmd-only agent resolves to nothing, and a name with an extension is taken as written. Agent tests: 432 pass. clippy is clean.