You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(server): managed Codex on Windows no longer adopts a .cmd shim - #45513
On Windows, managed Codex fails its provider probe with Codex App Server protocol operation 'decode-wire-message' failed when codex on PATH is a batch shim, such as pnpm's global %LOCALAPPDATA%\pnpm\codex.cmd. CodexInstallation adopts any supported local codex, and treats every non-.exe on win32 as a launcher. The managed launch passes quoted -c overrides whose auth command is the desktop exe path (...\T3 Code (Beta).exe). The .cmd runs through cmd.exe, the shim re-expands %* inside an IF ( ... ) block, the ) from (Beta) closes that block early, and cmd echoes the command line to stdout. The protocol then fails to parse that line as JSON. Full chain and a standalone repro are in #45510.
Change
localKind() now returns null for .cmd/.bat on win32, which is the same condition resolveSpawnCommand uses to run a command through shell: true. A batch launcher on PATH is skipped, and resolve() falls back to T3's managed native build.
This also covers npm's codex.cmd, which managed mode adopted before. With this change, a Windows user whose only newer Codex comes from npm or pnpm gets the managed build instead. If no managed release is installed yet, the provider shows "Set up Codex to get started." until they install it. I haven't checked whether npm's shim survives the managed args, so I left out a narrower npm-only exception. .exe launchers (Volta, mise, Scoop, bun) and "existing" setup are unchanged, since CodexInstallation only backs managed mode.
Found it: on Windows 11 with T3 Code 0.1.13, a pnpm-global Codex 0.171.0 and the managed Codex 0.166.0, I rebuilt the probe's command line (T3's escaping and managed launch args) and ran it against pnpm's codex.cmd. stdout had a non-JSON echo line, stderr had ...}}" was unexpected at this time., and the exit code was 255. The same args spawned directly against the managed codex.exe, and against pnpm's vendored native codex.exe, returned a clean JSON initialize response. The minimal repro in [Bug]: Windows: managed Codex probe fails with 'decode-wire-message' when codex on PATH is a pnpm .cmd shim #45510 fails with a path containing (Beta) and passes without the parentheses. That was on the 0.1.13 build. The code path is unchanged on main.
Test: a new case in CodexInstallation.test.ts puts codex.cmd (and codex.BAT) on a win32 PATH, with a fake spawner that answers as a supported Codex and a seeded managed install. On main it fails, and resolve() returns { source: "local", executablePath: ".../local/codex.cmd" }. With the fix it returns the managed codex.exe. The whole file passes (43 tests), and vp run check:changed passes (format, lint, knip, typecheck, tests).
Not checked: I haven't run the patched build on Windows. The test runs on Linux with platform: "win32".
On Windows, managed Codex adopted a supported codex.cmd or codex.bat on
PATH, such as pnpm's global shim. Managed launches pass quoted -c
overrides that cmd.exe re-parses through the shim's %*, so the probe
read cmd's echoed command line and failed with decode-wire-message.
Batch launchers now resolve to the managed native build instead.
Fixespingdotgg#45510
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Macroscope's review found this PR approvable — Windows batch shims are no longer adopted as local Codex runtimes, avoiding argument-reparsing problems and retaining the existing managed-runtime fallback. The change is limited to those shim types and introduces no material risk requiring human judgment.
You can add or adjust custom eligibility rules. Learn more.
Reviewing files that changed from the base of the PR and between a27da78 and 0e083d6.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
On Windows, .cmd and .bat Codex paths are no longer accepted as local installations. Tests verify that resolution selects the managed codex.exe when those shims report a supported version.
Changes: Windows Codex resolution
Layer / File(s)
Summary
Reject batch shims and verify managed resolution apps/server/src/provider/CodexInstallation.ts, apps/server/src/provider/CodexInstallation.test.ts
On Windows, localKind returns null for .cmd and .bat paths. Tests cover both extensions and verify that resolution selects the managed bin/codex.exe.
On Windows, managed Codex no longer adopts .cmd or .bat shims and uses the managed native build instead. This matches the stated intent and has a small blast radius, so merge risk is minimal.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: managed Codex on Windows no longer adopts a .cmd shim. The changeset makes localKind return null for .cmd/.bat on win32, so the managed native build is used. The title…
Linked Issues check
[#45510] The objective is that managed mode must not adopt a .cmd/.bat launcher on win32 and must fall back to T3's managed native build. The head diff of apps/server/src/provider/CodexInstallation.ts…
Out of Scope Changes check
The head diff of CodexInstallation.ts changes only the win32 branch of localKind() (+4/-1 lines). The test change in CodexInstallation.test.ts (per the summary, +70/-2) adds a harness parameter for th…
Description check
The description follows the repository template closely. It has all four required sections: Problem, Change, Scope, and Verification. The Problem section gives the error text, the trigger (a pnpm .cmd…
Full details: Title check
Explanation
The title names the main change: managed Codex on Windows no longer adopts a .cmd shim. The changeset makes localKind return null for .cmd/.bat on win32, so the managed native build is used. The title follows the conventional commit format and is specific.
Full details: Linked Issues check
Explanation
[#45510] The objective is that managed mode must not adopt a .cmd/.bat launcher on win32 and must fall back to T3's managed native build. The head diff of apps/server/src/provider/CodexInstallation.ts changes localKind(): on win32, a path with extension .cmd or .bat now returns null (not adopted). Other non-.exe paths still return "launcher", and .exe paths keep the existing marker and native checks. This removes the shim from resolveLocal(), so resolve() falls through to resolveManaged(). The PR adds a test case for codex.cmd and codex.BAT on a win32 PATH that expects the managed codex.exe. I did not read the test file. The PR reports that the test fails on main and passes with the fix, and that the file passes (43 tests). The fix does not implement the excluded follow-ups (error message improvement #40696, npm/pnpm shim-to-native mapping). The Windows runtime behavior is not verified on a Windows host, which is not a coding requirement. The "existing" setup is not part of this change, per the PR description and the issue; this relies on the claim that localKind is used only by CodexInstallation, which I did not re-verify.
Full details: Out of Scope Changes check
Explanation
The head diff of CodexInstallation.ts changes only the win32 branch of localKind() (+4/-1 lines). The test change in CodexInstallation.test.ts (per the summary, +70/-2) adds a harness parameter for the local executable filename and a Windows regression test, which supports the same objective. No unrelated files are listed in the summary. The npm codex.cmd effect is a direct consequence of the same .cmd/.bat rule. The PR states it, so it is not an unrelated change. The PR does not map npm or pnpm shims to native executables, so it does not add the excluded follow-up work.
Full details: Description check
Explanation
The description follows the repository template closely. It has all four required sections: Problem, Change, Scope, and Verification. The Problem section gives the error text, the trigger (a pnpm .cmd shim on PATH), and the root cause (the (Beta) parenthesis in the desktop exe path closing an IF block in cmd.exe). The Change section states that localKind() returns null for .cmd/.bat on win32 and that resolve() falls back to the managed native build. It also names the side effect for npm/pnpm-only users. The Scope section says this is a bug fix and links #45510. The Verification section lists a reproduction on Windows 11 with versions, a new regression test that fails on main and passes with the fix, the test count, and the lint/typecheck run. It states what was not checked: the patched build was not run on Windows. The model and harness are named, as the template asks.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
CI annotation context is incomplete: annotation collection unavailable or limited
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
The automated pipeline stopped on this pull request and will not merge it:
the fix is written and reviewed, but proving it needs something no worker has:
Permanent blocker: A real first-party ChatGPT OAuth connection with chatgpt.tokens.use.direct token sharing is required to reach the managed Codex app-server status probe on both commits. The brief states this access is unavailable on every worker. Consequently neither the base decode-wire-message failure nor the head probe success was observed.
The reported Windows 11 Beta desktop installation and parenthesized executable-path reproduction remain unverified; the available Windows pool runs Windows Server 2025, and no desktop comparison was launched.
Verified on Windows 11 with pnpm's codex.CMD and a ChatGPT token-sharing sign-in
Setup, identical for every run
Windows 11 Pro 10.0.26200 x64. codex on PATH is pnpm's global shim C:\Users\<user>\AppData\Local\pnpm\codex.CMD (@openai/codex 0.172.0, compatibility supported). No other codex on PATH.
vp run dev --home-dir C:\Users\<user>\.t3-verify --no-seed, isolated from the desktop install, started from a checkout at C:\Users\<user>\Projects\t3code (test).
The parentheses come from the folder. Dev self-invokes as node.exe ...\t3code (test)\apps\server\src\bin.ts.
That entrypoint lands in auth.args of the openai_token_sharing-c override, which is where T3 Code (Beta).exe lands in the packaged app.
The default codex instance with setupMode: "managed", signed in with ChatGPT (token sharing). Same home and same account in every run.
Before is 3257af75e3, the main commit merged into the PR head. After is 0e083d62. git diff --stat 3257af75e3 0e083d62 touches only CodexInstallation.ts and CodexInstallation.test.ts.
Before: main @ 3257af75e3
Provider status: error, version 0.172.0, "Codex app-server provider probe failed: Codex App Server protocol operation 'decode-wire-message' failed.."
The local shim was adopted. During resolveLocal the server ran cmd.exe /d /s /c "^"C:\Users\<user>\AppData\Local\pnpm\codex.CMD^" ^"app-server^" ^"--help^"".
The probe then launched cmd.exe /d /s /c "^"C:\Users\<user>\AppData\Local\pnpm\codex.CMD^" ^"app-server^" ^"-c^" ^"thread_unload_delay_secs=0^" ^"-c^" ^"model_provider=\^"openai_token_sharing\^"^" ^"-c^" ^"model_providers.openai_token_sharing={name=\^"OpenAI^ Token^ Sharing\^"^,.... No child process followed, so cmd.exe failed while parsing the shim.
First start: CodexInstallation.resolve failed with "Codex is not installed in T3 Code. Install it to continue." The shim (0.172.0, supported) is no longer adopted. The UI showed "Set up Codex to get started."
I installed the managed release through provider setup ("Reconnect account" → install). That flow also re-ran the ChatGPT sign-in for the same saved account.
Control: main @ 3257af75e3 again, managed 0.166.0 now installed, same account
Provider status: error, version 0.172.0, decode-wire-message.
So on main the shim still wins over an installed managed release.
Exit code and stderr
T3 doesn't record these, so I replayed the same launch outside T3.
Inputs: escapeWindowsShellArg and managedCodexLaunchArgs copied from 3257af75e3, and tokenizeCliArgs imported from the checkout.
Run like resolveSpawnCommand's .cmd branch: one escaped command line, shell: true, against codex.CMD.
Results:
exit code 255.
stdout line 1 is cmd.exe echoing the command line (1077 chars, not JSON). That's the line decode-wire-message rejects.
stderr, localized on this machine: ...\\apps\\server\\src\\bin.ts\",\"__managed-chatgpt-token\",...],timeout_ms=80000,refresh_interval_ms=0}}" was unexpected at this time.
Differences between runs
Only the commit and the managed release.
The release was absent in Before. The Control run covers that.
The After setup flow re-ran the ChatGPT sign-in, with the same account.
PATH, folder, home, instance and pnpm Codex version were the same throughout.
Separate from this PR: an additional ChatGPT account (codex_<id>, which gets a shadow home) fails earlier on main on this machine: materializeCodexShadowHome → EPERM: operation not permitted, symlink 'C:\Users\<user>\.codex\sessions' -> '...\providers\codex\<id>\shadow\sessions'. It happens without Windows symlink privilege, i.e. no Developer Mode or admin. That's why these runs use the default codex instance, which has no shadow home. I can file it separately.
Verification run by Claude Opus 5.5 in T3 Code on the reporter's machine.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:XS0-9 changed lines (additions + deletions).takeover:blockedTakeover blocked; reason in the PR bodyvouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Windows, managed Codex fails its provider probe with
Codex App Server protocol operation 'decode-wire-message' failedwhencodexon PATH is a batch shim, such as pnpm's global%LOCALAPPDATA%\pnpm\codex.cmd.CodexInstallationadopts any supported localcodex, and treats every non-.exeon win32 as a launcher. The managed launch passes quoted-coverrides whose auth command is the desktop exe path (...\T3 Code (Beta).exe). The.cmdruns throughcmd.exe, the shim re-expands%*inside anIF ( ... )block, the)from(Beta)closes that block early, and cmd echoes the command line to stdout. The protocol then fails to parse that line as JSON. Full chain and a standalone repro are in #45510.Change
localKind()now returnsnullfor.cmd/.baton win32, which is the same conditionresolveSpawnCommanduses to run a command throughshell: true. A batch launcher on PATH is skipped, andresolve()falls back to T3's managed native build.This also covers npm's
codex.cmd, which managed mode adopted before. With this change, a Windows user whose only newer Codex comes from npm or pnpm gets the managed build instead. If no managed release is installed yet, the provider shows "Set up Codex to get started." until they install it. I haven't checked whether npm's shim survives the managed args, so I left out a narrower npm-only exception..exelaunchers (Volta, mise, Scoop, bun) and "existing" setup are unchanged, sinceCodexInstallationonly backs managed mode.Scope
Bug fix. Fixes #45510.
Verification
codex.cmd. stdout had a non-JSON echo line, stderr had...}}" was unexpected at this time., and the exit code was 255. The same args spawned directly against the managedcodex.exe, and against pnpm's vendored nativecodex.exe, returned a clean JSONinitializeresponse. The minimal repro in [Bug]: Windows: managed Codex probe fails with 'decode-wire-message' when codex on PATH is a pnpm .cmd shim #45510 fails with a path containing(Beta)and passes without the parentheses. That was on the 0.1.13 build. The code path is unchanged onmain.CodexInstallation.test.tsputscodex.cmd(andcodex.BAT) on a win32 PATH, with a fake spawner that answers as a supported Codex and a seeded managed install. Onmainit fails, andresolve()returns{ source: "local", executablePath: ".../local/codex.cmd" }. With the fix it returns the managedcodex.exe. The whole file passes (43 tests), andvp run check:changedpasses (format, lint, knip, typecheck, tests).platform: "win32".Written with Claude Opus 5.5 in Claude Code.
🤖 Generated with Claude Code