John on Discord: agents on fish's PATH weren't found, fish being the login
shell (set with chsh). With SHELL=fish and a plain config.fish the probe
already worked (9bad1144's checks), so the difference is in the profile.
Reproduced with real fish 4.9.3 under the probe (ProbeContext, -ilc, no
terminal), a config.fish adding a folder with fish_add_path, plus:
fish_greeting set PATH comes
read -P under is-interactive PATH comes
exec tmux under is-interactive no answer: tmux replaces fish
exec /bin/cat likewise no answer
sleep 6 (a slow profile) no answer after the 5s limit
With no answer magpie got no PATH at all from the login shell.
askShell now asks again as a login shell only (-lc) when the interactive
login shell (-ilc) gives no answer, timed out or not, with the same 5s
limit. fish reads config.fish then too, zsh .zprofile, bash
.bash_profile. MAGPIE_SHELL_PROBE=1 is in the probe's environment both
times, so a profile can skip its auto-start for magpie.
Not the cause, checked: a desktop app and a LaunchAgent get SHELL from
the user record (every launchd job here has SHELL); askShell runs the
absolute $SHELL as it is (/opt/homebrew/bin/fish). A SHELL left from
before chsh until logout is covered by 9bad1144 asking an installed,
set-up fish beside it. The TUI/CLI take the terminal's own PATH.
Tests: TestAskShellProfileExecsOrHangs (fake shells that exec cat or
sleep when interactive) and TestAskShellRealFishAutostart (real fish,
skipped without it) fail on the old askShell:
slow: PATH = "", vars false: the login shell wasn't asked again
tmux: PATH = "", want ".../fb" in it
and with the variable taken out: "exec: MAGPIE_SHELL_PROBE didn't reach
the profile". Run: internal/proc and internal/update tests pass (with
fish 4.9.3 on PATH); gofmt -l clean; go vet and GOOS=linux,
GOOS=windows go vet on internal/proc clean.
Real use: sandbox magpie (go build -tags dev, own HOME, ports
3486/3487, PATH=/usr/bin:/bin:/usr/sbin:/sbin, SHELL=<real fish>,
config.fish with fish_add_path to a folder holding a fake claude and
`if status is-interactive; and not set -q TMUX; exec /bin/cat; end`):
origin/main finds no claude in /api/agents/cli or /api/state; this
build finds it (2.1.99, the fake's).