Windows finds a program through PATHEXT and skips a file with no
extension. testenv.inertTools wrote a .bat beside each #!/bin/sh stand-in.
The gateway's TestMain calls StandIns directly, though, and StandIns wrote
only the extensionless file. On a box with Codex installed, LookPath went
past the stand-in to the user's codex.cmd.
TestCodexPoolSaysTheClientsVersion then saw the installed 0.162.0 instead
of its fixture's 0.161.0, which is exactly what EdwinDigital reported. The
.bat is now written in StandIns, so every caller gets it.
TestStandInsComeBeforeTheInstalled puts StandIns("codex") on PATH first
and an "installed" codex (codex.cmd on Windows) that prints 0.162.0
further down. LookPath must pick the stand-in, and running it must fail
with no output.
Run:
- gofmt -l is clean.
- go vet passes for darwin, linux -tags nogui and windows (testenv and
gateway).
- go test ./internal/testenv/ passes on macOS.
- Windows 11 x64 box (ssh), test binaries cross-built with Go 1.26.8.
A fake codex.cmd printing "codex-cli 0.162.0" was on PATH.
- The gateway binary before this change fails
TestCodexPoolSaysTheClientsVersion with EdwinDigital's error (UA
codex_cli_rs/0.162.0). The binary after it passes.
- The testenv binary before this change fails the new test, and the one
after it passes.
- Full gateway binary on that box, with its testdata copied (no source
tree): the same failures before and after. They are source-reading tests
that need the checkout, and TestClaudeAsRootEnv (#1827). The one
exception is TestQueuedStreamKeptAliveForASlot, which failed once in the
run after this change. It passes 5 of 5 alone on both binaries. Its cause
is Windows' ~0.5ms clock tick in a strict Before (filed as #2249).