zi_xiang5806's in-magpie Claude sign-in ended "Sign-in didn't finish":
the claude magpie ran was an npm 2.1.38 first on PATH, which has no
`auth login --claudeai` ("error: unknown option '--claudeai'"), while
`claude update` had installed 2.1.325 into another Node after it.
- proc.FindTools lists every `claude` (each PATH folder, then where
installers put it), deduped by real path, cached like FindTool.
- claudecode.Own (behind claudecode.Find, so the sign-in, the gateway's
bridge, bili, keep and `magpie claude-code` all get it) runs the
newest. The first on PATH is passed over only for one whose version
is known and newer; an unreadable version is unknown, not old.
Versions are read first where each is installed, running nothing
(npm package.json via proc.PackageVersion, the native installer's
versions/<v>, Homebrew's Caskroom/claude-code/<v>); only when one is
known that way is another asked --version (VersionOf, kept per file
until it changes, an unknown for a minute). With one claude, or none
known, nothing is run.
- A sign-in whose claude says "unknown option"/"unknown command" now
says Claude Code is too old, with its version and path, and to run
`claude update` (or npm install -g @anthropic-ai/claude-code@latest).
Tests: TestClaudeSignInRunsTheNewestClaudeCode and
TestClaudeSignInSaysClaudeCodeIsTooOld put two fake npm-layout claudes
(2.1.38 first, 2.1.325 second) on PATH in a sandbox HOME; both were red
with Find reverted to the first on PATH (the first with the reporter's
exact "unknown option '--claudeai'"). TestOwn*, TestInstalledVersion,
TestFindTools.
Run at base 96d1b93b2 (the 5 commits rebased over touch none of these
files): full `go test -count=1 -timeout 45m ./...` on mote, 101 ok,
exit 0 (internal/gateway ok 1036s; an earlier version that ran
--version on every candidate turned ~20 gateway Claude bridge tests red
through their fake claude, which is why nothing is run when no version
is known where it is installed). claudecode, proc and provider
TestClaudeSignIn also ok on wsl-run (Linux) and claudecode on win-run;
GOOS=linux and GOOS=windows go vet of proc, claudecode, provider ok;
gofmt clean.
Not tried: a real sign-in with a real old CLI and account; WSL's
too-old message; the Agents page still shows the first on PATH.