With a WSL distro stopped, the Instructions page listed none of its
agents: instructionsView built its rows from the targets only, and an
agent in a stopped distro is no target (#3896). So Claude Code, Codex
and the rest in WSL couldn't be switched on until the distro ran. And a
switch on the page sent the agents the page listed, so switching any
agent on or off while the distro was stopped took its agents off the
set, and the next sync once the distro ran took magpie's part out of
their files.
The same way c1da9ccda did it for the MCP and Skills pages: keepShape
keeps the instructions file's path in the shape (wsl.json, key
library:<kind>) while the distro runs. While it is stopped,
instructionsView lists its agents from that (asleepInstructions, asleep:
<distro>), switched on as library.json has them, with what each gets
besides, which is in magpie's own folder. The file itself isn't read:
its own lines, an edit to magpie's part and an override file aren't
known then, so the row says nothing of them, and Move its own and Write
again don't show. One switched on whose file magpie never saw (no path
in its shape, or a shape kept before this commit) is listed as unseen.
ReadInstructions, which the page reads after each instructions change,
lists them too, or the rows would go after the first switch. The TUI's
instructions picker sends the agents Read lists as on, so by its code it
had the same loss and keeps them now, with no change of its own (read,
not run).
A switch on one is kept in library.json, as any is. Takes accepts one
with a known file, so the CLI's `library instructions agents` records
it, and says on stderr that the distro isn't running (AsleepIn, as
before). Woken now watches a distro that Instructions.Agents names, or
whose agent still has magpie's part (Applied.Instructions), so a switch
on is written there once the distro runs, and a switch off is taken
out. Nothing is opened or run in the distro while it is stopped.
The page greys a stopped agent's row (icon as on the chips), shows its
path as text, not a button (showing it in Explorer opens the distro),
gives its switch the line's words as its tooltip and as the status after
a switch, and adds the one line per distro under the list
(asleepAsides, now given the page's own rows). An unseen agent's switch
is greyed out (aria-disabled), says why with the unseen chip's tooltip,
and sends nothing; every other switch keeps it on. No new strings: the
line, the unseen tooltip and "{agents} can be changed once it runs." are
c1da9ccda's, in en, zh, zh-TW, ja and de. The "keeps no user-wide
instructions file" line still leaves stopped agents out.
The MCP and Skills pages are the same, except that an agent seen with
an instructions file only (no MCP file or skills folder) now has a
shape: it is listed there as it is while the distro runs, among the
agents with no MCP servers or no skills folder, where before it was
listed only when unseen and named.
What was run (tree 7fd5f65a, on origin/main ec5571d6, go1.26.8,
linux/amd64, Linux 5.15, umask 077):
- TestWSLStoppedInstructions (new): Codex and Claude Code in a FakeWSL
distro, seen running, then stopped with the distro's folder moved
away. Both are on the Instructions page, asleep, at their files, Own,
Edited and Override empty (Codex's AGENTS.md has a line of its own,
counted once it runs), from Read and from ReadInstructions alike.
Codex switched on while stopped is kept; Woken writes the shared text
into its AGENTS.md once the distro runs. Stopped again and switched
off, Woken takes the part out (the file is "Mine.\n" again). Nothing
was written into the stopped distro and FakeWSLRuns didn't move.
- TestWSLStoppedInstructionsUnseen (new): Pi switched on in a distro
stopped before magpie saw its file is listed on and unseen; Codex,
never seen and off, isn't; Takes refuses it.
- Broken by hand, each alone, the two tests above run:
instructionsView skipping the stopped agents: "a stopped distro's
Codex isn't on the Instructions page", "Pi switched on while stopped:
<nil>". distrosNamed without Instructions.Agents: "no sync once the
distro ran" at the first start. distrosNamed without
Applied.Instructions: the same at the second start, the switch off.
ReadInstructions back on Targets(): "Read lists 15 instructions rows,
ReadInstructions 11". Takes without instructions: "Takes while
stopped: ... can be given instructions". keepShape without the path:
Codex not on the page.
- library-wsl-asleep, its new Instructions case, Chromium and WebKit,
en, zh, zh-TW, ja and de at 1100 and 390px: Codex's row greyed, its
path a span, not the reveal button, its switch's tooltip the
distro's line; Pi's switch aria-disabled with the unseen tooltip; one
line naming the distro and Pi. A click on the path asks no reveal, a
click on Pi's switch sends nothing, Codex switched on sends claude,
Codex and Pi with the line as the status, and Claude Code switched off
sends Codex and Pi. Broken by hand in the page, in Chromium: Pi's
switch sending (all 10 red at the deepEqual of the posts with [] after
Pi's switch is clicked), the path a reveal button again (all 10 red,
tagName BUTTON for SPAN), no line (all 10 red, 0 .lib-asleep lines for
1).
- GUI files, each alone, Chromium and WebKit, Node 22.22.1, Playwright
1.62.1, DISPLAY unset: library-wsl-asleep 22/22 each, i18n-keys 4/4,
library-instr-sets 3/3, library-instr-busy 6/6, library-linked-set
11/11, library-alma-profile 6/6, library-gone-agents 11/11,
library-items 9/9, library-mcp-hub 11/11: 166 of 166.
- go test -tags nogui -count=1 ./internal/library ./internal/agent
./internal/cli: library and cli ok; agent red in TestInstalledVersion,
TestHowInstalled, TestCursorFolderFromTheEditorIsNotTheCLI,
TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
TestQoderSettingsFromAnIDEPluginIsNotTheCLI, TestOmpDetectedWithPiDir
and TestZedAppPath (#3141, a set that varies from run to run;
five of them red at origin/main ec5571d6 in its suite too). go test
-race -run TestWSL ./internal/library: ok.
- gofmt -l clean. go vet -tags nogui for linux, windows and darwin, go
vet for windows, go build -tags nogui for linux and darwin and go
build for windows: exit 0 each. go vet and go build without the tag on
linux: exit 1 (no GTK headers here).
Not run at this tree: the full go test ./..., which ran at the
branch's last commit. Not tried: a real distro stopped and started, and
the real app; FakeWSL counts the wsl.exe -d commands run in the stopped
distro (none). Not changed: the Hooks and Subagents pages (#4237,
#4238, the next commits), and the CLI's code for `library
instructions agents`, which already says on stderr that a stopped
distro's agent is written there once it runs.
Reviewed and run again by the maintainer at the stack's tree 45994757c
(this commit and the six beside it, on origin/main 90518de26), go1.26.8:
- mote (macOS, arm64): gofmt -l clean; go vet and go build for darwin,
GOOS=linux -tags nogui and GOOS=windows (library, plugin, gui): exit 0.
go test -tags nogui -count=1 -timeout 45m ./...: every package ok but
internal/gui TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
internal/proc TestNoCommandBypassesProc (#4491), both red on main
from b09349d17 and c59c547c5, in files this stack doesn't touch.
go test -race -run 'TestWSL|TestTagged|TestPinnedPiCache' for
library and plugin: ok.
- magpie-desktop (Linux, wsl-run; WebKit hangs on mote), Chromium and
WebKit: every library-*, sync-*, s3-sync, github-sync and i18n-keys
file, 4 at a time: 1003 of 1020. The 17 reds are in 6 files no commit here
touches: i18n-keys ("Unmarked", #4524), library-chip-fan, -items,
-mcp-health, -mcp-hub (#4483) and -mcp-tools. Those 6 alone, one at a
time, at load ~60: 74 of 92 here, 77 of 92 at 90518de26 itself. Red
in both: i18n-keys, -chip-fan and -items in WebKit, -mcp-tools in
Chromium ja 420; -mcp-health green in both; -mcp-hub's WebKit case
red here only, the case #4483 has red on main. -chip-fan and -items
are #3072's and #4501's kind, WebKit under load.
- Broken by hand on mote, each red: instructionsView skipping the
stopped distro's agents (TestWSLStoppedInstructions, "a stopped
distro's Codex isn't on the Instructions page", and ...Unseen, "Pi
switched on while stopped"); keepShape without Instructions (Codex
not on the page); distrosNamed without Instructions.Agents ("no sync
once the distro ran"). On Linux, client.js's asleep row back to
pathLink with the unseen switch's guard gone: library-wsl-asleep's
Instructions test red in both engines, 10 subtests each.