Repository navigation
Conversation
|
The PR is now open as a Draft. The implementation keeps the POSIX command unchanged, makes Codex's generated Windows built-in command safe when the selected shell is PowerShell, and leaves team-hook dispatcher commands bare so blocking exit codes/stderr are preserved. The local built-CLI check generated the expected |
|
No findings in the specified PR diff. The PR description meets the testing requirement: it records a build and a representative real-CLI run verifying the generated Codex Review was read-only; I did not run, build, or install anything from the PR. |
|
Updated the stale Codex retired-Skill fixture and its reconciliation expectation in Validation at this head:
The full CI matrix has been retriggered by the push. |
|
No findings in the specified PR diff. The PR description meets the testing requirement: it records a successful build and a representative real-CLI run verifying the generated Codex The earlier pass reported no findings; there are none to mark resolved. Review was read-only—I did not run, build, or install anything from the PR. |
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
Thanks, this fixes #1578. Checked with the built CLI and PowerShell 7.5.2 (on macOS, with a stand-in cmd.exe): the reporter's probe and main's commandWindows string both print a BackgroundJob table under pwsh -NoProfile -Command, and the new cmd.exe /d /s /c "... & exit /b 0" string prints only the hook's output, exit 0. teamai hooks inject rewrites an old-form .codex/hooks.json with no duplicates, hooks remove still recognizes the old entries as teamai's, and Claude and CodeBuddy output is unchanged. The POSIX command is unchanged. CI is green and the CI review reported no findings; I agree. I added that record to the body. Windows itself was not run: the cmd.exe side is reasoned from Codex 0.166.0's runner, which passes the string to cmd unescaped.
Non-blocking:
- [P2 non-blocking] The new comment says the bare team dispatcher keeps the blocking contract. Under an explicit PowerShell shell,
pwsh -Commandturns a child's exit 2 into exit 1, so a blocking team hook reaches Codex as a plain failure. That was already the case before this PR; the comment should say the contract holds under cmd. - [P3 nit]
codex-internalandtcodexshare the Codex format and get the wrapper too; the tests cover onlycodex. - [P3 nit] The
currentCodexWindowstest helper re-derives the expected string instead of asserting the literal.
Approving. Merges once CI is green at this head.
Codex 0.166.0 on Windows can run `commandWindows` through the session's PowerShell instead of cmd.exe. The built-in form `... 2>nul & exit 0` then started a PowerShell background job and printed its table to the hook's stdout, so Stop returned invalid JSON. The built-in Windows dispatch is now wrapped in `cmd.exe /d /s /c`; team-hook dispatchers and the POSIX `command` are unchanged. Closes Tencent#1578
Summary
Fixes #1578.
Codex's Windows hook payload can be executed by an explicitly selected PowerShell session, not only by the
%COMSPEC%fallback. The generatedcommandWindowsbuilt-in form previously exposed cmd syntax (&andexit 0) directly to PowerShell, which caused aBackgroundJobtable to be written to hook stdout instead of the expected hook response.This change keeps the portable POSIX
commandunchanged and wraps the Windows built-in dispatch in an explicitcmd.exe /d /s /cinvocation. Team-hook dispatcher commands remain bare so their blocking exit status and stderr continue to reach Codex.Validation
npx.cmd vitest run src/__tests__/hooks.test.ts -t "Codex format"— 3 passednpx.cmd vitest run src/__tests__/builtin-hooks.test.ts src/__tests__/codex-team-hooks.test.ts— 23 passednpm run typecheck— passednpm run lint— 0 warnings / 0 errorsnpm run build— passedgit diff --check— passedteamai init --self --agent codex --forcegenerated the expectedcommandWindowsvalue in a disposable workspace. The unrelated registration push was intentionally pointed at a non-routable fixture remote; local hook generation and assertion completed.The full provider/agent matrix and a fresh Codex session are left to CI because they require the corresponding host installation.
Disclosure and authorization
Slai Agent Runtime performed the investigation, implementation, and test execution. The account owner authorized this contribution and is responsible for its content.
Real-CLI record (added by a reviewer)