Two users on X (v0.1.1549 to v0.1.1557, Windows, Codex routing) see
/api/hello answer while /v1/models, Providers and agent requests hang.
`magpie goroutines` (b18a6a080, #3362, since v0.1.1404) can capture the
stuck process, but its route sat behind lanGuard's allow list
(settings.json's file lock) and holdCatalog (provider.Hold, filememo),
so a request stuck holding any of them would hang the dump too.
dumpFirst serves GET /v1/magpie/goroutines, for callers
goroutinesRefused lets in, ahead of lanGuard in Front and ahead of
counted/holdCatalog in Handler. It reads only the request, the
environment and the runtime. Every refused or other request goes on
as before; a caller it lets in is one lanGuard and corsGuard already
let in (loopback, unproxied, no browser marks, loopback Host).
docs/reference.md now says how to run it from an app install, where
magpie isn't on PATH unless Settings > Command line adds it:
macOS /Applications/magpie.app/Contents/MacOS/magpie goroutines;
Windows PowerShell
& (Get-ItemPropertyValue 'HKCU:\Software\Microsoft\Windows\CurrentVersion\App Paths\magpie.exe' '(default)') goroutines | Out-Host
(| Out-Host so PowerShell waits for the GUI-subsystem exe), or a
portable copy's own path.
Run, at this tree on c0985122b:
- go test -tags nogui -count=1 -timeout 45m ./internal/cli ./internal/gateway:
ok cli 36.2s, ok gateway 388.7s
- TestGoroutineDumpAnswersWhileRequestsWait -count=3: ok
- gofmt -l: clean; GOOS=linux and GOOS=windows go vet -tags nogui
./internal/...: exit 0
Broken by hand:
- Front back to lanGuard(s.Handler()): the new test is red at 20.02s
("the dump didn't answer while settings.json's lock was held").
- Both refusal checks (dumpFirst and goroutineDump) removed:
TestGoroutineDumpOnlyToThisComputer red, 25 failure lines.
Real use, Windows box: v0.1.1558 magpie-windows-amd64.exe (SHA256
matches SHA256SUMS) serving a sandbox home on :3447; the App Paths
one-liner above saved the dump and printed "goroutines 41", exit 0;
`& exe goroutines` with and without | Out-Host both saved it.
Not tried: a really stuck app; this build on Windows or macOS (the
real-use run above was v0.1.1558, without dumpFirst); an interactive
PowerShell console without | Out-Host; the Handler-only path has no
red test, since provider.held can't be held from the gateway package.