Skip to content

fix(plugin): find the Codex CLI the desktop app ships - #383

Merged
runkids merged 7 commits into
mainfrom
runkids/codex-cli-fallback
Oct 4, 2026
Merged

runkids merged 7 commits into
mainfrom
runkids/codex-cli-fallback

Conversation

@runkids

@runkids runkids commented Oct 4, 2026

Copy link
Copy Markdown
Owner

Type

  • Bug fix
  • Small improvement (docs, typo, minor refactor)
  • Feature proposal (proposals/ only — see CONTRIBUTING.md)

Linked Issue

Refs #338

Summary

Plugin commands ran the bare name codex from PATH. A machine with only the Codex desktop app, or a scheduled job with a minimal PATH, reported the CLI as missing, and the account-only cli override could not help the default codex target or a config shared between macOS and Windows.

  • When codex is not on PATH, Skillshare now tries Homebrew (/opt/homebrew/bin, /usr/local/bin) and the CLI the Codex app ships: Codex.app/Contents/Resources/codex in /Applications or ~/Applications on macOS, and %LOCALAPPDATA%\OpenAI\Codex\bin\<hash>\codex.exe on Windows (newest one).
  • SKILLSHARE_CODEX_CLI overrides the search on one machine, without touching the synced config.
  • An account target with its own cli is unchanged.
  • The missing-CLI error lists every place searched (plugins.error.codexMissing with a looked argument), in the CLI and in the dashboard's "Not installed" group, which now expands to show it. Translated in all 11 locales.
  • Docs: environment variables, troubleshooting, cross-machine sync, plugin reference, and the sharing guide (en, zh-Hant, zh-Hans, ja, ko), plus the built-in skill's plugin reference.

Verification

  • make check in the devcontainer: passed.
  • UI: vitest run 873/873 (one earlier run had a single failure while make check ran in parallel; two reruns passed), pnpm run build passed.
  • Website: docusaurus build for en, zh-Hant, zh-Hans, ja and ko, no broken links or anchors.
  • Windows 11 ARM64 (UTM), commit 18fe9b6, desktop user with full token, PATH reduced to system folders as a scheduled job would have, ss plugin list --json:
    • app only: Codex ready, codex-cli 0.160.0, its bundled plugins listed
    • SKILLSHARE_CODEX_CLI=C:\nope\codex.exe: missing, error names the variable
    • no app CLI found: missing, error lists PATH and the %LOCALAPPDATA% pattern
  • Not run: the macOS app bundle path on a real Mac background job (covered by unit tests and the path documented in openai/codex issues); the Windows basic-user token (no symlink behavior involved); a browser screenshot of the dashboard row (covered by a vitest).

Checklist

  • I've read CONTRIBUTING.md
  • Tests included and passing (make check) — for code changes
  • No unrelated changes in the diff
  • Scope is focused — one concern per PR

Plugin commands ran the bare name `codex` from PATH, so a machine with only
the Codex desktop app, or a scheduled job started with a minimal PATH,
reported the CLI as missing. The account-only `cli` override did not help:
the default codex target cannot set it, and an absolute path in a config
shared between macOS and Windows is wrong on one of them.

When `codex` is not on PATH, look in Homebrew's folders and the CLI the app
installs (Codex.app on macOS, %LOCALAPPDATA%\OpenAI\Codex\bin on Windows).
SKILLSHARE_CODEX_CLI overrides the search on one machine without touching
the synced config. The missing-CLI error now lists every place searched, in
the CLI and the dashboard.

Refs #338
The plugin reference and the sharing guide still said every native CLI must
be on PATH, and the built-in skill told agents a missing CLI has no
fallback. Codex now has one, plus a machine-local override that agents
should prefer over a path in a shared config.

Refs #338
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-04T07:02:50.981620Z 1f09925 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8944ea638c

ℹ️ 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".

Comment thread internal/plugin/codex_cli.go Resolved
Comment thread internal/plugin/codex_cli.go Resolved
Comment thread internal/plugin/codex_cli.go Resolved
Comment thread internal/plugin/codex_cli.go Resolved
Since the Codex desktop app merged with ChatGPT, macOS installs it as
ChatGPT.app, so an app-only Mac with a minimal PATH still reported Codex as
missing. Try ChatGPT.app before Codex.app in /Applications and
~/Applications, the order Codex's own desktop-app finder uses.

Refs #338
@runkids

runkids commented Oct 4, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 76b11ec51e

ℹ️ 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".

Comment thread internal/plugin/codex_cli.go Resolved
ChatGPT Desktop 26.924 removed Contents/Resources/codex and ships the CLI
at the entrypoint its package manifest declares, codex-cli/bin/codex, so a
current app-only Mac still reported Codex as missing. Try that entrypoint
first in each app bundle and keep the old path for earlier builds.

Refs #338
@runkids

runkids commented Oct 4, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c8d7fb4408

ℹ️ 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".

Comment thread internal/plugin/codex_cli.go Outdated
return paths
case "windows":
if f.localAppData != "" {
return []string{filepath.Join(f.localAppData, "OpenAI", "Codex", "bin", "*", "codex.exe")}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include the official Windows standalone install path

When Codex is installed with the official PowerShell installer and Skillshare runs from a scheduled job with a minimal PATH, this branch searches only the desktop app's relocated runtime. The official installer defaults its visible executable to %LOCALAPPDATA%\Programs\OpenAI\Codex\bin\codex.exe, so this supported installation is reported as missing unless the user also configures SKILLSHARE_CODEX_CLI. Include that fixed path among the Windows candidates so the minimal-PATH fallback covers the standard standalone installation.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 1f09925. Windows now tries %LOCALAPPDATA%\Programs\OpenAI\Codex\bin\codex.exe (the installer's defaultVisibleBinDir) before the desktop app's copy, mirroring Homebrew before the app bundle on macOS. Covered by TestCodexFinderPrefersWindowsInstaller; TestCodexFinderListsWhereItLooked now expects it in the searched places. The environment-variable docs and the built-in skill list it.

The official PowerShell installer puts codex.exe in
%LOCALAPPDATA%\Programs\OpenAI\Codex\bin and adds it to the user PATH. A job
started without that PATH missed it, the same gap Homebrew's folders cover
on macOS. Try it before the desktop app's copy.

Refs #338
@runkids

runkids commented Oct 4, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1f09925f60

ℹ️ 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".

Comment thread internal/plugin/native.go Outdated
Comment on lines +141 to +142
if bin != "codex" {
return run(ctx, dir, env, bin, args...)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve an explicit account CLI named codex

When a Codex account explicitly configures the valid bare executable cli: codex, this condition still enters the machine-wide finder, so SKILLSHARE_CODEX_CLI or a bundled app executable can replace the account's configured CLI. This contradicts the documented contract that an account with its own cli is not searched and can make that account run a different Codex binary; track whether account.CLI was supplied rather than inferring it from the resulting string.

AGENTS.md reference: AGENTS.md:L15-L15

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 6205a54. Service.run now searches only when the account sets no cli; an explicit cli: codex runs as written. TestCodexAccountCLIIsNotSearched now uses the bare name codex (it used an absolute path before, which never reached the search) and failed before the change.

The Codex search ran whenever the executable was the bare name codex, so an
account that set cli: codex could get SKILLSHARE_CODEX_CLI or the app's CLI
instead, against the documented rule that an account's own cli is kept.
Search only when no account cli is set.

Refs #338
@runkids
runkids merged commit 70cb287 into main Oct 4, 2026
8 checks passed
@runkids
runkids deleted the runkids/codex-cli-fallback branch October 4, 2026 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant