Files
magpie/docs
ggbdpq 90258cf20a agent: a Codex in a WSL distro stands in for a model it names from its own config.toml (#2198)
StandIn("codex", …) read this machine's ~/.codex/config.toml alone, so a
Codex wired in a WSL distro (model_provider = "magpie", the only shape a
distro under NAT is wired in since #2145) naming a model magpie doesn't
serve (codex -m <unserved>) was answered 404, where this machine's Codex
goes to its config's model and a Claude Code in the same distro goes to
the stand-in its settings name (wslClaudeStandIn, #254). On Windows, when
this machine's Codex names none, StandIn now asks wslCodexStandIn: the
first distro running now whose config.toml has magpie as its provider,
read as codexStandIn reads it. The collecting of running distros the
probe found a kind in is shared with wslClaudeStandIn (wslReady); a
stopped distro is never opened. Off Windows nothing changes.

Reported with a patch by ggbdpq (gua2100 on Discord), independently
re-run by Edward4226. Taken as written except: the distro's config path
comes from the place's codexHome (where magpie writes it) rather than a
spelled-out ~/.codex; wslClaudeClassifier, which landed since with the
same loop, is left as it is (no test covers it); and TestWSLCodexStandIn
now also calls StandIn itself, so the Windows-only wiring is tested.

Run (sandbox HOME, caches pinned):
- go test -tags nogui -run 'TestWSLCodexStandIn|TestWSLClaude|TestCodexStandIn|TestClaudeStandIn' ./internal/agent: ok.
- Broken by hand: wslCodexStandIn returning "" fails TestWSLCodexStandIn
  ("stand-in: \"\""); wslReady without the running filter fails
  TestWSLCodexStandInSkipsStopped ("stand-in from a stopped distro:
  \"stopped/model\""). Restored: ok.
- On the Windows box (agent test binary built GOOS=windows): the same
  five tests pass; built with StandIn's codex branch put back,
  TestWSLCodexStandIn fails "StandIn on windows: \"\", want \"relay/main\"".
- go test -tags nogui -run 'WSL|StandIn|Wsl' ./internal/agent: one red,
  TestWSLColdPlaceOpensNothing (Hermes profiles of a stopped distro),
  red the same at origin/main 7f0f71a0e and filed as #3924.
- gofmt -l clean; go vet darwin, GOOS=windows, GOOS=linux -tags nogui on
  ./internal/agent: clean.

Not tried: a real Codex in a real WSL distro naming an unserved model
(the distros are fakes, on the Windows box too); a Windows Codex wired to
another model still wins over the distro's, as for Claude Code; the full
./... suite (one suite per machine, others running).
2026-10-28 00:47:44 +08:00
..