Files
orca/src/main/cli
Hotragn PettuganiandNeil 1279d5f588 fix(cli): never register the bundled launcher as a link to itself (#35371)
* fix(cli): never register the bundled launcher as a link to itself

orca serve registers the CLI at startup. On macOS the installer walks
PATH for an existing orca command, and Orca's own terminals put the
bundled Resources/bin first on PATH. The bundled launcher reads as a
managed Orca launcher, so it was picked as the command slot, moved
aside, and replaced with a symlink to itself. The app's CLI then broke
until reinstalled.

Skip the launcher when scanning PATH, and refuse any symlink install
whose command path is the launcher.

Fixes #33872

* fix(cli): compare the launcher by directory entry, not path spelling

The self-link guards compared path strings, so a PATH entry or
ORCA_CLI_INSTALL_PATH that reached Resources/bin through a symlinked or
differently cased directory still replaced the bundled launcher with a
link to itself. Compare entry and parent-directory identity instead.

Co-authored-by: Hotragn <103170876+Hotragn@users.noreply.github.com>

* fix(cli): keep differently named hard links to the launcher replaceable

* fix(cli): treat a case-variant name as the launcher only when it is an alias, not a second hard link

* refactor(cli): compare the launcher by inode via existing entry snapshots

Replace the speculative isSameDirectoryEntry helper with isSameEntry beside
readEntrySnapshot/hasSameIdentity, and drop the hard-link test that only
pinned the removed behavior.

Co-authored-by: Hotragn <103170876+Hotragn@users.noreply.github.com>

* Revert "refactor(cli): compare the launcher by inode via existing entry snapshots"

This reverts commit f02f8c2a2ba0263fd611170af7c3f76d22e48ea7.

* test(cli): fold the bundled-launcher cases into the macOS command-path suite

* refactor(cli): move the launcher entry check beside the entry snapshots

Reuse readEntrySnapshot/hasSameIdentity for the entries, keep the parent
identity check (a hard link in another dir such as /usr/local/bin must stay
replaceable, which is why f02f8c2a2ba was reverted), and drop the readdir
case-folding branch. Pin the cross-directory hard link instead of the
speculative sibling one.

Co-authored-by: Hotragn <103170876+Hotragn@users.noreply.github.com>

* fix(cli): keep a case-variant hard link beside the launcher replaceable

---------

Co-authored-by: Neil <neil@stably.ai>
2026-10-28 23:55:31 -07:00
..