Repository navigation
Closed
Description
Short summary
Clicking Update on an outdated skill (and the background auto-update) fails with "skills update exited with code 126". The failure is caused by Orca resolving npx to an asdf shim whose declared node version is not installed; the dialog headline gives no hint about the real cause.
Environment
- macOS (arm64)
- Orca 1.4.180
- Node managed with asdf;
~/.asdf/shimsprecedes/opt/homebrew/binin the shell PATH, and the app was launched from a terminal so it inherits that ordering
What happened
- Skill freshness dialog reports an outdated skill
- Clicking Update shows "The update didn't finish" with message
skills update exited with code 126 - The run log contains the asdf shim's stderr:
No version is set for command npx / Consider adding one of the following versions in your config file at .../.tool-versions / nodejs 22.22.2
Root cause
SkillUpdateRunnerresolvesnpxviaresolveCliCommand('npx')(src/shared/node-cli-command-resolution.ts)- That resolver only checks
accessSync(X_OK), which asdf/mise shims pass, so~/.asdf/shims/npxis chosen over a realnpxlater in PATH (e.g./opt/homebrew/bin/npx) - The shim itself then exits 126 because the node version declared in
~/.tool-versions(nodejs 24.9.0) is not installed (only 22.22.2), so asdf cannot exec anything patchPackagedProcessPath(src/main/startup/configure-process.ts) only prepends missing dirs; it never reorders an inherited PATH where shims come before real binaries, so the broken shim wins- The runner turns exit code 126 into the bare message
skills update exited with code 126(src/main/skills/skill-update-run.ts), which is not actionable
In a login shell the same machine resolves npx to /opt/homebrew/bin/npx and the update works, which is why this looks like a recent Orca regression: no skill-update/CLI-resolution code changed in v1.4.176..v1.4.180 — the trigger is environment PATH ordering.
Repro
- asdf with
~/.tool-versionsdeclaring a node version that is not installed (asdf installmissing), only an older one installed - PATH ordered with
~/.asdf/shimsbefore/opt/homebrew/bin - Launch Orca from that shell (inherited PATH), open Skills, click Update on an outdated skill
- Observe exit code 126
Expected behavior
- The update should not be permanently blocked by a dead shim: when the resolved
npxis a version-manager shim that exits 126 on POSIX, Orca should fall back to the next runnablenpxcandidate in PATH (e.g./opt/homebrew/bin/npx) and retry once - If the retry also fails, the message should name the resolved binary and suggest checking the version-manager config (install the declared node version)
Proposed fix
In SkillUpdateRunner (src/main/skills/skill-update-run.ts):
- Resolve all runnable
npxcandidates (new shared helper alongsideresolveCliCommand) - On POSIX, if the spawned candidate exits 126 and another candidate exists, respawn with the next candidate once, same run token
- If it still fails, include the resolved binary path and a version-manager hint in the error message instead of a bare exit code
Relevant files:
- src/main/skills/skill-update-run.ts
- src/shared/node-cli-command-resolution.ts
- src/main/startup/configure-process.ts
Activity
manuaudio commentedon Aug 11, 2026
Every citation in this checks out, including the "not a regression" claim, which I verified independently. Two things to add to the root cause and three traps in the proposed fix. Checked against
upstream/mainata0a654c3a9.Confirming what you found
isRunnableCommand(src/shared/node-cli-command-resolution.ts:70-86) is exactly the predicate you describe —statSync().isFile()plusaccessSync(candidate, constants.X_OK), nothing more. An asdf shim is a real, executable file, so it passes and wins on first match.patchPackagedProcessPath(src/main/startup/configure-process.ts:130-134) confirms the second half:And the runner's bare message is at
src/main/skills/skill-update-run.ts:179, resolving npx at:92-94.Your regression claim holds and I'd state it more strongly. Across the 317 commits in
v1.4.176..upstream/main,skill-update-run.ts,node-cli-command-resolution.tsandcli/handlers/skills.tsare untouched.configure-process.tsshows two commits — but they're17b3dff3c4and its revert17cfc968cf, andgit diff v1.4.176 upstream/main -- src/main/startup/configure-process.tsis empty. Net zero. Nothing in this path moved.Two additions to the root cause
The fallback list has the same preference baked in. You frame this as inherited PATH ordering, but even with a clean PATH the resolver would still pick the shim:
getBaseVersionManagerDirectoriesputsjoin(homePath, '.asdf', 'shims')at position two (:91), ahead of~/.local/binand everything else. So the shim preference isn't only environmental — it's in the resolver's own fallback order.The PATH patcher is disabled by the very thing that would have saved you.
/opt/homebrew/binis inextraPathsand gets prepended when missing — which would have put the real npx first. But your PATH already contains it (just later), so it isn't "missing" and never gets promoted. Having homebrew on PATH is what stops the patcher from fixing the ordering. (It's alsoapp.isPackaged-gated at:94-96, so it does nothing in dev at all.)Trap 1 — this is one call site of seven
src/main/codex-cli/command.tsis a single line:export * from '../../shared/node-cli-command-resolution'. So the imports inskill-update-run.tsand the shared module are the same function. Non-test call sites:src/main/skills/skill-update-run.ts:92src/cli/handlers/skills.ts:122orca skills install/updatefrom the CLIsrc/cli/handlers/account.ts:92src/main/external-editor-launch.ts:138,:235src/main/text-generation/commit-message-text-generation.ts:362,:656A retry-on-126 inside
SkillUpdateRunnerfixes one row. The same machine, same shim, still breaks the other four — with different and probably worse symptoms, since none of them has a dialog to report into.Trap 2 — the CLI path makes it worse, and your fix doesn't touch it
src/cli/handlers/skills.tsresolves npx independently at:122, then builds the child's PATH withbuildNpxPath(:105-115):/** PATH with the resolved npx's own directory first, so its `env node` shebang resolves. */For a resolved
~/.asdf/shims/npx, that prepends~/.asdf/shimsto the child's PATH — actively promoting the broken shim directory to the front for the spawned process. The// Why:explains it ("every version manager ships node beside npx in the same bin directory"), and the reasoning is sound for a working version manager; it just compounds the failure for a dead one. Worth fixing in the same pass, since it's the same user hitting the same shim throughorca skills update.Trap 3 — a blind retry on 126 can re-run a partially applied update
The child is
npx --yes skills update <names> --global -y. Exit 126 is not exclusive to the shim: if npx runs fine and the innerskillsCLI exits 126 for its own reasons, "respawn with the next candidate" re-runs a global skill update that may already have written to disk.That isn't hypothetical here — the runner's own
// Why:(:196-199) says the outcome is decided by re-hashing disk:If the exit code is the weakest evidence the runner has, it's a thin basis for deciding to run the whole thing again.
The discriminator is already in hand: a dead shim fails before the inner tool produces any output, and its stderr is distinctive — the string you quoted,
No version is set for command npx. Gating the retry on 126 and shim-shaped stderr (or 126 with no inner-tool output) keeps it safe. The bare exit code alone doesn't.The part of your proposal that's already precedented
Your point 3 — name the resolved binary in the message — has a sibling three lines up. The
unsafe-command-pathbranch (:109-118) already does exactly that:So "publish an error that names
npxCommand" is an established shape in this file, not a new one. Of your three proposals I'd rank this one first: it's the smallest change, it can't re-run anything, and it turnsexited with code 126into a message that would have saved you the investigation. The candidate-fallback is the part that deserves the design discussion.What would sharpen it
Two things that would help whoever picks this up:
orca skills updatefrom the CLI fail the same way on your machine? That confirms Trap 2 and shows the fix has to be shared rather than runner-local.skillsCLI itself before the 126, or only the asdf stderr? That's what decides whether stderr-gating is enough to make a retry safe.What I did not verify
No asdf install here, so I haven't reproduced the 126 or confirmed that a fallback candidate would succeed — your repro is specific enough that I'd take it as given. Everything above is read from source or measured in git; the trap analysis is about what the fix runs into, not whether your diagnosis is right. It is.
spanishkangaroo commentedon Aug 11, 2026
Thank you very much guys for your implication and quick review.
It was actually one of my agents, working autonomously who picked it up - I went out for lunch, then came back and you already had everything sorted out!
I'll test it asap.
AmethystLiang commentedon Aug 11, 2026
thanks for reporting. looking into it
manuaudio commentedon Aug 11, 2026
Following up because
mainjust moved into this exact subsystem, and chasing that turned up a second PATH mutator that neither your analysis nor my earlier comment accounted for. It strengthens your root cause and changes where a fix has to go. Checked againstupstream/mainatc96ded8dfd.There are two PATH mutators at startup, not one
src/main/index.ts:629-637:My earlier comment only discussed the first one. The second is the one that matters for you, because of how it merges —
hydrate-shell-path.ts:308-311:The shell's segments go in front, and the trailing
// Why:(:316) states the intent outright: "shell-provided entries must win over hardcoded packaged-app fallbacks."Why that makes your case stronger, not weaker
The probe is not a plain login shell.
shellPathProbe(:96-99) spawns with-ilc— interactive and login — so it sources.zshrc, not just.zprofile. asdf is conventionally initialised in.zshrc.So on a packaged macOS build, the sequence is:
patchPackagedProcessPath()prepends any missing dirs (which, as established, does nothing for you because/opt/homebrew/binis already present, just late).hydrateShellPath()probes an interactive login shell — the same one that puts~/.asdf/shimsahead of/opt/homebrew/bin— andmergePathSegmentsinstalls that ordering at the front.So Orca doesn't merely inherit your bad ordering from the launching terminal. On a packaged build it re-derives and re-applies it, in front of anything the packaged-app seeding added. Even a fix that taught
patchPackagedProcessPathto reorder would be overwritten a moment later.I want to be explicit that this kills a theory I had while writing this: I expected the probe to be login-only (
-lc), which would have skipped.zshrc, missed asdf, and produced a good ordering — making this a race you could win by retrying. The-ilcat:99rules that out. It isn't a race; it's deterministic.Why this is timely
The commit that just landed, #13792
fix(startup): restore Windows PATH before shell changes(c96ded8dfd), is about precisely this collision — the packaged-app seeding versus the shell probe fighting over PATH. It addssrc/main/startup/windows-shell-path-ownership.tsand reworkshydrate-shell-path.ts.But it is scoped to win32 only, and your report is macOS. So the ownership question that PR settles for Windows is still open on the platform you hit. Worth flagging to whoever picks this up: the shape of the fix may already exist one platform over.
What this changes about the fix
My earlier three traps still stand. This adds a fourth, and it's the load-bearing one: any fix that works by reordering PATH has to survive
mergePathSegments. Otherwise it's correct for a few hundred milliseconds and then silently undone.Which pushes toward the conclusion your own report reached from the other direction: resolution shouldn't depend on PATH order at all.
resolveCliCommand'sisRunnableCommandaccepts any executable file, so a shim that cannot exec still wins — and now we know PATH order is actively re-asserted from the user's rc files, so "fix the ordering" isn't a durable strategy on macOS either.One measurement that would confirm it
In the failing app, compare the PATH at launch with the PATH a second later — or simply check whether
~/.asdf/shimssits ahead of/opt/homebrew/binin the packaged app'sprocess.env.PATHafter startup settles. If the shims are in front there,mergePathSegmentsput them there, and the hydration path is confirmed as the dominant ordering authority.What I did not verify
No packaged build running here, so I have not observed the merged PATH at runtime — the two call sites, the merge order and the
-ilcflag are read from source atc96ded8dfd. Whether hydration completes before your Update click is a timing question I can't answer from here, but given-ilcit doesn't change the outcome either way.nwparker commentedon Oct 26, 2026
Thanks @spanishkangaroo for the detailed report and root-cause analysis. This is fixed on main by #31688 (d3dbd96): skill updates (the Update button and the background update) now run through Orca's own in-process installer instead of spawning
npx skills, so a broken asdf/misenpxshim on PATH can no longer cause theexited with code 126failure. The change shipped in v1.4.239 and later. If you still see a skill update fail on the latest build, please comment here and we'll take another look.manuaudio commentedon Oct 26, 2026
Confirmed on my side: #31688 merged as
d3dbd9683fa, and that commit is included in v1.4.239. Moving skill updates into the in-process installer removes thenpxresolution path entirely, so the PATH-order and unsafe-retry concerns I raised no longer apply to this flow. This is cleaner than retrying around a dead shim.