Files
magpie/docs
yetone 2b22425b45 agent: Claude Science in a WSL distro is found and run on magpie from Windows
shuitunlulu_ (Discord) has Claude Science in WSL2, and Windows magpie
didn't find it. It is now a WSL twin (claude-science@wsl:<distro>), found
by the probe's claude-science (~/.local/bin or PATH). Its daemon is
restarted there through wsl.exe with ANTHROPIC_BASE_URL set, the same steps
as this machine's (claudescience.go is now one scienceHost for here and for
each distro), and v0.1.3334's keeper puts it back on magpie in each running
distro that has a note (claude-science-wsl-<distro>.json). With no note,
nothing runs in WSL.

The daemon takes http only to a loopback address and sends its Claude
sign-in as the key. In mirrored networking it gets the gateway's address.
Under NAT magpie starts a relay in the distro: socat on
127.0.0.1:<gateway port> to Windows' WSL address. The daemon gets
http://127.0.0.1:<port>/<WSL key>; the gateway's lanGuard takes the key
off the path (takeWSLPathKey) before fromWSL judges it. Connect says so
when the distro has no socat. Disconnect stops the relay with the
connections it forked, as one process group. When Windows' firewall keeps
WSL out, the row shows the same firewall drift and rule as other WSL
agents.

Run:
- gofmt -l clean
- go vet: darwin, GOOS=linux -tags nogui, GOOS=windows (mote)
- go test ./internal/agent ./internal/gateway on mote (macOS)
- go test ./internal/agent on xiaomi-gpu (Windows 11): 26 FAIL; 25 fail
  the same at origin/main c7ebb6f8d on that box (#4115, #5019, #3700,
  #5344, #2808, #4785, #2958, #1827, #4786). The 26th,
  TestHermesProfilesFollowMagpieModel, passed 5/5 alone on both and
  failed only in the whole-package run (#4115, #2540). Every
  ClaudeScience test passed there.
- At the pushed head (rebased on 9dd7aabca, which changes neither
  package): go vet darwin + windows and -run 'ClaudeScience|WSL' of agent
  and gateway ok on mote.
- Full suite, -timeout 45m: not finished at push. It waits on the lock
  behind other sessions' runs on mote and on magpie-desktop; the
  packages it changes (agent, gateway) were run above.
- Real run against magpie-desktop (Ubuntu 24.04, NAT, claude-science
  0.1.72 in ~/.local/bin) from a Windows test binary, with a sandbox
  XDG_CONFIG_HOME and a stand-in gateway on 127.0.0.1 and 172.17.32.1:
  - Connect took about 10s, and /proc/<daemon>/environ had
    ANTHROPIC_BASE_URL=http://127.0.0.1:<port>/wsl-...
  - The relay outlived wsl.exe (setsid, its own SID).
  - With the firewall blocking the test binary, the row's drift named the
    firewall and the New-NetFirewallRule.
  - With a temporary allow rule for the test binary (removed afterwards),
    curl in WSL through the relay reached the stand-in with the key path,
    and no drift showed.
  - Daemon and relay were killed as a WSL restart would; one keeper pass
    brought both back.
  - Disconnect left no relay and no relay forks (a held curl fork
    included), and the daemon ran without the variable.

Broken by hand:
- relay := false: the NAT test went red six ways.
- Without lanGuard's takeWSLPathKey line: TestWSLKeyInPath got 403.
- Check's firewall branch off: TestClaudeScienceInWSLFirewall red.
- A plain kill of the relay pid left a fork connecting on the real distro;
  that is what led to the process-group kill.

Not tried:
- The real magpie GUI on Windows with this build.
- A daemon's own model request through the relay; only curl was sent.
- Bridged networking.
- A distro without socat; that path was run only in the fake.

Reported-by: shuitunlulu_ (Discord)
2026-11-09 17:46:13 +08:00
..