ac4af582301a4e8a29245dbba767eba31334ddf9
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
1bf722e289 |
proc, provider, agent: a claude (or other agent CLI) that is a mise wrapper script is run as the program mise names, and a Claude sign-in that gets no link says which program it ran (deluxe on Discord)
deluxe (Omarchy Linux, magpie started from the desktop) never saw the
Claude sign-in link. ~/.local/bin/claude was a script ending
`exec mise x "claude" -- "claude" "$@"`; without the shell's mise
environment, `mise x` looks claude up on PATH, finds the same script
(~/.local/bin is before mise's shims) and it runs itself for ever.
What changed:
- proc.Unwrap / proc.LookPath (internal/proc/wrapper.go): a small #!
script whose line is `[exec] mise|rtx x|exec [opts] [tool] -- <name>`
is resolved with `mise which <name>` (then `mise which --tool <tool>
<name>`), run as a probe (process group killed) with a 5s timeout,
magpie's environment and the home folder as cwd. The answer must be an
executable file that isn't the wrapper or another wrapper; otherwise,
or with no mise, the old path is kept. Answers are cached per file
(path, mtime, size); a failed ask is retried after a minute.
Windows is unchanged.
- proc.FindTool (claude via claudecode.Find: the sign-in, the gateway's
Claude subscription, `magpie claude-code`) unwraps what it finds.
- The siblings that looked an agent CLI up with exec.LookPath use
proc.LookPath: agent.binAt (detection, CLI version/update), codex,
kiro-cli, devin, cursor-agent, Air's opencode, nativemodels' npm
package lookup.
- The Claude sign-in already gave up after linkWait (30s) with "claude
auth login gave no link to open". It now adds the last line the CLI
printed, or, when it printed nothing, the program it ran and to run
`<path> auth login` in a terminal to see what it does.
asdf shims (`exec asdf exec "claude" "$@"`) are left alone: asdf exec
resolves the real program itself and doesn't recurse.
Verified (macOS, sandbox HOME, Go caches pinned):
- New tests: internal/proc/wrapper_test.go (wrapper -> mise's program;
no mise -> wrapper; mise fails / names the wrapper / names a folder /
hangs -> wrapper, and the hung mise's pid is gone; deluxe's own fixed
script, a node launcher, a wrapper of another command, a commented
line -> unchanged and mise never asked; parse cases; --tool retry),
internal/provider/signin_claude_wrapper_test.go (the full Claude
sign-in through the wrapper with a fake mise that really recurses:
link shown, account added; with no `mise which`, the sign-in fails in
linkWait naming the wrapper).
- Break checks: with find.go put back, TestFindToolUnwrapsMiseWrapper and
TestFindToolAsksWithWrappersTool FAIL (FindTool = the wrapper), and
TestClaudeSignInThroughMiseWrapper FAILs with "claude auth login gave
no link to open: .../local-bin/claude printed nothing in 5s". With the
old error string, TestClaudeSignInWrapperThatNeverStarts FAILs.
- gofmt -l clean; go vet ./...; GOOS=linux go vet -tags nogui ./...;
GOOS=windows go vet ./...; GOOS=linux go build -tags nogui;
GOOS=windows go build.
- go test -tags nogui ./...: every package ok except internal/agent and
internal/gateway, which hit the default 10m timeout with the machine
at load ~45 (different tests each run, none in the new code). Those
two were rerun with -timeout 40m; origin/main 217d2f8f2's
internal/agent alone took 2094s under the same load.
- Rebased on
|
||
|
|
5d126a0db7 | agents: Pi's model picker lists the models of its openai-codex sign-in from Pi's own registry, and its Default says it lets Pi pick (#709) — Pi's native options came from models.dev by provider id, and models.dev has no openai-codex (Pi's "OpenAI Codex (legacy)" ChatGPT sign-in), so a Pi signed in to both openai and openai-codex was offered openai/… only. Pi's (and OmO's) own options now come first from the model registry in the package Pi was installed from: the pi command on PATH leads to @earendil-works/pi-coding-agent, and pi-ai's dist/providers/data/<provider>.json (Pi 1.0) is read as is, in its order, chat models only (no gpt-image-2), memoized by the file's stamp — the list Pi's /model offers, which moves with every Pi update. A provider the registry doesn't have keeps models.dev's list; openai-codex with no registry in reach falls back to Codex CLI's models_cache.json (the same ChatGPT backend); models.dev's openai list isn't mapped onto it. The rows are openai-codex/<model> under "OpenAI Codex" with OpenAI's logo, a row each beside openai/<model> of the same name; picking one writes defaultProvider=openai-codex, defaultModel=<model> as before. omp shared the gap for its current model's provider (ownOptions): it now reads omp's own catalog (@oh-my-pi/pi-catalog src/models.json, non-chat kinds left out); omp's signed-in providers that aren't the current one are still #341's. Default in Pi's and OmO's model picker now says "clears the default model; Pi picks one on its own" (zh 清除显式默认模型,由 Pi 自动选择; no ja table exists), other agents' still say what they ship with. TestPiOffersItsOwnOpenAICodexModels (a fake npm-linked Pi 1.0 install, temp HOME and PI_CODING_AGENT_DIR, auth.json with openai and openai-codex oauth test metadata), TestPiOpenAICodexWithoutItsRegistry and TestOmpOffersItsOwnOpenAICodexModels fail on the old code (no openai-codex rows) and pass; pi-default-note.test.cjs (webkit, en/zh) fails on the old app.js and passes; agent-disconnect, agent-models and agent-model-groups GUI tests pass. Read-only against this machine's real installs: Pi 1.0.0 gives openai-codex 9 models and openai 44, omp's catalog openai-codex 8. go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass but TestProvidersAnswerWhileListsComeIn, TestClaudeSignedOut, TestClaudeAccountNamedAsItsLogin and TestClaudeIdentityServedWhileAsked, timing tests that pass alone. Not tried in the GUI with real Pi sign-ins, nor with a Pi older than 1.0 (no data folder: models.dev and Codex CLI's list as before) or a Windows npm shim. |