Files
magpie/internal
yetone 1e88598384 gateway: a Claude Code test or /usage run that magpie gives up on ends with what it started, npm's node on Windows too (#1894, heng91)
What changed: magpie runs Claude Code one-off for an account's model test
(askClaude) and for /usage (claudeUsage, read in the background for each
Claude account). Both ran through CommandContext, whose kill on the
timeout ends only the process magpie started. On Windows an npm install's
claude is claude.cmd: cmd.exe running node, and only cmd.exe was killed,
so node went on running with nothing to end it. Elsewhere a CLI that is a
wrapper script left its child the same way.

Now both run in a proc.Tree (a job on Windows, a session elsewhere), as
the Claude subscription's runs do: what is left once the head ends is
ended with it, and on Windows the job ends it if magpie exits mid-run.

Run:
- go test -tags nogui -count=3 -run 'ClaudeRunEnds|WarmClaude|ClaudeUsage|ClaudeTest'
  ./internal/gateway: ok. New TestClaudeRunEndsWhatItStarted: a script
  claude that starts a child and hangs; once it has started the child the
  run is given up on, and the child must be gone. With cmd.Run() put back
  by hand, both subtests (test, usage) go red with the child running.
- gofmt -l; GOOS=linux and GOOS=windows go vet -tags nogui: clean.

Not run on the Windows box: the job path is the one subscription runs
already use. Not found to be the reporter's processes: magpie's other
Claude Code processes are the subscription runs kept for a conversation's
next turn (at most 6, at most an hour, by design).

Reported-by: heng91
2026-10-13 13:03:26 +08:00
..
…
…