Skip to content

feat(installation): report the copies on PATH that never run (#160) - #162

Merged
xxchan merged 2 commits into
mainfrom
installation-shadowed
Oct 7, 2026
Merged

xxchan merged 2 commits into
mainfrom
installation-shadowed

Conversation

@xxchan

@xxchan xxchan commented Oct 7, 2026

Copy link
Copy Markdown
Member

Part 1 of #160, in the shape decided on the issue (comment): parts 2 and 3 stay out of oar, so this is all of oar's side.

Why

On a Ferry user's Linux machine, Codex's updater ran npm install -g, printed success, and oar correctly reported unchanged. npm had installed 0.160.1 into ~/.npm-global, which is not on PATH, while the codex that runs was nvm's, one of five copies on the machine. Ferry could not show that other copies exist, so someone had to SSH in.

What

ExecutableInstallation gains an optional shadowed?: readonly string[]: the other copies of the same command that PATH lists after the one found, in PATH order, as PATH spells them. These copies never run.

  • Paths only. No --version per copy, since that would add a process per copy to every probe; the host reads versions on demand. No npm/Homebrew/standalone classification.
  • Only for a PATH lookup. Absent when an OAR_*_BIN override names the executable (as a path or a bare name), and when a fallback outside PATH found it (codex's macOS app bundle, kimi's and grok's installer folders). A bare-name fallback (morph's mistermorph, kimi's kimi-code) is a PATH lookup, so it reports its own name's copies.
  • Omitted when empty, the same way version is omitted.
  • Shared, not per runtime. locateOnPath in shared/installation.ts walks PATH in which -a order (resolveExecutableAll). executableInstallation keeps every PATH match of a candidate and reports the winner's, so claude, codex, grok, kimi, opencode, antigravity and the community morph get it without runtime code. locateExecutable (used by login) is unchanged.
  • Docs: the contract's TSDoc, the root README's installation bullet, the CLI README (oar installation prints it in its JSON; oar list shows no installations), and the unchanged row in docs/spec/update.md.

Edge cases

  • A folder listed several times counts once.
  • PATH entries that resolve to the same file are one copy: a symlinked folder (/bin → /usr/bin on merged-usr Linux, fnm's multishell folders) or a symlink to the running copy. Copies are compared by realpathSync.native and reported as PATH spells them.
  • Windows PATHEXT: matches carry the extension (codex.CMD). A folder holds one copy, its first match. Windows runs the first PATHEXT extension there, and npm's codex.cmd and codex.ps1 side by side are one install, so they do not show up as a second copy when .PS1 is in PATHEXT.
  • Folders and non-executable files (no exec bit on POSIX, no PATHEXT extension on Windows) never match.
  • Unchanged: the readiness fallback (app-server --help failing moves on to the next candidate, not the next PATH copy). Which copy runs stays the same.

Test evidence

  • New tests/installation-shadowed.test.ts builds temp-dir PATHs with fixture executables (.CMD on Windows) and covers: PATH order and a repeated folder; a symlinked folder (a junction on Windows); a symlink to the running copy; non-executable files and a folder named like the command; launchers in one folder; first-PATHEXT-match on Windows (runIf(win32)); the probe reporting through the command name and a bare-name fallback; the field missing for one copy, for an override (path and bare name), and for a fallback outside PATH. If Windows refuses to create the file symlink (EPERM without Developer Mode), that one case skips instead of failing.
  • tests/installation.test.ts: the two exact snapshots of the real node now probe with PATH set to node's own folder, so the machine's other node copies stay out of them.
  • Mutation check: turning off the folder rule or the real-path rule each fails a case.
  • Locally: pnpm run check and CI=1 pnpm run check pass (696 tests), and pnpm tsx sea-trial/all.ts passes on all four backends (mock, claude-aimock, codex-aimock, pi-aimock). On this machine, oar installation reports "shadowed": ["/usr/local/bin/kimi"] for kimi (two real copies) and nothing for grok (~/.local/bin/grok and ~/.grok/bin/grok resolve to one file) or codex (one folder listed six times).

🤖 Generated with Claude Code

exe.dev user and others added 2 commits October 7, 2026 02:33
On a Ferry user's machine, Codex's updater ran `npm install -g`, printed
success, and oar correctly reported `unchanged`: npm had installed the new
version into a prefix that is not on PATH, while the codex that runs was
one of five copies. Hosts could not see that other copies exist, so
someone had to SSH in to find out.

`ExecutableInstallation` gains an optional `shadowed`: the other copies of
the same command that PATH lists after the one found, in PATH order, as
PATH spells them. This is part 1 of #160 in the shape decided on the
issue: paths only, no `--version` per copy (a process per copy on every
probe; a host reads versions on demand) and no npm/Homebrew/standalone
classification. It is absent when an `OAR_*_BIN` override names the
executable (as a path or a bare name), when a fallback outside PATH found
it (codex's macOS app bundle, kimi's and grok's installer folders), and
when PATH lists no other copy.

The PATH walk is shared (`locateOnPath` over `which -a` order in
shared/installation.ts), so `executableInstallation` reports it for every
executable runtime: claude, codex, grok, kimi, opencode, antigravity and
the community morph. A copy is a real file: a folder listed twice, `/bin`
beside `/usr/bin` on merged-usr Linux, or a symlink to the running copy is
not another one. A folder holds one copy, its first match: on Windows the
first PATHEXT extension, since npm's `.cmd` and `.ps1` side by side are one
install. Folders and non-executable files never match.

Validation: `pnpm run check` (also with `CI=1`) and
`pnpm tsx sea-trial/all.ts` (mock and the three aimock backends) pass.
New temp-dir tests cover order, a repeated folder, a symlinked folder, a
symlink to the running copy, non-executable files, launchers in one
folder, Windows PATHEXT, and overrides and outside fallbacks reporting
none. On this machine `oar installation` reports kimi's second copy
(`/usr/local/bin/kimi`) and nothing for grok, whose two PATH entries
resolve to one file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review on #162: the contract comment and the `unchanged` row in
docs/spec/update.md implied that `shadowed` shows the copy an updater
updated. It does not in the case that prompted #160: npm installed into
`~/.npm-global/bin`, which is not on PATH, so that copy is not in
`shadowed`. Both now state the fact instead: `shadowed` lists copies on
PATH only, and a copy installed off PATH is not among them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@xxchan
xxchan merged commit 9d4bb5b into main Oct 7, 2026
13 checks passed
@xxchan
xxchan deleted the installation-shadowed branch October 7, 2026 02:40
@xxchan xxchan mentioned this pull request Oct 7, 2026
xxchan added a commit that referenced this pull request Oct 7, 2026
Release OAR and CLI 0.27.0. This PR changes only the two package version
fields.

**New**
- `ExecutableInstallation.shadowed` (#162, part 1 of #160): when PATH
found the runtime's command, the other copies of it that PATH lists
later, which never run, in PATH order and as PATH spells them. Paths
only, no versions. Entries that resolve to one file count once. Absent
when an `OAR_*_BIN` override or a fallback outside PATH found the
executable, and when there are no other copies. A copy installed off
PATH is not listed. `oar installation --json` prints it.

Validation: all 13 checks passed on #162's final head (`390945d`). After
this PR passes CI and merges, tag its exact squash commit as `v0.27.0`
to trigger npm trusted publishing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: exe.dev user <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
stamp-build Bot added a commit that referenced this pull request Nov 5, 2026
<!-- stamp:review:v1 -->
<sup><img
src="https://cdn.slock.ai/avatars/6aabf32c-20bc-4cba-b55a-2aa72b60999b/8ba4452ceb890f1930886ef4286fdb99.webp"
width="16" height="16" align="absmiddle" alt=""> <b>Otter</b> from
open-agent-runtime opened this pull request through
Stamp</sup><br><sup><a
href="https://stamp.build/review?receipt=prc_79892a3340b0f81c316fddd6141f962a"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://stamp.build/assets/brand/stamp-glyph-dark.d907ffcadb44.svg"><img
src="https://stamp.build/assets/brand/stamp-glyph-light.58a2c10ed108.svg"
width="13" height="12" align="absmiddle" alt=""></picture> View in Stamp
→</a></sup>

---
<!-- /stamp:review:v1 -->

A Pi prompt refused before native start can leave held inputs stranded
and retain cancellation intent for the next run. Recover that path by
recording the refusal, clearing stale abort state and draining held
work. SDK disposal during pending admission now reports disposed, late
failures cannot settle a later extension run, and RPC clears a
cancellation fallback rearmed while terminal statistics or observers
finish, preventing a healthy child from being killed later.

Ordinary terminal publication keeps its existing order: publish
`turn_ended`, then release the native run gate and drain. A synchronous
SDK/RPC observer can therefore see idle while prompt is still busy;
submit after the observer returns. The earlier synchronous-submission
implementation is withdrawn, including its preflight admission helper,
deferred dispatch, isStreaming checks and front requeue. The design
decision documents why settlement-time extension scheduling makes that
approach unsafe and what evidence would reopen it. Pi Durable product
behavior is unchanged.

Extension-handled inputs, competing extension runs, missing queue
ownership and a reentrant prompt from a pre-start refusal observer
remain explicit limitations. Task #173 owns their separate
record/ownership design. No completion is fabricated here, and this
change does not claim to fix those existing gaps.

Validation on main `91c626a5`:

- Full check: 3,202 tests and 18 mock behavior cases passed. Build and
clean packed consumption passed.
- 21 focused regressions cover refusal draining, stale cancellation,
disposal, late failures, terminal callback ordering and ordinary FIFO.
Eight focused mutations are caught; the main product code fails eight of
the retained independent regression cases.
- Native Pi SDK/RPC 1.5.0 vendor suites passed (101/99 cases), Durable
passed 26 cases, and all three Pi behavior backends passed. Missing-key
refusal uses a local scripted provider and verifies recovery. Ordinary
terminal observer prompt/queue controls preserve FIFO; Durable remains a
separate control.
- The supplied review probes for extension preparation failure, delayed
extension input and competing observer prompts were compared with main
in SDK and RPC. Their recorded facts match byte for byte after
narrowing. Those diagnostics are retained locally, not installed as
public tests; their existing limitations remain documented.

Task #162, intended for 0.87.2 with #626. No package version or release
tag change. Windows/macOS results require this head's CI.

Rebased after #626; all four commit patches are unchanged.

---------

Co-authored-by: Otter <[email protected]>
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