Repository navigation
fix(install): npm CLIs keep their platform binary and must start (v1.5.1) - #56
Merged
Merged
Conversation
Codex ships its native binary as a per-platform optional dependency (@openai/codex-linux-arm64, ...). An in-place npm install can drop it, and the CLI then fails with "Missing optional dependency" while the install reported success. ak install and ak update now run npm install -g with --include=optional, then probe the installed copy's --version. A CLI that does not start is uninstalled and installed once more; still failing, the install fails with the CLI's own error instead of printing "installed". ak doctor reports a CLI that resolves but does not start as a problem with the exact repair; the doctor JSON shape is unchanged (version_status stays unknown). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review findings on the start check: - the post-install --version probe ran the freshly installed CLI (and the unpinned dependencies npm fetched for it) with the full process environment; it now gets the same key-free environment npm gets (common.probe_status takes env), and a test plants a key in the process environment to prove it; - the clean reinstall runs only when the broken copy lives in npm's global prefix; a broken copy npm did not install is reported, never reinstalled over, and doctor names the npm repair only for a copy in that prefix; - doctor runs one --version per CLI (version and start problem from the same probe), and install and doctor share one rule: a non-zero exit; - the update scope now covers a release that does not start: a failed update, one JSON document, exactly one clean reinstall, the pin kept. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member
Author
Self-review: head
|
| # | Finding | Fix |
|---|---|---|
| Major | The post-install --version probe ran the new CLI, and the unpinned dependencies npm fetched for it, with every key in the process environment. |
common.probe_status takes env, and the probe gets the key-free installer_env. The new check plants a key in os.environ. I confirmed it fails when env= is removed. |
| Minor | The repair could reinstall over a copy npm never wrote, for example a vendor copy first on PATH. | The uninstall and reinstall run only when the broken copy is under npm's global prefix. Otherwise ak reports the copy and repairs nothing. A new check proves npm uninstall never runs in that case. |
| Minor | Doctor's fix text assumed the broken copy came from npm. | Doctor gives the npm repair only for a copy in npm's prefix. Otherwise it says "remove or repair the broken copy at ". Both cases are tested. |
| Minor | A hanging CLI cost doctor two probes. | Doctor now takes the version and the start problem from one --version. |
| Minor | Install and doctor used different rules for "does not start". | Both use one rule: a non-zero exit. |
| Minor | The update scope had no broken case. | New scenario: a verified release that does not start. It produces a failed update, one JSON document, exactly one clean reinstall, and an unchanged pin. |
Nits: the note about npm 6 and 7 is now in docs/install.md, and the update.md wrap is fixed.
Unchanged: interface 1 and the doctor-v1 shape (version_status stays unknown). The code uses the stdlib only, and ak itself prints no key value.
Gate: bash tests/run.sh gives 2956 passed, 0 failed, 1 skipped. Public hygiene is clean.
Stamps 1.5.1: lib/common.py VERSION, the skills' versions, every pinned install line (README, docs/install.md, docs/setup.md, the skills), the schema $id URLs, the doctor example, the issue template, the addon registry and AGENTS.md, and the test version checks. CHANGELOG gets the 1.5.1 section and the missing 1.5.0 and 1.5.1 compare links. The contract scope keeps its historical 1.5.0 reference (the release that added the tokens field) and the update scope its 1.4.0 references. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member
Author
Self-review: head
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
This was reported from a Linux aarch64 devcontainer. Codex's own in-CLI update ran
npm install -g @openai/codex, which dropped the optional dependency that carries the platform binary (@openai/codex-linux-arm64). Every laterak codexthen failed with:The reported workaround worked:
npm uninstall -g @openai/codex && npm install -g @openai/codex@latest --include=optional.The in-CLI update itself is Codex's, not ak's, so ak cannot verify it. ak's own npm path (
ak install,ak update) had the same gap, though: it never passed--include=optional, and it called an install a success without checking that the CLI starts.Change
--include=optional:ak installandak updatenow runnpm install -g --include=optional <verified tarball>.<cli> --version. It probes npm's prefix copy, or the copy PATH resolves; on Windows only the resolved.cmd.npm uninstall -g <package>and installs once more.ak doctor: a CLI that resolves but whose--versionexits non-zero becomes a problem. The problem quotes the CLI's error and names the repair:npm uninstall -g <package>, then ak install <cli>. The doctor JSON shape is unchanged:version_statusstaysunknown, so interface 1 is untouched.npm_prefix_binmoves toinstaller.pyandupdate.pyreuses it.install.md,update.md,doctor.mdand the CHANGELOG[Unreleased]section are updated.Tests
tests/py/install_checks.py:doctorscope: a broken codex is exactly one problem, which quotes the error and names the repair, andversion_statusstaysunknown. A CLI that starts but prints an odd line is not called broken.updatescope: the update installs with--include=optional, and a CLI that starts is not reinstalled.bash tests/run.shgives 2949 passed, 0 failed, 1 skipped. Public hygiene is clean.🤖 Generated with Claude Code