fix(codex): bundle codex-code-mode-host next to the codex binary#3603
Conversation
The codex 0.140.0 -> 0.144.0 bump (#3567) introduced a new runtime dependency: codex resolves codex-code-mode-host as a sibling of its own executable and routes all command execution through it for code-mode models (gpt-5.6 family advertises tool_mode: code_mode_only). We only shipped codex and rg into .vite/build/codex-acp, so Codex sessions could chat but every command/edit failed with the host binary missing. Download the host from the same codex release, stage it next to codex, and make the packaged-app verification fail the release when any codex sibling binary is missing. Generated-By: PostHog Code Task-Id: 541351db-2923-49df-8b67-45e277f5dce8
|
😎 Merged directly without going through the merge queue, as the queue was empty and the PR was up to date with the target branch - details. |
Prompt To Fix All With AIFix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
.github/workflows/code-release.yml:205
**Linux And Windows Packages Stay Unchecked**
This required-binary check only runs in the macOS release job. If staging skips a missing platform-specific source on Linux or Windows, packaging still succeeds and those artifacts can ship without `codex-code-mode-host`, leaving code-mode sessions unable to run commands.
### Issue 2 of 2
apps/code/scripts/download-binaries.mjs:49-52
**Windows Archive Name Is Assumed**
The new Windows host download assumes the ZIP member is named `codex-code-mode-host-${target}.exe`. If the release archive contains the target-suffixed host without `.exe`, extraction succeeds but the rename is skipped and `downloadBinary` throws `Binary not found after extraction`, blocking Windows setup and release builds. The current tests cover HTTP retries but not this Windows archive contract.
Reviews (1): Last reviewed commit: "fix(codex): bundle codex-code-mode-host ..." | Re-trigger Greptile |
| # codex resolves codex-code-mode-host and rg as siblings of its own | ||
| # executable; shipping codex without them breaks command execution | ||
| # at runtime (code-mode models route all commands through the host). | ||
| for f in codex codex-code-mode-host rg; do |
There was a problem hiding this comment.
Linux And Windows Packages Stay Unchecked
This required-binary check only runs in the macOS release job. If staging skips a missing platform-specific source on Linux or Windows, packaging still succeeds and those artifacts can ship without codex-code-mode-host, leaving code-mode sessions unable to run commands.
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/code-release.yml
Line: 205
Comment:
**Linux And Windows Packages Stay Unchecked**
This required-binary check only runs in the macOS release job. If staging skips a missing platform-specific source on Linux or Windows, packaging still succeeds and those artifacts can ship without `codex-code-mode-host`, leaving code-mode sessions unable to run commands.
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Fixed in b51839c: added Verify package steps to the publish-windows and publish-linux jobs, checking codex, codex-code-mode-host, and rg in the unpacked electron-builder output (win-unpacked, linux-unpacked / linux-arm64-unpacked) before artifacts upload.
| const codexArchiveBinaryName = (binary) => (target) => | ||
| process.platform === "win32" | ||
| ? `${binary}-${target}.exe` | ||
| : `${binary}-${target}`; |
There was a problem hiding this comment.
Windows Archive Name Is Assumed
The new Windows host download assumes the ZIP member is named codex-code-mode-host-${target}.exe. If the release archive contains the target-suffixed host without .exe, extraction succeeds but the rename is skipped and downloadBinary throws Binary not found after extraction, blocking Windows setup and release builds. The current tests cover HTTP retries but not this Windows archive contract.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/scripts/download-binaries.mjs
Line: 49-52
Comment:
**Windows Archive Name Is Assumed**
The new Windows host download assumes the ZIP member is named `codex-code-mode-host-${target}.exe`. If the release archive contains the target-suffixed host without `.exe`, extraction succeeds but the rename is skipped and `downloadBinary` throws `Binary not found after extraction`, blocking Windows setup and release builds. The current tests cover HTTP retries but not this Windows archive contract.
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Verified against the actual rust-v0.144.0 release asset: codex-code-mode-host-x86_64-pc-windows-msvc.exe.zip contains exactly one member, codex-code-mode-host-x86_64-pc-windows-msvc.exe, matching archiveBinaryName (same target-suffixed convention as the codex zip we already ship from). If upstream ever changes the member name, downloadBinary throws Binary not found after extraction at postinstall/CI time — a loud failure at build time, not a broken package at runtime — so no defensive handling added.
The packaged-app binary check only ran in the macOS release job, so a windows or linux package missing codex-code-mode-host (or codex/rg) would still ship. Check the unpacked electron-builder output on all three platforms. Generated-By: PostHog Code Task-Id: 541351db-2923-49df-8b67-45e277f5dce8
richardsolomou
left a comment
There was a problem hiding this comment.
would be worth adding pre-merge coverage for the new host staging path. rn the release checks only run on v* tags and download-binaries.test.mjs only covers HTTP retries, so a typo here wouldnt show up until release packaging.
Generated-By: PostHog Code Task-Id: f00e3e6c-6f38-4baa-8df1-ddb7547129a1
Generated-By: PostHog Code Task-Id: f00e3e6c-6f38-4baa-8df1-ddb7547129a1
|
Could not verify team-posthog-code membership (GitHub API error). Auto-release is limited to Team PostHog Code members, so this will ship with the next scheduled release instead. |
|
👋 Visual changes detected for this PR. Review and approve in PostHog Visual Review If these changes are unexpected, they may be caused by a flaky test or a broken snapshot on master. Don't approve — rerun the job or wait for a fix. |
Problem
Two users reported that after updating to v0.57.237, Codex sessions can chat but cannot run any terminal commands or edit files — the agent reports a missing binary at
.../app.asar.unpacked/.vite/build/codex-acp/codex-code-mode-host.Why: the codex 0.140.0 → 0.144.0 bump in #3567 introduced a new runtime dependency. In codex 0.144, the gpt-5.6 model family advertises
tool_mode: code_mode_onlyin codex's bundled model metadata (which overridesfeatures.*config), so all command execution routes through code-mode cells. With thecode_mode_hostfeature stable/default-on, those cells run in a standalonecodex-code-mode-hostprocess that codex resolves as a sibling of its own executable. We only shipcodexandrginto.vite/build/codex-acp/, so every exec fails while chat keeps working.Changes
download-binaries.mjs: fetchcodex-code-mode-hostfrom the sameopenai/codexrelease ascodex(shared version const so they can't drift), and deduplicate the identicalgetTarget/URL logic.vite-main-plugins.mts: stage the host next tocodexin.vite/build/codex-acp/(also removes a stray duplicatecodexentry left over from the codex-acp removal in feat(codex)!: remove the codex-acp harness, app-server is the only codex adapter #3198). It ships via the existingasarUnpackglob and gets ad-hoc signed on macOS like its siblings; the inherit entitlements already allow JIT, which the host's embedded V8 needs.code-release.yml: the packaged-app verification now fails the release if any codex sibling binary is missing, so this class of regression can't ship again.How did you test this?
node apps/code/scripts/download-binaries.mjson linux-x64: all three binaries download, the host extracts and renames from its target-suffixed archive name, and executes (exit 0).vitest run apps/code/scripts/download-binaries.test.mjs: 6/6 pass.resolve_host_program()in codex 0.144'scode-mode/src/remote_session.rsjoinscodex-code-mode-hostontocurrent_exe().parent(), matching the exact path in the user reports.Automatic notifications
Created with PostHog Code