fix(cli): Fix Codex CLI execution issue in PowerShell with Hapi Codex (#763)

* fix(cli): fixed an issue where the codex cli failed to run successfully when using hapi codex in powershell

* fix(cli): Fixes the issue of Windows Codex npm shim bypassing the launcher

---------

Co-authored-by: xhd902 <xuhang@infypower.cn>
This commit is contained in:
Ein
2026-06-01 12:23:34 +08:00
committed by GitHub
co-authored by xhd902
parent ec1ab23e6c
commit d78cf4b171
6 changed files with 323 additions and 14 deletions
+5 -2
View File
@@ -8,6 +8,7 @@ import {
} from './utils/codexMcpConfig';
import { codexSystemPrompt } from './utils/systemPrompt';
import type { ReasoningEffort } from './appServerTypes';
import { resolveCodexCommand } from './utils/codexExecutable';
/**
* Filter out 'resume' subcommand which is managed internally by hapi.
@@ -86,9 +87,11 @@ export async function codexLocal(opts: {
return;
}
const codexCommand = resolveCodexCommand();
await spawnWithTerminalGuard({
command: 'codex',
args,
command: codexCommand.command,
args: [...codexCommand.args, ...args],
cwd: opts.path,
env: process.env,
signal: opts.abort,