Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions tests/cli/cli-connect-readiness.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ function runStatusProbe(options: {
const rejectedDir = join(opencodexHome, "rejected");
const selected = writeRuntimeFixture(selectedDir, "0.145.0");
writeRuntimeFixture(lowerDir, "99.0.0");
if (options.externalInstalledRoot && process.platform === "win32") {
// Use a real executable for the Windows-only installed-root control.
copyFileSync(process.execPath, join(lowerDir, "codex.exe"));
}
const preferred = options.preferred ?? "valid";
runtimeEnv.CODEX_CLI_PATH = preferred === "valid" ? selected
: preferred === "failed" ? writeRuntimeFixture(rejectedDir, "", false)
Expand Down Expand Up @@ -271,17 +275,10 @@ function runStatusProbe(options: {
if (externalRoot) {
const { execFileSync } = require("node:child_process");
const sentinel = join(externalRoot, "OpenAI", "Codex", "bin", "fixture-installed", "codex.exe");
const lowerExecutable = join(dirs.lower, "codex.exe");
const observeInstalled = env => {
const sentinelCalls = [];
const lowerBefore = calls().lower.length;
// Windows process.env looks up PATH without case, but a spread plain
// object may contain only Path; the resolver reads env.PATH literally.
// Keep the lower launcher as the sole PATH alternative to the
// selected absolute CODEX_CLI_PATH and the installed sentinel.
for (const key of Object.keys(env)) {
if (key.toLowerCase() === "path") delete env[key];
}
env.PATH = dirs.lower;
const lowerCalls = [];
resolveCodexRuntime({
env,
execFileSync: (file, args, options) => {
Expand All @@ -290,10 +287,11 @@ function runStatusProbe(options: {
if (call) sentinelCalls.push(call);
const output = execFileSync(file, args, options);
if (call) call.completed = true;
if (file === lowerExecutable) lowerCalls.push(args.join(" "));
return output;
},
});
return { sentinelCalls, lowerCalls: calls().lower.slice(lowerBefore) };
return { sentinelCalls, lowerCalls };
};
// Explicit deps make both observations cold without altering the ordinary cache oracle.
runtime.installedIsolation = {
Expand Down
Loading