fix(codex): prefer real PowerShell executable on Windows - #2492
Conversation
Signed-off-by: zyaoii <347929035@qq.com>
|
| Filename | Overview |
|---|---|
| packages/maker-core/src/agents/codex/env-builder.ts | 在 Windows 上识别并前置首个非 WindowsApps 的真实 pwsh.exe,未发现符合跟进审查范围的新问题。 |
| packages/maker-core/src/agents/codex/env-builder.test.ts | 新增 Windows 回归测试,覆盖 shim、执行别名和带引号 PATH 条目。 |
Reviews (2): Last reviewed commit: "fix(codex): handle quoted PowerShell PAT..." | Re-trigger Greptile
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 58ab92510e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
MagicLizi
left a comment
There was a problem hiding this comment.
格式门:PR 描述不完整
你的 PR 描述缺少以下必要段落,请补充后重新请求审查:
- 这次改了什么:说明本次改动的内容和背景
- 怎么验证的:说明你是怎么验证这个修复的(测试、手动验证步骤等)
补充完毕后直接 push(不需要新开 PR),自动化流程会在下一轮重新扫描。
|
@zymk8353 👋 这个 PR 还有 1 条 review conversation 没 resolve(packages/maker-core/src/agents/codex/env-builder.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
Signed-off-by: zyaoii <347929035@qq.com>
|
Addressed the quoted-PATH review feedback in The PowerShell probe now removes one surrounding quote pair for normalization and Verification:
The inline conversation has been resolved. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d94a04dc14
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const [executableDir] = entries.splice(executableIndex, 1); | ||
| entries.unshift(executableDir); |
There was a problem hiding this comment.
Keep host-managed PATH prefixes ahead of PowerShell
When runtimeConfig.pathPrepends is present, this unshift moves the discovered PowerShell directory ahead of those explicitly prepended directories. The inspected Desktop config uses pathPrepends for its mandatory bundled ripgrep, so installations where the PowerShell directory also contains an rg.exe—for example, a shared user-managed shim directory—will run that copy instead of Cindy's validated binary. Prioritize pwsh.exe only within the user PATH, or perform this reordering before prepending host-managed tools.
Useful? React with 👍 / 👎.
| const normalized = path.win32.normalize(directory).replace(/[\\/]+$/, '').toLowerCase(); | ||
| if (normalized.endsWith('\\microsoft\\windowsapps')) return false; | ||
|
|
||
| return existsSync(path.join(directory, 'pwsh.exe')); |
There was a problem hiding this comment.
Avoid synchronous probes of arbitrary PATH shares
When a Windows PATH contains a disconnected or slow UNC/network directory before the first usable pwsh.exe, existsSync blocks while Windows resolves that share. This scan runs during buildCodexEnv, which the Desktop main process calls while creating every local Codex host, so the main thread and UI can freeze until the filesystem timeout expires. Probe arbitrary PATH entries asynchronously with a bound, or use a lookup mechanism that cannot synchronously stall the Electron main thread.
Useful? React with 👍 / 👎.
|
@zyaoii 👋 这个 PR 还有 2 条 review conversation 没 resolve(packages/maker-core/src/agents/codex/env-builder.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
这次改了什么
Fixes #2446
pwsh.exe的目录放到PATH首位。WindowsAppsalias,避免 Codex 选中pwsh.cmdshim 或无效 alias 后让所有 shell 命令报batch file arguments are invalid。.cmdshim、WindowsAppsalias 和带引号真实 PowerShell 目录的回归测试。怎么验证的
pnpm --filter @cindy/maker-core test -- src/agents/codex/env-builder.test.ts(6/6 通过)pnpm --filter @cindy/maker-core exec eslint src/agents/codex/env-builder.ts src/agents/codex/env-builder.test.ts(通过)pnpm --filter @cindy/maker-core run --if-present typecheck(该 package 无 typecheck script,按仓库门禁跳过)pnpm test:unit -- --workspace-concurrency=1(D 盘隔离 worktree 全量通过;仅在命令 PATH 前置本机 Python 3.10,以避开系统 Python 2.7)pnpm check:dco(2 个 PR commits 均通过)风险与回滚
UI