0.1.47 (npm, checked with npm view --prefer-online) sends a free gift
model such as GLM-5.3-Flash-Trial to ZCode spelled as the registry does
("GLM-5.3-Flash"), as the 3.17.2 app sends it, not the lowercase bucket
name, and the plugin's own 429 says when ZCode answered 429 to the last
request for the model (rested a minute). Reported on Discord as the
free Flash model failing in magpie while working in the ZCode app.
Run: go test -timeout 45m ./internal/provider on mote: ok. go vet for
linux and windows: no errors. gofmt -l: clean. The plugin side ran
bun test packages/zcode on mote.
Not tried: a real ZCode account; the cause is not proven. A 405/3012 is
ZCode's account risk control (plugins#348) and this does not lift it.
A trackpad's tap-to-click presses and lets go within tens of ms and the
pointer can slide a few pixels between. dragRows and dragCards lifted the
row after 4px and marked the handle dragged, so the click that followed was
swallowed: an agent row's logo, a provider row, a usage card took a second
tap. A press let go under 300ms and under 12px from where it came down now
sets nothing down and lets the click through (tapLike). A real drag, held or
long, still moves the row.
Reported by refeccd (Discord #feedback, 2026-11-03).
Run at the pushed head (mote, node --test, Playwright chromium + webkit):
tap-click.test.cjs (new; en/zh, window/panel, slid 0/5/9px; 26 ok), and
account-arrange, agent-grip, drag-rows-shift, fold-show-grip,
gateway-key-arrange, grip-inset, group-arrange, group-member-drag,
list-sort, panel-arrange, usage-arrange, click-scroll: ok.
Broken by hand: with the old app.js tap-click is 18 of 26 red (every slid
5px and 9px case, both engines); the 0px case passes on both.
routing-rule-drag chromium is red on the old app.js too (known: #3789,
#5088), not from this.
Not run: the whole GUI suite (another session's was running on mote), a
real trackpad tap (can't be done from a test), and hover-revealed controls
that shift under a tap, none found to be the cause.
isaac_bai on Discord, after v0.1.2857 named the header's icon "Open the
main window": with Windows' taskbar at the bottom, the panel stands above
the tray and its header is the panel's whole height from the icon; the
button left of Quit was where his pointer already was. yogurt36 had asked
for one opener, not two, so the panel still has exactly one, now on the
edge nearest the tray:
- Hung below its icon (the Mac's menu bar, a taskbar or bar at the top)
it is the header's icon, as before.
- Standing above it (Windows' bottom taskbar, a bottom panel on Linux) it
is "Open the main window" left of Quit in the foot (#openMain), and the
header has no icon. The string is the one the icon's name already
uses, in all five languages.
Which side: once togglePanelNow has placed and shown the panel,
tellPanelSide reads the panel's bounds and its screen's and sends
magpiePanelOpenAt("foot") when the panel is nearer the screen's bottom,
"head" otherwise (panelOpenAt, panelside.go; the Mac is always "head").
Under Wayland a window can't read where the compositor put it, so there,
and until the app says, layout.js sets body[data-open-at] by the system:
"foot" on Windows, "head" elsewhere. CSS shows one of the two from it.
Tests:
- TestPanelOpensTheWindowFromTheEdgeNearestTheTray: Windows bottom/top
taskbar, a tall panel, a second screen above the first, Linux X11
bottom/top, Wayland, a screen not read, the Mac, unknown places; only
"head" or "foot" reach the page.
- TestPanelToldItsSideWhenShown: both show paths in togglePanelNow call
tellPanelSide after placing; app.js has magpiePanelOpenAt.
- panel-open-once.test.cjs, Chromium and WebKit x en/zh/zh-TW/ja/de:
on a Mac platform exactly one opener, the header's, named per
language, opening /api/window/main, foot ["profBtn","quit"]; told
"foot" it moves. On Win32 exactly one opener, the foot's, left of Quit
(["profBtn","openMain","quit"]), the foot's buttons fitting apart with
their words whole at 360px, opening /api/window/main; told "head" it
moves back; an unknown side changes nothing.
Run on mote via mote-run:
- At this head (rebased on 8468afecb): go test ./internal/gui -run
'TestPanel|TestTrayDouble|Budget|I18n|Asset': ok; node --test
panel-open-once, i18n-keys, window-no-footer, panel-profiles,
quit-ask-setting, gui-de, gui-ja, gui-zh-tw: 165 of 165 pass.
- At the same change rebased on f168dd278 (main's 8 commits since are
Library, Routing, browser and Codex-subagent work, none in the
panel's header or foot): the 127 GUI files that load
mode=panel or touch the foot, Quit, i18n or a budget, both engines,
6 at a time: 2112 of 2136 pass. The 24 reds are in 7 other files; run
again 2 at a time, 16 stay red at this change and 17 at origin/main
1e1068c86, the same tests: usage-fold, tray-cell-click and
codex-auto-reset webkit de (#4790), remote-magpie (#4398), and one
provider-mask case (filed #5109); account-mask (#3951) and
quota-curve (#4768) went green on the second run.
- At this head: wsl-run go vet -tags gtk3 ./internal/gui: ok
- win-run go vet ./internal/gui: ok; win-run go test -run
'TestPanelOpens|TestPanelToldItsSide|TestTrayDouble' ./internal/gui: ok
- gofmt -l internal/gui: empty
Broken by hand (in a copy): panelOpenAt always "head" plus the page's
default and magpiePanelOpenAt doing nothing: the Go test red on 5 cases,
panel-open-once 20 of 20 red. Only the CSS rule that hides the header's
icon at the foot dropped: panel-open-once red (two openers shown).
Not tried: a real Windows tray with the taskbar at the bottom or the top,
or a Linux X11 bottom panel; the bounds Wails reports there are read from
its source (positionWindow, the screen's Bounds), not seen. The whole GUI
suite (1175 files) was not run: mote was at load ~55-100 from other
sessions' suites.
Claude Code notes each image it is given ([Image: source: .../images/N.jpg])
in a note after the message, with a path in the gateway's temp folder. With
no history before the turn, nothing said what they are: the model took the
paths for the images, said it could not see them and quoted the paths as on
another computer (sinsoul1647 on Discord, v0.1.2862, 7 tool-result photos).
The prompt (renderClaudePrompt) and a saved session's turn (renderClaudeTurn)
now say the images, tool results' too, are in the message.
Tried: real claude 2.1.316 on mote against a fake Anthropic server, with
-p user images, MCP tool-result images, a url source, the TUI paste and a
resumed transcript: every one reached the API as image blocks, so the loss
is the model's reading of the notes, not a dropped image.
Not tried: the reporter's client; whether the model stops quoting paths.
Broken by hand: with the note left out, TestClaudePromptSaysToolResultImagesAreAttached is red.
Run at the pushed head (rebased on 8e27369bd): gofmt -l clean; go vet gateway linux and windows ok; go test ./internal/gateway -run Claude|Subscription|Prompt|Image ok (not the full gateway suite: another full suite was on mote).
Asked for in chat ("Magpie Browser MCP 也要支持录屏哦"), like
claude-in-chrome's gif_creator. The browser tool gets two actions:
- record_start: from now on, after each action that can change the page
(not tabs, snapshot, text, console, screenshot, tab_close), the gateway
takes a picture of the session's window, 800 wide, with the action and
what it was done to written in a strip under it (the url, ref, key or
drag; never what was typed).
- record_stop: the frames as an animated GIF, a second a frame and the
last three, each frame after the first only the rectangle that changed.
It is kept an hour behind the image server's tokened files link and
named in FilesMeta, so `magpie tool` saves it; the text says to curl it.
The gateway does it all through browser_screenshot, so every extension
version records and nobody has to reload theirs. At most 300 frames;
a recording nobody stops goes after 30 minutes. A picture an action's
screenshot: true asks for is the same one the frame is made from.
Run on mote (macOS, Chrome for Testing 1234 headless):
- GOOS=darwin/linux/windows go vet ./internal/gateway, gofmt -l: clean.
- MAGPIE_BROWSER_CHROME=... go test ./internal/gateway -count=1
-timeout 45m: ok (794s).
- New: TestBrowserRecordsAGIF (real Chromium: navigate, type, snapshot,
navigate → 3 frames, GIF fetched from the link, 800 wide),
TestBrowserGIFFramesHoldWhatChanged, TestBrowserRecSayKeepsTypedTextOut,
TestBrowserRecordStopWithNothing.
Broken by hand: with browserRecWorth always false, TestBrowserRecordsAGIF
is red ("no frames").
Not tried: a real headful Chrome, Edge or Arc; Windows and Linux browsers.
The owner: Magpie Browser "老是会代替掉用户正在浏览的网页". A call that
named no tab, from a session with none, took the tab the user had in
front and navigated it away under them. Now:
- such a call opens a new tab of the session's (about:blank), behind the
shown one, in its Magpie tab group, in the window used last, or an
unfocused window of its own when none is open (open() in background.js);
- browser_tabs new / tab_new open behind too; front: true shows the tab,
for when the user asked to see it (background is still taken, and is
now the default);
- a screenshot of a tab behind shows it for the picture, then gives the
window back the tab the user had in front;
- a link with target=_blank clicked in a tab behind: Chrome shows the new
tab and names the user's shown tab as its opener. It is still followed,
grouped in the session's group, and the user's tab is put back in front.
- the tool descriptions say so; the user's tabs are acted in only when a
call names one.
Extension 0.1.4. When an older one connects, the gateway writes this
magpie's over its folders (browserext.Refresh; only folders already
written, never a newer one's: browserext.Older), so the browser picks it
up when it starts again or on the extension's reload in
chrome://extensions. Before, only opening Library's Browser page did. The
dir helpers moved from gui to browserext for it.
Tried and dropped: telling the extension to chrome.runtime.reload()
itself. In Chrome for Testing 1234 on mote an unpacked extension that
calls it never comes back (headless and headful, --load-extension and
CDP Extensions.loadUnpacked, with an onInstalled listener), which would
leave the user with none until a restart.
Run on mote at 1e1068c86 + this:
- MAGPIE_BROWSER_CHROME=Chrome for Testing 1234, go test -run Browser -v
./internal/gateway: ok, 16 passed, including the new
TestBrowserLeavesTheUsersTabAlone (navigate, link to a new tab, tab new,
screenshot, tab_new: the user's about:blank tab stays + and unchanged,
the agent's in [Magpie]) and TestBrowserOlderExtensionsFolderWritten.
- go test ./internal/browserext (TestOlder, TestRefreshWritesOnlyWrittenFolders): ok.
- go test ./internal/gui: one red, TestMainWindowCorners/macOS_26_SDK,
filed as #3949 (macOS 27 on mote), not touched here.
- gofmt -l; GOOS=darwin/linux/windows go vet of the three packages: clean.
Broken by hand: TestBrowserLeavesTheUsersTabAlone with origin/main's
background.js is red ("navigated the user's tab"). The link case was
found by TestBrowserToolsInARealBrowser going red on the first version.
Not tried: the user's own Chrome (headful Chrome with real sign-ins),
Edge and Arc; Windows and Linux browsers.
cleverpigo (Windows, Codex App 26.1027.6604.0) had Codex's lead on
WorkBuddy's DeepSeek-V4.1-Flash, the subagent model on what the GUI called
"Same as the lead", and the Routing page still showed a subagent on
gpt-5.6-sol through Codex's own sign-in.
Cause: that setting, unset, never held a subagent to anything. Since
67c8f562c (mengxiao) a subagent keeps the model its lead names in
spawn_agent (codexFollowTo leaves subagents alone; codexSubagentPick
returns nil with nothing set), and Codex lists its own models first under
spawn_agent's model overrides, so the DeepSeek lead named gpt-5.6-sol.
Codex's side calls use luna, terra or codex-auto-review, not sol, so it
was the subagent, not a side call.
Now:
- "lead" (settings.CodexSubagentLead / provider.CodexSubagentLead) is a
value of CodexSubagentModel: every Codex subagent goes on the model the
lead's own turns last went on (codexLeads.lookup), whatever it names.
The trace says so (SubagentPick.Lead) and Routing tells it as "the
model its lead is on".
- A lead on one of Codex's own models is followed on the ChatGPT backend
route only; in serve such a lead leaves the request as asked. With no
lead turn seen, a subagent goes as asked.
- The GUI's picker offers "Lead's pick" (unset, mengxiao's case, as
before) and "Same as the lead" (the new value); the texts say which one
holds the subagents. en, zh, zh-TW, ja and de.
- No prompt text sent to a vendor changes.
Users who had it unset stay on Lead's pick; the label now says what it
does, and they pick Same as the lead to hold their subagents.
Docs: agent-wiring.md (subagent model field), gateway-routing.md
(CodexSubagentModel paragraph).
Ran, on mote through mote-run at this tree (base origin/main 50265256b):
- go test -tags nogui ./internal/gateway (whole package, -timeout 45m): ok
- go test -tags nogui ./internal/provider ./internal/settings
./internal/settingsapi: ok; -run Codex ./internal/agent ./internal/gui:
ok; -run Budget ./internal/gui (TestCoreScriptBudget): ok
- go vet ./..., GOOS=windows go vet ./..., GOOS=linux go vet -tags nogui
./... (and -tags nogui darwin/windows): clean; gofmt -l: nothing
- node --test, both engines: codex-subagent-model (now picks Same as the
lead and back, sheet row, Routing story of a lead-moved subagent, five
languages), codex-subagents-lead, i18n-keys, routing-request-model,
routing-sealed-task: pass. routing-story-shrinks is red in WebKit (4
subtests, "held while under way"), the same alone at origin/main
50265256b: #3954.
Broken by hand (in mote's copy only):
- lead lookup turned off in codexSubagentPick: both new tests red
(TestCodexSubagentFollowsTheLeadWhenSet: "ChatGPT was asked for
[gpt-5.6-sol]", the reporter's case).
- codexBackend's gate back to bare models only:
TestCodexSubagentFollowsALeadOnCodexsOwnModel red.
- On the old code the tests don't build (no "lead" value), and
SetCodexSubagentModel refused "lead".
Not tried: a real Codex App/CLI with a DeepSeek lead spawning a subagent,
and nothing on Windows (the change has no OS-specific path). The whole GUI
suite wasn't run: mote had two other sessions' full GUI suites going.
youyo.p_10001 on Discord: with many skills and MCP servers installed,
you can't tell what each is for or which to use. A skill has the
description its author wrote for models, often in English and about
what it does, not why you installed it. An MCP server has nothing but
its command and its tool list. So each now takes a note in the user's
own words.
- Server.Note and Skill.Note in library.json: one line of at most 200
characters, whitespace run together (checkNote), as a hook's
description (#2011). A longer one is turned away, not cut.
- The server editor has a Note field under the name. A skill's reader
(2a19043af's file reader) has one over its files: Save shows once it
changes, saves the file being edited with it, and a changed note is
asked about before the dialog closes. SkillNote, POST skills/note.
- A row shows the note in place of its command or description, so rows
keep their height; the tooltip gives the note, then that line. The
skills' filter matches notes.
- No agent is given a note: not in any agent's MCP entry, a project's
file, the MCP router's list or a skill's copied SKILL.md.
- A sync carries it (CarriedSkill.Note; a server goes whole), and
clearing it is carried too. An older magpie on another computer
doesn't know notes: a bundle it writes has none, so a sync from it
clears them. The TUI's server editor keeps a note as it was.
Run at the pushed head:
Run at the pushed head (on origin/main f168dd278, then
rebased onto 94d0fbfcd, whose two commits change only
migrate_zcode.go and the searcher-pick test):
- mote: go test -timeout 45m internal/library (TestNoteNeverGiven,
TestNoteCarried, TestNoteTooLong), gui, tui, davsync, backup: ok,
except internal/gui's TestMainWindowCorners/macOS_26_SDK, mote's SDK
(#3949). GOOS=windows go vet of library, gui, tui and GOOS=linux of
library, tui: clean. gofmt -l: clean.
- mote, both engines, every language, narrow and wide: skill-edit (the
skill reader's note), library-mcp-json (the server's note, its row and
the filter), mcp-editor-cancel, library-mcp-win-line, market-address,
market-have, i18n-keys: 108 of 108.
- WSL, the whole GUI suite: no red in a library file that origin/main
hasn't too (see the command commit; #4120, #4471 for the rest).
- "Note" is in core i18n.js, not the plugin's: agent code says it as a
word. The rebase had dropped main's title on a server row's command
line (library-mcp-win-line went red); it is back, and with a note the
tooltip gives the note, then that line.
Broken by hand, each red, then restored:
- add("note", s.Note) in Claude's MCP format: TestNoteNeverGiven
(.claude.json held the note).
- the carry of Note left out: TestNoteCarried.
- note left out of the server editor's save: the GUI test, 22 of 22.
- notes left out of the skills' filter text: the GUI test, 22 of 22.
- the note's save left out of the skill reader's Save: skill-edit, 22
of 22 (Save never goes away).
- the note left out of the reader's unsaved check: skill-edit, 22 of 22
(closing never asks).
Not tried: a real sync between two computers, a real agent reading its
config (the guard reads every file magpie writes in a sandbox HOME), a
real app window, Linux WebKitGTK.
hema_17384 on Discord: in Library > MCP servers, the editor's Command
field was one line, so `npx -y universal-db-mcp --type sqlserver --host
... --user sa --password ... --database ...` was cut off, and they asked
to see and edit the server as JSON.
- The command is a box that wraps (lineBox, a textarea of one row that
grows with autosize). It is still one line: Enter saves, Escape
closes, and a newline is a space between words (a shell's \ before it
too, except on Windows, whose lines keep their backslashes). At 390
wide it wraps over several rows; nothing scrolls sideways.
- The editor's head has a Form | JSON switch (the app's segmented
control, not a <select>). JSON is the server as Copy config gives it
for Claude Code: {"mcpServers": {name: {type, command, args, env}}},
or {type, url, headers} for a URL, with ${NAME} references as written.
An edit there is read as a paste is (serversIn) and becomes the form's
at once. JSON that isn't one server's marks the box invalid, says so,
and keeps the dialog from saving or going back to the form, and
counts as unsaved for Cancel. The agents, sync and the startup
timeout and OAuth app stay in the form and are kept as they were.
⌘/Ctrl-Enter saves from the box; a paste into it is the box's, not
the dialog's "paste a README's JSON".
- Strings in en, zh, zh-TW, ja and de.
Run at the pushed head (on top of the note commit, which shares these
files):
Run at the pushed head (on origin/main f168dd278, then
rebased onto 94d0fbfcd, whose two commits change only
migrate_zcode.go and the searcher-pick test, with the note commit
on top, which shares these files):
- mote: go test -timeout 45m internal/library, gui, tui, davsync, backup:
ok, except internal/gui's TestMainWindowCorners/macOS_26_SDK, mote's
SDK (#3949). GOOS=windows go vet of library, gui, tui and GOOS=linux of
library, tui: clean (internal/gui's Linux vet needs gtk3 and ran clean
on WSL before the rebase, with no Go change since). gofmt -l: clean.
- mote, both engines, en/zh/zh-TW/ja/de, 390 to 1100 wide:
library-mcp-json (new), mcp-editor-cancel, library-mcp-win-line,
market-address, market-have, skill-edit, i18n-keys: 108 of 108.
- WSL, the whole GUI suite (before this rebase, at the same change):
541 subtests red in 57 tests, the WSL baseline (#4120, #4471). Those
in library files are red on origin/main too, run side by side:
found-skill-pick-remove (#5013, #4097), library-mcp-hub (#4483),
market-more (#5076), library-chip-fan (#3072), library-mcp-tools ja
420 (#4693). market-address and market-have were mine: they still
looked for the command's <input>; they find textarea.lib-cmd now and
pass 32 of 32 on WSL.
- "Form" is in core i18n.js, not the plugin's: agent code says it as a
word, which i18n-keys turns away in a plugin.
Broken by hand, each red, then restored:
- .lib-cmd back to white-space: pre: "the command scrolls sideways".
- the command field back to an <input>: the new test and
library-mcp-win-line fail (28 of 28).
- save without the JSON check: the "isn't an MCP server's JSON" error
never shows and the broken JSON goes to save.
- (wrap="off" on the textarea alone stays green: the CSS's pre-wrap
wins, so the CSS is the guard.)
Not tried: a real magpie app window (the GUI tests fake the API), the
reporter's real server, Linux WebKitGTK.
ZCode 3.17.2's marketing feed answers empty to the 3.16.3 the plugin
signed in as, so from 11-03 the daily claim found nothing (plugins#676,
jinpy666; rick_49551 on Discord). 0.1.45 (#678, jinpy666) reads the feed
under 3.17.2's version header and drops billing/preview, which the 3.17
client no longer polls. 0.1.46 sends every call as 3.17.2, since the
client says the Start Plan balance judges capability by the real
app_version, and takes a sign-in whose only Start Plan starts later, as
the client's resolveStartPlanBalanceAvailability does, instead of
refusing it as "ended or never started" (sliyrainbow on Discord, whose
account works in the official client). Checked against
zai-org/ZCode@a9fe401. Raising min moves every moved user onto 0.1.46
through keepMovedCurrent.
npm has 0.1.46 as latest (published 2026-11-03T13:41:44Z, plugins
8fc12a3).
Run on mote at this change (on f168dd278; the rebase onto 93b1b4904
only touches a GUI test): go test -timeout 45m ./internal/provider ok
(121s); GOOS=windows and GOOS=linux go vet ./internal/provider ok;
gofmt -l clean. Plugin side: bun test packages/zcode 191 pass; with
the old app version, without the later-start Start Plan, or with the
old locale put back by hand, 7, 2 and 1 tests went red.
Broken by hand here: nothing; this is a version string, and no test
pins the zcode min.
Not tried: no real ZCode account was available, so neither the claim
nor the sign-in was run live by us; the feed's version gate rests on
jinpy666's live run in #678. Packages that import internal/provider
were not run.
After the reload, the test took the first searcher row it found and
scrolled to it. Settings draws the row when the page opens and again
when load() has the state, so on a busy machine the row was replaced
under scrollIntoViewIfNeeded: "Element is not attached to the DOM"
(webkit zh alone on WSL at 01de489de, webkit en in a whole run).
Now the test waits for settingsDrawn, as it does on first open (#1659).
The fake server can hold the state and settings reads (st.slowRead, 400ms
here), so the page's first drawing and load()'s are apart every run, and
the test checks the row it scrolled to is the one that stays.
Run:
- Broken by hand (settingsDrawn after the reload removed), with the
injected read delay, on WSL: 2 of 4 red with the reported error,
"locator.scrollIntoViewIfNeeded: Element is not attached to the DOM"
(chromium en, webkit zh).
- Fixed, on mote: node --test searcher-pick.test.cjs, both engines,
22 pass, 0 fail.
- Fixed, on WSL: the picked-in-Settings cases in WebKit, 2 of 2 ok.
Not tried: the whole GUI suite (test-only change to one file).
anthropicTextCalls (the filter that turns calls a model wrote into its
text into tool_use blocks, on a Messages passthrough that offered tools)
split each read with bytes.SplitAfter on "\n". The piece ending a read
always left a trailing empty slice, which line() took for the blank
line that ends an SSE event. So an upstream that flushed `event:` and
`data:` in separate reads had its events dispatched early: a
content_block_start reached the client without its data ("Unexpected
end of JSON input"), or a held block start was joined to the next
event without a blank line ("Unexpected non-whitespace character after
JSON"). Claude Code retried and gave up; hugemulberry on Discord sees
499s often.
The filter now reads whole events with tidyEvents and eventData, as
responsesTextCalls, phaseTidy and idTidy already do. Because tidyEvents
hands out slices of a buffer the next write reuses, the held block
start and stop are copied (startHeld, stopHeld); nothing else the
filter keeps past an event points into the buffer (pending and held
are strings, m is read within the call).
Siblings: the other SSE writers that cut a read on its last "\n"
(textCallTidy, geminiTextCalls, chatTidy, crTidy, usageSniffer) handle
each line alone and keep no event across lines, so the trailing empty
piece goes on as nothing; phase.go's withData and redact's splitEvent
split a whole event. Only this filter gathered lines into events.
Port of oDaiSuno's fix (7bee8c4d0) and tinytub's regression tests and
doc line (d1a7b02a8); yetone/magpie PRs are collaborators-only. Added
here: TestAnthropicTextCallsSSEChunksKeepFraming feeds each stream in
two reads cut at every byte (LF and CRLF), and
TestAnthropicMessagesSSEChunksKeepFraming cuts the handler's upstream
after each line and adds a request with no tools.
Run on mote at this tree (origin/main 4c0c6c02b + this change):
- go test ./internal/gateway -timeout 45m -count=1: ok (628s)
- gofmt -l internal/gateway: empty
- GOOS=linux go vet ./internal/gateway, GOOS=windows go vet
./internal/gateway: ok
Broken by hand:
- textcalls_anthropic.go from origin/main: 36 subtests red (lines,
bytes, CRLF lines, every cut, each line cut, for all four streams in
both tests: "SSE frame "content_block_start" has 0 data lines");
whole, events and no-tools stay green.
- the fix without the startHeld/stopHeld copies: 30 subtests red,
events reads included (a held start overwritten by the next event's
bytes: "has 2 data lines").
Not tried: a live provider through this build (tinytub reproduced the
original failure through JoyCode on v0.1.2838 with Claude Code
2.1.316); lone-CR line endings, which neither the old nor the new
reader supports.
Co-authored-by: oDaiSuno <157346420+oDaiSuno@users.noreply.github.com>
Co-authored-by: tinytub <1871460+tinytub@users.noreply.github.com>
refeccd on Discord (#help): on the Routing page, in a full-screen
window, the stage kept the agent and magpie in columns of 124px each, so
the agent read "Claude Desk…" (and its model auto/claude-opus… was cut)
while the group's member rows ran on across the rest of the stage.
The two columns are now fit-content(max(124px, 15%)): as wide as their
words, at least 124px (min-width on .rt-srcs/.rt-hub, dropped again in
the narrow layout), at most 15% of the stage. Where 15% is no more than
124px (a stage up to ~826px) they are exactly as before, so the member
rows lose nothing on a narrow window; the narrow layout (560px and less)
is unchanged. The stage's ResizeObserver now also watches the agents'
and magpie's cards, so the wires follow a card that changes width while
the stage keeps its size (a new agent name or gateway address).
Run, on mote:
- new routing-stage-wide.test.cjs: 60/60 (chromium + webkit, en zh
zh-TW ja de, 2560/1920/1100/800/560/390px): name, model and address
read whole at 1920+, columns 124px..15%, exactly 124px where 15% is
less, wires start and end at the cards, no sideways scroll.
- broken by hand: with the old routing.css the same test is red in all
20 cases at 2560 and 1920px ("Claude Desktop" cut, columns 124/124).
- every routing-*.test.cjs + i18n-keys at 8d7583a78 (this change on
6c201095d): 2442 tests, 2409 ok, 33 red in 12 files. The 12 files
rerun at 6c201095d and at 8d7583a78 side by side: 29 red at the
base, 28 with the change, the same tests (routing-folder, rule-drag,
rule-remove, rules-line, rule-models, many-keys, row-swap, steady,
steps-cap, story-shrinks, order-unknown); sky-under's one red in the
whole run passed in the rerun. Filed with both outputs as #5088.
- at this tree, rebased on 4c0c6c02b (nothing new on main touches
routing): routing-stage-wide, routing-sky-under, routing-scroll-end,
i18n-keys: 126/126.
Not tried: the whole GUI suite (mote was down mid-run; it runs after
the push), the real Wails/WebKitGTK app, and a test of the wires
following a card that changes width with the stage's size unchanged.
A plugin with auth.refresh had a sign-in renewed only when something
used the account (a request, its models, usage or check-in) within its
refreshLead of expiry. An account left idle past its token's life
lapsed. OrcaTerm's WeChat token lives two hours, and after that its
refresh answers SESSION_EXPIRED for good, so the user had to sign in
again (orinsid, magpie-community/plugins#675).
The gateway now renews each such sign-in as it comes due
(provider.KeepPluginsSignedIn, started beside KeepPluginsListed):
- Due times come from plugin-auth.json through filememo
(plugin.RenewAt: expires less the lead the host reckons, now listed
as Provider.Renews/RenewLead). Nothing is asked, and no host started,
until an account is due. The loop sleeps until the next one, at most
5 minutes, and renews them one after another.
- A due sign-in goes through the host's own renewal (host.js
keepSignedIn, which shares renewal() with fresh()). It is one at a
time per account whoever asks: a request arriving meanwhile waits
for the same promise, under the cross-process lock file, through the
account's proxy.
- Kept: accounts switched on and not marked, of a plugin provider not
switched off, hidden (leftAlone) or being moved.
- A failed renewal marks nothing. It is held back for 1m, doubling to
at most 30m, for that sign-in only. Only the plugin's
signIn:"expired" marks it, as at a request.
- A plugin can opt out with auth.keepAlive: false. None in the plugins
repo needs to: no refresh costs quota, the ones rotating single-use
refresh tokens (Cline, Factory, Nous, SenseNova, CodeArts, Qoder,
MiniMax) rotate at use already, and kimi-work's reference accounts
and Raccoon's desktop reuse never refresh another app's token.
Docs: provider-plugins.md "A sign-in nothing uses"; leftAlone list in
providers-accounts.md.
Run at the pushed head, on mote (mote-run), -tags nogui:
- go test -count=1 -timeout 45m ./internal/plugin ./internal/provider
./internal/gateway: ok (109s, 119s, 637s), rebased on origin/main
6cfe78635. Rebased again on b088fd0f0 (gateway.go, prompt.go
changed): go build ./..., go vet of the three packages and the new
tests plus TestLivePrompt*: ok.
- the new tests on Windows (win-run) and Linux (wsl-run): ok.
- GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...,
go vet ./...: ok. gofmt -l: clean.
Broken by hand, each red, then restored:
- keepSignedIn refreshing by itself, not through renewal()/the lock:
TestKeepSignedInRenewsIdleSignIns red (r-ok-busy renewed twice
beside concurrent requests).
- keepAlive:false ignored: red (stayco listed as renewed).
- a network failure reported as gone: red (down: Gone true).
- Go backoff removed: TestKeeperBacksOffAFailedRenewal red.
- the On, Lapsed and leftAlone filters each dropped:
TestKeptSignInsAreTheOnesSwitchedOn red.
The new tests don't compile on the old code (no KeepSignedIn).
Not tried: a real OrcaTerm account idling past its 2h token with the
gateway running; Windows/Linux runs of the new tests (vet only); a
magpie with many plugin accounts beyond the unit test's look.
isaac_bai on Discord missed the "Open magpie" button beside the quick
panel's Quit, and was setting the tray click to open the main window just
to get back to it; he asked for a double-click on the tray icon.
History: the foot's button (#openMain) was taken out on purpose in
e0ad48641 (10-30, yogurt36 on Discord): the panel had two buttons to the
same window, the header's open-as-a-window icon (#open) and the foot's
"Open magpie". The header icon stayed, but its tooltip said "Open as a
window", which reads as this panel in a window. Rather than bring the
second button back (and undo yogurt36's ask four days later), the icon now
says what it opens: "Open the main window", a string every language
already had (Settings' tray-click choice). "Open as a window" is out of
i18n.js, nothing else used it.
Double-click, per OS, from Wails v3.0.0-beta.24's source:
- Windows: systemtray_windows.go passes WM_LBUTTONDBLCLK on as
OnDoubleClick. A double-click arrives as LBUTTONUP (the click: the panel
opens), LBUTTONDBLCLK (now: ShowMain, whose openMain hides the panel),
LBUTTONUP again; that last one is swallowed once (trayDouble, within
2s) so it doesn't open the panel over the window.
- macOS: the status item's action runs per mouse-down with no click count
(systemtray_darwin.m statusItemClicked); a double-click would be the
panel opened and closed. Not added.
- Linux: StatusNotifierItem has Activate only (systemtray_linux.go); the
same. Not added.
docs/subsystems/gui-shell.md step 10 says so.
Tests:
- TestTrayDoubleClickOpensTheWindowOnWindowsOnly: windows on, darwin and
linux off, and app.go wires OnDoubleClick to ShowMain and checks the
swallow first in OnClick.
- TestTrayDoubleClickReleaseSwallowedOnce: the release after a
double-click opens nothing, once; the next click, or one past the bound,
opens the panel. Fixed instants, no sleeps.
- panel-open-once.test.cjs: the header icon's title and accessible name
are "Open the main window" in en, zh, zh-TW, ja and de, both engines.
Run (at the pushed head's tree before rebase onto 78667e9b7, which changes
only docs/subsystems/gui-shell.md among these files):
- mote: gofmt -l internal/gui clean; GOOS=windows go vet ./internal/gui ok;
go test -run TrayDouble ./internal/gui ok.
- Linux (wsl-run, magpie-desktop): go vet -tags gtk3 ./internal/gui ok;
go test -tags gtk3 -run 'TrayDouble|TrayMenu' ./internal/gui ok.
- Windows (win-run, xiaomi-gpu): go test -run TrayDouble ./internal/gui ok.
- mote GUI, both engines: panel-*, phone-web, old-webkit and i18n-keys
(24 files), 280/280 ok.
- Broken by hand (a copy on mote): trayDoubleClicks false for windows and
the swallow never reset are both red; the old "Open as a window" title
is red in every language, Chromium 0/5 and WebKit 0/5.
At the pushed head (rebased on 78667e9b7), mote: gofmt clean, go test -run
TrayDouble ./internal/gui ok, panel-open-once + i18n-keys 14/14 ok.
Not run: the whole GUI suite (a tooltip only, no layout or API change) or
the whole Go suite. Not tried: a real double-click on the Windows tray
icon in the built app, or the panel in the real tray on any OS.
packinggoods on Discord: Routing's context window card said "the model's
window isn't known" for a request on remote-magpie/claude/claude-opus-5-5
that was still answering, though the remote magpie's list gives that
model's window. The window was put on a route's prompt only when the
request ended (calibrate at the route's end). A live request always
showed it as unknown, on every provider.
Now the window of the model a try goes to is read as the try goes out.
That is windowOf(c.p, c.model), the same call the route's end makes. It
is kept on the route (Route.window, unexported), and the prompt shows it
while the request is under way (livePrompt). This holds whether the
prompt is read before or after the try starts. A fallback to another
model updates it. At the end the answering model's window still comes
first, as before. Codex turns through magpie's Codex backend now work out
Codex's own window (CodexWindow, else models.dev) when the turn begins,
not when it ends, so they show it live too.
Run at this head (rebased on fb1f4856a), on mote:
- go test ./internal/gateway -run 'Window|Prompt|Context|Trace|Codex': ok
- GOOS=linux and GOOS=windows go vet ./internal/gateway: ok; gofmt clean
Run before the rebase (base 7d022bdb6; since then main changed only
gateway-key code in internal/gateway):
- go test -count=1 -timeout 45m ./internal/gateway: ok (724s)
- go vet (darwin, linux, windows) ./internal/gateway: ok
Broken by hand: TestLivePromptHasItsWindow, run on the old code, is red in
both subtests ("in flight: prompt &{Window:0 ...}, want the window
1000000", and Codex's 272000). The done route was right on the old code
too.
Not tried: a real remote magpie on another computer. The test serves its
/v1/models window through catalog.SaveLive, as the remote's list does.
why8023: Codex switched off and on again showed 「已接入」 with its
subagents' and memories' models back, while its own model never reached
magpie. fae438b4a (NancyTom18 on X) made reconnect call Join first, which
fixed the ChatGPT sign-in case, but where Join can't apply then (a
model_provider of the user's own, magpie API) reconnect still put the
helper fields back alone and answered Wired(), which a helper field on
one of magpie's models makes true. So the switch said connected while
Codex's own turns went to the user's provider.
Now, when Join doesn't join and the model Codex was on wasn't one of
magpie's, reconnect gives up and the switch connects Codex as at first,
on one of magpie's models. Where its model was magpie's, that model
routes it, as before. docs/subsystems/agent-wiring.md says so.
coffemon's (JoeyWu-tech) patch 9ee95ba9, re-ported onto fae438b4a: main
already joins first, so only the !ok check is taken, with his
TestCodexOffAndOnJoinsAgainWithItsHelpersOnMagpie (seven cases, all
green on main too since fae438b4a). TestCodexOwnProviderOffAndOnIsNot-
ConnectedByItsHelpers is new and covers the case that was left: a relay
model_provider, Connect, subagents' model on magpie, gpt-5.5 picked
back, off and on.
Run (mote-run, macOS, go1.26.8, -tags nogui):
- the new test: ok. With the check turned off by hand (if false && ...):
red, "on again ({How:again ...}) with its own model off magpie".
- TestCodexOffAndOnJoinsAgainWithItsHelpersOnMagpie,
TestCodexReconnectStaysJoined, TestCodexConnectKeepsItsPick,
TestReconnectKeepsTheLastPick, TestCodexDisconnectStaysWithAccountsOn
and the OpenCode/OpenChamber tests: ok.
Not tried: the Agents page and a real Codex on a relay afterwards; the
test drives ConnectHow and Disconnect, which the switch calls, with
config.toml in a sandbox HOME.
Batch run, at tree 104d75f0a (the twelve coffemon ports together, on
origin/main 7d022bdb6), mote, macOS, go1.26.8:
- go test -tags nogui -count=1 -timeout 45m on the packages the batch
changes (agent, autostart, daemon, gateway, library, proc, provider,
sessions, testenv, tui, gui): ok each.
- GUI, node --test with Playwright 1.62.0, Chromium and WebKit:
library-*.test.cjs and i18n-keys.test.cjs, 1044 of 1044 pass.
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./... and go build ./...: ok at cdd7c8e46, the same
batch on origin/main 00098f12b one rebase before.
- The whole go test ./... at cdd7c8e46: 86 packages ok, one red,
internal/cli TestEveryRouteHasACommandOrIsNamed (GET
/api/context/reply has no command), red on main too (#5026).
- Linux (wsl-run, Ubuntu 24.04, at 339055896, the batch on f4c664a09):
proc, autostart, testenv, tui ok; agent: only TestGrokInstalled red
(#3548); #4033's proc.Look reds (Zed, Copilot, Qoder, Cursor, Omp)
pass.
- Windows (win-run, Windows 11, at 339055896): proc, autostart, testenv,
tui ok; library and agent red in the same tests as on origin/main
f4c664a09 (#4115, #1827, #4786; #5068, #5069, #5070 filed now).
- Rebased onto origin/main fb1f4856a (three commits, no file in
common with the batch) and run again at the pushed tree: gofmt -l
nothing, go build ./... and go vet ./... ok; go test -tags nogui
sessions, agent, autostart, tui, proc, testenv ok; i18n-keys and
library-* 1044 of 1044 pass.
- Not run before the push: the whole GUI suite (a run at cdd7c8e46 was
cut off at 1170 of ~1174 tests when mote rebooted; it runs again after
the tag and any red is filed).
Co-authored-by: yetone <9rqwv2ak@gmail.com>
Found while fixing #3883. OpenCode 2 keeps a provider under providers,
its base URL in settings.baseURL, and reads it there before the same
name under provider, OpenCode 1's spelling: the one under providers is
taken whole, and the other is only a WARN, "retained native value over
legacy value" (packages/core/src/config/normalize.ts, mergeMaps, at
v2.1.4). OpenChamber's provider form saves a provider there and takes
it out of provider (packages/web/server/lib/opencode/config-v2.js,
writeSectionEntry). magpie read the user's own providers under provider
only, in the two places that look for them:
- ownGatewayProvider: a provider of the user's own at magpie's gateway
that lists the model, as a layout of one provider per family of
magpie's models has, gets a pick of that model of magpie's as
<theirs>/<model>, with no provider.magpie beside it. One under
providers wasn't seen, so the pick went to magpie/<model> and
magpie's provider was added beside the user's.
- openCodeSpelled: a model on a provider named as one of magpie's and
at the gateway (relay/glm-4.6 on the user's own relay) counts as
magpie's. Under providers it didn't, so Agent.Models left it out.
On origin/main e056779a, the same provider under each spelling:
provider: pick -> magpie-relay/relay/glm-4.6, no provider.magpie
providers: pick -> magpie/relay/glm-4.6, provider.magpie added
provider: Spelled=true Models=[relay/glm-4.6]
providers: Spelled=false Models=[]
Both now read a provider under providers as OpenCode 2 reads it: the
base URL from settings.baseURL (openCodeBaseURL), and a name under both
is the one under providers. They serve OpenCode, OpenChamber's pickers
on OpenCode's config, MiMo Code and DevEco Code; a config without
providers, as OpenCode 1 and the forks on it write, is read as before.
This changes what magpie reads, not what it writes, so there is no old
data to bring up. agent-wiring.md says so beside DevEco Code.
What was run (tree 77e2237e, on origin/main 2b038757, go1.26.8,
linux/amd64, Linux 5.15), outside graftcp, umask 077:
- TestOpenCodeKeepsItsOwnGatewayProvidersUnderProviders, new: a pick
of magpie/relay/glm-4.6 with the user's magpie-relay under providers
is written as magpie-relay/relay/glm-4.6 with no provider.magpie; a
model on relay under providers at the gateway is in Models; with
relay under both, the one under providers is read, for Models and
for a pick: ok
- broken by hand, one at a time, with
TestOpenCodeKeepsItsOwnGatewayProviders (the same under provider)
green under each:
- openCodeSpelled reading provider only, as on main: red, "models =
[]"
- ownGatewayProvider reading provider only, as on main: red, "model
= "magpie/relay/glm-4.6""
- the one under provider read over the one under providers, in
openCodeBaseURL: red, "the provider under provider read over the
one under providers: [relay/glm-4.6]"; in ownGatewayProvider: red,
"picked on the provider under provider: model =
"mine/relay/glm-4.6""
- the 26 internal/agent tests matching OpenCode, OpenChamber, MiMo,
DevEco or Spelled: ok
- OpenCode 2.1.4 itself (opencode models, sandbox HOME): with
magpie-relay under providers as the test writes it, it lists
magpie-relay/relay/glm-4.6; with relay under both, it logs "retained
native value over legacy value" for $.providers.relay and lists only
the models under providers (a model only under provider is gone)
- go test -tags nogui -count=1 -timeout 45m ./... (log kept), Bun
1.4.2: 68 packages ok and 8 red, none in what this changes; in
internal/agent every test this adds or touches passes. The reds: agent
TestFolderVarsAreListed (#3884, fixed on main since in 3116b8f5),
TestCodexDriftReached (#3398), TestInstalledVersion,
TestCursorFolderFromTheEditorIsNotTheCLI,
TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
TestQoderSettingsFromAnIDEPluginIsNotTheCLI and
TestOmpDetectedWithPiDir (#3141),
TestReasonixCLIRequiresSupportedNativeVersion and
TestReasonixCLIRecoversAfterProbeTimeout (#3641); edit
TestWriteAtomicReadOnlyHardLink and testenv TestProgram (umask 077,
#3640); gateway TestPluginToldWhereTheAgentWorks (#3675); gui
TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie
(#3649); proc TestEnvOfChild and provider TestCodexAppServersOnHome
(#3906), then "close of synctest channel from outside bubble" from
TestUnreadLoginsWriteErrorsKeepCredentials (#3632); tui
TestTUIFetchesSubscriptionModels/agent (#3919).
- gofmt -l clean. go vet -tags nogui and go build -tags nogui for linux,
windows and darwin, and go vet and go build for windows without the
tag: exit 0 each. go vet and go build without the tag on linux: exit 1
(this box has no GTK or WebKitGTK dev packages).
Not tried: OpenChamber's app itself, a request sent through such a
provider, Windows and macOS.
Batch run, at tree 104d75f0a (the twelve coffemon ports together, on
origin/main 7d022bdb6), mote, macOS, go1.26.8:
- go test -tags nogui -count=1 -timeout 45m on the packages the batch
changes (agent, autostart, daemon, gateway, library, proc, provider,
sessions, testenv, tui, gui): ok each.
- GUI, node --test with Playwright 1.62.0, Chromium and WebKit:
library-*.test.cjs and i18n-keys.test.cjs, 1044 of 1044 pass.
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./... and go build ./...: ok at cdd7c8e46, the same
batch on origin/main 00098f12b one rebase before.
- The whole go test ./... at cdd7c8e46: 86 packages ok, one red,
internal/cli TestEveryRouteHasACommandOrIsNamed (GET
/api/context/reply has no command), red on main too (#5026).
- Linux (wsl-run, Ubuntu 24.04, at 339055896, the batch on f4c664a09):
proc, autostart, testenv, tui ok; agent: only TestGrokInstalled red
(#3548); #4033's proc.Look reds (Zed, Copilot, Qoder, Cursor, Omp)
pass.
- Windows (win-run, Windows 11, at 339055896): proc, autostart, testenv,
tui ok; library and agent red in the same tests as on origin/main
f4c664a09 (#4115, #1827, #4786; #5068, #5069, #5070 filed now).
- Rebased onto origin/main fb1f4856a (three commits, no file in
common with the batch) and run again at the pushed tree: gofmt -l
nothing, go build ./... and go vet ./... ok; go test -tags nogui
sessions, agent, autostart, tui, proc, testenv ok; i18n-keys and
library-* 1044 of 1044 pass.
- Not run before the push: the whole GUI suite (a run at cdd7c8e46 was
cut off at 1170 of ~1174 tests when mote rebooted; it runs again after
the tag and any red is filed).
Murciee (#3883, OpenCode 2.1.4 as OpenChamber bundles it, Windows): a
model added in magpie never reached OpenCode 2, though magpie said it
was exposed. ~/.config/opencode/opencode.json held magpie's provider
twice, provider.magpie with 43 models and providers.magpie with 38, and
opencode models listed the 38. OpenCode 2 keeps a provider under
providers, in words of its own, and still reads OpenCode 1's provider:
a provider named under both is the one under providers, whole, and the
other only a WARN in its log, "retained native value over legacy value"
(packages/core/src/config/normalize.ts, mergeMaps, at v2.1.4).
OpenChamber's provider form saves a provider under providers and takes
it out of provider (packages/web/server/lib/opencode/config-v2.js,
writeSectionEntry). Once it had saved magpie's, magpie's next sync put
provider.magpie back, as a model of magpie's was picked, and from then
on brought only that one up to date.
Where an OpenCode config keeps magpie's provider under providers, each
sync and model pick now write it there too, and the wiring check reads
it there (opencode_providers.go). It is written as OpenCode 2 reads
magpie's provider.magpie (packages/core/src/v1/config/migrate.ts,
migrateStandardProvider and migrateModel): npm as package
"aisdk:<npm>", options as settings, a model's modalities as
capabilities beside tools, its variants a list of {id, settings, body}
with the options OpenCode 2 reads itself in settings and the rest in
body (provider-options.ts, COMPATIBLE_KEYS: a fast variant's
service_tier), and reasoning, which it doesn't read, left out. As under
provider (theirsKept, openCodeKept), magpie's models are written whole,
a key of the user's in the block stays, and so does a variant the user
put on a model of magpie's. A variant is magpie's when it says what
magpie's of its name says, split as OpenCode 2 splits it or all in
settings, as OpenChamber carries one over from provider
(toModelVariants). A config without providers.magpie doesn't get one:
provider.magpie is still what magpie writes, and OpenCode 1 and 2 both
read it. Taking magpie out of OpenCode or OpenChamber takes out both
blocks, as OpenChamber's own delete does. agent-wiring.md says so
beside #2379's variants.
Old data: a config already in the reporter's state is brought up to
date by the next sync, which SyncCatalog runs over every agent at each
start and update of magpie. A providers.magpie an older magpie left
behind when taking magpie out (it took out provider.magpie alone) is
kept up to date from now on, and goes the next time magpie is taken
out.
Not changed:
- Air: its magpie-opencode.json is magpie's own and holds
provider.magpie alone. With OpenChamber's providers.magpie in the
global config and nothing else of magpie's there, OpenCode 2.1.4
handed Air's file as OPENCODE_CONFIG still listed the model only
Air's file had.
- MiMo Code and DevEco Code go through the same code. Their configs
hold no providers block unless something of theirs writes one; not
checked against their source.
- A provider of the user's own at magpie's gateway kept under providers
isn't read by openCodeSpelled and ownGatewayProvider, which read
provider alone: #3915, filed with this.
- What else OpenChamber's form puts on a model of magpie's under
providers (a modelID, a cost) goes with the rest of the model at the
next sync, as a key on one under provider does today.
What was run (tree 61b3fff7, on origin/main e056779a, go1.26.8,
linux/amd64, Linux 5.15), outside graftcp, umask 077:
- TestOpenCodeNativeIsOpenCode2s, new: openCodeNative of a block with
levels, fast variants, an image model and one without levels is what
OpenCode 2.1.4's opencode debug config printed under providers.magpie
for that block in an opencode.json (its apiKey, shown as ***, put
back).
- TestOpenCodeProvidersKeptCurrent and
TestOpenChamberProvidersKeptCurrent, new: a config as OpenChamber's
form leaves it, provider.magpie gone and providers.magpie from before
think/new (a stale baseURL and key, a header and a timeout of the
user's, a modelID, magpie's variants of levels deep no longer has,
one of them in OpenChamber's form, one the user wrote over, one of
their own, and a model the catalog dropped). A sync, and a model
picked, bring it to the models under provider with the user's keys
and two variants kept; a second sync writes nothing; stepping off
magpie takes out both. A config without providers gets none.
TestOpenCodeCheckReadsProviders, new: a providers.magpie at another
address is off until a sync.
- The 21 tests named TestOpenCode*, TestOpenChamber* and TestDevEco*:
ok. -race -count=5 over the four new ones: ok.
- Broken by hand, one at a time, each red where it says: no sync under
providers in OpenCode's Sync, in a pick, in OpenChamber's Sync; no
delete there for OpenCode or for OpenChamber; the check reading
provider alone; no theirsKept; the user's variants dropped; no
variant taken for magpie's; only OpenCode 2's split taken for
magpie's (OpenChamber's high-fast stayed); providers written into a
config without it; a write on every sync; every option in settings;
no capabilities. The sync, pick, delete and check breaks at once,
which is what e056779a does: three of the four new tests red.
- The reporter's case with the real binaries, in a sandbox HOME: magpie
at e056779a wired OpenCode to think/deep; OpenChamber's own
toProviderEntity (openchamber main 6b48aecb, its zod import stubbed
so the module loads) turned that provider.magpie into the
providers.magpie its form saves, and provider.magpie was taken out,
as its form does; think/new was added, and magpie at e056779a synced.
OpenCode 2.1.4's opencode models (npm @opencode/cli-linux-x64,
integrity checked) listed magpie/think/deep alone, and its log had
two "retained native value over legacy value" lines. The same file
synced by this commit: magpie/think/deep and magpie/think/new, no
such line, and a second sync left the file as it was, mtime too.
- go test -tags nogui -count=1 -timeout 45m ./... (log kept), Bun
1.4.2: 69 packages ok and 7 red, none in what this changes; in
internal/agent every test this adds or touches passes. The reds: agent
TestFolderVarsAreListed (#3884, main's CI red), TestInstalledVersion,
TestCursorFolderFromTheEditorIsNotTheCLI,
TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
TestQoderSettingsFromAnIDEPluginIsNotTheCLI, TestOmpDetectedWithPiDir
and TestZedAppPath (#3141: alone at -count=40, TestZedAppPath is red
37 and 35 times at e056779a, 35 and 38 here),
TestReasonixCLIRequiresSupportedNativeVersion and
TestReasonixCLIRecoversAfterProbeTimeout (#3641); davsync TestSync
(#3420: alone at -count=20, red 3 times at e056779a and 2 here); edit
TestWriteAtomicReadOnlyHardLink and testenv TestProgram (umask 077,
#3640); gateway TestPluginToldWhereTheAgentWorks (#3675); gui
TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie
(#3649); provider TestCodexAppServersOnHome (#3906, main's CI red),
then "close of synctest channel from outside bubble" from
TestUnreadLoginsWriteErrorsKeepCredentials (#3632, main's CI red).
- gofmt -l clean. go vet -tags nogui and go build -tags nogui for linux,
windows and darwin, and go vet and go build for windows without the
tag: exit 0 each. go vet and go build without the tag on linux: exit 1
(this box has no GTK or WebKitGTK dev packages).
Not tried: Windows, the reporter's system, and OpenChamber's app
itself: its converter alone was run.
Ported onto main by yetone. Since this was written, cdd470ce9 (#4575)
made the models of magpie's provider under provider an ordered list
(orderedJSON) instead of a map, so the block under providers came out
with no models at all (TestOpenCodeProvidersKeptCurrent and
TestOpenChamberProvidersKeptCurrent red on main with the patch as it
was), and #4575 added a model's cost. openCodeNative now reads that list
and writes the models under providers in the same order, and a cost in
OpenCode 2's words: a list of tiers, cache prices under cache
(migrateModel's costs in packages/core/src/v1/config/migrate.ts).
OpenCode's source read at v2.1.4 (68bc26b7) and v2.2.5: in both,
normalize.ts merges provider into providers (mergeMaps), and a name
under both is the one under providers, taken whole, so the fix holds
on the current 2.2.x too. TestOpenCodeNativeKeepsOrderAndCost is new,
and providersCurrent checks the order.
Run for the port (mote-run, macOS, go1.26.8): go test -tags nogui
-count=1 -run 'OpenCode|OpenChamber|MiMo|DevEco|Spelled|Wiring'
./internal/agent: ok.
Batch run, at tree 104d75f0a (the twelve coffemon ports together, on
origin/main 7d022bdb6), mote, macOS, go1.26.8:
- go test -tags nogui -count=1 -timeout 45m on the packages the batch
changes (agent, autostart, daemon, gateway, library, proc, provider,
sessions, testenv, tui, gui): ok each.
- GUI, node --test with Playwright 1.62.0, Chromium and WebKit:
library-*.test.cjs and i18n-keys.test.cjs, 1044 of 1044 pass.
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./... and go build ./...: ok at cdd7c8e46, the same
batch on origin/main 00098f12b one rebase before.
- The whole go test ./... at cdd7c8e46: 86 packages ok, one red,
internal/cli TestEveryRouteHasACommandOrIsNamed (GET
/api/context/reply has no command), red on main too (#5026).
- Linux (wsl-run, Ubuntu 24.04, at 339055896, the batch on f4c664a09):
proc, autostart, testenv, tui ok; agent: only TestGrokInstalled red
(#3548); #4033's proc.Look reds (Zed, Copilot, Qoder, Cursor, Omp)
pass.
- Windows (win-run, Windows 11, at 339055896): proc, autostart, testenv,
tui ok; library and agent red in the same tests as on origin/main
f4c664a09 (#4115, #1827, #4786; #5068, #5069, #5070 filed now).
- Rebased onto origin/main fb1f4856a (three commits, no file in
common with the batch) and run again at the pushed tree: gofmt -l
nothing, go build ./... and go vet ./... ok; go test -tags nogui
sessions, agent, autostart, tui, proc, testenv ok; i18n-keys and
library-* 1044 of 1044 pass.
- Not run before the push: the whole GUI suite (a run at cdd7c8e46 was
cut off at 1170 of ~1174 tests when mote rebooted; it runs again after
the tag and any red is filed).
Co-authored-by: yetone <9rqwv2ak@gmail.com>
With #3372, Open at login on Linux reads a package's own autostart entry
in $XDG_CONFIG_DIRS (nixpkgs ships one). JoeyWu-tech's #3756 asked what
`magpie daemon install`'s guard and `magpie tui`'s hand-off as it quits
should count on a box no desktop logs into (NixOS-WSL, a server over SSH),
where nothing ever starts that entry.
Decided: both keep counting what Open at login shows (autostart.Enabled).
A session check can't tell (an SSH login into a desktop box has no
DISPLAY either), and counting less than the switch shows would install
the service beside an app the desktop does start. The install already
refuses with "run `magpie autostart off` first", which is the way out.
The terminal's quit only said "the gateway stopped", with nothing about
why or what to do; it now says magpie opens at login and serves it then,
and that `magpie autostart off` has magpie tui hand it on where no
desktop logs in (atLoginNote). Off Linux and with nothing connected the
note is as before.
What was run (wsl-run, magpie-desktop Ubuntu 24.04, go1.26.8):
go test -tags nogui -count=1 ./internal/autostart ./internal/daemon
./internal/testenv ./internal/tui: ok
With keep.go as before (the test kept): TestKeepGatewayAsTheTerminalQuits
red, "app at login: ... the gateway stopped with magpie tui; ..."
gofmt -l: nothing
Not tried: a real NixOS-WSL login; mtul0729 ran the #3372 patch on real
NixOS + COSMIC, at the systemd generator's level.
Batch run, at tree 104d75f0a (the twelve coffemon ports together, on
origin/main 7d022bdb6), mote, macOS, go1.26.8:
- go test -tags nogui -count=1 -timeout 45m on the packages the batch
changes (agent, autostart, daemon, gateway, library, proc, provider,
sessions, testenv, tui, gui): ok each.
- GUI, node --test with Playwright 1.62.0, Chromium and WebKit:
library-*.test.cjs and i18n-keys.test.cjs, 1044 of 1044 pass.
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./... and go build ./...: ok at cdd7c8e46, the same
batch on origin/main 00098f12b one rebase before.
- The whole go test ./... at cdd7c8e46: 86 packages ok, one red,
internal/cli TestEveryRouteHasACommandOrIsNamed (GET
/api/context/reply has no command), red on main too (#5026).
- Linux (wsl-run, Ubuntu 24.04, at 339055896, the batch on f4c664a09):
proc, autostart, testenv, tui ok; agent: only TestGrokInstalled red
(#3548); #4033's proc.Look reds (Zed, Copilot, Qoder, Cursor, Omp)
pass.
- Windows (win-run, Windows 11, at 339055896): proc, autostart, testenv,
tui ok; library and agent red in the same tests as on origin/main
f4c664a09 (#4115, #1827, #4786; #5068, #5069, #5070 filed now).
- Rebased onto origin/main fb1f4856a (three commits, no file in
common with the batch) and run again at the pushed tree: gofmt -l
nothing, go build ./... and go vet ./... ok; go test -tags nogui
sessions, agent, autostart, tui, proc, testenv ok; i18n-keys and
library-* 1044 of 1044 pass.
- Not run before the push: the whole GUI suite (a run at cdd7c8e46 was
cut off at 1170 of ~1174 tests when mote rebooted; it runs again after
the tag and any red is filed).
mtul0729, packaging magpie for nixpkgs (#3372, COSMIC on Wayland,
v0.1.1334): a package that ships its own autostart entry
($XDG_CONFIG_DIRS/autostart/magpie.desktop, /etc/xdg when unset) has
magpie open at login, but enabled() read only
$XDG_CONFIG_HOME/autostart, so Open at login said off over it. Off
removed a user file that wasn't there, and the package's entry went on
starting magpie. On wrote this copy's own path over the package's entry:
under a package manager a versioned path, gone once the package is
upgraded and collected. The package doc says the switch "can't say one
thing while the system does another"; on such a system it did.
Now, as the XDG Autostart spec has it:
- The entry that counts is the user's, else the first of the
$XDG_CONFIG_DIRS folders (/etc/xdg when unset or empty) that has one.
A relative folder has none, as the spec says, and neither has a file
listed there, a folder this user can't search or a name too long,
which systemd's generator and GLib can't open either. The user's own
folder listed there too, by any name (os.SameFile, so /home linked to
/var/home too), is still the user's.
- An entry is read as GLib's key file and systemd's parser read it: the
keys of its [Desktop Entry] group alone (a [Desktop Action]'s Exec is
not the entry's), spaces around = and CRLF lines as any others, the
last of a key given twice, true or 1 for Hidden. It opens magpie when
it is an application (Type=Application) with an Exec other than true
(below), not Hidden.
- X-GNOME-Autostart-enabled=false (or 0) reads off too, as the issue
asks. GNOME's and Cinnamon's sessions read it; systemd's generator
(KDE's and COSMIC's sessions under systemd) doesn't, so there such an
entry reads off while it starts.
- Off, over a package's entry that some desktop starts, writes an entry
of the user's that hides it; that includes one GNOME has off, which
systemd's generator still starts. Otherwise off removes the user's
entry, as before. On, over a package's entry that starts magpie,
removes the user's entry and writes no path; otherwise (no package
entry, a hidden one, or one GNOME has off) it writes this copy's
entry, as before.
The hiding entry is "[Desktop Entry] Type=Application Name=magpie
Exec=true Hidden=true". A session holds back the entries of a name only
once it has read one, and each reads differently (from their source):
- gnome-session (main and 42.0) and cinnamon-session load an entry with
g_desktop_app_info_new_from_filename. GLib (main,
g_desktop_app_info_load_from_keyfile) refuses one with no Type or
Name, or whose Exec names a program it can't find, and the session
skips an entry it can't load, so the package's starts.
- mate-session's egg_desktop_file_new refuses an application entry with
no Exec, and the entry then takes no app id.
- cosmic-session without systemd never reads Hidden: it starts what Exec
names, and takes the name once that ran.
- systemd's generator (main, xdg-autostart-service.c) reads Hidden
first, and hides an entry it can't parse, which still holds back the
rest.
true is on every system by that name, so each session reads the entry,
and COSMIC's runs true where it would have run magpie. A copy of the
package's own Exec would stop holding the package's back on GNOME once
its store path is collected. With this box's GLib 2.72.4 (Ubuntu
22.04's) and 2.84.2 (anaconda's), through ctypes: Exec=true and no Exec
load, hidden; an Exec naming a store path that is gone, and a bare
"[Desktop Entry] Hidden=true", don't load. An entry that runs true opens
nothing, so it reads off: XFCE's Session and Startup lists the hiding
entry as magpie, unticked, and ticking it there writes Hidden=false into
it (xfae-model.c), which runs true, not magpie. On takes it away for the
package's.
What is no entry, and what can't be read: a path where no regular file
is (a folder, a link that leads nowhere or round in a loop) is no entry,
as systemd's generator and GLib pass over it, and on leaves a folder
there alone. A file that can't be read (EACCES, EPERM, EIO) counts and
starts nothing, as systemd's generator has it; GLib passes over it, so
where the first entry is unreadable GNOME starts the next folder's while
Open at login reads off. Any other failed read, magpie out of files or
memory, says nothing of what the desktop reads at login: Set returns it
and writes nothing, and Open at login reads on, as the package's doc has
it for a system that can't be asked (Windows' Run key that can't be read
is not a no either).
The user's entry is written where the desktop reads it. A link there (to
magpie's launcher, which install.sh writes, the usual way to have an app
open at login; or into a read-only store), or a hard link, is replaced
by the entry, not written through: edit.WriteAtomic writes a link's
target, and a hard-linked file in place, so off over a package's entry
would have left the launcher running true, and failed over a read-only
target with the switch still on. Main's enable() wrote through such a
link too, when on was asked over one (a linked launcher already reads
on); it goes through the same write now.
Old entries: a user entry an older magpie wrote stays and still counts
over a package's, as before. The switch reads on over it, so in the app
taking it away is off, then on; `magpie autostart on` does it in one
step. One whose store path was collected reads on as well, though
systemd's generator starts nothing for it and still holds the package's
back, so on COSMIC or KDE magpie doesn't open while the switch says on;
GLib passes over it, and GNOME starts the package's.
The daemon and the terminal: `magpie daemon install` refuses while
magpie opens at login, so the app and the service don't both serve the
gateway, and `magpie tui` quitting hands the gateway on (keepGateway,
75e78a5a) only where nothing opens magpie at login. Both read
autostart.Enabled, code unchanged, so a package's entry counts for both
now. Where a desktop session runs XDG autostart that is the point:
install says to run `magpie autostart off` first, which now hides the
entry, where before the service went in beside an app the package's
entry went on opening. On a box no desktop logs into (NixOS-WSL, a NixOS
server over SSH) nothing runs the entry, yet install refuses and
keepGateway only says the gateway stopped; `magpie autostart off` gets
both going. That is #3756, filed with this, for yetone to say what they
should count on Linux; a session check wouldn't settle it, since install
over SSH into a desktop box has no DISPLAY either.
An entry the desktop's own settings switched off reads off for the guard
as well: XFCE writes Hidden=true into the user's entry, which main still
counted (it read Type and Exec alone), so install refused; now it goes
in. I kept that reading, and daemon.go's comment now says so, rather
than have the guard count such an entry. The switch and `magpie
autostart` read it off, and a guard counting it would refuse with
"magpie already opens at login" where `magpie autostart` says it
doesn't. The Mac has a state for that case (NeedsAllowing, which the CLI
and the app explain in System Settings' words), and Linux has none to
show it; Windows reads a Run value Task Manager switched off as off, and
on switches it back, as Set(true) does here. What it costs: ticking
magpie again in the desktop's settings after the install opens the app
beside the service, in #3756 too. For an AppImage or a tarball, with no
package entry, on and off write and remove as before, and what changes
is how an entry reads (Hidden, the GNOME key, a failed read, as above)
and that a link at the entry is replaced, not written through.
docs/subsystems/gui-shell.md says how Open at login reads on Linux, and
that the terminal's hand-off counts a package's entry (#3756).
Rebased onto origin/main 58fb3a77: 824100f3 added a line to
gui-shell.md next to the one this patch changes, so 7e9003aa no longer
applied. The code and the docs line are as they were (the same patch
for internal/).
What was run (tree 59fb33a8, on origin/main 58fb3a77, go1.26.8,
linux/amd64, Linux 5.15), outside graftcp, umask 077:
- go test -tags nogui ./internal/autostart ./internal/testenv -v:
autostart ok, its new tests among them; testenv ok but TestProgram,
red under this box's umask 077 (#3640), as on main.
- gofmt -l clean. go vet -tags nogui for linux, windows and darwin, go
vet for windows without the tag, go build -tags nogui for linux and
darwin, and go build for windows: exit 0 each; untagged linux vet and
build stop at pkg-config (no GTK headers here). GOOS=freebsd vet: not
run at this tree.
- go test -tags nogui -count=1 -timeout 45m ./... (log kept), Bun
1.4.2, 8m35s, load 19 at its start: 70 packages ok, autostart,
daemon, cli and tui among them; reds in 6, each known: agent
TestInstalledVersion, TestCursorFolderFromTheEditorIsNotTheCLI,
TestQoderSettingsFromAnIDEPluginIsNotTheCLI, TestOmpDetectedWithPiDir
and TestZedAppPath (#3141), TestCodexDriftReached (#3398) and the two
Reasonix tests (#3641); davsync TestSyncTeraCloudStillSeesOtherWrites
(#3420);
edit TestWriteAtomicReadOnlyHardLink and testenv TestProgram
(umask 077, #3640); gateway TestPluginToldWhereTheAgentWorks (#3675),
the package ran to its end; gui TestGatewayHeldByAContainer and
TestGatewayFixQuitsOnlyAMagpie (#3649).
The rest is what was run for 7e9003aa, at tree 719db0e7 on origin/main
6e6aba51, the same code (not this tree):
- Real use (real.log): the built magpie (-tags nogui) and origin/main's,
each in a sandbox HOME under env -i, with a package entry (Exec=magpie
tray, magpie on PATH) in XDG_CONFIG_DIRS, and systemd 249's
systemd-xdg-autostart-generator after each step:
- the package's entry alone: main says magpie doesn't open at login
while the generator starts magpie tray; this says on.
- off, twice: main writes nothing and it still starts; this writes the
hiding entry, and the generator starts nothing.
- on: main writes its own path, which it starts; this takes the hiding
entry away, and the generator starts the package's magpie tray.
- no package entry, on then off: both write their own path, which
starts, then remove it, and nothing starts. The package's entry put
back, off again: as the first off.
- the package's entry with X-GNOME-Autostart-enabled=false: both say
off while the generator starts it. Off: main writes nothing and it
still starts; this writes the hiding entry, and nothing starts. On:
both write their own path.
- the hiding entry ticked again as XFCE does (Exec=true, Hidden=false)
over the package's: the generator runs /usr/bin/true; main says on,
this says off. On: this takes it away and the package's magpie tray
starts; main writes its own path.
- the user's entry a link to magpie's launcher, off over the
package's: main takes the link away and the package's entry still
starts; this writes the hiding entry in the link's place, and
nothing starts. The launcher is unchanged in both.
- an old entry of magpie's naming a store path that is gone, over the
package's: both say on, and the generator starts nothing. On: this
takes it away and the package's starts; main writes its own path.
- The new tests over origin/main's autostart_other.go, with a nil
systemRecords and readEntry added so they build (red-on-main.log): all
9 new ones red, and TestSet and TestSetThenTruncatedRecordReadsAsOff,
which main has, pass. The first red of each: :101 "the package's entry
opens magpie at login, and Open at login reads off"; :226 "the second
system folder's alone: off, want on" (and 5 more rows: three more
where a system folder alone has the entry, the user's own entry
Hidden, and the user's own off by the GNOME key); :241
"XDG_CONFIG_DIRS unset: [], want
["/etc/xdg/autostart/magpie.desktop"]"; :311 and :373, no hiding entry
written; :440, off over a link to the launcher left no entry of the
user's, and :437, on over it with no package's entry wrote through to
the launcher (main's own enable(), the sibling above); :491 "a folder
at the user's entry, the package's entry there: true: off, want on";
:534, on over an unreadable user entry leaves it; :568, no hiding
entry to read.
- Broken by hand (breaks.log), each one part of the fix undone, all 36
red, the fix put back ok after. The first red of each:
- where entries come from: no system folders :101; the system's
folders over the user's :108; unset XDG_CONFIG_DIRS with no /etc/xdg
:241; a relative folder kept :266; the user's folder, by any name,
taken for a system's :290.
- how an entry reads: Hidden ignored, Hidden=false read as hidden,
Hidden=1 not read, all :226; the GNOME key ignored, and its 0 not
read, :226; the system's entry starting whatever its Type :226;
spaces around = kept, a line's CR kept, every group's keys read as
the entry's, all :226; an entry that runs true read as opening
magpie :120.
- what off and on write: off always removing :108; off writing the
hiding entry with no package entry :173; off deciding by GNOME's
reading :373; on always writing this copy's path :131; on over a
package's entry keeping the hiding entry :127; on taking away a
folder of the entry's name :495.
- the hiding entry: with no Exec :323, no Type :318, a store path for
Exec :326, true named by a path :326.
- what can't be read: a file in XDG_CONFIG_DIRS, a folder this user
can't search and a name too long, each read as a failed read, :269;
a folder at the entry's path, and a link loop, read as one :491; an
unreadable entry read as no entry :528; every failed read an entry
that starts nothing :576; magpie's own failed read read as no entry
:576, and taken for a no :580.
- links: a symlinked entry written through :437, and a hard-linked one
:437.
- internal/autostart, daemon, cli and tui (pkgs.log): ok.
internal/autostart with -race -count=3 (race.log): ok; nothing in it
runs in a goroutine of its own.
- Probes at this tree, thrown away after (probes-3756.log): keepGateway
with the real reading and all else stubbed, and Install behind
daemon_test's fakes (fake systemctl, launchctl and loginctl alone on
PATH). With the package's entry, keepGateway only says the gateway
stopped and Install refuses before any systemctl call. Under the
hiding entry off writes, and with no package entry but the user's own
entry Hidden=true as XFCE writes it, keepGateway installs the service
and Install goes through (the fake's daemon-reload, enable and
restart).
- Full suite, -tags nogui (CI's Linux job tags gtk3), outside graftcp
(systemd-run, umask 077, Bun 1.4.2 first on PATH as on CI, -timeout
45m, log kept): 64 packages ok, autostart, daemon, cli and tui among
them, and 8 packages red, each filed:
- agent TestCodexDriftReached: #3398; TestInstalledVersion,
TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
TestQoderSettingsFromAnIDEPluginIsNotTheCLI,
TestOmpDetectedWithPiDir and TestZedAppPath: #3141;
TestReasonixCLIRequiresSupportedNativeVersion and
TestReasonixCLIRecoversAfterProbeTimeout: this box's /tmp/.git,
#3641.
- davsync TestSyncTeraCloudStillSeesOtherWrites: #3420.
- edit TestWriteAtomicReadOnlyHardLink: this box's umask 077, #3640.
- gateway TestPluginToldWhereTheAgentWorks: this box's /tmp/.git,
#3675.
- gui TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie:
this box's millions of open fds, #3649.
- #3741.
- provider: "fatal error: close of synctest channel from outside
bubble" in TestUnreadLoginsWriteErrorsKeepCredentials, main's CI
red, #3632; the package's tests after it didn't run.
- testenv TestProgram: this box's umask 077, #3640, red so at
origin/main 6e6aba51 alone too (testprogram-main.log).
- gofmt -l: clean. go vet -tags nogui for linux, windows and darwin,
GOOS=windows go vet ./..., GOOS=freebsd go vet ./internal/autostart/
./internal/daemon/, go build -tags nogui for linux and darwin and
GOOS=windows go build ./...: all clean. Untagged linux vet and build
stop at pkg-config here (no GTK headers on this box).
Not changed: gnome-session also reads $XDG_DATA_DIRS/gnome/autostart,
between the user's folder and $XDG_CONFIG_DIRS; it isn't in the spec,
and this doesn't read it. systemd reads an XDG_CONFIG_DIRS that is set
but empty as no folders, and opens a relative folder from its working
directory; this follows the spec: /etc/xdg for an empty one, and no
relative folder. Whether the program an entry's Exec or TryExec names is
there isn't checked, and an entry with any Exec (Exec=magpie serve,
another program's magpie.desktop) reads as magpie opening at login. With
no package entry that starts magpie (none, a hidden one, or one GNOME
has off), on still writes the path self() gives, a versioned one under a
package manager (#3621, where skygunner has a branch, 0aac5452, which
git apply --check takes over this one); a Linux refresh() that took away
an old entry of magpie's whose Exec is gone, where a package's entry
starts magpie, belongs there too.
Not tried: a real login into GNOME, KDE, MATE, Cinnamon, XFCE or COSMIC
(what each session does is read from its source, GLib's loading tried
with the two GLibs above); NixOS itself, and home-manager's links; a
real `magpie daemon install` or keepGateway over a package's entry,
which would reach this box's own systemd and gateway
(TestRefusedBesideAutostart and TestKeepGatewayAsTheTerminalQuits stub
what they read, and the probes above use the real reading).
Batch run, at tree 104d75f0a (the twelve coffemon ports together, on
origin/main 7d022bdb6), mote, macOS, go1.26.8:
- go test -tags nogui -count=1 -timeout 45m on the packages the batch
changes (agent, autostart, daemon, gateway, library, proc, provider,
sessions, testenv, tui, gui): ok each.
- GUI, node --test with Playwright 1.62.0, Chromium and WebKit:
library-*.test.cjs and i18n-keys.test.cjs, 1044 of 1044 pass.
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./... and go build ./...: ok at cdd7c8e46, the same
batch on origin/main 00098f12b one rebase before.
- The whole go test ./... at cdd7c8e46: 86 packages ok, one red,
internal/cli TestEveryRouteHasACommandOrIsNamed (GET
/api/context/reply has no command), red on main too (#5026).
- Linux (wsl-run, Ubuntu 24.04, at 339055896, the batch on f4c664a09):
proc, autostart, testenv, tui ok; agent: only TestGrokInstalled red
(#3548); #4033's proc.Look reds (Zed, Copilot, Qoder, Cursor, Omp)
pass.
- Windows (win-run, Windows 11, at 339055896): proc, autostart, testenv,
tui ok; library and agent red in the same tests as on origin/main
f4c664a09 (#4115, #1827, #4786; #5068, #5069, #5070 filed now).
- Rebased onto origin/main fb1f4856a (three commits, no file in
common with the batch) and run again at the pushed tree: gofmt -l
nothing, go build ./... and go vet ./... ok; go test -tags nogui
sessions, agent, autostart, tui, proc, testenv ok; i18n-keys and
library-* 1044 of 1044 pass.
- Not run before the push: the whole GUI suite (a run at cdd7c8e46 was
cut off at 1170 of ~1174 tests when mote rebooted; it runs again after
the tag and any red is filed).
Isolate pointed HOME, USERPROFILE, the XDG_*_HOME folders, APPDATA and
LOCALAPPDATA into the temporary home, and left XDG_CONFIG_DIRS as the
machine has it. The next commit has Open at login on Linux read a
package's autostart entry in $XDG_CONFIG_DIRS/autostart, /etc/xdg when
it is unset or empty (#3372), and the gui's settingsState reads Open at
login (api.go's loginState) in many tests. On a machine with a package's
magpie.desktop (NixOS, or a distro's package some day) their s.Login
would follow that entry, and a test switching it would write a hiding
entry where it expects none. LESSONS has the rule: give the sandbox
every variable the code reads (ee7a9b24a).
Now Isolate points XDG_CONFIG_DIRS at <home>/etc/xdg, which nothing
makes, so a test reads no system entry unless it writes one there. Every
test package that reaches internal/autostart (autostart, cli, daemon,
gui and tui) isolates through testenv. It isn't one of folderVars:
checkChild checks each of those as one path in the temporary folder, and
XDG_CONFIG_DIRS is a list.
Rebased onto origin/main 58fb3a77 with the next commit; this one is
as it was.
What was run (tree 2da4f92a, on origin/main 58fb3a77, go1.26.8,
linux/amd64, Linux 5.15), outside graftcp, umask 077:
- This commit's tree alone: not run. At the next commit's tree
(59fb33a8), go test ./internal/testenv -v: TestIsolate ok, and all
but TestProgram (umask 077, #3640); the full suite there is in the
next commit.
The rest is what was run for 2d17d5e8, at tree efb86cbc on origin/main
6e6aba51, the same code (not this tree):
- TestIsolate sets XDG_CONFIG_DIRS to /etc/xdg before Isolate, and now
checks that it lies in the test home after. With the new line taken
out of Isolate by hand it went red, testenv_test.go:65:
XDG_CONFIG_DIRS is "/etc/xdg", outside
"/tmp/magpie-test-home-1706789611"; put back, it passed.
- The testenv package through pkgtest.sh, outside graftcp: all pass but
TestProgram, red under this box's umask 077 (#3640), as it is when run
alone at origin/main 6e6aba51. No -race: the change sets one more
variable before any test starts.
- Full suite, -tags nogui (CI's Linux job tags gtk3), outside graftcp
(systemd-run, umask 077, Bun 1.4.2 first on PATH as on CI, -timeout
45m, log kept): 64 packages ok and 8 packages red, each filed: #3640
(umask 077: testenv's TestProgram, as above, and edit's
TestWriteAtomicReadOnlyHardLink), #3141 (TestInstalledVersion,
TestCursorFolderFromTheEditorIsNotTheCLI,
TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
TestQoderSettingsFromAnIDEPluginIsNotTheCLI,
TestOmpDetectedWithPiDir), #3398 (TestCodexDriftReached), #3641 (the
two Reasonix tests, this box's /tmp/.git), #3420 (davsync's TestSync),
#3675 (TestPluginToldWhereTheAgentWorks, this box's /tmp/.git), #3649
(TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie, this
box's open fds), #3741, and provider's synctest fatal (#3632) in
TestUnreadLoginsWriteErrorsKeepCredentials, after which that package's
tests didn't run.
- gofmt -l: clean. go vet -tags nogui for linux, windows and darwin,
GOOS=windows go vet ./..., GOOS=freebsd go vet ./internal/testenv/, go
build -tags nogui for linux and darwin and GOOS=windows go build
./...: all clean. Untagged linux vet and build stop at pkg-config here
(no GTK headers on this box).
Not changed: internal/gateway isolates itself in its own TestMain, not
through testenv, and doesn't set XDG_CONFIG_DIRS; none of its tests
reach internal/autostart.
Not tried: a machine with a package's magpie.desktop in
/etc/xdg/autostart (this box has none), where without this the gui's
tests would read it once the next commit is in.
Batch run, at tree 104d75f0a (the twelve coffemon ports together, on
origin/main 7d022bdb6), mote, macOS, go1.26.8:
- go test -tags nogui -count=1 -timeout 45m on the packages the batch
changes (agent, autostart, daemon, gateway, library, proc, provider,
sessions, testenv, tui, gui): ok each.
- GUI, node --test with Playwright 1.62.0, Chromium and WebKit:
library-*.test.cjs and i18n-keys.test.cjs, 1044 of 1044 pass.
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./... and go build ./...: ok at cdd7c8e46, the same
batch on origin/main 00098f12b one rebase before.
- The whole go test ./... at cdd7c8e46: 86 packages ok, one red,
internal/cli TestEveryRouteHasACommandOrIsNamed (GET
/api/context/reply has no command), red on main too (#5026).
- Linux (wsl-run, Ubuntu 24.04, at 339055896, the batch on f4c664a09):
proc, autostart, testenv, tui ok; agent: only TestGrokInstalled red
(#3548); #4033's proc.Look reds (Zed, Copilot, Qoder, Cursor, Omp)
pass.
- Windows (win-run, Windows 11, at 339055896): proc, autostart, testenv,
tui ok; library and agent red in the same tests as on origin/main
f4c664a09 (#4115, #1827, #4786; #5068, #5069, #5070 filed now).
- Rebased onto origin/main fb1f4856a (three commits, no file in
common with the batch) and run again at the pushed tree: gofmt -l
nothing, go build ./... and go vet ./... ok; go test -tags nogui
sessions, agent, autostart, tui, proc, testenv ok; i18n-keys and
library-* 1044 of 1044 pass.
- Not run before the push: the whole GUI suite (a run at cdd7c8e46 was
cut off at 1170 of ~1174 tests when mote rebooted; it runs again after
the tag and any red is filed).
Zachary-wW (#3745): the Library's "Some of the Library couldn't be
written" card had Try again and nothing else. Their Grok Build has an
AGENTS.md magpie can't stat, and every change writes every agent again,
so the card stood over the page through every edit on the Instructions
tab, with no way to put it away.
The card has a × beside Try again now, named "Hide until something new
can't be written". It hides the write failures the card lists, on every
tab, and sends nothing. The page keeps what was hidden by agent and item
("grok" and "instructions"). After every answer, a read or a change, it
lets go of a hidden failure that no longer stands, and a failure not
hidden brings the card back with all it lists; so does a hidden one
whose item was written in between and fails again. So the card stays
hidden while the reporter keeps editing, though each change fails on
Grok Build's file again, and a new write error shows it again.
The key is not the error's text: a write goes through a temp file named
anew at each try (edit.WriteAtomic), so a folder that can't be written
fails with a new text at every sync, and the card would never stay
hidden. Meanwhile each change's toast still names what failed, as
before, and a skill that couldn't be given keeps the dot on its agent's
chip. The list magpie keeps (lastProblems) is not touched. The × is
named by its title, as the Library's other × buttons are.
An agent's own skills in the library's way are the agent's to settle,
not failures: they stay, under their own title, with no ×. The view
keeps its scroll as the card goes, as render() keeps it for Try again;
Chromium's scroll anchoring moved it. From the keyboard the focus goes
to the card's next button, or to the tab open. On a phone the × is 44px
wide and as tall as Try again. The card's title keeps its words whole:
with less than 10em beside it, Try again and the × go to a line of their
own (beside them, a German title at 320px broke "Bibliothek" and
"geschrieben" inside).
library-problems-hide.test.cjs is new. Its API answers as
internal/gui/library.go does: a change's problems are its full sync's,
an Instructions change keeps the rest and puts its own in, and a read
gets the list with no result. Its error texts are the ones magpie's own
sync gave in a sandbox HOME, through Handler in a scratch Go test (not
kept): Grok Build's AGENTS.md a link into a folder magpie can't search,
its folder read-only, and its skills folder read-only.
Not covered: what was hidden lasts as long as the page, so a reload
shows the card again. The × hides, it doesn't fold: while the card is
hidden, its error texts and Try again are out of reach, though any
change writes every agent again. An agent's instructions, and its whole
MCP file, have no mark of their own as a skill's chip has, so with the
card hidden only a change's toast names their failure (#3987).
What was run (tree f98a4b99, on origin/main f8cd964a, go1.26.8,
linux/amd64, Linux 5.15), outside graftcp, umask 077:
library-problems-hide.test.cjs, Node's runner with Playwright 1.58,
Chromium and WebKit, three runs each: 16 of 16 pass in every run (15
cases and the file's own)
Without this change (f8cd964a's client.js, i18n.js and library.css,
the new test kept): 16 of 16 red in both. Broken by hand, one at a
time, Chromium and WebKit unless said:
any change that fails at all brings the card back (the first
draft's rule): the reporter's case, the same failure under another
error and a hidden failure written since, red
a change's failure not hidden brings it back, nothing let go: a
hidden failure written since, red
a new failure never brings it back while anything is hidden: a
failure not hidden, a hidden failure written since and another
window's change, red
the key with the error's text in it (Chromium): the same failure
under another error, red
the × writes every agent again (Chromium): 9 red, the reporter's
case among them
the view's scroll not kept as the card goes: 9 red in Chromium,
green in WebKit, which keeps it without
the × 44px wide on a phone taken out (Chromium): the five locales'
"named and inside the card", red
the head as the draft had it, no wrap and the title shrinking: de,
red
the focus moved without preventScroll (Chromium): green, 16 of 16;
no test here tells it apart
Library and siblings, Chromium and WebKit: 69 files, the Library's
own tests, the skills' and market's that share its page, gui-de,
gui-ja, gui-zh-tw and i18n-keys: all pass but two, red the same at
f8cd964a without this change: i18n-keys "a plugin's words are its
own", fixed on main since (#3897), and title-bar-tools (Chromium de,
WebKit all five locales: a locator.waitFor timeout)
TestCoreScriptBudget: ok (the Library is a plugin, outside the core);
on origin/main c752082e with this commit applied too (a scratch
worktree, not this tree)
On origin/main e9dd8e83 with this commit applied (a scratch
worktree, not this tree), Chromium and WebKit:
library-problems-hide, i18n-keys, library-items and
library-instr-busy, 66 of 66 pass
gofmt -l of every .go file: nothing. GOOS=linux, windows and darwin
go vet -tags nogui ./..., GOOS=windows go vet ./...: exit 0.
GOOS=linux and darwin go build -tags nogui ./..., GOOS=windows go
build ./...: exit 0. Untagged linux vet and build stop at pkg-config
(no libsoup-3.0 or gio-unix-2.0 here)
full suite, go test -tags nogui -count=1 -timeout 45m ./... (8m25s,
load 35 at its start, Bun 1.4.2): 68 packages ok, reds in 8, none
in internal/gui's library code:
internal/agent TestInstalledVersion, TestZedAppPath,
TestCursorFolderFromTheEditorIsNotTheCLI,
TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
TestQoderSettingsFromAnIDEPluginIsNotTheCLI and
TestOmpDetectedWithPiDir (#3141); TestCodexDriftReached (#3398);
the two Reasonix tests (#3641); TestWSLColdPlaceOpensNothing
(#3924, fixed on main since)
internal/davsync TestSyncTeraCloudStillSeesOtherWrites (#3420)
internal/edit TestWriteAtomicReadOnlyHardLink and internal/testenv
TestProgram, umask 077 (#3640)
internal/gateway TestPluginToldWhereTheAgentWorks (#3675)
internal/gui TestGatewayHeldByAContainer and
TestGatewayFixQuitsOnlyAMagpie (#3649)
internal/provider TestCodexAppServersOnHome (#3906), then "fatal
error: close of synctest channel from outside bubble" (#3632),
which ends the package's run
internal/tui TestTUIFetchesSubscriptionModels/agent (#3919)
Not tried: the × in a running magpie, in macOS's or Windows' window or
WebKitGTK; the page here is the test's, with magpie's own replies.
Batch run, at tree 104d75f0a (the twelve coffemon ports together, on
origin/main 7d022bdb6), mote, macOS, go1.26.8:
- go test -tags nogui -count=1 -timeout 45m on the packages the batch
changes (agent, autostart, daemon, gateway, library, proc, provider,
sessions, testenv, tui, gui): ok each.
- GUI, node --test with Playwright 1.62.0, Chromium and WebKit:
library-*.test.cjs and i18n-keys.test.cjs, 1044 of 1044 pass.
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./... and go build ./...: ok at cdd7c8e46, the same
batch on origin/main 00098f12b one rebase before.
- The whole go test ./... at cdd7c8e46: 86 packages ok, one red,
internal/cli TestEveryRouteHasACommandOrIsNamed (GET
/api/context/reply has no command), red on main too (#5026).
- Linux (wsl-run, Ubuntu 24.04, at 339055896, the batch on f4c664a09):
proc, autostart, testenv, tui ok; agent: only TestGrokInstalled red
(#3548); #4033's proc.Look reds (Zed, Copilot, Qoder, Cursor, Omp)
pass.
- Windows (win-run, Windows 11, at 339055896): proc, autostart, testenv,
tui ok; library and agent red in the same tests as on origin/main
f4c664a09 (#4115, #1827, #4786; #5068, #5069, #5070 filed now).
- Rebased onto origin/main fb1f4856a (three commits, no file in
common with the batch) and run again at the pushed tree: gofmt -l
nothing, go build ./... and go vet ./... ok; go test -tags nogui
sessions, agent, autostart, tui, proc, testenv ok; i18n-keys and
library-* 1044 of 1044 pass.
- Not run before the push: the whole GUI suite (a run at cdd7c8e46 was
cut off at 1170 of ~1174 tests when mote rebooted; it runs again after
the tag and any red is filed).
keeyangyy (#3938) named their client: Reasonix 1.x, which sends no
session header (it sets x-opencode-session on its OpenCode Go paths
only) and opens every conversation on a snapshot it writes, the same
bytes in every conversation started in one workspace while its memory
and skills catalog don't change:
{"role":"user","content":"<session-context version=\"1\">\nThis host-generated snapshot supersedes every earlier session-context snapshot.\n\n## Environment\n...\nDigest: sha256:<hex>\n</session-context>"},
{"role":"user","content":"the question the user actually typed"}
userWords didn't know the block, so the commit before this one still
hashed it alone: every conversation a workspace opened had one id, and
under Stays = session each new one was kept on the account that
answered the first.
"<session-context" joins injected, beside Codex's
"<environment_context>", with no closing ">" so that its version
attribute matches. What asks userWords now passes over the snapshot as
it passes over Codex's context:
- the conversation's id runs from the snapshot through what the user
typed (conversationOpening);
- the turn count: [snapshot][typed] is turn 1, where it was 2
(turnIn);
- a group's conversation key is the typed words, where it was the
snapshot, the same for every conversation in the workspace
(firstWords, in ruleKey and the affinity scope);
- the turn before, which the classifier is told (turnBefore): on a
conversation's first turn, and on each turn a new snapshot comes
with, it was the snapshot, workspace and memory and all, as the
user's previous message with no reply; now it is nothing on a first
turn, and the user's words before the snapshot and the reply to them
on a later one;
- the classifier's question, Copilot's Auto and gatewayQuery take the
user's last words before a snapshot sent after them, and the Claude
subscription takes one after tool results as the agent's notice
(agentNotice).
A Reasonix conversation under way when this lands gets an id of its
own on its next turn and is routed once as a new conversation, as the
previous commit says of the others: it may move to another account,
and its cache there starts over.
The shape is the report's, which keeyangyy read from Reasonix's source
(internal/sessioncontext) and didn't capture; its folder and digest
are left out as they left them, and the tests use it as written.
Not changed: the prompt breakdown (promptBuilder.userText) keeps its
own list of Codex's blocks and still files the snapshot as a chat
turn, so a Reasonix conversation's first turn shows there as two
turns, where Codex's context adds none. That is left for a commit of
its own.
What was run (tree 71364f08, on origin/main a5315c70, go1.26.8,
linux/amd64, Linux 5.15), outside graftcp, umask 077:
- With the previous commit's prompt.go and the tests as committed, the
four tests this commit touches are red:
TestReasonixConversationsInOneWorkspaceAreApart on every protocol
("chat: two conversations opened on one snapshot:
magpie-310d1b42730f273079337f01 and magpie-310d1b42730f273079337f01
(the snapshot alone: magpie-310d1b42730f273079337f01)");
TestNewConversationsInOneFolderAreRoutedApart ("Reasonix's second
conversation went to k2 as "session", conv
magpie-310d1b42730f273079337f01; its first is on k2, conv
magpie-310d1b42730f273079337f01"); TestTurnInSkipsWhatTheAgentPutIn
("Reasonix's snapshot, then the user's words: turn 2 within false,
want 1 false"); TestFirstWordsAreWhatTheUserSaid ("key changed for
conversation 4").
- Here, those four -count=5: 20 pass.
- The tests of the opening and of what userWords feeds, in
internal/gateway, sessions, gui and provider (the conversation id,
dsh's ids, affinity, rotate, strict, OpenCode's sessions, the turn
count, the classifier's question, firstWords, Copilot's Auto, a
rule's turn held past an agent's message): ok, 121 top-level tests
passed, none failed.
- The previous commit's 12 hand-breaks of conversationOpening,
userOpens and writeOpening, each alone on this tree: each red on the
same tests as at a6037f68, and the first (the first user message
hashed alone) also on TestReasonixConversationsInOneWorkspaceAreApart.
- -race -count=5 of the routing and opening tests with the new ones:
85 pass, no race. -race -count=3 of the two allocation bounds: 6
pass.
- gofmt -l clean. go vet -tags nogui for linux, windows and darwin, go
build -tags nogui for linux and darwin, and go vet and go build for
windows without the tag: exit 0 each. go vet and go build without the
tag on linux: exit 1 (no libsoup-3.0 or gio-unix-2.0 here).
- go test -tags nogui -count=1 -timeout 45m ./... (Bun 1.4.2, log
kept; 8m43s, load 28 at its start): 72 packages ok, 5 red, none of
them this commit's tests or what they cover. internal/gateway ran to
its end (510s), so the new tests passed in it. The reds: agent
TestInstalledVersion, TestQoderSettingsFromAnIDEPluginIsNotTheCLI and
TestOmpDetectedWithPiDir (#3141), and
TestReasonixCLIRequiresSupportedNativeVersion and
TestReasonixCLIRecoversAfterProbeTimeout (#3641, the Agents page's
check of the Reasonix CLI, which this doesn't reach); edit
TestWriteAtomicReadOnlyHardLink and testenv TestProgram (umask 077,
#3640); gateway TestPluginToldWhereTheAgentWorks (#3675) and
TestUploadStillUnderwayIsNotCutByHealthPing (red on main, #3909,
which has a test-only patch); gui TestGatewayHeldByAContainer and
TestGatewayFixQuitsOnlyAMagpie (#3649).
Not tried: Reasonix itself, or a body it sent. Its source
(internal/agent/session_context.go, 1.39.10) sends a new snapshot only
when its digest changes, as a user message of its own; the openai
provider magpie writes for it (internal/agent/reasonix.go) sends each
message as a Chat message of its own, and its Anthropic provider,
which merges adjacent user messages, keeps the snapshot a text block of
its own, which userWords reads alone.
Ported with the commit before onto origin/main 5ee5274bd from
JoeyWu-tech/magpie fix/3938-opening-run-4 (02c1de292, f50687a46; posted
on #3938, sha256 7cdb7e83...). The code applied as is; the docs and
extrabody.go's comment were merged by hand beside main's newer text
(${threadId}, ${subagentId}).
What was run for the port (mote, macOS, go1.26.8): the five tests in
conversation_opening_test.go and user_said_test.go's new case, with
the conversation id, dsh, affinity, rotate, strict, sticks and extra
body tests: ok. The same tests on 5ee5274bd (old code, new tests):
TestConversationsOnOneEnvironmentMessageAreApart (chat, messages,
responses, gemini, gemini without roles),
TestReasonixConversationsInOneWorkspaceAreApart,
TestCacheMarkMovingOnKeepsTheID, TestOpeningHashReadsInPlace and
TestNewConversationsInOneFolderAreRoutedApart red.
Batch run, at tree 104d75f0a (the twelve coffemon ports together, on
origin/main 7d022bdb6), mote, macOS, go1.26.8:
- go test -tags nogui -count=1 -timeout 45m on the packages the batch
changes (agent, autostart, daemon, gateway, library, proc, provider,
sessions, testenv, tui, gui): ok each.
- GUI, node --test with Playwright 1.62.0, Chromium and WebKit:
library-*.test.cjs and i18n-keys.test.cjs, 1044 of 1044 pass.
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./... and go build ./...: ok at cdd7c8e46, the same
batch on origin/main 00098f12b one rebase before.
- The whole go test ./... at cdd7c8e46: 86 packages ok, one red,
internal/cli TestEveryRouteHasACommandOrIsNamed (GET
/api/context/reply has no command), red on main too (#5026).
- Linux (wsl-run, Ubuntu 24.04, at 339055896, the batch on f4c664a09):
proc, autostart, testenv, tui ok; agent: only TestGrokInstalled red
(#3548); #4033's proc.Look reds (Zed, Copilot, Qoder, Cursor, Omp)
pass.
- Windows (win-run, Windows 11, at 339055896): proc, autostart, testenv,
tui ok; library and agent red in the same tests as on origin/main
f4c664a09 (#4115, #1827, #4786; #5068, #5069, #5070 filed now).
- Rebased onto origin/main fb1f4856a (three commits, no file in
common with the batch) and run again at the pushed tree: gofmt -l
nothing, go build ./... and go vet ./... ok; go test -tags nogui
sessions, agent, autostart, tui, proc, testenv ok; i18n-keys and
library-* 1044 of 1044 pass.
- Not run before the push: the whole GUI suite (a run at cdd7c8e46 was
cut off at 1170 of ~1174 tests when mote rebooted; it runs again after
the tag and any red is filed).
keeyangyy (#3938): with no session header, conversationID named a
conversation by the raw bytes of its first user message alone. Some
agents open every conversation on a message they write themselves and
send what the user typed as the next user message:
{"role":"user","content":"<environment_context>cwd=/w/proj ...</environment_context>"},
{"role":"user","content":"the question the user actually typed"}
That message is the same in every conversation started in one folder,
so all of them had one id: under Stays = session each new one was kept
on the account that answered the first, and rotate never moved on.
conversationOpening now says what is hashed, from the first user
message on (Chat and Anthropic messages, Responses input, Gemini
contents, where an omitted role is the user's):
- A first user message that holds anything of the user's own is hashed
alone, as the request has it, exactly as before: their words
(userWords, which already tells an <environment_context> or
<user_instructions> block or an instruction file from what the user
typed), an image, a file or a recording (userOpens). So is one that
holds a tool's result.
- One the agent wrote alone is hashed with the user messages after it,
in order, through the first that holds the user's own. A system or
developer message between them is passed over.
- A reply, a call, its output, reasoning, a tool's result (Gemini's
function result too), an item without a role (Chat, Responses) or
one that can't be read ends the opening. With nothing of the user's
before it, the first message is hashed alone, as before.
Every later turn repeats the opening before the first reply, so the id
holds through the conversation. A Responses input that is one string
is hashed as before.
An opening of several messages is hashed as writeOpening reads them,
one after another: every object's members in key order with no space
between, no cache_control at any depth, and a content of one text part
as that part's text. An agent marks its newest user message for the
cache and moves the mark on next turn, so the typed message's bytes
change at turn 2; some spell a marked message as a list of one part and
an unmarked one as a plain string (dsh does). Hashed as sent, an
opening of several would get a new id at its second turn, and on
/v1/messages under rotate that turn would go to the other key as a new
conversation (below). writeOpening reads the messages where they are:
the id of a 1.1 MB body whose opening holds a screenshot allocates
about 10 KB (TestOpeningHashReadsInPlace).
Every conversation whose first user message is the user's own keeps
the id it has, so no stick record needs moving. One that opened on an
agent's message and is under way when this lands gets an id of its own
on its next turn and is routed once as a new conversation: it may move
to another account, and its cache there starts over. The record they
all shared stays under the old id.
A tool's result (Anthropic clients send it as a user message) ends the
opening: it answers a call the model made, so the opening is over. A
history that starts with one was cut by its client (magpie takes such
orphans, TestMessagesOrphanToolResultWithoutACallBecomesText). Its
opening is gone, and whatever was taken in after the cut would move the
id each time the client cuts again, so its first message is hashed
alone, as before.
Not the issue's "first two user messages", nor every user message up
to the first reply: in an ordinary conversation the second user message
is the next turn, so the id would move when it arrives, and every
record would need the migration the issue describes. And a run of
every user message takes in what dsh sends after the typed prompt, its
runtime context, where the Context page finds dsh's sessions by the
typed prompt's hash alone; TestDshSessionConvsAreTheGatewayIDs and
TestDshRoutesCarryTheSessionConvs go red under such a run (below).
What reads the id moves with it: stickKey (session, turn and strict
affinity, and rotate's spread of new conversations), the Routing
trace's conv (convOf), a sealed task's lead (leadProvider,
loggedAnswerers), extraBody's ${sessionId}, Kilo's task and session
headers (KiloClient), X-Magpie-Conversation to plugins and OpenCode's
x-opencode-session fallback (openCodeSeed). A group rule's key reads
conversationID without a body, beside firstWords, which already passes
over the agent's blocks, so it doesn't change. One reader rebuilds the
id itself: sessions' dshConvs, which the Context page joins dsh's
sessions by (joinConvs). It hashes dsh's typed prompt, a first user
message of the user's own, which is still hashed alone, so its ids stay
the same. Nothing else in sessions, gui or elsewhere rebuilds a
"magpie-" id. The comments that named the first user message, and the
Gateway routing and Providers and accounts pages, say what the id is
now.
Siblings left for a decision, each in an issue filed with this
patch: #3988, ChatGPT accounts (conversationKey in
internal/provider/codex_request.go, for a client that sends no
prompt_cache_key), and #3989, Antigravity accounts (antigravitySession
in internal/provider/google.go). Both hash the first user message in the
provider package, and userWords is the gateway's.
Not changed: a fixed first message that userWords doesn't read as the
agent's is still hashed alone, so the conversations an agent opens on
it still share one id. A first user message hashed alone is hashed as
the request has it, cache mark and all, so a client without a session
header that marks that message on its first turn only gets a new id at
its second, as before. An agent that answers its own first message
with a fixed reply before the user's turn ends the opening at that
reply, so its first message is hashed alone too.
What was run (tree 523c770b, on origin/main a5315c70, go1.26.8,
linux/amd64, Linux 5.15), outside graftcp, umask 077:
- This commit's tree alone: not run. It is a6037f68 rebased: its
internal/ diff is the same (one patch-id), and
docs/subsystems/gateway-routing.md was merged by hand beside main's
new One try row. At the next commit's tree (71364f08), which adds a
line to userWords' list and tests: this commit's tests, every break
below again, -race, vet and the full suite, recorded in the next
commit.
The rest is what was run for a6037f68, at tree e8fc1eee on origin/main
e9dd8e83, the same code (not this tree):
- New: TestConversationsOnOneEnvironmentMessageAreApart, on Chat,
Messages, Responses and Gemini bodies, the last with and without
roles. The issue's two conversations from one folder get two ids,
neither the environment message's own, and each keeps its id on its
next turn. A conversation that opens in the user's words has
"magpie-" and the hex of sha256(its first user message)[:12], alone,
on a later turn and with the agent's message after it. A screenshot
after the agent's message opens a conversation as words do. A
developer or system message between them doesn't move the id. dsh's
turn, its runtime context marked for the cache, has the typed
message's own. A history cut at a tool's result keeps its first
message's own, and so do these after the agent's message: a tool's
result, a Chat message without a role, a Responses call, its output
or reasoning, and a Gemini function's result, in a user content or
in its own role. A Responses string input is hashed as before.
TestCacheMarkMovingOnKeepsTheID: the issue's opening on Messages,
Chat and Responses, the mark on each turn's newest user message,
turns 1, 2 and 3 with one id, the typed message going on unmarked as
one part, as a plain string or with a screenshot, and on Chat marked
on the message itself. TestOpeningHashReadsInPlace: the 1.1 MB body
above under image_input_test.go's bar of an eighth of the body.
TestNewConversationsInOneFolderAreRoutedApart: two keys, rotate,
Stays = session, no session header. On /v1/chat/completions the two
conversations are each "first", on different keys with different
convs, and each next turn stays on its key as "session" with its
conv. On /v1/messages a third conversation, its mark moving on, is
"first" and turns 2 and 3 stay on its key as "session" with its conv.
- Broken by hand, each red:
- back to the first user message alone (the old rule):
TestConversationsOnOneEnvironmentMessageAreApart on all five bodies
("two conversations opened on one environment message": one id, the
message's own; and the screenshot case),
TestCacheMarkMovingOnKeepsTheID (each of its ten first turns the
environment message's own),
TestOpeningHashReadsInPlace ("the environment message was hashed
alone") and TestNewConversationsInOneFolderAreRoutedApart (the
second conversation on k1 as "session", with the first's conv).
- every consecutive user message, unread: the five bodies' cases
with the agent's message after the user's, the screenshot cases,
dsh's two turns, the cut history, the tool's result after the
agent's message and Gemini's function result in a user content,
and TestDshSessionConvsAreTheGatewayIDs and
TestDshRoutesCarryTheSessionConvs (the turn's conv not among the
session's).
- a tool's result taken into the opening, and passed over like a
developer message: the cut history, the tool's result after the
agent's message and Gemini's function result, each way.
- a system or developer message ending the opening: the Chat and
Responses pairs.
- an image, a file or a recording not counted as the user's: the
screenshot case on all five bodies.
- an item without a role passed over like a developer message: the
Chat message without a role and the Responses call, output and
reasoning.
- Gemini's functionResponse not read as a tool's result: its case.
- an opening of several hashed as sent:
TestCacheMarkMovingOnKeepsTheID at turns 2 and 3 in all ten
spellings, and on /v1/messages turn 2 went to k2 as "first" with a
new conv, where turn 1 was on k1.
- cache marks kept: the screenshot spellings and the message marked
on Chat, at turns 2 and 3 (a one-part content is read as its text
either way).
- a content of one text part not read as its text: the three plain
string spellings at turns 2 and 3.
- each string copied before it is hashed: TestOpeningHashReadsInPlace,
2,233,788 bytes an id.
- With their neighbours, -v: TestConversationID, the Dsh tests in
gateway and sessions, TestContextDshSessionTitles,
TestImageWalkReadsTextOnlyTurnsInPlace, the orphan tool result tests,
TestClaudeConversationKeepsItsAccountsCache, and the affinity,
rotate, strict, sticks, session route, OpenCode, extra body,
WorkBuddy session and gateway conversation tests: 115 tests in
gateway, sessions, gui and provider pass (154 with subtests).
- -race -count=5: TestConversationsOnOneEnvironmentMessageAreApart,
TestCacheMarkMovingOnKeepsTheID,
TestNewConversationsInOneFolderAreRoutedApart, TestAffinity,
TestRotateSpreadsSessions, TestRotateSpreadsABurstOfNewConversations,
TestGeminiFallbackSessionAffinity, TestSticksWrittenBehind, the three
TestStrictAffinity tests, the two dsh conv tests and
TestClaudeConversationKeepsItsAccountsCache: 14 tests, 5 of 5 each.
-race -count=3: TestOpeningHashReadsInPlace and
TestImageWalkReadsTextOnlyTurnsInPlace, 3 of 3 each (the id under
-race: 17 to 32 KB).
- gofmt -l clean. go vet -tags nogui for linux, windows and darwin, go
build -tags nogui for linux and darwin, and go vet and go build for
windows without the tag: exit 0 each. go vet and go build without
the tag on linux: exit 1 (this box has no GTK or WebKitGTK dev
packages).
- go test -tags nogui -count=1 -timeout 45m ./... (tools/suite.sh, Bun
1.4.2, log kept; 8m23s, load 21 at its start): 71 packages ok, 5
red, none in what this changes: agent TestInstalledVersion,
TestCursorFolderFromTheEditorIsNotTheCLI,
TestQoderSettingsFromAnIDEPluginIsNotTheCLI, TestOmpDetectedWithPiDir
and TestZedAppPath (#3141), TestCodexDriftReached (#3398) and the two
Reasonix tests (#3641); edit TestWriteAtomicReadOnlyHardLink and
testenv TestProgram (umask 077, #3640); gateway
TestPluginToldWhereTheAgentWorks (#3675), the package ran to its
end, so the new tests passed in it too; gui
TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie
(#3649).
Not tried: keeyangyy's own client, or any real agent end to end.
Batch run, at tree 104d75f0a (the twelve coffemon ports together, on
origin/main 7d022bdb6), mote, macOS, go1.26.8:
- go test -tags nogui -count=1 -timeout 45m on the packages the batch
changes (agent, autostart, daemon, gateway, library, proc, provider,
sessions, testenv, tui, gui): ok each.
- GUI, node --test with Playwright 1.62.0, Chromium and WebKit:
library-*.test.cjs and i18n-keys.test.cjs, 1044 of 1044 pass.
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./... and go build ./...: ok at cdd7c8e46, the same
batch on origin/main 00098f12b one rebase before.
- The whole go test ./... at cdd7c8e46: 86 packages ok, one red,
internal/cli TestEveryRouteHasACommandOrIsNamed (GET
/api/context/reply has no command), red on main too (#5026).
- Linux (wsl-run, Ubuntu 24.04, at 339055896, the batch on f4c664a09):
proc, autostart, testenv, tui ok; agent: only TestGrokInstalled red
(#3548); #4033's proc.Look reds (Zed, Copilot, Qoder, Cursor, Omp)
pass.
- Windows (win-run, Windows 11, at 339055896): proc, autostart, testenv,
tui ok; library and agent red in the same tests as on origin/main
f4c664a09 (#4115, #1827, #4786; #5068, #5069, #5070 filed now).
- Rebased onto origin/main fb1f4856a (three commits, no file in
common with the batch) and run again at the pushed tree: gofmt -l
nothing, go build ./... and go vet ./... ok; go test -tags nogui
sessions, agent, autostart, tui, proc, testenv ok; i18n-keys and
library-* 1044 of 1044 pass.
- Not run before the push: the whole GUI suite (a run at cdd7c8e46 was
cut off at 1170 of ~1174 tests when mote rebooted; it runs again after
the tag and any red is filed).
TestLibraryMCPHub (internal/cli) adds `npx -y fs` to Claude Code, turns
the MCP router on and off and keeps fs direct. Each sync gave the agent
the package run by node from magpie's own install (mcp_npx.go), so it
started `npm install fs` in the background under the test's temp HOME,
and each change that took fs out of every agent ended the machine's
processes running `npx -y fs` (mcp_reap.go). Only internal/library's
TestMain turned the two off (npxInstall = nil, ending a no-op); every
other package that syncs the library ran them for real. So npm was
still writing .config/magpie/mcp-npm/<hash>/node_modules when TempDir
cleaned up (#4140, macOS: "directory not empty"; Windows: "being used
by another process"), and the user's own running fs server was ended
by a test. coffemon (Discord) pointed out the second.
Now the library turns both off itself in any test binary
(testing.Testing(), in init), as internal/provider and internal/agent
do for their own reach out of a test; internal/library's TestMain no
longer sets them, and the tests about either still set their own.
What was run (mote, macOS, go1.26.8):
- TestTestsLeaveTheMachineAlone, new (internal/library): ok; with
mcp_npx.go as on 5ee5274bd and the new tests, red: "npxInstall is set
in a test binary: a test adding an npx server runs npm install" and
"ending is endDropped in a test binary: ...".
- TestLibraryMCPHub with a fake npm first on PATH that records its
calls, and a process `.../npx -y fs` (a sh script sleeping) started
before it: on 5ee5274bd npm was run twice, "npm install --prefix
.../TestLibraryMCPHub2348071777/001/.config/magpie/mcp-npm/
dce7cce055566bed ... fs", and the running `npx -y fs` was ended by
the test (Terminated: 15); with this change npm was never run and the
process was still running after it.
- go test -count=1 ./internal/library ./internal/cli ./internal/proc:
library and proc ok; cli's one red is TestEveryRouteHasACommandOrIsNamed
("GET /api/context/reply has no command"), #5026, red on main.
Batch run, at tree 104d75f0a (the twelve coffemon ports together, on
origin/main 7d022bdb6), mote, macOS, go1.26.8:
- go test -tags nogui -count=1 -timeout 45m on the packages the batch
changes (agent, autostart, daemon, gateway, library, proc, provider,
sessions, testenv, tui, gui): ok each.
- GUI, node --test with Playwright 1.62.0, Chromium and WebKit:
library-*.test.cjs and i18n-keys.test.cjs, 1044 of 1044 pass.
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./... and go build ./...: ok at cdd7c8e46, the same
batch on origin/main 00098f12b one rebase before.
- The whole go test ./... at cdd7c8e46: 86 packages ok, one red,
internal/cli TestEveryRouteHasACommandOrIsNamed (GET
/api/context/reply has no command), red on main too (#5026).
- Linux (wsl-run, Ubuntu 24.04, at 339055896, the batch on f4c664a09):
proc, autostart, testenv, tui ok; agent: only TestGrokInstalled red
(#3548); #4033's proc.Look reds (Zed, Copilot, Qoder, Cursor, Omp)
pass.
- Windows (win-run, Windows 11, at 339055896): proc, autostart, testenv,
tui ok; library and agent red in the same tests as on origin/main
f4c664a09 (#4115, #1827, #4786; #5068, #5069, #5070 filed now).
- Rebased onto origin/main fb1f4856a (three commits, no file in
common with the batch) and run again at the pushed tree: gofmt -l
nothing, go build ./... and go vet ./... ok; go test -tags nogui
sessions, agent, autostart, tui, proc, testenv ok; i18n-keys and
library-* 1044 of 1044 pass.
- Not run before the push: the whole GUI suite (a run at cdd7c8e46 was
cut off at 1170 of ~1174 tests when mote rebooted; it runs again after
the tag and any red is filed).
hheei (#3887): a Codex conversation with a web search in it (OpenAI's
own web_search, a web_search_call in its history) failed on every turn
with "HTTP 400: Codex: Encrypted content could not be decrypted or
parsed. (code: invalid_encrypted_content)" once magpie had moved it to
another ChatGPT account of the same routing group: after its affinity
went cold ("why": "cold", over two hours on), or after the account it
was on was used up or rate limited.
What an account's turn wrote comes back sealed for that account
(encrypted_content): its reasoning, a web search, and with Codex's
output token replay on (codex-rs core/src/client.rs: only for a provider
named "OpenAI", which Codex signed in reaches magpie as) each message
and call. Codex hands it all back on every turn, and between ChatGPT
accounts, or a ChatGPT account and an OpenAI API key, magpie sends it as
it came (forVendor, 2a19245c). The account asked next can't read the
first's seals and says so. serve asked again without the reasoning only
(withoutReasoning), was refused again over the web search, had no
compaction to leave out, and passed the 400 on. What it remembered as
refused for the conversation's later turns (refusedSeals) was reasoning
and compactions only, so each later turn went the same way. The relay of
Codex's own sign-in (withoutUnreadable) left only the reasoning out as
well.
Now such a refusal is asked again without every seal but a compaction's
(withoutSeals): reasoning goes whole, as before, and any other item
keeps all but its encrypted_content (withoutItemSeal, the rest of it
byte for byte). refused records what was taken out for the key or
account that refused, and withoutRefused leaves it out of the
conversation's later requests there up front, reasoning whole and the
rest by its seal alone. What that one sealed itself still goes along,
and a request on the account that sealed what it carries goes as it
came, so a turn that doesn't move keeps OpenAI's cache and replay as
before. A compaction keeps its own step (withoutCompaction after a
second refusal, unless native compaction is on). The relay asks again
the same way after its 400. The retry is serve's, so it holds whatever
moved the conversation: an account used up, rate limited or resting, the
next member of a group, routing's own pick once the affinity went cold;
on the backend path (one of Codex's own models, signed in) and on
/v1/responses (the codex provider's model, a group of it) alike.
gateway-routing.md says so.
A refusal doesn't say whose seal it couldn't read, so the account asked
loses its own seals from an earlier stay in the conversation too, and
they are remembered as refused, as its reasoning already was.
Not changed, each as on main (#3934): a context_compaction
another account sealed stays in through both steps (keepsSeal has it,
compactionKinds doesn't); the relay keeps no record of what was refused,
so each later turn there is refused once and asked again, and a refusal
in its stream reaches Codex as it came; the relay's /responses/compact
isn't asked again; the Routing view still calls such a try "another
account's reasoning" (client.js and its translations).
What was run (tree 326b178e, on origin/main f8cd964a, go1.26.8,
linux/amd64, Linux 5.15), outside graftcp, umask 077:
- TestForeignSealedItemsMoveToAnotherAccount, new: a conversation
holding acct-1's sealed reasoning, web search, call and answer moves
to acct-2 as acct-1 answers 429 or response.failed
rate_limit_exceeded, signed in, as codex/gpt-5.5 and as group/g,
acct-2 refusing with a 400 or in its stream (12 cases). acct-2 is
asked with every seal, refuses, is asked again bare and answers, and
the next turn asks it bare with its own seals on: ok
- TestForeignSealedItemsAfterAColdSwitch, new: the same conversation
moved back to acct-1 by its affinity gone cold (Why "cold"), 6 cases:
ok
- TestForeignSealedItemsRelayedToAnotherSignIn, new: Codex's own sign-in
relayed as acct-2, the history sealed by acct-1: ok
- TestSealsTakenOutLeaveTheRest, new: the exact bytes withoutSeals and
withoutRefused leave (a seal first, in the middle and last in its
item; compactions keeping theirs; reasoning alone taken as
withoutKinds took it), and nothing taken out for another account or
conversation: ok
- the three new end-to-end tests with affinity.go, gateway.go,
codex_backend.go and routing.go as on main (swapped in through go test
-overlay, the checkout left as committed; the unit test left out, as
it calls withoutSeals): 21 of 21 red. The 400 cases: "moved on: 400
{"error":{"code":"invalid_encrypted_content","message":"Codex:
Encrypted content could not be decrypted or
parsed.","param":null,"type":"invalid_request_error"}}", and "gone
cold: 400" with the same; in the stream: "moved on: 200" and "gone
cold: 200", the response.failed invalid_encrypted_content passed on to
Codex; the relay: "400 {"error":{"message":"Encrypted content could
not be decrypted or parsed.", ...
"code":"invalid_encrypted_content"}}"
- broken by hand, one at a time, each swapped in the same way, beside
the tests already there for foreign seals, compactions, reasoning and
output replay (TestForeignSeal*, TestForeignCompaction*,
TestForeignReasoning*, TestCodexOwnModelAfterAnotherVendor,
TestCodexSpentMovesToGrokWithSealedReasoning, TestCodexOutputReplay*),
all green under each but where named:
- serve's retry taking the reasoning only (withoutKinds(body,
"reasoning")): TestForeignSealedItemsMoveToAnotherAccount (12 of 12)
and TestForeignSealedItemsAfterAColdSwitch (6 of 6) red, "moved on:
400" and "gone cold: 400" with the error as on main
- the relay's taking the reasoning only:
TestForeignSealedItemsRelayedToAnotherSignIn red, "400
{"error":{"message":"Encrypted content could not be decrypted or
parsed.",...}}"
- refused recording reasoning and compactions only (seals as on main):
the same 18 cases and TestSealsTakenOutLeaveTheRest red, the next
turn refused once more, "then asked [{"acct-2" "message user,
web_search_call 上海天气 gAAAA-acct-1-w1, function_call c1
gAAAA-acct-1-f1, ..."} {"acct-2" ...}]", and "next turn:" with the
seals left on
- withoutRefused taking out reasoning and compactions only: the same
19 red, with the same lines
- withoutRefused dropping each refused item whole: the same 19 red,
"then asked [{"acct-2" "message user, message assistant, message
user, message assistant, message user, reasoning gAAAA-acct-2-r3,
..."}]", the searches and calls gone
- withoutItemSeal writing the item out again (marshalPlain):
TestSealsTakenOutLeaveTheRest red, "got {...}" with the web search's
keys sorted,
{"action":{...},"id":"ws_1",...,"type":"web_search_call"}
- withoutItemSeal without its keepsSeal check:
TestSealsTakenOutLeaveTheRest and TestForeignCompactionToGrok red,
"grok was sent [["compaction:sealed-by-openai-compaction"
"reasoning:sealed-by-openai"] []]": the compaction lost its seal in
the first step instead of going in its own
- the related tests (TestForeign*, TestCodexOwnModel*, TestCodexSpent*,
output replay, the rewrite equivalence tests, TestAffinity*,
TestNativeCompaction*, TestRemoteMagpie*, TestGatewayKey*, groups and
Codex accounts): 257 passed with their subtests, none skipped (Bun
1.4.2)
- go test -tags nogui -count=1 -timeout 45m ./internal/gateway (log
kept), Bun 1.4.2: 5418 passed with their subtests, 3 skipped, and one
red, TestPluginToldWhereTheAgentWorks (#3675): "not in one: the plugin
was told "/tmp/TestPluginToldWhereTheAgentWorks191044475/005", git
"yes"; want "/tmp/TestPluginToldWhereTheAgentWorks191044475/005",
"no"". It is red the same alone, and with the four code files as on
f8cd964a: this box has an empty /tmp/.git, and GitOnDisk counts a .git
in any folder above.
- read against main's 7f0f71a0 (#2481) and fff05e55 (#2725), which
change code beside this: 7f0f71a0 puts the route on two of the relay's
record exits, which come after withoutUnreadable has chosen the body
asked again; fff05e55 changes only whether Codex's compaction trigger
is kept native (plannedCarrier), not serve's retry or the step it
skips for a provider compacting natively (compactsNatively), so a
trigger it now has magpie summarise goes through serve and the same
retry. Neither changes what withoutSeals or withoutUnreadable do.
- go test -tags nogui -count=1 -timeout 45m ./... (log kept), Bun
1.4.2: 69 packages ok and 7 red, none in what this changes; gateway's
only red is TestPluginToldWhereTheAgentWorks (#3675), the new tests
pass in it. The reds: agent TestInstalledVersion,
TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
TestQoderSettingsFromAnIDEPluginIsNotTheCLI and
TestOmpDetectedWithPiDir (#3141), the two Reasonix tests (#3641) and
TestWSLColdPlaceOpensNothing (#3924); edit
TestWriteAtomicReadOnlyHardLink and testenv TestProgram (umask 077,
#3640); gui TestGatewayHeldByAContainer and
TestGatewayFixQuitsOnlyAMagpie (#3649); provider
TestCodexAppServersOnHome (#3906), then "close of synctest channel
from outside bubble" (#3632); tui
TestTUIFetchesSubscriptionModels/agent (#3919).
- gofmt -l clean. go vet -tags nogui for linux, windows and darwin, go
build -tags nogui for linux and darwin, and go vet and go build for
windows without the tag: exit 0 each. go vet and go build without the
tag on linux: exit 1 (this box has no GTK or WebKitGTK dev packages).
Not tried: real ChatGPT or OpenAI accounts. Whether the ChatGPT backend
takes a web_search_call with neither its id (magpie's Codex account
route sends none, as on main) nor its seal; hheei's 200 was OpenAI's
Responses API with the id kept. Whether one account refuses another's
replayed message and call seals at all (the fake does; if it reads them,
they are still taken out on a hop, where the conversation's cache is
gone anyway). OpenAI refusing in the stream: the fake does, as xAI may;
hheei's refusal came as a 400. An OpenAI API key as the next member of a
group: forVendor keeps the seals for *openai.com only, so a fake on
127.0.0.1 can't stand in for it; it reaches the same retry in serve. Nor
magpie's summary of a Codex compaction after a move: codexCompact asks
through serve, so the same retry should apply, but no test drives it.
Ported onto origin/main 5ee5274bd from yinwu01/magpie 2d764b1c (posted
on #3887, sha256 d9185e84...). Conflicts resolved by hand: main had
since grown noteRefused (also used by reasoning_carry.go's
refuseCarried), so refused(key, who, sent, left) now hands it the seals
sent minus those left; foreignReasoning keeps main's broader pattern;
foreign_seal_test.go keeps main's TestForeignSealAzureSummary and
TestForeignSealGrokRelayCompactionBlob beside the four new tests; the
Affinity row and the new bullet in gateway-routing.md were merged into
main's text.
What was run for the port (mote, macOS, go1.26.8):
- go vet -tags nogui ./internal/gateway, and go test -tags nogui
-count=1 -run 'TestForeign|TestSeals|TestCodexOutputReplay|
TestCodexOwnModel|TestCodexSpent|TestRefused|TestReasoningCarr|
TestWithout|TestNativeCompaction' ./internal/gateway: ok
- the three new end-to-end tests on 5ee5274bd (old code, the unit test
left out as it calls withoutSeals): all red,
TestForeignSealedItemsMoveToAnotherAccount and ...AfterAColdSwitch
"moved on: 400 {...invalid_encrypted_content... Codex: Encrypted
content could not be decrypted or parsed.}" and "gone cold: 400",
...RelayedToAnotherSignIn "400 {...Encrypted content could not be
decrypted or parsed...}"
Batch run, at tree 104d75f0a (the twelve coffemon ports together, on
origin/main 7d022bdb6), mote, macOS, go1.26.8:
- go test -tags nogui -count=1 -timeout 45m on the packages the batch
changes (agent, autostart, daemon, gateway, library, proc, provider,
sessions, testenv, tui, gui): ok each.
- GUI, node --test with Playwright 1.62.0, Chromium and WebKit:
library-*.test.cjs and i18n-keys.test.cjs, 1044 of 1044 pass.
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./... and go build ./...: ok at cdd7c8e46, the same
batch on origin/main 00098f12b one rebase before.
- The whole go test ./... at cdd7c8e46: 86 packages ok, one red,
internal/cli TestEveryRouteHasACommandOrIsNamed (GET
/api/context/reply has no command), red on main too (#5026).
- Linux (wsl-run, Ubuntu 24.04, at 339055896, the batch on f4c664a09):
proc, autostart, testenv, tui ok; agent: only TestGrokInstalled red
(#3548); #4033's proc.Look reds (Zed, Copilot, Qoder, Cursor, Omp)
pass.
- Windows (win-run, Windows 11, at 339055896): proc, autostart, testenv,
tui ok; library and agent red in the same tests as on origin/main
f4c664a09 (#4115, #1827, #4786; #5068, #5069, #5070 filed now).
- Rebased onto origin/main fb1f4856a (three commits, no file in
common with the batch) and run again at the pushed tree: gofmt -l
nothing, go build ./... and go vet ./... ok; go test -tags nogui
sessions, agent, autostart, tui, proc, testenv ok; i18n-keys and
library-* 1044 of 1044 pass.
- Not run before the push: the whole GUI suite (a run at cdd7c8e46 was
cut off at 1170 of ~1174 tests when mote rebooted; it runs again after
the tag and any red is filed).
Adapt JoeyWu-tech f9d7eac9: do not retain lookup answers or directory listings while their timestamps are fresh. Freeze the clock in the same-tick regression so scheduler delays cannot age the fixture. Keep the settled/future directory cache and document the 100ms resolution limit.
Validation: the same-tick regression fails with both old layers, only the stamp fixed, and only the listing fixed. Restored proc lookup and four affected agent tests pass five race runs.
Batch run, at tree 104d75f0a (the twelve coffemon ports together, on
origin/main 7d022bdb6), mote, macOS, go1.26.8:
- go test -tags nogui -count=1 -timeout 45m on the packages the batch
changes (agent, autostart, daemon, gateway, library, proc, provider,
sessions, testenv, tui, gui): ok each.
- GUI, node --test with Playwright 1.62.0, Chromium and WebKit:
library-*.test.cjs and i18n-keys.test.cjs, 1044 of 1044 pass.
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./... and go build ./...: ok at cdd7c8e46, the same
batch on origin/main 00098f12b one rebase before.
- The whole go test ./... at cdd7c8e46: 86 packages ok, one red,
internal/cli TestEveryRouteHasACommandOrIsNamed (GET
/api/context/reply has no command), red on main too (#5026).
- Linux (wsl-run, Ubuntu 24.04, at 339055896, the batch on f4c664a09):
proc, autostart, testenv, tui ok; agent: only TestGrokInstalled red
(#3548); #4033's proc.Look reds (Zed, Copilot, Qoder, Cursor, Omp)
pass.
- Windows (win-run, Windows 11, at 339055896): proc, autostart, testenv,
tui ok; library and agent red in the same tests as on origin/main
f4c664a09 (#4115, #1827, #4786; #5068, #5069, #5070 filed now).
- Rebased onto origin/main fb1f4856a (three commits, no file in
common with the batch) and run again at the pushed tree: gofmt -l
nothing, go build ./... and go vet ./... ok; go test -tags nogui
sessions, agent, autostart, tui, proc, testenv ok; i18n-keys and
library-* 1044 of 1044 pass.
- Not run before the push: the whole GUI suite (a run at cdd7c8e46 was
cut off at 1170 of ~1174 tests when mote rebooted; it runs again after
the tag and any red is filed).
Co-authored-by: JoeyWu-tech <joey110551567@gmail.com>
Sky (skyhuang1994) on Discord, on their real ZCode database after
v0.1.2847 (1d0fc2bb0): September's message table holds 57,787 rows,
13.552B tokens; 5,204 rows (1.537B) carry a forkOrigin and are copies,
and ZCode's cloud usage says 12.057B. The new version took 5.094B out,
3.6B of it real. The biggest was the "msc" session: forked at the end of
August, then 11,409 calls of its own in September (3.489B), none with a
forkOrigin, a custom-UUID provider. The Usage page had 0 of them.
Cause (ZCode): readZCodeCalls marked copies in a map keyed by m.ID. A
row's id is in the message table's id column, not in its data (OpenCode
writes data without id; checked on this machine's real opencode.db: 2 of 2
rows have no $.id), so every message decodes with ID "". One copy in a
session set copies[""], and every assistant message of that session was
left out: a fork that went on working lost all of its own calls. The test
fixtures had "id" inside data, so they never saw it. The Sessions page
(parseOpenCode) asks zcDB.copied per message and was right.
Fix: copies are marked by row index. Only a message whose forkOrigin
names a messageId still in the database is skipped.
Codex: a fork's checkpoint was a copy whenever its {total, last} was one
the parent's rollout holds, anywhere in the fork. A fork goes on working,
and its first own call can carry exactly the numbers of the parent's
next call after the fork (same history, same next prompt). The copies
are now the head of the fork only: the fork's first turn_id the parent
never had (turn_context or task_started) ends them (ownTurn,
CopiedTurns, read with the parent's checkpoints). A rollout with no turn
ids is matched as before; its running total keeps later calls apart.
callParseVersions codex 2, zcode 2 and parseVersions codex 2, so the
parses kept by v0.1.2847 are read again once. ZCode's Sessions parse
didn't change and stays at 1.
Tests (fixtures follow Sky's case: a parent of 08-30, a fork with
forkOrigin copies of its replies, ZCode's fork notice, then 40 replies of
its own in September with no forkOrigin, no id in data, provider a UUID):
- TestZCodeForkThatWentOnWorkingKeepsItsOwnCalls: red on origin/main
7d022bdb6 ("the fork's calls: 0 {...}, want its 40 own"), as Sky saw.
- TestCodexForkThatWentOnWorkingKeepsItsOwnCalls: red on main and with
ownTurn turned off by hand (1 call on the fork, want its 2 own).
docs/subsystems/gateway-sessions.md says this.
Run on mote (mote-run) at this change on origin/main 7d022bdb6; rebased
on 08d7bfaaa (gui, redact, gateway-key only), go build ./... and
internal/sessions run again: ok.
- gofmt -l internal: empty
- GOOS=linux go vet -tags nogui ./... ; GOOS=windows go vet ./... : ok
- go test -count=1 -timeout 45m ./internal/sessions ./internal/usage
./internal/tune ./internal/otlp ./internal/davsync ./internal/tui : ok
- go test -run 'Session|Usage|Calls|Ledger|Stats|ZCode|Codex|Fork'
./internal/gui ./internal/cli : ok
Broken by hand:
- the copies keyed by message id again (origin/main): the ZCode test red,
0 calls on the fork.
- ownTurn's call in context() off: the Codex test red, 1 call on the fork.
Not tried:
- Sky's real ZCode database; there is none on this machine and no ZCode
source to read its writer. That ZCode's data has no id, as OpenCode's,
rests on the symptom (every row of the fork gone) and OpenCode's real
rows here.
- a real forked Codex rollout that went on working; the turn ids of a
real 0.117 fork were read from the fixtures' shape, not a real file.
- the whole gui and gateway suites, and a full go test ./...: other
sessions' suites were running on mote.
noahhrreion on Discord: the masked words are the names a user keeps from
vendors, and Settings showed them to anyone looking at the screen.
The redact plugin (plugins/redact/settings.js, outside the core budget)
draws the Masked words box with -webkit-text-security: disc and a
Show/Hide button after it, as a provider's key is; Show holds through a
redraw, for the page's life. The box stays a text box, so an IME still
writes into it; where the engine has no text security it falls back to a
password box. Nothing saved changes.
Test: redact-words-hidden.test.cjs, chromium and webkit,
en/zh/zh-TW/ja/de, 1100 and 400px: dots first, Show and Hide with
aria-pressed, Show kept through another row's save, a word typed while
hidden saves and stays hidden.
Run (mote): redact-words-hidden 20/20 (chromium, webkit, every language, 1100 and 400px) after
f37742e14 and 44/44 with the other new file and i18n-keys at the pushed head; every redact-*, masking-*, privacy-* file and i18n-keys pass
there; TestCoreScriptBudget, i18n-keys and this test again at the pushed head (plugin files are outside the core).
Broken by hand: the wrapper's redactWordsHidden() call taken out, 10/10 red.
Not run: the whole GUI suite (lost twice, mote rebooted mid-run); it runs after the push.
Not tried: the real app, Firefox's password-box fallback, an IME typing into the dotted box.
isaac_bai on Discord: a gateway key's value is random, and only rotate
changes it, to another random one; they want to set one easy to pass on.
Adding a key could take an own value since 6b6113aa; an existing key
couldn't.
- access: rotate-key takes Change.Secret. Given, it is checked as an
added key's own value (ownSecret: 8-256 printable ASCII, no space, not
sk-magpie-, no other key's value; its own current value is allowed);
empty, magpie makes one as before. The key keeps its id, name, limits,
models and accounts, and Named counts a request from this computer
with it as that key.
- ownSecret now refuses a value that is one of the user's provider keys
(a provider's Key or any of its Keys, constant-time), for add-key too:
a client sending it would spend that provider directly.
- CLI: `magpie gateway-key rotate <id> --key <value|->`; docs/reference.md.
- GUI (plugins/gateway/keys.js, outside the core budget): the Rotate key
dialog has a hidden "Your own key (optional)" field; Enter rotates,
Escape cancels; an own value says "Gateway key changed. Clients that
send this key reach magpie now." Strings in zh, zh-TW, ja, de.
Tests: TestRotateToOwnValue (bad values refused, old value still works
after a refusal, trimmed own value authenticates as the same key, is
Named, listed masked; empty makes a new key; add-key refuses a provider
key). TestRotatedOwnValueKeepsTheKeysLimit: after rotating to an own
value the old one is 401 from another computer, the own one 200 from
another computer and from 127.0.0.1, and a 700-token day limit stops
the third request from either (429), every record under the key.
gateway-key-own-rotate.test.cjs: chromium and webkit, en/zh/zh-TW/ja/de,
1000 and 400px.
Run (mote): at the pushed head: TestCoreScriptBudget ok, ./internal/access ok, the
own-key/caller-key gateway tests ok. At f37742e14 with this change (no file the rebase touched):
gofmt -l clean; go vet GOOS=linux and windows (./internal/access ./internal/gateway, cli with
-tags nogui on linux) ok; ./internal/cli red on TestEveryRouteHasACommandOrIsNamed only,
/api/context/reply (#5026, 0872bc2a0, the same at main); GUI: gateway-key-own-rotate 20/20,
every gateway-key-*, redact-*, masking-*, privacy-* file and i18n-keys pass.
Broken by hand: the rotate own-value path off made TestRotateToOwnValue and
TestRotatedOwnValueKeepsTheKeysLimit red (401 from another computer); the provider-key check off
made TestRotateToOwnValue red ("accepted upstream-first-key").
Not run: the whole GUI suite (two runs lost: one to another run of this tree, one to mote
rebooting mid-run); it runs after the push. Not tried: a real client on another computer with
the own value, the real app.
cursor 0.2.40 (plugins#672, ooboqoo) gives a new user turn whose earlier
native calls all have their results a retained Run of its own, with those
calls as imported history. Before, every tool step after the first user
turn rebuilt the whole history on a fresh stateless Run. Raising the min
makes keepMovedCurrent bring every moved Cursor user to it.
npm view --prefer-online @magpie-community/opencode-cursor-auth version
gave 0.2.40 before this commit.
Run on mote at this change on 6c201095d (rebased onto 22f5cf69e, which touches only internal/agent and internal/library, neither imported by internal/provider): go build ./..., GOOS=linux and GOOS=windows
go vet ./internal/provider, go test -timeout 45m ./internal/provider:
ok (169.8s); vet ok on both. gofmt -l internal/provider is empty.
Plugin side (at the merged head 5b4dcf1): packages/cursor bun test 394
pass; with main's native-session.mjs the PR's two new tests fail.
Not tried: a real Cursor account through magpie on 0.2.40.
Cause: an agent in a WSL distro could only get copies (Target.Copy).
A distro can't follow a link to the library's folder on Windows. A
link Windows makes through \\wsl.localhost (os.Symlink) is an empty
folder inside the distro. Windows can't use a link the distro has: it
can Lstat one (irregular), but Readlink fails ("Incorrect function"),
and Stat, ReadDir and Remove all say it isn't there. Probed on
xiaomi-gpu with magpie-desktop. So every agent there got a copy of
its own of every skill.
Now each distro keeps one copy of each skill its agents are given,
magpie's and marked, in ~/.local/share/magpie/skills (Target.Store,
storeSkill). Each agent there gets a link to it, which wsl.exe makes,
reads and removes inside the distro (agent.WSLSymlink, WSLReadlink,
WSLRemoveLink). The scripts refuse to put a link over a folder or file.
- An edit made through the link is in that copy, and takeEdits reads
it like any copy of magpie's.
- When no agent there links to a copy or is given its skill any more,
sweepWSLStores removes it. An edited copy goes to the backups.
- A folder in the store that isn't magpie's is never touched. Each
agent it blocks reports a problem and keeps what it had.
- An agent set to copies (SkillHow) still gets copies of its own.
- So does one whose skills folder or the store is on a Windows drive
(#4502): a link the distro makes there can't be read from Windows.
- The copy isn't put in the distro's ~/.agents/skills. Every agent
there that reads that folder would get each skill, ticked or not.
- A stopped distro's agents are now shown as linked (HowLink), not as
forced to copies.
Agents that read ~/.agents/skills on their own (readsShared, checked
against each one's source or docs when the list was made): Codex,
Gemini CLI, OpenCode, DevEco Code, Crush, dsh, Command Code, Devin,
Droid, Cline, Grok Build, Grok App, fx, Alma, Kimi Code and OmO, plus
Pi from 0.54.0 and omp from 11.0.0. Claude Code doesn't. Ticks are per
agent, so the store keeps per-agent choices working in WSL.
Existing users: nothing to do. On the next sync, each per-agent copy
magpie made in a distro is replaced by a link:
- its edit is taken into the library first (newest edit wins);
- a copy whose edit lost is set aside with the backups (wslRelink);
- unmarked folders (the user's own skills) are left alone.
Run:
- mote, at 3f1f1882a plus this change:
- go test ./internal/library ./internal/agent -timeout 45m -count=1:
both ok (493 and 1210 Test funcs; library 184s, agent 312s).
- gofmt -l .: empty.
- GOOS=windows, linux and darwin go vet of both packages: ok.
- xiaomi-gpu, Windows 11, WSL 2, distro magpie-desktop only:
- TestWSLLinksLive passes. A link made through wsl.exe is followed by
the distro, read back from Windows, refused over a folder and
removed alone.
- TestWSLSkillsLinkedLive passes. Working in a /tmp home inside the
distro, it checks:
- links for Codex and Claude Code that the distro follows;
- a second sync changes nothing;
- an edit made in WSL through the link reaches the library and
Windows' Claude Code;
- copies, then links again;
- an untick removes the links and the store copy.
- go test ./internal/library ./internal/agent -run 'WSL|Wsl|Skill'
with MAGPIE_WSL_TEST_DISTRO set: library ok. In agent, only the
older TestWSLCodexLive is red. It calls wslList() without -l -q, so
it lists no distros. Filed as #5077; this change doesn't touch it.
New tests:
- TestWSLLinks (fake);
- TestWSLOldCopiesBecomeLinks, which edits a copy and then syncs;
- TestWSLEditThroughLinkReachesTheLibrary;
- TestWSLStoreSweepKeepsEdits;
- the two live tests above.
TestWSLSkillsCopied is now TestWSLSkillsLinked.
Broken by hand (logs in wsl-skills-scratch):
- WSL targets given copies again: 7 red, including TestWSLTargets,
TestWSLSkillsLinked and TestWSLOldCopiesBecomeLinks.
- takeEdits not following the link to the store: 1 red,
TestWSLEditThroughLinkReachesTheLibrary.
- ours not counting a link to the store: 3 red.
- wslLinkScript's folder refusal dropped: TestWSLLinksLive red on the
real distro.
Not tried:
- the magpie GUI on Windows against a real distro, and agents running
in a real WSL reading a skill through the link (the distro reads the
link's files, checked with cat);
- WSL 1;
- a distro whose home is on a Windows drive (covered by the fake
#4502 tests only);
- the GUI suite, since no GUI file changed.
jiezhengj (Discord #feedback) runs magpie in Docker on a NAS at
192.168.31.218. The web UI's host address, http://192.168.31.218:3425,
works for other devices. Other containers on the NAS couldn't use it, and
not the container's own 172.17.0.x either. What works for them is the
host's Docker bridge address, http://172.17.0.1:3425. On Linux,
host.docker.internal is there only in a container given extra_hosts.
magpie showed no such address.
- gateway.ContainerHostURL: in a container on a bridge network, the
gateway of /proc/net/route's default route (172.17.0.1 on the default
bridge, a compose network's own otherwise), on the gateway's port.
It is "" outside a container and on the host's network
(`network_mode: host`, told by the host's
docker0/br-*/veth*/podman* interfaces). In that case ContainerAddrs is
false too, since the addresses are the host's own.
- The GUI gets it as /api/providers' gateway.containerHost,
/api/settings' lanContainerHost and boot's sideGateway.containerHost.
- settings.js lanShown is fed by the new gwLAN(g) for Gateway, Connect,
the sidebar and the key page. Each case lists:
- Opened at the host: the host's address first, then the bridge
address, labelled "Other containers on this host".
- At localhost: the bridge address alone, with that label, and a line
that the host's own is MAGPIE_PUBLIC_URL's.
- No default route: as before.
The container's own 172.17.0.x is no longer offered beside them. The
sidebar line and the key page prefer an address other machines reach.
The scheme comes from the URL, not a hard-coded http. Three new strings
are in zh, zh-TW, ja and de.
- CLI: `magpie web` and the share banner print "other containers on this
host <url>".
- docs/reference.md and site docs/docker (en, zh, ja): the log example and a new "Other
containers on the same host" paragraph.
Run on mote, at this change on d8501848a:
- gofmt -l: clean. node --check: passes.
- Vet: darwin go vet, GOOS=linux go vet -tags nogui and GOOS=windows go
vet of internal/gateway, internal/gui and internal/cli: ok.
- go test -timeout 45m: internal/gateway ok. internal/gui is red only on
TestMainWindowCorners/macOS_26_SDK, which is red on macOS 27 at main
(#3949). internal/cli is red only on TestEveryRouteHasACommandOrIsNamed
for GET /api/context/reply, red at main (#5026).
- GUI, chromium and webkit: lan-docker (en, zh, zh-TW, ja, de) and the
40 files on the caller-keys fixture or the LAN paths. 586 tests, 580
pass. Each red is also red alone at the base d8501848a or af9ac3d25:
- phone-connect-menu 420, 4 reds (#4706, #4707).
- gateway-key-models webkit en (#4616, #4081; 4 of 4 at the base).
- gateway-caller-keys chromium en (#3797; 2 of 3 at the base, 1 of 3
here).
After the rebase onto 3f1f1882a (187f3e272, the usage page alone, came after): the commits
between touch none of these files. Linux and Windows vet ok. go test -run
'Container|HostNetwork|DefaultGateway|PublicURL|LAN|Boot|Provider' ok in
gateway, gui and cli. GUI lan-docker, i18n-keys, side-gateway-lan and
key-page: 56 of 56, in both engines.
Broken by hand, in a copy:
- defaultGateway reading big-endian: TestDefaultGateway goes red
("1.0.17.172").
- The old settings.js, client.js and keys.js: every lan-docker test goes
red, in both engines and every language.
TestDefaultGateway stubs the in-container check, so it tests the
container path on mote and CI too.
Not tried:
- a real Docker container, on a NAS or anywhere;
- reaching 172.17.0.1 from a container on another compose network on the
reporter's NAS;
- a published port that differs from the gateway's (MAGPIE_PUBLIC_URL
sets the host's; the bridge address uses the gateway's own port);
- Podman's rootless networking (slirp4netns, pasta), where the default
route may not be the host.
Pluviophile on Discord (a phone, magpie's web page and the installed
PWA): swiping the Usage › Requests table left or right trembles and
sticks (左右滑动震颤, 粘滞卡顿).
The cause: the table (#ledWrap) and the scrollbar kept at the window's
foot (#ledHScroll, #799) followed each other both ways, each scroll
handler copying its scrollLeft to the other when they differed. The
scroll a copy sets off is told a frame later in WebKit, and on a phone
the finger (the UI side's own scrolling) has moved the table on by
then, so the bar's echo saw bar != table and wrote the table back to
where it was a frame ago, every other frame of a swipe.
Now each copy records the value it set (ledFollow), and that box's next
scroll at that value is its echo and is passed on to nobody
(ledFollowed). A scroll of the reader's on either box still moves the
other, in both directions; ledHScroll's own copy at a redraw goes
through ledFollow too.
Measured with Playwright at an iPhone 13 profile (390x664, touch, dpr
3), the table moved 2.5px every 7ms off the frame, as a phone's own
scrolling moves it, 60 frames:
- WebKit before: 44 writes of the table by the page, the table stood
still in 29 of 59 frames (5,5,15,15,22,22,...).
- WebKit after: 0 writes, 0 frames standing still.
- Chromium before and after: 0 writes, 0 still; a real touch gesture
(CDP Input.synthesizeScrollGesture, touch) also showed none. The
report is WebKit's (iOS), which Chromium doesn't reproduce.
New test, internal/gui/tests/ledger-swipe.test.cjs: the table swiped
off the frame is never written back nor stands still, and the bar
follows; the bar dragged off the frame is never written back, and the
table follows. en and zh, Chromium and WebKit, iPhone 13 profile.
Broken by hand: page.js at its base (d8501848a) turns the new test red
in WebKit, en and zh (the table written back, values in pairs); green
in Chromium, which never had it.
Run at the pushed head, on mote, through mote-run:
- at f5c709ddc (this commit rebased on origin/main 3f1f1882a): node
--check page.js; ledger-swipe, ledger-hscroll, ledger-hscroll-foot,
usage-ledger-fit, usage-ledger-detail, phone-web, usage-phone-head:
55 of 55 pass, Chromium and WebKit.
- before the rebase (base d8501848a): the 33 ledger-*, usage-ledger-*,
phone-*, mobile-web, usage-phone-head, plugin-page* and i18n-keys
files, 527 of 547 pass. The 20 reds (mobile-web "magpie web on
phones", phone-connect-menu 420 "the address clicked from the
page's top", usage-ledger "newest live route needs no
return-to-live button") fail the same 20 with page.js at d8501848a
and are filed: #3952, #5013, #4706, #4707, #3104, #4078, #5048.
Not tried: a real phone (iOS Safari, an iOS PWA, Android Chrome); the
model is WebKit on macOS with the table moved between frames. Desktop
is covered by ledger-hscroll (600px, bar moves the table and the table
the bar, both engines), which passes unchanged.
roswellcsy on X (v0.1.2846). Claude Code was switched off magpie and on
its own sign-in, with several Claude accounts and one made first. Every
session said "There's an issue with the selected model
(claude/claude-opus-5-5)", while settings.json's model was the bare
claude-opus-5-5.
Cause: a name of magpie's left in Claude Code's env.
- The env's ANTHROPIC_MODEL outranks settings.json's model (Claude Code
2.1.316: Wg(), `i.ANTHROPIC_MODEL||settings.model`). The tier variables
stand in for opus/sonnet/haiku. On Anthropic's endpoint a
provider/model name is a 404, shown as that message.
- How it got there and kept coming back:
- Connecting a Claude Code that is not routed stashes its env models as
"the user's own" (claude.env.<VAR>), magpie's names included.
- Disconnect (unroute) then writes them back, again unchecked.
- Once one is there, every connect and switch-off keeps it.
- The bare model is the user's own, from connect.was or untouched.
- Nothing took the name out afterwards:
- unroute returned at once when not routed;
- Sync only did desktopOnly;
- Disconnect is a no-op once Wired() is false (a bare model with no
gateway URL).
- Sibling: wiring at an older gateway address (magpie's key) was left in
place by Disconnect, while set("") already took it out.
Fix (internal/agent/claude.go):
- claudeMagpieModel(v): v is a catalog ref, read through ClaudeRead and
with any :effort or [1m] taken off.
- It is never stashed as the user's own, and never given back from a
stash (one an older magpie wrote included).
- dropStray: with no ANTHROPIC_BASE_URL (Anthropic's own endpoint), every
claudeModelEnv key and `model` holding one of magpie's names is taken
out. ANTHROPIC_MODEL, SMALL_FAST, SUBAGENT, the four tiers and the
auto mode model are covered.
- It runs from Sync when not routed, so SyncCatalog repairs users
already in this state at the next start.
- It also runs from unroute when not routed (Disconnect, the default
model, a non-magpie model).
- An endpoint of the user's own may name its models so, and those
stay.
- unroute, when not routed: wiring at an older gateway address
(keyOurs) goes whole, as set("") takes it.
- docs/subsystems/agent-wiring.md says so.
Test: TestClaudeOffLeavesNoMagpieModel, in a sandbox HOME. Each subtest
reads settings.json as Claude Code starts on it (ANTHROPIC_MODEL over
model, the tiers, small fast, subagent, auto mode).
- start: the stray env, then SyncCatalog;
- connect + Disconnect twice;
- a stash an older magpie wrote;
- the user's own models come back;
- an older gateway address;
- another endpoint's names are left alone.
Red on the old code: start, connect+Disconnect and older-address fail
(red-old.log). "connected and switched off again" reproduces the report
exactly: model "claude-opus-5-5" with env ANTHROPIC_MODEL
"relay/claude-opus-5-5".
Broken by hand, each through mote-run:
- dropStray out of Sync: start red.
- Both stash guards out: connect+Disconnect red.
- The restore guard alone out: older-stash red.
- keyOurs cleanup off: older-address red.
- With the stash guard alone out, the restore guard still holds, so it
stays green.
Run on mote (mote-run, at d8501848a plus this change; the doc edit came
after the run):
- go test ./internal/agent/ ./internal/provider/ -count=1 -timeout 45m:
ok agent (200s), ok provider (136s).
- The new test: 7 of 7 PASS (the parent and 6 subtests).
- GOOS=windows go vet ./...: ok.
- GOOS=linux go vet -tags nogui ./...: ok. Without the tag it stops in
Wails' cgo-only Linux files when cross-compiling, which this change
doesn't touch. GOOS=linux go vet ./internal/agent/ ./internal/provider/
is ok too.
- gofmt -l: clean.
Not tried:
- A real Claude Code run against Anthropic. The 404 path was read from
the 2.1.316 bundle, not hit.
- The user's literal provider id claude/: the test uses a relay
provider. isMagpie resolves both the same way.
- WSL's Claude Code goes through the same claudeIn and wasn't run.
- A Claude Desktop Code tab with a provider/model in settings.json's
model and no base URL would also lose it at Sync. Desktop writes
mythos-magpie-<n> ids there, not provider/model ones.
Sky (skyhuang1994) on Discord: on ZCode, 10-31 showed ~0.70B GLM-5.3
tokens where ZCode's own model_usage had ~0.28B. A selection side chat
opened on 11-02 from a 10-31 session holds a copy of its 860 assistant
messages, with the 10-31 times and the same 421,041,276 tokens, and made
no calls. On Codex, a week of 2026-03 read 5,136,041,178 gpt-5.4 tokens,
where the machine had spent ~0.27B.
ZCode: ZCode 3.17's CLI copies a session's messages (gce, for a side
chat, a fork and a checkpoint restored) with a new id and session, the
original's time, model and tokens, and metadata.forkOrigin
{sessionId, messageId}. zcDB.copied says a message is a copy of one still
in the database, and readZCodeCalls and parseOpenCode (for ZCode) leave
it out. A copy of a copy names the copy it came from, so of each chain
one is counted. A copy whose original is gone is counted. ZCode's own
fork notices carry a forkOrigin with no messageId, and are not copies.
Codex: a fork (/fork, spawn_agent with the parent's context) writes every
line of the parent's rollout into its own first, token_count events too,
stamped at the fork's time (codex-rs 0.117 record_initial_history,
InitialHistory::Forked). Each copied checkpoint was booked as a call on
the fork's day. The fork's session_meta has forked_from_id. The parent's
rollout is found in the same Codex home: the UUIDv7 day of its id ±1
day, then every day, then archived_sessions. Its checkpoints, {total,
last}, are read once (8 parents kept), and a fork's checkpoint found among
them only advances the running total, on Usage (calls) and Sessions
(stats) both. A parent not found leaves the fork read as before.
callParseVersions and parseVersions raise codex and zcode to 1, so their
kept parses are read again once. The version tests (call_versions,
parse_versions, cache_decode) now hold the versions at none raised: they
test the mechanism, not the current numbers.
docs/subsystems/gateway-sessions.md says all of this. Filed #5072:
OpenCode's fork copies the same way and names no original, so it is
still counted twice.
Run at this head on mote (mote-run):
- gofmt -l internal: empty
- GOOS=linux go vet -tags nogui ./... ; GOOS=windows go vet ./... : ok
- go test -count=1 -timeout 45m ./internal/sessions ./internal/usage
./internal/tune ./internal/otlp ./internal/davsync ./internal/tui : ok
- go test -run 'Session|Usage|Calls|Ledger|Stats|ZCode|Codex'
./internal/gui ./internal/cli : ok
Broken by hand:
- zcDB.copied returning false: TestZCodeCopiesCountedOnce red. msg_c1 and
msg_d1 were counted as calls, and the Sessions page's 10-31 read
{1200 300 1800} for {400 100 600}.
- the copied() check in count() off: TestCodexForkCountsOnlyItsOwnCalls
red. 4 calls on the fork, {87984 5950 268416} for {45744 3550 179584}.
Not tried:
- a real ZCode database or side chat. There is none on this machine.
The copy shape was read from ZCode 3.17.2's zcode.cjs (gce).
- a real forked Codex rollout or one from 2026-03. ~/.codex/sessions here
spans 2026-07 to 11 and has no forks. The fixtures follow codex-rs
0.117's writer. Whether Sky's 5.1B week is all fork copies is not
known; a cumulative count read as per-turn in an older format was not
found in that source.
- newer rollouts' token_usage_record copies in a fork, and a parent in
another Codex home (WSL, CODEX_HOME).
- the whole gui and gateway suites. Another session's suite was running
on mote; gui and cli ran only the tests above.
axelburks on Discord listed what /v1/images/generations did to a Seedream
request against Ark's images API (docs 82379/1541523). Checked against
those docs and draw.go / draw_volcengine.go; the real ones:
- Image params were dropped. drawing read OpenAI's fields alone, so
sequential_image_generation and its options (a group of up to 15),
optimize_prompt_options, tools, layer_decomposition and every other
Ark field never reached Ark. Now the request's fields magpie doesn't
read (drawingRead) are drawing.Extra, from a JSON body or a multipart
form, masked as the prompt is (fails closed), and sent to Ark as they
came; a form's values are typed as Ark takes them (formValue, with
Ark's text fields kept as text). layer_decomposition with an image
needs no prompt.
- watermark and response_format were forced. Every request went with
watermark false and response_format b64_json. Now watermark false is
magpie's default only, and a caller's watermark wins; response_format
"url" asks Ark for its URL and answers it, anything else still asks
b64_json.
- stream true would have gone to Ark and come back as events this route
can't read: it is a 400 that names
/v1/magpie/native/<provider>/images/generations.
Kept as it was: n stays OpenAI's, that many requests, each one image or
one group.
Tests: TestArkImagesPassOnTheirOwnFields (a group, optimize_prompt_options,
a caller's watermark, tools and url reach Ark as sent; a form's fields
typed; stream refused naming the native route). Docs: gateway-routing.md
(the Ark images row and paragraph), docs/integrating.md and the site's
integrate page (en, zh) on the vendor fields and the native route.
Run on mote at the head of this stack (the Ark video fields, the native
route and the Ark image fields, three commits on af9ac3d25):
- go test -count=1 -timeout 45m ./internal/gateway ./internal/gui
./internal/access: gateway and access ok; gui red only in
TestMainWindowCorners/macOS_26_SDK (#3949, red on main).
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
./...: clean. gofmt -l: nothing.
- No GUI file or script changes in this stack, so no GUI run.
The commits between were not run on their own at this base.
Broken by hand, each red, then put back:
- Extra not merged into Ark's request: TestArkImagesPassOnTheirOwnFields red
- response_format url not asked of Ark: TestArkImagesPassOnTheirOwnFields red
Not tried: no real Ark image was drawn (no money spent); the shapes are
from Ark's docs, on a fake Ark.
Credit: axelburks on Discord.
axelburks on Discord asked for a way to reach what the OpenAI-shaped
routes can't carry: Ark's image stream, its task list and cancel, a
field newer than magpie. A coordinator asked for it to stay behind the
gateway's key and auth like every route, and for the design to be said.
Decided:
- One route, /v1/magpie/native/{provider}/{path...} (POST, GET, DELETE),
for Volcengine Ark only (isArk, not a remote magpie), at the paths it
makes images and videos at: POST images/generations; POST/GET
contents/generations/tasks (with Ark's query); GET/DELETE
contents/generations/tasks/<id> (nativeArkPath). Never Ark's chat,
whose routing, usage and masking are the chat routes'. Another
provider or path is a 404 that says what is served.
- Behind every guard a /v1 route has (a key beyond loopback, corsGuard,
the key's rate), and refused to a read-only key (readOnlyRefused).
- Refused (403) to a key held to models, accounts or a spend limit, or
issued by one (nativeHeld): a poll or a cancel can't be tied to a
model, and magpie prices no answer it doesn't read, so it couldn't
hold such a key to them. Such keys use /v1/images/generations and
/v1/videos, which now pass the vendor's own fields on.
- A model the user switched off is refused. The body's strings are
masked (fails closed) and put back in the answer (restoring); numbers
go exact (UseNumber, a 17-digit seed is kept).
- Signed with the provider's key and magpie's User-Agent; no caller
header goes on but Accept. The answer comes back as it came, an event
stream flushed as it arrives.
- Each request is a Requests row and a usage record (Operation
"native", no tokens).
Tests: TestNativeArkRoute (the stream, the task list's query and a
cancel reach Ark signed with the provider's key, the body as sent; chat,
a wrong method, a deeper path, another provider, an unknown one and
every held key are refused without Ark being asked),
TestNativeArkStreamsAsItComes (the first event reaches the caller while
Ark holds the rest), TestReadOnlyKeyEveryRoute (the three patterns in
readOnlyRefused). Docs: gateway-routing.md's native route section.
Run on mote at the head of this stack (the Ark video fields, the native
route and the Ark image fields, three commits on af9ac3d25):
- go test -count=1 -timeout 45m ./internal/gateway ./internal/gui
./internal/access: gateway and access ok; gui red only in
TestMainWindowCorners/macOS_26_SDK (#3949, red on main).
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
./...: clean. gofmt -l: nothing.
- No GUI file or script changes in this stack, so no GUI run.
The commits between were not run on their own at this base.
Broken by hand, each red, then put back:
- nativeHeld skipped: TestNativeArkRoute red
- an issuer's hold not read: TestNativeArkRoute red
- nativeArkPath skipped: TestNativeArkRoute red
- isArk not checked: TestNativeArkRoute red
- no flush: TestNativeArkStreamsAsItComes red (its 30s bound)
- the DELETE pattern out of readOnlyRefused: TestReadOnlyKeyEveryRoute red
Not tried: no real Ark request through the route (it would spend money);
Ark's answers are a fake shaped from its docs.
Credit: axelburks on Discord.
axelburks on Discord listed what /v1/videos did to a Seedance request
against Ark's own API (docs 82379/1520757 create, 1521309 query). Each
item checked against those docs and video.go; the real ones:
- A caller's content was overwritten. volcengineVideoBody built content
from the prompt and OpenAI's image fields and set it over the caller's,
so reference_video, reference_audio and draft_task items were lost.
Now a content sent is Ark's own and kept whole; the prompt goes first
only when it has no text item, OpenAI's image fields after it.
- Image-to-video needed a prompt; asset:// and seconds -1 were refused.
Ark's image-to-video takes no prompt, its asset library's asset://
ids are images, and duration -1 lets the model choose. Now the prompt
is optional with an image or a content, asset:// is kept as it is, and
-1 goes as -1. These three are Ark's alone: arkOnly turns them away
with a 400 before another vendor (MiniMax, Grok, an OpenAI-compatible
one) is asked.
- size overrode an explicit ratio/resolution, and its mapping was wrong.
size went through to ratio and resolution after the caller's own were
copied, so ratio "adaptive" was lost; its resolutions stopped at 1080p
and its ratios were Grok's, without 21:9 (3840x2160 went as 1080p). Now a ratio, resolution
or duration the caller sends is never overridden; size is the nearest
of Ark's tiers by pixels (480p, 720p, 1080p, 4k) and of Ark's
ratios (arkVideoSize).
- Every string field, a JSON body's too, was read as JSON when it parsed
as a bool or a number, and nothing else was: a form's tools stayed the
string "[{...}]", and safety_identifier "12345" became 12345. Now only a
multipart form's values are parsed (formValue), and Ark's text fields
(arkTextFields: safety_identifier, callback_url, service_tier, ratio, …) stay strings. A
JSON body's values keep their JSON types.
- The query answer dropped Ark's extras. Now every field of Ark's task
that OpenAI's video object doesn't have (content.last_frame_url, usage,
resolution, ratio, framespersecond, seed, tools, output_format, …) is
passed on as it came (videoState.Ark, all but arkOwnFields).
- A MOV was served as mp4. /content now reads the ftyp brand ("qt " is
video/quicktime), then the vendor's video/* type, then Ark's
output_format; mp4 only when none says otherwise (videoType).
- The expired message was wrong: Ark's expired is a task that ran past
its execution_expires_after (48h by default) unfinished, not a link
that expired. It now says so.
Not real: watermark is not forced on videos (it went as sent already).
Tests (internal/gateway/ark_video_fields_test.go):
TestArkVideoKeepsCallersContent, TestArkVideoFromImageNeedsNoPrompt,
TestOnlyArkTakesItsOwnVideoAsks, TestArkVideoSize,
TestArkVideoFieldTypes, TestArkVideoAnswersItsOwnFields, TestVideoType.
Docs: gateway-routing.md's Ark video paragraph and /content row.
Run on mote at the head of this stack (the Ark video fields, the native
route and the Ark image fields, three commits on af9ac3d25):
- go test -count=1 -timeout 45m ./internal/gateway ./internal/gui
./internal/access: gateway and access ok; gui red only in
TestMainWindowCorners/macOS_26_SDK (#3949, red on main).
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
./...: clean. gofmt -l: nothing.
- No GUI file or script changes in this stack, so no GUI run.
The commits between were not run on their own at this base.
Broken by hand, each red, then put back:
- the caller's content not read: TestArkVideoKeepsCallersContent red
- the prompt required with an image: TestArkVideoFromImageNeedsNoPrompt red
- arkOnly skipped: TestOnlyArkTakesItsOwnVideoAsks red
- size overriding a named ratio: TestArkVideoSize red
- Grok's ratios in place of Ark's: TestArkVideoSize red
- Ark's text fields parsed as JSON: TestArkVideoFieldTypes red
- a JSON body's values parsed as a form's: TestArkVideoFieldTypes red
- Ark's extra fields not copied: TestArkVideoAnswersItsOwnFields red
- the old expired wording: TestArkVideoAnswersItsOwnFields red
- a MOV served as mp4: TestVideoType red
Not tried: no real Ark video was made (no money spent); the request and
answer shapes are from Ark's docs, on a fake Ark.
Credit: axelburks on Discord.
axelburks on Discord asked that /v1/models return the image and video
models too, so a client can find them. It listed chat models alone, with
no way to ask for the others.
Decided: they are listed only when asked for, with ?kind=image,video
(or ?kind=chat,image,video, or ?kind=all), each row marked "kind":
"image" or "kind": "video". Without ?kind= the list is the same chat
list as before. Why not add them by default:
- Agents and clients offer every id this list gives as a model to chat
with: OpenCode's and Cherry Studio's model lists, ZCode's and others'
pasted ?format=text. An image or video id there would sit in their chat
pickers and fail on the first message (an image model on
/v1/chat/completions).
- OpenAI's own list mixes gpt-image and sora in with nothing to tell them
apart, so a client has no field it would already read to skip them.
- magpie's own callers that want them already ask (another magpie's
drawers header, kind=image/video/decision on the MCP list); ?kind=
gives any other client the same.
An unknown kind is a 400 that names the kinds, not read as none. A
gateway key held to models or accounts sees only its own image and video
models, as on the chat list (drawerObjects/videomakerObjects already
check modelAllowed and accountServes). Unticked image and video models
(HiddenDrawers, HiddenVideomakers) are left out.
TestModelsListMediaOnlyWhenAsked: the default list and ?kind=chat have no
image or video row (so no agent's chat picker that reads it can offer
one), ?format=text likewise; ?kind=image / video / image,video / all give
them, marked; a bad kind is 400.
Docs: docs/integrating.md, providers-accounts.md, site docs (en, zh).
Run on mote, this change rebased on f4c664a09:
- go test -count=1 -timeout 45m ./internal/catalog ./internal/provider
./internal/gateway ./internal/gui: catalog, provider and gateway ok;
gui red only in TestMainWindowCorners/macOS_26_SDK (#3949, red on main).
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
./...: clean. gofmt -l: nothing.
- GUI: the 51 provider-*, drawers, image-models, i18n and
video-models-hide files, both engines, every language, wide and narrow:
1161 of 1188 ok. The 27 reds are 5 files that are red the same 27 at
origin/main d1cdce130 run alone: provider-fetch-again (#3292/#5057),
provider-models-rest (#4396), provider-picks-stay (#4397),
provider-levels-scroll (#4395), provider-typed (#4673).
video-models-hide: 22 of 22 ok.
- The whole GUI suite (all files) ran earlier at this change on 8af751987,
347 of 19153 red at load 100 to 200; the 66 files with a red, run again
alone, are red in the same tests at origin/main 17f2387e1 (all filed:
#4388, #4391, #4398, #4320, #4541/#5013, #2564, #4244, #4304 and the
above).
Rebased again onto d1cdce130 (sessions, Cursor mover, library and routing
plugins, group-unlists; nothing this change touches but gateway.go,
which merged clean) and run there: TestCoreScriptBudget and internal/gui's
new tests, the gateway's ?kind= and video tests, internal/provider and
internal/catalog, video-models-hide 22 of 22: ok.
Broken by hand, each red, then put back:
- listKinds' default returning all three kinds:
TestModelsListMediaOnlyWhenAsked red
- an unknown kind let through: TestModelsListMediaOnlyWhenAsked red
Not tried: no real client was pointed at ?kind=; the agents' pickers were
checked by what they read (the default list, unchanged), not by opening
each one.
Credit: axelburks on Discord.
axelburks on Discord: "供应商里方舟的配置页,有图像模型选项能勾选模型,但是没
有视频模型选项不能勾选视频模型". A Volcengine Ark key's editor listed its
Seedream models under Image models, to tick, and had its Seedance models
among the chat models or nowhere.
Cause, two parts:
- The editor had no video section at all: video models had no list and no
hidden set (gateway-routing.md said "Video models aren't listed in the
editor, so there is nothing to hide there").
- catalog's live parse read only "kind" and modalities.input/output. Ark's
/api/v3/models marks no kind: it says domain "VideoGeneration" /
"ImageGeneration" and modalities.input_modalities/output_modalities. So
Seedance came back as a chat model, and 3D models (output 3d, no text)
as chat models too.
Change:
- catalog: a live row with no kind is a video model when its domain is
VideoGeneration or it outputs video without text, an image model for
ImageGeneration or image without text; Ark's input_modalities /
output_modalities are read when input/output aren't there, so a model
that gives no text (Ark's 3D) is left out of the chat list.
TestFetchArkMarksVideoModels runs on a captured Ark list
(testdata/volcengine-ark-models-2026-11-03.json, fetched read-only
with GET /api/v3/models, no key in it).
- provider: HiddenVideomakers beside HiddenDrawers, VideomakerHidden.
- gateway: VideomakersOf (Videomakers on a given list, for the editor),
OfferedVideomakers = Videomakers less the unticked ones, read by
AutoVideomaker, videomakerObjects (another magpie's list) and
mediaModels(true) (generate_video). A hidden one still makes its video
when named: bareVideomaker, videosCreate and arkFilms read Videomakers.
- gui: the editor's Video models section (renderVideomakers), filmIds and
hiddenVideomakers on /api/providers, kept on save as hiddenDrawers is;
i18n for every language. app.js comments cut to stay under
TestCoreScriptBudget, which this change reached; no raise.
- docs: gateway-routing.md's Hidden image models section.
Old data: an Ark list fetched before keeps Seedance among its chat models
until its list is fetched again;
customVideomakers already counts any Seedance id an Ark key lists or picks
as a video model, so it makes videos and shows under Video models now.
Run on mote, this change and the next (/v1/models ?kind=, gateway and
docs only) rebased on f4c664a09; this commit's own tree, on 17f2387e1,
gave the same Go results with Linux and Windows vet of ./internal/...
clean:
- go test -count=1 -timeout 45m ./internal/catalog ./internal/provider
./internal/gateway ./internal/gui: catalog, provider and gateway ok;
gui red only in TestMainWindowCorners/macOS_26_SDK (#3949, red on main).
- GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: clean. gofmt -l: nothing.
- GUI (at the next commit's tree, which adds no GUI file or script): the 51 provider-*, drawers, image-models, i18n and
video-models-hide files, both engines, every language, wide and narrow:
1161 of 1188 ok. The 27 reds are 5 files that are red the same 27 at
origin/main d1cdce130 run alone: provider-fetch-again (#3292/#5057),
provider-models-rest (#4396), provider-picks-stay (#4397),
provider-levels-scroll (#4395), provider-typed (#4673).
video-models-hide: 22 of 22 ok.
- The whole GUI suite (all files) ran earlier at this change on 8af751987,
347 of 19153 red at load 100 to 200; the 66 files with a red, run again
alone, are red in the same tests at origin/main 17f2387e1 (all filed:
#4388, #4391, #4398, #4320, #4541/#5013, #2564, #4244, #4304 and the
above).
Rebased again onto d1cdce130 (sessions, Cursor mover, library and routing
plugins, group-unlists; nothing this change touches but gateway.go,
which merged clean) and run there: TestCoreScriptBudget and internal/gui's
new tests, the gateway's ?kind= and video tests, internal/provider and
internal/catalog, video-models-hide 22 of 22: ok.
Broken by hand, each red, then put back:
- the domain/output check in catalog's live parse:
TestFetchArkMarksVideoModels red
- OfferedVideomakers returning Videomakers whole:
TestHiddenVideomakerLeavesListsButStillFilms red
- the editor's filmIds left empty: TestVideoModelsHidden red
- a save without hiddenVideomakers dropping the old ones:
TestVideoModelsHidden red
- renderVideomakers' call in the editor left out: video-models-hide
22 of 22 red
- a chip's click not changing the draft: video-models-hide 22 of 22 red
Not tried: no real Ark video was made (no money spent); the list parse was
checked on a real Ark list fetched read-only. The editor was not opened in
the real app, only in the GUI tests' fake API.
Credit: axelburks on Discord.
shaoyang. on Discord (#general, 11-03): with a routing group's Model
lists set to the group alone (its card's 成员模型不单独列出), the model
list fetched still had every model of the group.
Cause: 88e6fb9cf (v0.1.2176, 10-30) had catalogOf keep a signed-in
subscription's models (SubscriptionKept: a ChatGPT, Claude, Copilot or
plugin account's) for every agent, leaving the group alone only for a
client that is no agent (""). Over HTTP no client is "": agentOf falls
back to usage.AgentOf(User-Agent), which is "other" or the UA's name, so
every /v1/models fetch, every agent's written list and every picker
listed a subscription member beside the group. For a group made of
subscription models, as most are, the option changed nothing.
Fix: catalogOf gives every agent but Codex Catalog(), as before
88e6fb9cf; Codex keeps its ChatGPT sign-in's own models (CodexOwn,
a3ee00c05), which its app reaches on that sign-in. SubscriptionKept is
gone; Unlisted() and GroupKept() name subscription members again, so the
picker's "kept for routing groups" note and the provider editor's
"listed alone" line (3d063e34f) say where they went. The routing editor's
hint says Codex keeps its own, in en, zh, zh-TW, ja and de. Docs:
reference.md, gateway-routing.md.
Behaviour change for 士奇's case (88e6fb9cf): with "The group alone" on,
Hermes, WorkBuddy and the rest lose the group's subscription models
again; that is what the option says. Listing its models too keeps them beside
the group, which the new test checks.
Tests:
- gui TestGroupAloneKeepsSubscriptionModelsOutOfEveryAgentsList (replaces
TestSubscriptionModelsStayInEveryAgentsListWithGroupOn): a sandbox
ChatGPT sign-in's 5 models in a group listing alone. For every agent
but Codex that lists the group, its Agents-page list, CatalogFor and
model pickers leave them out; Unlisted names them; with "Its models
too" hermes, workbuddy, claude and codex list them.
- gateway TestGroupAloneKeepsSubscriptionModelsOffAgentsModelList:
GET /v1/models with no key, "magpie" and magpie-hermes/-claude/-opencode
lists group/mine and not its members; /v1/models/{id} doesn't find one
for Hermes; Codex's key lists and finds them; listed again with
listed too.
- TestCodexOwnModelsListedOnlyThroughGroups again expects Claude Code not
to list a group-alone member.
Run on mote at 3da80330a (rebased on origin/main c3593dc49): gofmt -l
clean; go vet (darwin -tags nogui, GOOS=linux -tags nogui at the base,
GOOS=windows) on provider, gateway, gui ok; go test -timeout 45m
internal/provider ok, internal/gui ok, internal/gateway -run
"TestGroup|TestCodex|TestUnlisted|TestModels|TestDesktop" ok. At the
base 40a287b21: internal/provider, gateway, gui and agent whole ok;
internal/cli red only in TestEveryRouteHasACommandOrIsNamed (GET
/api/context/reply, #5026, red on main since 0872bc2a0). GUI:
group-unlists (en/zh/zh-TW/ja/de, 1100 and 420px), unlisted-group-kept,
unlisted-models, agent-models-group-on, i18n-keys in chromium and webkit,
56 of 56.
Broken by hand: catalogOf back to SubscriptionKept with the new tests in
place; the gui test failed with 484 "the group alone" errors (codex/gpt-5.5
in claude's, claude-desktop's, claude-science's lists and pickers among
them) and the gateway test for every key, no key and "magpie" included.
Not tried: a real ChatGPT/Claude sign-in or the running app, and the
reporter's Docker deployment (same /v1/models path, no OS branch); which
agent fetched the list isn't known.
tao0194 on Discord (v0.1.2828, zh, panel-width window): in Library > MCP
servers the magpie-browser row showed the connected ask (green dot, the
question, a button per agent) inside the name's column, wrapped into a
narrow strip between the command and the row's Scope and agent chips,
three lines tall beside every other server's two.
browserAsk's element was appended to the row's .who. It is now the row's
own child: the row gets lib-asking while it shows, wraps, and the ask
takes a line under the name, command and chips, from the name's left
edge (the picture plus the row's gap, 37px, 38px in the window's rows)
to the row's right edge. The first line keeps the name, command and
chips as the other rows have them (.who flex-basis 0 above 560px). At
560px and under, where rows already wrap, a long command now ellipsizes
beside the row's picture instead of taking the name to a line of its
own under it; that was so for any server with a long command, and the
ask's left edge follows the name. docs/subsystems/library.md says where
the ask sits.
library-browser-ask.test.cjs now has three agents (Codex, Zed among
them) and a context7 row beside it, runs at 1100, 600, the panel's 440
and 360, and checks the ask starts under the first line, at the name's
left edge, reaches the chips' right edge, that the first line is as
tall as another server's, and that the name sits beside the picture.
Run (mote, Playwright 1.62.0, Chromium and WebKit, en/zh/zh-TW/ja/de):
- library-browser-ask.test.cjs on the old client.js/library.css: 42 of
44 red (every layout subtest; the two not-connected/given ones pass).
With the change: 44 of 44 green.
- The 84 GUI files that open the Library, name lib-row/lib-server or
library.css, or check budgets and i18n keys: 1480 of 1480 ok, before
the rebase onto c3593dc49 (no upstream change touches these files);
library-browser-ask, i18n-keys and builtins again after it: 52 of 52
ok. go test ./internal/gui at the rebased head: TestMainWindowCorners
red only (an AppKit window test, the same on origin/main 78cd4e6dd,
#3949); everything else ok.
Not tried: the real app's panel (WKWebView) with a connected extension;
the full GUI suite.
jealousy03888 on Discord: "cindy里用Zcode订阅 同一个请求两个记录是特性吗".
Their Routing list had one ZCode GLM-5.3 request twice: the gateway's row
(ZCode · api.z.ai, 135/37/84,736 tokens, ~$0.026) and five seconds later
a "local session" row on the provider "magpie-beedee1a" with the same
tokens and cost, so Usage and the Requests totals counted it twice too.
Cause: Cindy's import parser gives a custom provider the link's id plus
eight hex digits of a new UUID (`${id.slice(0,24)}-${randomUUID()
.slice(0,8)}`, read in Cindy 0.1.94's app.asar), so magpie's link (id
"magpie") becomes "magpie-<8 hex>", and Cindy's Pi writes that id on
every reply. The Pi reader left out only "magpie"/"dial", so Cindy's
calls through magpie were read as Cindy's own beside the gateway's.
Now piGateway(agent, provider) also takes "magpie-" + eight lowercase
hex digits as magpie's entry, in Cindy's files only (Pi's own and omp's
providers are named by the user; magpie writes "magpie" there). A
provider the user adds by hand in Cindy under the name Magpie gets the
slug "magpie" or "magpie-2", never this shape. callParseVersions raises
cindy to 1, so Cindy's call shards written before are read again once
on update and the duplicates already shown go away (usage's request and
heat caches key on CallCacheVersion, so they are rebuilt too); no other
agent's shards are re-read.
Every other agent's reader was checked for the same gap (an id the app
chooses rather than magpie): OpenCode and ZCode ("magpie", written by
magpie), dsh (magpie's three route names), MiniMax Code
(custom_provider:magpie), Kimi ("magpie/" model prefix), WorkBuddy and
CodeBuddy (models.json vendor magpie), Grok Build (its config.toml
tables), Pi, omp and Raft (models.json "magpie"), Claude Code, Codex
and Antigravity (paired with the gateway's rows by session, response id
or tokens and time). Cindy is the only one whose provider id is made by
the app; Lody and AionUi also import a link but their sessions aren't
read.
TestCindyGatewayCallsCountedOnce puts a Cindy Pi session shaped like
the report (provider magpie-beedee1a, zcode/GLM-5.3, 135/37/84,736,
durationMs 5292) and a reply on a user's own "magpie-relay" into
Cindy's session folder; the first must not be a call, the second must
be one. TestCallParseVersionRaiseReadsThatAgentAlone now restores the
real versions after it.
Run (on mote): gofmt -l internal/sessions (nothing); go vet;
GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet ./...; go build
./... all ok. go test -tags nogui -timeout 45m ./... at 40a287b21+this:
86 packages ok, internal/cli red on two filed reds outside this change:
TestEveryRouteHasACommandOrIsNamed (GET /api/context/reply, #5026,
red alone too) and TestLibraryMCPHub (#4140, passes alone). Rebased on
c3593dc49 (no sessions or usage change between) and run again at the
pushed head: internal/sessions ok, internal/usage ok.
Broken by hand: piGateway's Cindy branch replaced by `return false`:
TestCindyGatewayCallsCountedOnce FAIL ("a call through magpie's link in
Cindy counted as Cindy's own: ... Upstream:magpie-beedee1a ...").
Not tried: a real Cindy session through magpie (none on this machine;
the shape is from Cindy's source and the reporter's screenshot); the
Sessions overview's session count for Cindy, which counts sessions,
not calls, and was not changed.
@magpie-community/opencode-cursor-auth 0.2.39 (plugins b8ec827 by
jiaohanying, released in 0236317) asks Cursor's full catalog
(AvailableModels scope 3) alongside the picker. An account Cursor blocks
Claude for, whose picker has no Claude while cursor-agent's usable list
does, now gets those models as the picker's are listed: once per context
size (claude-opus-5-5@300k and @1m, 1m in Max Mode), the efforts the
account is served, and only the parameters the model defines (the
catalog's Opus 4.7 to 5.5 variants carry cyber=false, which is not
sent). Before, each such family was one fallback entry with a 200K
window. 0.2.39 also carries 0.2.38 (OpenCode 2.x entry, plugins#657).
Raising the min lets keepMovedCurrent bring every moved Cursor user up
to it.
npm view --prefer-online @magpie-community/opencode-cursor-auth version:
0.2.39 (latest) before this commit.
Run on mote at this head: go test -count=1 -run
'Mov|Migrat|Retir|HandOver|Adopt|Plugin|Cursor' ./internal/provider ok;
GOOS=linux and GOOS=windows go vet ./internal/provider ok; gofmt -l
clean. Plugin side (reviewed head f4cb8ed and the squash on main):
bun test packages/cursor 393 pass, whole bun test 0 fail, check.mjs ok;
the cyber test goes red with the parameter filter taken out.
Not tried: a real Cursor account (none for this run); the author ran a
real request at 300k and 1m on a blocked account.
The second way acezan's 57 <defunct> magpie-bun (v0.1.2819, a Linux
systemd service, 47 hours) pile up: magpie web's restart to update
(AutoRestart) runs the new version with syscall.Exec in the same pid.
The running plugin host was the old image's child, and the old image's
host.read held the only Wait for it. After the exec nothing waits for
it, so it ends on stdin EOF and stays <defunct> under that pid, one per
restart to update. skygunner reproduced it and AAEE86 counted 22 zombies
for 23 images under one pid (#3285). With about a hundred releases a
day, an AutoRestart service makes about one a hour, as acezan's did.
- plugin.EndHosts (host.go) stops every host started and not yet
reaped, including the retiring ones, waits until each one has been
waited for, and refuses to start another (errHostsEnded). startOn
starts the host and records it under one lock (live), so a host that
starts during EndHosts isn't missed.
- Web.Wait calls it right before update.Reexec.
Run at 72bc741ef (on origin/main 40a287b21, after the previous commit):
- mote (macOS): gofmt -l clean; go vet ./internal/gui ./internal/plugin,
GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: ok.
go test -count=1 -timeout 45m ./internal/plugin: ok; -run Web
./internal/gui: ok.
- WSL magpie-desktop (Linux): ./internal/plugin ok, including
TestEndHostsLeavesNoChild and TestHostReapedWhileItsChildHoldsStdout
with a real Bun host; -race -count=3 of both: ok; go vet -tags nogui
and -run Web of ./internal/gui: ok.
Both commits were then rebased onto 0acba61a3, which changes only
app.js and plugin-checkin.test.cjs; no Go file these runs built moved,
and they were not run again there.
Broken by hand: EndHosts returning at once makes
TestEndHostsLeavesNoChild fail on Linux ("children left once EndHosts
returned: [16459 S bun]").
Not tried: a real magpie web restart to update (a downloaded update
exec'd in the same pid) on Linux. The test covers EndHosts, not the
exec. Not changed: anything else alive at the exec (pii's helper,
awake's caffeinate, #4188) still outlives it the same way.
Reported by acezan on Discord. Diagnosed in #3285 by skygunner and
AAEE86.
acezan on Discord (v0.1.2819, Linux x86_64, a systemd service): after
47 hours, 57 <defunct> magpie-bun children of magpie, growing toward the
unit's TasksMax until a restart.
One cause: the plugin host's only cmd.Wait ran in host.read after its
stdout reached EOF. A program a plugin started that kept a copy of the
host's stdout (Bun.spawn given Bun.stdout, which host.js's spawn guard
doesn't catch, #5063; a daemon left behind) held that pipe open past the
host's end, so EOF never came, Wait never ran, the host was never marked
dead, and every host stopped (Restart, a moved proxy, hostStale) stayed a
zombie until magpie quit. Reproduced on Linux (WSL magpie-desktop,
Bun 1.4.2): one more Z-state bun under the test process per Restart,
1, 2, 3, 4 over four rounds. The other cause, magpie web's restart to
update leaving the running host behind its exec (#3285), is the next
commit.
- proc.Output (new, internal/proc/output.go) gives a command's stdout and
stderr pipes of magpie's own and waits for the command the moment it
ends. Its readers then have OutputGrace (2s) to read the last lines;
the pipes are closed after that, which ends a read held up by a
grandchild. startOn uses it, and a reap goroutine fails the host when
its child ends. host.read no longer calls Wait. The tests' fake hosts
(no child) keep cmd.Wait.
- Every other start that wasn't waited for now goes through
proc.StartReaped (Start, then go cmd.Wait()). Process.Release doesn't
reap on Unix: codexrelay.Start (a relay that can end while magpie
runs), tui serveInBackground, uninstall's startAfter, update's
runAfterExit and OpenBeside (no Wait at all), and Windows' Reexec.
- TestEveryStartedCommandIsWaited (internal/proc) parses every non-test
.go file. In each function, an x.Start() on a command needs an
x.Wait(), or x handed on (a call's argument, a struct field), and
.Process.Release() is refused. It found exactly the sites above.
- docs/subsystems/provider-plugins.md says how the host is reaped.
Checked and left as they are (each waits): the StartTree callers
(provider/install, library mcp_run and mcp_check, gateway claude_warmup
and claude_subscription), pii/serve, provider grok and claude_signin,
claudetui child_unix and wslread, awake, every other bun start (bun.go,
bunupdate, store, dist use Output/CombinedOutput).
Run at 82460a2f9 (on origin/main 40a287b21):
- mote (macOS): gofmt -l clean; go vet on the touched packages,
GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: ok.
go test -count=1 -timeout 45m ./internal/plugin ./internal/proc
./internal/codexrelay ./internal/tui ./internal/uninstall
./internal/update: all ok. -race -count=3 of the new proc tests: ok.
- WSL magpie-desktop (Linux): the same six packages ok, including
TestHostReapedWhileItsChildHoldsStdout with a real Bun host; -race
-count=3 of it and the Output tests: ok.
- Windows (xiaomi-gpu), at the tree before the rebase (base 5ee5274bd):
proc and codexrelay ok. plugin and update had TestPiPackage,
TestLoadConcurrentWithSavesAndEdits and TestPackagedByDpkg red; each
fails the same at untouched origin/main 40a287b21 on that box, 3 of 3,
and is filed (#4115, #1827, #4603).
Broken by hand, each red:
- host.go back to StdoutPipe with Wait only after EOF:
TestHostReapedWhileItsChildHoldsStdout fails on Linux ("the host isn't
marked ended 15s after Restart").
- Output.Start waiting for the readers before Wait:
TestOutputWaitsPastWhatHoldsIt fails (not waited for in 10s).
- codexrelay back to Process.Release: TestEveryStartedCommandIsWaited
names relay.go:89 and :92.
Not tried: a full go test ./... (mote and WSL were each running other
sessions' package runs, load 39 and 110); a real magpie serve or web
running for hours on Linux; the host test on macOS (no /proc; the
Output test runs there). Not changed: killing what a host left behind
(its process group) when it is stopped; an orphan like the sleep above
stays in the service's cgroup until it ends on its own.
Reported by acezan on Discord.
ljq906416 and justrun_way on X couldn't find WorkBuddy's daily check-in
after it moved to its plugin. The WorkBuddy plugin (0.2.0 on) checks in
itself, so magpie hides its own WorkBuddy tab under Settings › Usage's
check-in tabs and the switch sits under a tab labelled "Plugins" (插件),
which nobody looking for WorkBuddy reads. With one plugin checking in,
the tab now carries that plugin's name (WorkBuddy), as a built-in's tab
does; two or more still share "Plugins". The label is set through
data-en, so a language change keeps it.
Run (wsl-run, Linux, Chromium + WebKit, en/zh/zh-TW/ja/de):
plugin-checkin, checkin-reason, checkin-reason-once and i18n-keys:
64 pass, 0 fail. The new two-plugin test checks the shared tab's
translated name and both rows; the 440px test checks the lone tab reads
"FakeCo".
Broken by hand: with the old app.js the 440px test fails in chromium en
and zh (expected FakeCo, read "Plugins"); the two-plugin test passes
there, as it guards the shared case.
Size budgets summed by hand the way TestCoreScriptBudget does (the Go
package needs cgo, which wsl lacks): app.js 1,308,499 of 1,316,874,
core 1,529,963 of 1,533,802, no raise.
Not tried: the real app with a signed-in WorkBuddy plugin.
A streamed Claude subscription turn whose run says nothing for minutes
(the interactive mode tells a message only once it is whole; a long
conversation replayed to a new Claude Code is prefilled uncached first)
gave its client the held stream's 200 and comments, and those stop at
keepaliveLongest (5 min). Claude Code 2.1.316's byte watchdog then ended
the request 300s later, at 599s: the reporter's 599.29s and 599.33s.
Each cancel aborts the TUI run (letGo), so the retry is a new Claude Code
that replays the history and writes it to the cache again (#3808).
keepBridgeHeard wraps the run's events for a stream: after
bridgeHeardAfter (1 min) of a quiet run it sends an empty KStart, which
makes relay begin the reply (message_start), and a KAlive every
keepaliveEvery while it stays quiet, up to translatedQuietLongest, so the
client gets its protocol's pings (#2316's pattern). The hold still holds
the frames to holdLead and passes an error over. The run's own start
later adds its usage (collector), and a failure in the first minute is
still a status.
The gain is bounded. Claude Code 2.1.316 turns every 10s with bytes into
a ping of its own (RSr, __n=1e4) and counts 30 pings in a row (vSr=30),
so a stream of pings and comments alone ends 600s after its last other
event. The run now has until about 14 minutes (message_start at ~4 min
plus 600s), where it had 599s. The reporter's retries answered first at
385s and 527s.
Run:
- Real claude.exe 2.1.316 (-p, sandbox HOME, env -i) against a fake
Anthropic server:
- headers at 3s, comments to 300s: ended at 598.38s ("[byte-watchdog]
... no bytes for 300000ms"; "Stream idle timeout before first event").
- comments forever: ended at ~600s from headers ("no chunks received
for 300s").
- no headers: "Request timed out" at 360s.
- this fix's shape (message_start + ping at 300s, a ping every 60s):
lasted to 904s, then "no chunks received for 300s" and fell back to
non-streaming. That is the 600s bound above.
- mote-run: go test -tags nogui -count=1 -timeout 45m ./internal/gateway
ok (675.8s), at this change before its comment-only edits.
- mote-run: go test -tags nogui -count=1 -timeout 45m ./internal/gateway
ok (680.2s) again at this tree, rebased on origin/main 5ee5274bd.
- mote-run: TestClaudeBridgeQuietRunKeepsClientAlive -count=3 ok, and
gofmt -l internal/gateway clean, at the committed tree.
- mote-run: GOOS=linux and GOOS=windows go vet -tags nogui
./internal/gateway ok.
Broken by hand:
- Without the keepBridgeHeard call, the new test fails: no
message_start or ping before the reply.
- Without the synthetic KStart (KAlive alone), it fails with "0 pings
while the run was quiet": the client gets comments only.
Not tried:
- A real Claude account, the interactive (TUI) mode, a real replay.
The test uses a -p fake Claude Code. The wrapper doesn't depend on
the mode.
- Chat and Responses clients through the bridge. Their encoders take an
empty KStart, but no test covers it here.
- A run quiet for longer than ~14 min still ends. Only a real event of
the reply would keep it alive (#5060).
- magpie's pingEvery comment in gateway.go describes 2.1.311's count
without the synthetic pings. Not changed here.