t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: Codex one-click update always fails when the CLI is the ChatGPT.app-bundled binary

Open YL404 opened this issue 1 month ago • 3 comments

Summary

When the configured Codex binary is the CLI bundled inside ChatGPT.app, T3 Code offers a one-click update (version advisory behind_latest, canUpdate: true) that always fails immediately. The bundled CLI refuses to self-update, so the button can never work.

Environment

  • T3 Code (Nightly) 0.0.46-nightly.20261005.2702, macOS (darwin arm64)
  • Codex binary path: /Applications/ChatGPT.app/Contents/Resources/codex-cli/bin/codex (the workaround recommended in #10514 for users who have ChatGPT desktop but no standalone CLI on PATH)
  • codex-cli 0.160.0 (ChatGPT.app bundle), npm @openai/codex@latest = 0.160.1

Steps to reproduce

  1. Settings → Providers → Codex → Binary path = the ChatGPT.app path above.
  2. Wait for the "Codex update available" toast.
  3. Click Update.

Actual

The toast reports "Provider update failed — Codex: Update command exited with code 1." T3 runs /Applications/ChatGPT.app/.../codex update, which exits 1 in ~25 ms:

Error: Could not detect the Codex installation method. Please update manually: https://developers.openai.com/codex/cli/

Server trace shows three attempts, each runCommand completing in 20–28 ms — nothing is downloaded or installed. The install itself is fine; only the offered one-click path is broken.

Direct reproduction, no T3 involved:

CODEX_HOME=$(mktemp -d) /Applications/ChatGPT.app/Contents/Resources/codex-cli/bin/codex update
# exit 1, same error

The cached snapshot confirms the advisory:

"versionAdvisory": {
  "status": "behind_latest",
  "currentVersion": "0.160.0",
  "latestVersion": "0.160.1",
  "updateCommand": "/Applications/ChatGPT.app/Contents/Resources/codex-cli/bin/codex update",
  "canUpdate": true
}

Expected

Either the update works, or the install is treated as manual-only (no one-click button), the way mise-managed installs already are.

Root cause

resolvePackageManagedProviderMaintenance in apps/server/src/provider/providerMaintenance.ts falls back to the provider's own updater for any install no package manager proves (from #15416, commit fe93a5dbd). The ChatGPT-bundled CLI is not the standalone layout (no /packages/standalone/ in the path) and no package manager owns the path, so capabilities resolve to <path> update (lockKey: codex-native), which sets canUpdate: true. That build is updated by the ChatGPT app and cannot detect its own installation method, so the fallback is guaranteed to fail.

Proposed fix

Treat a provider executable inside a macOS app bundle (path containing .app/Contents/) as manual-only in resolvePackageManagedProviderMaintenance, next to the existing mise branch. canUpdate then becomes false, updateCommand is null, and the toast offers Settings instead of a button that cannot work. The rule is generic: any provider binary shipped inside an app bundle belongs to that app, not to T3.

YL404 avatar Oct 06 '26 03:10 YL404

[!NOTE] Grok responding on behalf of Julius.

Triage

Thanks for the precise report and for tracking down the code path, @YL404! This matches what we see in the code, and it looks like a regression from #15416.

What I found

  • resolvePackageManagedProviderMaintenance (apps/server/src/provider/providerMaintenance.ts) only treats a Codex install as native when the path contains /packages/standalone/ (isCodexStandaloneCommandPath in apps/server/src/provider/Drivers/CodexDriver.ts). Anything else without a proven package manager falls through to the provider's own updater.
  • The ChatGPT.app binary (/Applications/ChatGPT.app/Contents/Resources/codex-cli/bin/codex, and the older path from #10514 under Contents/Resources/codex) doesn't match that layout, npm, mise, or Homebrew, and isn't under node_modules. So the advisory gets update set to <binary> update (lockKey: codex-native), which sets canUpdate: true and shows the Update button.
  • That command can't succeed: the bundled CLI exits 1 right away with "Could not detect the Codex installation method" because the ChatGPT app owns the install. The ~25 ms trace with nothing downloaded is consistent with that refusal.
  • Mise installs already stay manual-only for a similar reason.

Likely fix area

  • One option is the one you suggested: keep the behind_latest advisory but treat provider executables inside a macOS app bundle (path containing .app/Contents/) as manual-only, next to the mise branch, so canUpdate is false and the toast points to Settings instead of a button that always fails.
  • #16352 is open along those lines. #14256 touches the related hint text for installs T3 Code can't update.

A maintainer will decide on the fix direction.

juliusmarminge avatar Oct 06 '26 03:10 juliusmarminge

Still reproduces on 0.0.46-nightly.20261012.3010 with the ChatGPT.app bundle at codex-cli 0.162.0-alpha.17.2: codex update exits 1 with "Could not detect the Codex installation method".

Workaround: point the Codex binary path at a standalone install (a pnpm global install in my case), where codex update works.

jadenexpitrans avatar Oct 12 '26 15:10 jadenexpitrans

Closing for housekeeping — the bug is still valid and was confirmed to reproduce on recent nightlies. For whoever picks this up later: PR #16352 implemented the manual-only fix but was closed by mistake and never reopened/merged.

YL404 avatar Oct 13 '26 02:10 YL404