Commit Graph
4872 Commits
Author SHA1 Message Date
yetone a67da2dd36 qoder: the mover's min is 0.2.43, the check-in asked as 10:00 (UTC+8) opens
npm view --prefer-online --registry=https://registry.npmjs.org/ @magpie-community/opencode-qoder-auth version: 0.2.43 at 10:02 CST, before this change.
0.2.43 answers auth.checkin's until (plugins fd40b20), which a05b37353 holds to. A real qoder account at 10:02:53 CST: today's campaign opened at 10:00:00 and was still CLAIMABLE (the 30-minute look hadn't reached it); 0.2.43 claimed 100 with until 2026-10-29T02:01Z.
Run (mote): go test -tags nogui -run 'Mover|Moved|Migrat|Qoder|Plugin.*Min|KeepMovedCurrent' ./internal/provider ./internal/plugin, ok; gofmt -l clean. The full suite ran on a05b37353, the parent's change; this one changes a string only.
Not tried: a moved user's keepMovedCurrent update to 0.2.43 end to end.
2026-10-28 10:03:34 +08:00
yetone a05b373538 checkin: a plugin's until is when its answer stops holding (Qoder's 10:00 UTC+8)
sdytman on Discord: Qoder's daily credits start at 10:00, can the plugin's
check-in follow it? Qoder's /me/campaigns opens each day's CLAIM_BENEFIT
campaign at 10:00 and closes it at 09:59 the next day, UTC+8 (startAt and
endAt, read with a real account on 10-28; Qoder.app polls the list every 5
minutes). A check-in before 10:00 meets the day before's campaign. Since
#2696 the Qoder plugins are asked again every 30 minutes, so today's was
claimed somewhere between 10:00 and 10:30; a plain plugin was settled for
the Beijing day.

auth.checkin may now answer until (RFC 3339 or epoch ms); host.js passes
it as RFC 3339 (plugin.Checkin.Until), kept as ValidUntil. settled holds
an answer only until then, whatever its outcome; the loop wakes at it
instead of its next 30-minute look; an early done that carries it is not
provisional (#3326), as the vendor said when its day turns. Instants
throughout, so the machine's zone doesn't matter. The Qoder plugins send
until from 0.2.43 (plugins fd40b20): the check-in now lands at 10:01.

Run (mote): TestPluginCheckinAsksAgainAtUntil, minute by minute from
09:27 Beijing to the next day's 10:30, with time.Local UTC, UTC-8 and
Beijing: asks at 09:27, 10:01, 00:00 (the Beijing day), 10:01; a failure
in the 09:59 gap asked at 10:01:00 only. GOOS=linux and windows go vet;
go test -tags nogui -timeout 45m ./... all ok (76 packages). gofmt -l
clean.
Broken by hand, each red: settled ignoring ValidUntil (no 10:01 asks);
tick not waking at it (10:27 instead); provisional ignoring it (asked
every 30 minutes from 00:00 to 10:00); host.js dropping until (ValidUntil
zero).
Not tried: the Qoder plugin's recheck path with until (the fake plugin
is fakeco; the tick and settled it goes through are the same); a GUI
change (none: until isn't shown).
2026-10-28 09:51:43 +08:00
yetone f39fc3ac8b usage: a model list that was answered is no row of Requests (ferock on Discord)
ferock (Discord #general): Usage > Requests is full of rows like
"magpie · magpie's own · Remote magpie · API · Model list · 0 0 · 757 ms
· 200, GET /v1/models", which no tool of theirs sent.

Cause: ffe493773 (v0.1.1446) wrote every request magpie sends a
provider on its own into the request log (source "probe"): the editor's
Test and Detect APIs, and every model-list fetch. 0152f6696 then gave a
Remote magpie a 10-minute list schedule (KeepListsFresh), so each Remote
magpie added ~144 such rows a day. The same rows came from every other
automatic fetch: start-up's FetchNew, the panel's FetchNewSoon, the
Providers page's FetchNewBehind and any provider with a RefreshEvery.
They were already counted in no token, cost, chart, budget or quota
total, but they were listed and counted in the page's row total.

Fix: a model_list probe with a 2xx/3xx status and no error
(usage.quietProbe) is not written by usage's probelog.Sink, and is
skipped when the log's index parses one (logSnapshot.probes). This rule
covers every list fetch, whoever started it, so every sibling is
covered by one check. A list that failed is still a row (the Failed
filter finds it, and the row says why models are missing), and every
Test and Detect APIs row stays as it was. Older rows: the answered
model lists already in usage.jsonl stop being listed at the next start
of the index, with no rewrite. The lines stay in the file and nothing
reads them. Quota and usage polls and health checks were never written
there (only Test, Detect and list are marked by probelog), so nothing
else needed changing. The TUI and CLI have no request list. The heatmap,
Summarize, Load and the exports skipped probes already.

Tests:
- usage TestAnsweredModelListIsNoRow (new): 200 and 304 lists aren't
  written; a 503 and a connection-refused list are listed and Failed
  finds both; a 200 Test is listed; an old answered list line in the log
  is not listed, and Total is 3.
- TestProbeRowsListedNotCounted and the rename tests now use a failed
  list (a 200 one would no longer be a row).

Broken by hand, each red: quietProbe returning false (the 200 list
written and listed); the index's skip removed, Sink's kept (the old line
listed, total 4).

Run, on mote:
- go test -tags nogui -timeout 45m ./... at the pre-rebase head
  (b4f2fa9d3 on 0a7633136): every package ok, 76 ok, exit 0 (gateway
  547s, agent 298s, provider 167s, usage 48s).
- After rebase on origin/main 9ba3f049e (which touched neither usage
  nor probelog): go build ./...; go vet for darwin, GOOS=linux and
  GOOS=windows on usage and probelog; go test usage, probelog,
  usageapi, and provider -run Probe|Detect|TestTestWrites: ok. gofmt
  -l clean.
- GUI (no asset changed): usage-ledger*.test.cjs, ledger-*.test.cjs and
  own-requests.test.cjs, chromium and webkit, each file's languages:
  381 tests, 375 pass. The 6 reds are usage-ledger's "newest live route
  needs no return-to-live button" (en, zh, both engines), which is
  already filed as #3104. usage-ledger-probe passed in every language.

Not tried: a real Remote magpie over a day. The row filter was not
checked on a real usage.jsonl.
2026-10-28 09:42:21 +08:00
yetone 9ba3f049e2 workbuddy: a model over 200K offers WorkBuddy's context choice, set to its whole window
xiao9could on X: WorkBuddy shows no context button for magpie's models,
Opus included. WorkBuddy 5.5.6's CLI builds its "Context" session option
(and the renderer its 200K/1M submenu) only from a model's
contextWindow.supportedLengths with two sizes or more, each no larger
than maxInputTokens; magpie wrote maxInputTokens alone. Each entry over
200K now has supportedLengths [200000, window] and defaultLength set to
the window. defaultLength matters: without it resolveEffectiveContextBudget
takes the smallest size, which would have cut every session to 200K.
Read from /Applications/WorkBuddy.app's app.asar (cli/dist/codebuddy.js:
resolveEffectiveContextBudget, the context_window config option;
renderer lib-chat-ui: getSupportedContextWindows). The models.json loader
spreads each entry whole, so the field reaches the model config.

Run (mote): go test ./internal/agent -count=1 ok (157s); go vet
./internal/agent for darwin, linux, windows ok; gofmt clean.
Broken by hand: without the workbuddy.go change TestWorkBuddyContextChoice
fails.
Not tried: the menu in the running WorkBuddy app.
2026-10-28 09:30:24 +08:00
yetone 08b02cf18c providers: a pool stops at its caps and reads usage again near them (plugins#349)
What was adopted on magpie-community/plugins#349 (1939869736luosi): one
place, in the GUI and the CLI, for a subscription's account pool, and an
opt-in conservative mode.

- Stop at the caps (Provider.CapStop, off by default): once every account
  in use is held at its cap, the request is answered 429 rather than going
  on to the provider's fallbacks (plan returns restLast). Off, as before.
- Check usage again near a cap (Provider.CapCareful, off by default,
  internal/gateway/cap_careful.go): before planning, a capped account's
  usage is read again when its reading is over 15s old within 5 points of
  a cap, or over 5m old at all; the request waits at most 10s, and a
  failed account is asked again at most every 15s. An account whose usage
  was never read, whose last read failed, or whose reading is still that
  old is then held as one at its cap is (capHold "unread", traced as
  Weighed.Unread, named in the 429 with "--careful off"). Generic: it
  goes by provider.UsageRead/ReadUsageNow, so every subscription that
  reports usage windows (Codex, Claude, plugins) gets it.
- provider: usedCache records each account's read state; a failed read
  keeps the last good reading's time. ReadUsageNow no longer reports
  false when the read had already finished on the first ask.
- GUI: under the provider's account list, once an account has a cap (or
  either is on), two ticks for the above, and a note naming the accounts
  in use with no cap ("used to 100% of each window"). Accounts, order and
  caps stay where they were in that list. zh, zh-TW, ja, de added.
  app.js 1,309,658 within its 1,310,460 budget, unraised: addRow and a
  per-row forgetOf replace 3 add-button and 5 Remove-button builds.
- CLI: magpie provider pool <id> [--accounts a,b,…] [--cap percent|off]
  [--stop on|off] [--careful on|off] shows and sets the whole pool.
- docs: gateway-routing.md and providers-accounts.md.

Run (mote, before the rebase at 8bade6c5e + this change):
- go test -tags nogui -timeout 45m ./...: exit 0, 76 packages ok, no
  FAIL (log grepped).
- GOOS=linux and GOOS=windows go vet of cli, gateway, provider, gui: ok.
- pool-ends.test.cjs: 32/32, Chromium and WebKit, en zh ja de, 1100 and
  420 wide.
- The 81 GUI files whose fixtures have accounts or caps, plus i18n*,
  6 at a time at load ~130: 76 pass. i18n-keys is red on the base too
  (#3897). account-mask (#3951), account-alias (#2984),
  signin-closes-sheet and signin-again timed out under load and pass
  run again, as on the base; signin-again filed as #3960.
- Real plugin host: TestPluginCarefulPool runs the fake plugin under Bun
  as Factory with two accounts capped at 90%: a failing usage call gives
  429 with nothing sent upstream while careful is on, the last reading
  is used with it off, a good read sends to A again, and with both at
  their caps the fallback serves unless Stop is on.
- CLI binary in a sandbox HOME on mote: unknown provider, a bad --stop
  value and no id each refuse and change nothing.
At the rebased head (0a7633136 + this): gofmt -l
clean, go build ./..., the new Go tests and the budget tests, and
pool-ends.test.cjs 32/32.

Broken by hand, each seen red, then restored:
- the CapStop line in plan: TestCapStopSkipsTheFallbacks and
  TestPluginCarefulPool red;
- the careful hold in capHeld: the three careful tests and
  TestPluginCarefulPool red;
- careful always on: TestCarefulOffByDefault red;
- readCareful not called: the failed, never-read, stale and re-read
  subtests red;
- a failed read not keeping the good time, or not counted as failed,
  and ReadUsageNow's early return forced false: TestUsageReadAndReadAgain
  red;
- the ticks' onchange emptied: pool-ends.test.cjs 16 of 16 red.

Not tried: a real Factory or any real account (fake plugin only); the
whole GUI suite (932 files, ~5h at this load), only the 81 files that
reach the account list; Linux WebKitGTK and Windows; the 15s/5m/5-point
figures against a real vendor's usage endpoint latency.
2026-10-28 09:29:44 +08:00
yetoneandMYCF711 0a7633136d routing: a skipped member's story line leads with its own logo (#3953)
A story line about a member the gateway skipped before trying it
(r.left, "API key is left out: this request is longer than its 200K
context window…") got no logo, or another member's: logoed walked only
r.order. MYCF711 found it and proposed walking r.left too, skipped
members first, with r.left in the logos memo keys; this ports that
(their branch MYCF711/magpie fix/routing-left-logos, 003611a02).

Changed from their patch: list order alone can't settle two members
named alike (an order key and a skipped account both "API key"). Left
first gave a failed order key's try line the skipped one's logo; order
first gives the skipped one's line the order key's. So a line now
carries the member it is about where it has one (a skipped one's line
via leftWhy, a try's via tried()), and that member wins a tie at the
same place; otherwise order before left. The memo keys take that
member's seat and every r.order + r.left logo.

Siblings checked: say()'s caption is plain text; the rows (3650) and
the stage list (1911) already read r.left; app.js has no story logos.

Run (mote-run, at 8bade6c5e):
- routing-log-icons.test.cjs, chromium + webkit, en/zh (+ the live
  case's en/zh/zh-TW/ja/de): 14/14 ok. New case: order [glm, DeepSeek
  key "API key", gpt], left [Zen "API key", 200K window], DeepSeek tried
  and failed; the 200K line must lead with opencode, the DeepSeek try
  line with deepseek-color.
- Broken by hand, each red: r.order only (skipped line got
  deepseek-color, the reporter's symptom), the reporter's left-first
  without the about member (try line got opencode), order-first
  without it (skipped line got deepseek-color).
- Every GUI file that reaches the Routing page (184 files with
  i18n-keys, 2375 tests): 98 red; the 15 red files run again side by
  side on a clean origin/main 8bade6c5e copy and this tree: 99 red on
  main, 93 here, the same files, under load ~100 on mote. Each has an
  open issue: #3897 (i18n-keys "Runs as"), #3402, #3408, #3409,
  #2115/#2658, #3410, #3799, #3789, #3411, #3094/#3096, #3593, #3412,
  #3954, #1905, #1345/#1948.
- go test -tags nogui ./internal/gui -run 'Budget|Size|I18n|Plugin':
  ok (client.js is the routing plugin's, not a core script).

Not tried: the real app with a real skipped Zen member; Windows/Linux
webviews.

Co-authored-by: MYCF711 <323101370+MYCF711@users.noreply.github.com>
2026-10-28 09:17:18 +08:00
yetone 8bade6c5e2 provider: a plugin's usage window can be a prepaid wallet's balance (#3950)
SuperMagic's accounts (mycf_711's magicrew plugin) are prepaid wallets of
points with no total. A plugin can now send a usage window as
{name, balance: 6291, unit: "积分"} with no used or limit.

- host.js passes a finite balance on (at least 0), anything else as null.
  plugin.UsageWindow.Balance and provider.QuotaWindow.Balance are *float64.
- quotaOfPlugin keeps the figure and does not make the window Text or
  Aside, so routing knows the account with no Used invented. allowanceOf
  copies it into Limit.Balance; an empty wallet counts as used up.
  Allowance.Left(model) is the least balance of the windows that count
  the model.
- weighRouted fills routes.Seat.Left and Seat.LeftIn (the account's
  provider and unit). Smart, pace and usage (least used) put the seat
  with more left first where they would otherwise tie (byLeft), only
  when every seat with a balance shares one LeftIn: balances in two
  units or two providers are never compared. Tiers still come first.
- The Usage card, the Routing page (Weighed.Balance: the small row's
  text, no bar, a why sentence, the account list), magpie accounts and
  the status line show the figure, "6,291 积分 left", never a share.
- Docs: provider-plugins (new section), gateway-routing,
  providers-accounts, plugin-runtime, host.js typings and the site's
  plugins page (en, zh, ja).

Run, at base f13aafa87, on mote:
- go test -tags nogui -timeout 45m ./...: 72 packages ok; red were
  TestQuotaSpanCarriesEveryWindowField (this change's: its fixture now
  sets Balance, green after), and on the unchanged base too
  TestWSLColdPlaceOpensNothing (#3924), TestFetchAsksASharedBaseOnce and
  two siblings (#3854), TestTUIFetchesSubscriptionModels (#3919), all
  fixed on main since and run again after the rebase; and
  TestPluginStreamsPastTheBudgetWait (#3946), green alone on both.
- GOOS=linux and GOOS=windows go vet -tags nogui ./internal/..., go
  build ./..., gofmt -l: clean.
- New tests: TestPluginWalletBalanceIsAReading, TestAllowanceLeftIsTheLeastBalance,
  TestPluginHostPassesABalanceOn (through real Bun and host.js),
  TestWalletsGoByWhatTheyHaveLeft, TestWalletLeftWithinItsTier,
  TestWalletWithMoreLeftGoesFirst, TestQuotaCell's balance cases;
  usage-wallet-balance.test.cjs and routing-wallet-balance.test.cjs,
  34 of 34 in Chromium and WebKit, en zh zh-TW ja de, 1100/900/420/390px.
- GUI: every quota*, usage*, panel*, routing*, i18n* and tray* file (220
  files, 2928 tests), concurrency 4: 130 red, in 21 files. Those 21 files
  run again on an unchanged base copy and on this change, concurrency 2:
  the same 19 files red on both (126 and 131), the differing subtests
  being routing-rule-remove / rules-line / intent-entry flaps that go
  both ways. Each is filed (#3679, #2115, #3410, #3404, #3411, #3897,
  #1905, #3096, #3593, #3408, #3409, #3799, #3789, #3412, #3947, #3415,
  #3414, #1345); routing-story-shrinks had none and is #3954.

After rebasing on origin/main 833f51adc, on mote: Linux and Windows vet,
go build, gofmt clean; go test -tags nogui of internal/routes, provider,
gateway, cli, plugin, gui (the script budgets), agent and tui: all ok;
the two wallet GUI files and i18n-keys: 37 of 38, the red being
i18n-keys' "Runs as" (#3897, not this change).

Broken by hand, each red then restored: quotaReport's Balance copy
removed (TestQuotaSpanCarriesEveryWindowField red); byLeft always nil (routes and
gateway tests red); host.js's balance line removed (host test red);
quotaOfPlugin's balance copy removed (provider tests red); app.js and
client.js at base (both GUI files 34 of 34 red, "0% used" / "已用 0%").

Not tried: a real SuperMagic account or the magicrew plugin (it isn't
in the community repo; it needs to send balance), Windows and Linux
GUI apps, and the WebKitGTK app.
2026-10-28 08:28:56 +08:00
yetone 9901303d1f gateway: a request held before routing is shown as its caller, read once as it comes
ubuntu CI's Race step at b90e81da1 (run 40602682209) found a data race
in TestUnroutedSlowBodyNotCutOff: the unrouted hold's show timer read the
request's headers (showLocked -> callerOf -> agentOf -> callerKeys) while
the handler deleted Content-Encoding from the same map (decodedBody). In
a build without -race that is Go's fatal "concurrent map read and map
write", the whole gateway gone, for a request whose body is still
arriving 15s in. withCaller deletes X-Magpie-Agent and friends from that
map too.

watchUnrouted runs in counted, outside withCaller, so callerOf(u.r)
never had the caller in its context and fell back to agentOf: a request
another magpie passed on was shown on Routing as "magpie" while it
waited, against callerFrom's own rule that every place naming a
request's agent uses it. The hold now reads callerFrom(r).agent once in
watchUnrouted, before anything else has the request, and showLocked
uses that.

New test TestUnroutedShownAsItsCaller: a magpie/0.1.0 request for pi,
its body held, is shown as pi. On the old code it fails: shown as
"magpie" while held, want pi.

Run at origin/main 60bcea073 + this change, on mote:
- go test -race -run 'TestUnrouted|TestRemoteMagpie|Masked|TestChatAndMessagesFacts'
  -count=5 ./internal/gateway/: ok (47.8s), no DATA RACE.
- go test -run TestUnrouted -count=3 ./internal/gateway/: ok.
- go vet ./internal/gateway/ for darwin, linux and windows: ok. gofmt -l: none.
Not run before the push: the whole internal/gateway package (running
after, recorded on #3956).
2026-10-28 08:28:23 +08:00
yetone 60bcea073f LESSONS: a red Test step hid a -race-only red until 10-28 (#3956)
CI runs the Race step only when Test passes. 9a888323a's allocation
bound was red under -race from 10-26 and first showed once the Test
step went green; a bytes bound runs once under -race before it lands.

Docs only; nothing run.
2026-10-28 08:23:54 +08:00
yetone fafce65455 gateway: the facts' allocation bound is checked when not under -race (#3956)
TestChatAndMessagesFactsLeaveTheHistory (9a888323a, #3472) was red every
time under -race on ubuntu and macOS CI from ec6c2de52 on; earlier runs
hid it, as their Test step was red and the Race step never ran.

regexp keeps its backtracker in a sync.Pool, and under -race sync.Pool
lets a quarter of what is put in it go, so userSaid's matches over a long
conversation made new ones: a memory profile of readFacts alone shows
regexp.(*bitState).reset at 13.61 MB over five reads under -race, 0.07 MB
without. The bound is now skipped under raceOn, as its sibling at
parse_memo_test.go:71 already is for workDirIn's regexps.

Run at origin/main 833f51adc + this change, on mote:
- go test -race -run TestChatAndMessagesFacts -count=3 ./internal/gateway/:
  ok, 3 of 3. Before the change: FAIL 3 of 3 (chat 3851848 bytes against
  a parse's 4524408).
- go test -run TestChatAndMessagesFacts -count=3 ./internal/gateway/: ok
  (facts 980072 bytes against 4503336, the bound unchanged).
- go vet ./internal/gateway/: ok. gofmt -l: none.
Not run: the full gateway race shards; CI runs them.
2026-10-28 08:23:31 +08:00
yetone 833f51adcf gui: a browser tab has the font rows too, with its own choice
Norcleeh on Discord: magpie opened in a browser had no font setting in
Settings > General, while the app does. The rows were hidden on purpose:
/api/fonts answered 404 to a browser page and boot sent it no choice,
since the list is the fonts of the computer magpie runs on and the tab
can be on another one.

Now a browser tab (magpie web, or the app's page in a browser) has both
rows wherever magpie can read its fonts (boot's fonts; a nogui build
can't, and keeps them hidden). Its list is /api/fonts less the families
this browser doesn't draw (fonts.js here(): text in the family measures
apart from monospace's or serif's on a canvas), so another computer's
fonts and Safari's user-installed ones aren't offered. The choice is the
browser's own, in localStorage (magpie.fonts), applied by fonts.js
before the first paint; it neither changes nor takes the app's
settings.UIFont/CodeFont, and a settings save from a browser still
keeps the app's.

Run on mote at this tree (on b90e81da1), also GOOS=linux (nogui) and
GOOS=windows go vet ./internal/gui/..., go build, gofmt -l:
- fonts.test.cjs, font-cascade.test.cjs, win-fonts.test.cjs, i18n-keys
  and the 42 drag/arrange GUI files, Chromium and WebKit, en and zh (and
  ja/de where a file has them). The reds are 32 subtests in 4 files
  that fail the same on origin/main b90e81da1 run alone (and one from
  a stray path in the run command): i18n-keys "a
  plugin's words are its own" (#3897), routing-rule-drag webkit de
  (#3789), segs-press-redraw webkit (#3922), usage-agents-hide (#3414).
- go test -tags nogui ./internal/gui (TestCoreScriptBudget and
  TestFontSettingsAPIAndBoot included) ok; go test ./internal/gui -run
  Font (cgo, CoreText) ok.
- Real use: magpie built on mote, `magpie web` in a sandbox HOME, real
  /api/fonts (204 families). Chromium offered 204, WebKit 179; Georgia
  picked in each, the body drew it and kept it across a reload, and no
  settings.json was written.
Broken by hand: fontsOn = !web (rows hidden as before): the new test
red in all four engine/language cases; here() returning the list
unfiltered: red with "a family this browser doesn't draw isn't
offered".
Not tried: a browser on a different computer from magpie (the canvas
filter is what covers it, checked with a family the test machine
lacks), Firefox, the Windows and Linux apps' pages in a browser.
Budget: not raised; the previous commit's 1,097 bytes cover it.
2026-10-28 08:01:46 +08:00
yetone 7a92506353 gui: dragRows and dragCards share their scrolling box and listeners
Both carried the same scroll-box search, edge speed and seven listeners
added and taken off by hand. dragScroll and dragListen hold them once;
each drag keeps its own paint, move and finish. No behaviour change.
app.js is 1,097 bytes smaller, room the next commit (fonts in a browser
tab) uses without raising the core budget.

Run on mote with the next commit on top (no drag code in it): the 42
GUI files that drag or arrange (agents, providers, accounts, usage
cards, search units, routing groups/members/rules), Chromium and
WebKit. Their only reds are routing-rule-drag webkit de (#3789) and
usage-agents-hide (#3414), both the same on origin/main b90e81da1 run
alone. go test -tags nogui ./internal/gui ok.
Not tried: dragging by hand in the app.
2026-10-28 08:01:40 +08:00
yetone b90e81da14 gui: on Linux without gst-plugins-good the masking demo shows her poster
On stock Omarchy (Arch + Hyprland, WebKitGTK 2.52.6, GStreamer 1.28.6
with gst-plugins-base and -bad only), opening the masking demo aborted
WebKitWebProcess about three seconds in, so the app's window went blank.
WebKitGTK gives every video, a muted one too, an audio sink it makes with
autoaudiosink ("GStreamer element autoaudiosink not found", then a NULL
g_signal_connect, then SIGABRT); that element is in gst-plugins-good.
canPlayType can't tell: an Ogg Theora copy, "probably" playable there,
crashed the same way, so no other format would do.

The Linux app now looks for libgstautodetect.so in GStreamer's plugin
folders (its variables' and the system's): GStreamer's core there and
autodetect in none of them means no video (webkitPlaysVideo). Settings
state says noVideo then, in the app only (magpie web plays in the user's
own browser), and the demo sets no src: she is her poster and the sheets
move on the frame clock, as when the video can't load. No GStreamer folder
found says nothing, and video stays on.

Run at this head (origin/main 0f053024f + this change; the runs were at
ec6c2de52 + this change, and 0f053024f changes only README and site/):
- mote: node --test masking-demo, masking-records: 110 pass, 0 fail
  (Chromium and WebKit; the new poster test in both).
- magpie-desktop (WSL, Ubuntu 24.04): go test -tags gtk3 -run
  'TestGstAutodetect|TestWebkitDefaults|TestRenderNodeOpens|TestSettings'
  ./internal/gui: ok.
- mote: GOOS=linux CGO_ENABLED=0 go vet -tags gtk3, GOOS=windows go vet
  and go vet of ./internal/gui: ok. gofmt -l: none.
- omarchy, the real check on the real system, from a test binary built
  at this head: webkitPlaysVideo() is false
  ([/usr/lib/gstreamer-1.0 /usr/lib64/gstreamer-1.0]); on magpie-desktop,
  which has gst-plugins-good, true.
- omarchy, WebKitGTK driven from Python on `magpie web`'s page: with the
  demo's webm src set, the web process aborts every time (core dumps
  23:07:33, 23:10:17, 23:12:59, and 23:18:30 with an .ogv); with no src,
  as this change does, it stays up and T runs (2.99 -> 4.39 s).
- Broken by hand: gstAutodetect returning true makes TestGstAutodetect
  red ("stock omarchy: gstAutodetect = true, want false"); demo.js setting
  src regardless makes the poster test red in both engines.

Not tried: clicking the demo row in the real desktop app on omarchy (no
pointer tool there); the app's half was checked through the same
WebKitGTK and the detection through the real folders, separately.
2026-10-28 07:31:02 +08:00
yetone 0f053024f5 README, site: link Apache Magpie and the ASF in the not-affiliated note
Jarek Potiuk (Apache Magpie PMC) suggested linking magpie.apache.org and
apache.org instead of naming them, to avoid any other confusion. Both
READMEs and the site footer (en, zh, ja, de) now link them.

Run: node --test site/*.test.mjs on mote, 45 of 45 pass.
2026-10-28 07:25:32 +08:00
yetone ec6c2de529 LESSONS: a red that kills its package hid 6eb510f78's three reds (#3854)
Evidence on 10-27/10-28: #3632's fatal ended internal/provider before
the TestFetch* tests ran, so 6eb510f78 shipped with -run Codex. With
#3632, #3854, #3906, #3919 and #3924 merged from JoeyWu-tech's patches,
internal/provider passes whole on mote. TestLoopGuard* ok on mote.
2026-10-28 07:11:05 +08:00
JoeyWu-tech ed49d1b38e provider: the shared-list tests count Codex's own ask of the list apart (#3854)
TestFetchAsksASharedBaseOnce, TestFetchAsksOneListOnceForTwoBasesOfIt
and TestFetchUnionsProtocolListsWithoutChat are red on main since
6eb510f78 ("codex: a relay's own Codex entries reach Codex as it gave
them"). Each counts every GET of the models list. For a provider added
by its address (no preset, no account) with a Responses base, 6eb510f78
asks the Responses list once more with client_version (codexEntries),
and says so: "fetchOne asks the same URL once more with client_version
(codexEntries). Only where the list is fetched (add, key change,
Refresh), never per Codex poll." The three tests' providers are such
providers, so each counted that ask as the list asked a second time.
They weren't seen red then: 6eb510f78's whole internal/provider run
crashed in TestUnreadLoginsWriteErrorsKeepCredentials (#3632) first, and
after its rebase provider ran with -run Codex. On CI that crash ends the
package before them (run 40492644859, at e056779a, names none of the
three).

The ask is that change's own, and its TestCodexListedEntry counts it, so
this keeps it and the three tests count it apart: a request carrying
client_version is Codex's, any other is the list. Each still wants the
list itself asked exactly once, what it is there for (#1006 for
TestFetchAsksOneListOnceForTwoBasesOfIt), and now wants Codex's ask once
at most: whether it is made is TestCodexListedEntry's to say. What a
Refresh of such a provider asks is unchanged, its Responses list twice,
the second time as Codex asks it. If that request isn't wanted, it is
codexEntries' to change, and these tests then need nothing.

What was run (tree 7e0975fa, on origin/main e056779a, go1.26.8,
linux/amd64), outside graftcp, umask 077:
- The three, -count=1 -v: red at e056779a as #3854 has them; here 3
  PASS. -race -count=20: ok.
- Broken by hand (restored after):
  - the fetch keeping no record of the lists it asked (a nil
    catalog.Listed, which pays for every list URL again):
    TestFetchAsksASharedBaseOnce ("asked 2 times, want once") and
    TestFetchAsksOneListOnceForTwoBasesOfIt ("the one list fetched 2
    times, want once", "chat and responses fetched the list 2 times,
    want once") red; the third's two lists are on two servers, none
    shared.
  - codexEntries asking Codex's list twice: all three red ("the list
    asked as Codex asks 2 times, want once at most", "asked responses as
    Codex asks 2 times", "asked as Codex asks 2 times").
- internal/provider whole but TestUnreadLoginsWriteErrorsKeepCredentials
  (#3632's crash), Bun 1.4.2: TestCodexAppServersOnHome alone red
  (#3906); at e056779a, that and the three.
- go test -tags nogui -count=1 -timeout 45m ./... outside graftcp, umask
  077, Bun 1.4.2 (log kept): 70 packages ok, 6 red, none in what this
  changes. internal/provider ends at #3632's crash before the three run,
  so the run above without that test is their record. The reds: agent
  TestFolderVarsAreListed (#3884, main's CI red), TestCodexDriftReached
  (#3398), TestInstalledVersion, TestCursorFolderFromTheEditorIsNotTheCLI,
  TestCopilotFolderFromAnIDEPluginIsNotTheCLI, TestOmpDetectedWithPiDir
  and TestZedAppPath (#3141), TestReasonixCLIRequiresSupportedNativeVersion
  and TestReasonixCLIRecoversAfterProbeTimeout (#3641); edit
  TestWriteAtomicReadOnlyHardLink and testenv TestProgram (umask 077,
  #3640); gateway TestPluginToldWhereTheAgentWorks (#3675); gui
  TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie (#3649);
  provider TestCodexAppServersOnHome (#3906), then "close of synctest
  channel from outside bubble" from
  TestUnreadLoginsWriteErrorsKeepCredentials (#3632), both 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).

Merged from JoeyWu-tech's branch, cherry-picked onto origin/main d6c459c79 with the other of #3906/#3854. Run on mote (macOS) at that tree:
- go test ./internal/proc/ ./internal/provider/: ok, both whole (provider's first whole pass since #3632).
- the six tests these two touch, -count=20: ok. Each was red on main before.
- GOOS=linux and GOOS=windows go vet ./internal/proc/ ./internal/provider/: ok.
Not run here: Linux, where #3906 was red; its record is the author's above and the CI run of this push.
2026-10-28 07:10:09 +08:00
JoeyWu-tech 759b3b8c49 proc, provider: the env tests wait for their helper to be running (#3906)
TestEnvOfChild (internal/proc) and TestCodexAppServersOnHome
(internal/provider) are red on Linux since 8b0132b3, on ubuntu CI at
e056779a (run 40492644859): "EnvOf = map[], want map[CODEX_HOME:/sand
box/h/.codex HOME:/sand box/h]" and "HOME's .codex: not counted". Each
starts this test binary as a helper with a HOME (and CODEX_HOME) of its
own, and reads them back (proc.EnvOf, which codexAppHomeIs asks) the
moment cmd.Start returns. On Linux EnvOf reads /proc/<pid>/environ.
Start returns once the exec has put the new program's memory in place,
before the kernel has set where its environment lies in it, and environ
read in that window is empty. On macOS EnvOf runs ps -E, and macOS CI
has neither red.

Each helper now writes "running" to its stdout once its test runs, and
the tests read that line before anything else, as filelock's
TestLockAcrossProcesses waits for "locked". TestEndExitsClean waited
200ms for the same helper before ending it, "so the signal isn't taken
before its handlers"; it waits for the line too.

The wait has a cost the old timing hid. A helper is given no
testenv.Marker, so its TestMain makes a test home of its own in TMPDIR,
and once killed at its test's end it never removes it. At e056779a each
helper was killed before it got that far; waiting for it to run, every
helper would leave its home in the machine's temporary folder. Each
helper's TMPDIR is now a folder of its test's own (t.TempDir), removed
after the helper is ended. The other tests that start this binary again
hand it os.Environ(), testenv.Marker included, and make no home.

Not changed: EnvOf. magpie reads it of the Codex app-servers it finds
running; one read in that window would have no HOME, so codexAppHomeIs
says no and the app-server is left running, not restarted.

What was run (tree d20d0362, on origin/main e056779a, go1.26.8,
linux/amd64, Linux 5.15), outside graftcp, umask 077:
- -count=100 -v: at e056779a TestEnvOfChild red 53 times and
  TestCodexAppServersOnHome 95 (80 at HOME's .codex, 15 at CODEX_HOME),
  TestEndExitsClean never. Here 300 PASS, in a TMPDIR of the run's own,
  with no test home left in it.
- Broken by hand, the helpers' TMPDIR a folder of its own instead of the
  test's, to count what they leave: -count=20 left 20 test homes from
  TestEnvOfChild's helpers and 40 from TestCodexAppServersOnHome's. The
  same at e056779a, without the wait: none, each helper killed before it
  made one. Here: none.
- -race -count=30 over the three: ok.
- The window itself, outside magpie: a Go program starting a child with
  a HOME and reading /proc/<pid>/environ the moment Start returns read
  it empty 510 times in 1000 for /bin/sleep and 58 in 1000 for a
  statically linked Go binary.
- internal/proc whole: ok (at e056779a TestEnvOfChild red).
  internal/provider whole but TestUnreadLoginsWriteErrorsKeepCredentials
  (#3632's crash), Bun 1.4.2: TestCodexAppServersOnHome passes, and
  #3854's three tests are red, as at e056779a.
- go test -tags nogui -count=1 -timeout 45m ./... outside graftcp, umask
  077, Bun 1.4.2 (log kept): 70 packages ok, internal/proc among them,
  and 6 red, none in what this changes. In internal/provider
  TestCodexAppServersOnHome passes before #3632's crash ends the
  package. The reds: agent TestFolderVarsAreListed (#3884, main's CI
  red), TestCodexDriftReached (#3398), TestInstalledVersion,
  TestHowInstalled, 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);
  provider's "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, where TestEndExitsClean wants code 0, and macOS.

Merged from JoeyWu-tech's branch, cherry-picked onto origin/main d6c459c79 with the other of #3906/#3854. Run on mote (macOS) at that tree:
- go test ./internal/proc/ ./internal/provider/: ok, both whole (provider's first whole pass since #3632).
- the six tests these two touch, -count=20: ok. Each was red on main before.
- GOOS=linux and GOOS=windows go vet ./internal/proc/ ./internal/provider/: ok.
Not run here: Linux, where #3906 was red; its record is the author's above and the CI run of this push.
2026-10-28 07:10:09 +08:00
JoeyWu-tech d6c459c79c tui: the agent view's picker test wants codex/gpt-6-luna, from a row (#3919)
TestTUIFetchesSubscriptionModels/agent is red on ubuntu and macOS CI
since c80b32c9 ("agent: a model Codex hides but the user ticked is
offered in Codex's picker"): the picker gives codex/gpt-6-luna where
the test wants gpt-6-luna. The picker is right. The test passed before
c80b32c9 only because nothing matched.

The test signs a ChatGPT account in to Codex and writes no
models_cache.json, so Codex has no list of its own here, and
codexViaMagpieFor offers the models magpie serves on that account,
codex/gpt-5.5 and codex/gpt-6-luna, in Codex's group. Before c80b32c9
those were dropped: at e056779a, once the list is in, the agent view's
whole list is auto/gpt-5.5 and b/gpt-5.5, with no gpt-6-luna row.
Codex's model field takes a value of one's own, and a picker that does
hands back the typed text when no row matches, so choice() gave
"gpt-6-luna", the test's want.

The agent view now wants codex/gpt-6-luna, and every view's last check
also needs a row to match, so typed text can't pass it again. The
other five views' wants were rows already.

What was run (tree bca161d7, on origin/main 791e27ec, go1.26.8,
linux/amd64, Linux 5.15), outside graftcp, umask 077:
- TestTUIFetchesSubscriptionModels -v at 791e27ec: agent red as on CI
  (models_test.go:96: got "codex/gpt-6-luna", want "gpt-6-luna"), the
  other five views pass. Here, with TestTUIAsksAgainForAMissingList,
  -count=3: 24 of 24 PASS.
- The agent view's items before and after the list comes, printed by a
  throwaway test at e056779a and at 791e27ec: the lists above.
- Broken by hand, TestTUIFetchesSubscriptionModels -v:
  - codexViaMagpieFor dropping every codex/ entry, as before c80b32c9:
    agent red (got "gpt-6-luna", want "codex/gpt-6-luna"), the other
    five pass;
  - the same, with the test as on main: all six pass, which is how the
    agent view's missing row went unnoticed;
  - the same, with main's bare want and the row check kept: agent red
    (got "gpt-6-luna", want "gpt-6-luna"), so the row check alone
    catches the typed text.
- 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, and
  internal/tui ok. The reds: agent TestCodexDriftReached (#3398),
  TestInstalledVersion, TestCursorFolderFromTheEditorIsNotTheCLI,
  TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
  TestQoderSettingsFromAnIDEPluginIsNotTheCLI, TestOmpDetectedWithPiDir
  and TestZedAppPath (#3141),
  TestReasonixCLIRequiresSupportedNativeVersion and
  TestReasonixCLIRecoversAfterProbeTimeout (#3641), and
  TestWSLColdPlaceOpensNothing (#3924); davsync TestSync (#3420); edit
  TestWriteAtomicReadOnlyHardLink and testenv TestProgram (umask 077,
  #3640); gateway TestHandedOverGatewayFinishesItsStream (#3568) and
  TestPluginToldWhereTheAgentWorks (#3675); gui
  TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie
  (#3649); provider TestCodexAppServersOnHome (#3906), then "close of
  synctest channel from outside bubble" from
  TestUnreadLoginsWriteErrorsKeepCredentials (#3632).
- 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: macOS, where CI is red too.

Merged from JoeyWu-tech's branch, cherry-picked onto origin/main f13aafa87 together with the other of #3919/#3924. Run on mote at that tree:
- go test ./internal/tui/: ok.
- GOOS=linux and GOOS=windows go vet ./internal/agent/ ./internal/tui/: ok.
2026-10-28 07:06:27 +08:00
JoeyWu-tech 41427e016b agent: a stopped distro's Hermes profiles are never listed (#3924)
TestWSLColdPlaceOpensNothing is red on main since 34d38ed6 ("hermes:
each profile picks its own model on the Agents page"), on ubuntu and
macOS CI too (run 40543233193, at 5a9fb36a). The Hermes builder now
adds a field for each profile but the connected one
(hermesProfileFields), found through hermesOthers and hermesProfiles,
which list <root>/profiles and stat each profile's tombstone and
config.yaml. The builder runs at a stopped distro's place too, so every
/api/state opened that distro's folder, which starts it again (#3896's
class): the test saw the profiles folder opened and work's tombstone
and config.yaml looked at, once per build, twice.

hermesProfiles now lists nothing at a cold place, as hermesActive reads
no active_profile there and dshAt lists no profiles (e54a7d50). A
stopped distro's Hermes row has no Other profiles until the distro
runs again (a value picked on that row starts it, as asleep's Set
does), and the next build lists them. Its other callers (spread,
Sync, Unwire, hermesBack and hermesFollow, through hermesOthers) never
run at a cold place, as the asleep agent has none of them, and now
couldn't list it either.

What was run (tree 43bd70cf, on origin/main 7f0f71a0, go1.26.8,
linux/amd64, Linux 5.15), outside graftcp, umask 077:
- TestWSLColdPlaceOpensNothing -v at 7f0f71a0: red, eight lines: the
  profiles folder opened, profiles/.deleted/work and
  profiles/work/config.yaml (twice) looked at, all of it twice. Here it
  passes.
- go test -run 'TestWSL|Hermes|Profile' -count=3 ./internal/agent: ok,
  372 passes, none failed.
- Broken by hand: the cold check taken out of hermesProfiles:
  TestWSLColdPlaceOpensNothing red with the same eight lines as on
  main.
- 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, and
  TestWSLColdPlaceOpensNothing passes in it. The reds: agent
  TestCodexDriftReached (#3398), TestInstalledVersion,
  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: Windows with a real stopped distro that has Hermes and its
profiles.

Merged from JoeyWu-tech's branch, cherry-picked onto origin/main f13aafa87 together with the other of #3919/#3924. Run on mote at that tree:
- go test -run 'TestWSL|Hermes|Profile' ./internal/agent/: ok. hermes.go put back as on main: TestWSLColdPlaceOpensNothing red.
- GOOS=linux and GOOS=windows go vet ./internal/agent/ ./internal/tui/: ok.
2026-10-28 07:06:27 +08:00
yetone f13aafa87e redact: the masking demo card keeps 14px from the card above it
The page has no gap of its own; the request list keeps its distance from
the card with margin-top: 14px. The demo card, put between them in
cad7bbbdb, had none, so it sat flush under the card above. It gets the
same 14px, and masking-demo checks the room above and below it is 14
and 14.

Run at this head (origin/main cad7bbbdb + this change), on mote:
- node --test masking-demo, masking-records: 108 pass, 0 fail
  (Chromium and WebKit, five languages, 1100 and 640px).
- Broken by hand: without the margin, the new check is red (0 for 14,
  WebKit en 1100px).
2026-10-28 06:56:38 +08:00
yetone cad7bbbdb7 redact: Insights › Masking shows how masking works, with Little Magpie, folded until opened
A card under "What the vendor didn't see" and above the request list
plays a 27s demo: Little Magpie takes one request (a GitHub sign-in with
a password and an email), tears the real values out into her notebook,
pastes placeholders in, sends it, and swaps them back on your computer
when the tool call comes home.

- Folded by default. The video (xq_light/xq_dark.webm, 1.7MB/1.5MB) and
  the stage are built only on the first open, so a folded card fetches
  nothing but its 0:27 thumbnail.
- It plays only while open, on screen, in a visible window and not
  covered by a single record's sheet; it plays once and rests on the
  last step. Under reduced motion it shows the last step, still.
- The stage (request, notebook, browser, provider) is drawn in the page
  and translated in every language (41 keys, zh, zh-TW, ja, de); only
  Little Magpie herself is video. Light and dark takes match the card's
  colour exactly, and the take follows the theme as it changes, still
  playing (a new source starts paused, so it is woken where T is).
- The request and provider boxes keep room for taller fonts: WebKitGTK's
  Noto ran the provider's note 16px past its box. The stage is 1000x420.
- T, the frame clock, is the authority; a video that drifts (a seek
  it couldn't make) is sent back to T, never the other way.

Run at this head (origin/main 4842f69be + this change), on mote (macOS 27):
- node --test masking-demo, masking-records, i18n-keys: 111 pass, 1
  fail. The red is i18n-keys "a plugin's words are its own" on
  plugins/library "Runs as", red on main since 7f827b3b0 (#3897).
- masking-demo: Chromium and WebKit x en/zh/zh-TW/ja/de x 1100/640:
  folded fetches no webm, opening fetches one, the stage fits, no
  English left, nothing wider than the window, every box's text inside
  it (4px to spare in request and provider); plays, stops when folded
  or covered, rests at the end, restarts; dark take on the card colour;
  a theme changed mid-play goes on playing in the new take.
- go test ./internal/gui/: only TestMainWindowCorners/macOS_26_SDK red,
  the same on main (#3949); TestCoreScriptBudget ok.
- gofmt clean (no Go changed); go vet, GOOS=linux go vet -tags nogui,
  GOOS=windows go vet ./internal/gui/ clean.

Broken by hand:
- T following vid.currentTime (the first take): "plays while open" red
  in Chromium (the step 7 seek never stuck); green after.
- pickVid without wake(): the theme test red in both engines (0/2).
- The provider box at 350px: the no-clip check red ("prov -26px").

Whole GUI suite (*.test.cjs, mote, before the rebase, at dc1cfe015 +
this change): 75 files pass, 33 fail; origin/main 9e6347608 alone: 73
pass, 35 fail. Every file red with this change is red on main too:
account-mask (#3951), gateway-caller-keys (#3797), gateway-key-models
(#2648), header-centre (#3479), icon-tile (#3858), library-row-remove
(#3099), menu-input-scroll (#3402), mobile-web (#3952), old-webkit
(#3403), phone-web (#3876), quota-count-wrap (#3404),
quota-refresh-order (#3679).

Real use, magpie web from this tree:
- Windows 11 (xiaomi-gpu), Edge 156 headless = WebView2's engine:
  folded fetches no webm, VP9 "probably"; rAF 60fps, video 30fps, T
  never steps back; the step 7 seek holds; the theme switch keeps
  playing; rests at 27.5s; no page errors; every box fits in all five
  languages (8px or more to spare).
- Linux (WSL2 magpie-desktop, WebKitGTK 2.52.6 under Xvfb, compositing
  off as under Wayland): plays with T on the video's time, seeks, rests
  at the end, no errors. It found the two fixes above: the theme switch
  left the new take paused, and the provider's note ran 16px past its
  box in English and Japanese (and the request box 6px in ja and de). After: 10px or more to
  spare in all five languages.

Not tried: the packaged Linux and Windows apps themselves (magpie web
in their engines stood in); a real request through masking (the demo
is drawn, not live).
2026-10-28 06:43:31 +08:00
JoeyWu-tech 4842f69be5 filememo: a write in a synctest bubble no longer crashes the next test (#3632)
091153bf (#3185) has Forget close the channel Written gives and make the
next one, and de49433f's wake, for another process's write that Watch
sees, does the same. A test that saves inside a synctest bubble writes
through Forget too, and a channel made in a bubble is that bubble's:
the next write from outside it, in another bubble or in none, closing
it is a fatal error. TestUnreadLoginsWriteErrorsKeepCredentials saves
in a bubble per case, so internal/provider's test binary dies in its
second bubble, on CI's ubuntu and macOS runs at 8299409e and 81a58d2f
and still at c158b043 (run 40265917236; a local -run prints the same
frames):

    fatal error: close of synctest channel from outside bubble

    goroutine 6032 [running, synctest bubble 2]:
    github.com/yetone/magpie/internal/filememo.Forget()
    	internal/filememo/filememo.go:91
    github.com/yetone/magpie/internal/provider.Changed()
    	internal/provider/hold.go:146
    github.com/yetone/magpie/internal/provider.writeLogins(...)
    	internal/provider/logins.go:272

Now Written makes the channel when there is none, and Forget and wake
close it only when one was taken, and make none (endWaits). Nothing
changes for the loops: the channel a loop takes is closed by the next
write, magpie's or another process's, and two loops taking it between
writes share one. A write with nothing taken since the last one had no
wait to end. Only the loops that follow magpie's files take it
(middleware's observer, OTel's session watch, pluginrt.KeepFresh,
awake's loop and the agent's Codex daemon check), so every channel is
made outside a bubble, and a bubble's write may close it.

A loop that took Written inside a bubble would make the channel that
bubble's in the same way, and it would outlive the bubble. None does. A
bubble lives only inside a synctest.Test call, and those are all in the
tests of internal/filememo, provider, plugin, otlp and gateway
(TestConcurrentClassification*, its only ones). With a probe in Forget,
wake and Written over those (a bubble's clock starts at 2000-01-01
00:00 UTC), provider's tests write twice in bubbles, filememo's new
test once in each of its four, and nothing takes Written in one.
provider's, plugin's and filememo's test binaries link none of those
five loops, so none of them can; otlp's and gateway's bubbles run an
exporter's send and classify. Written's comment says so.
internal/gateway's claudeRoom closes and remakes its freed channel the
same way, and no bubble reaches it either: #3690.

What was run (tree 8d629438, on origin/main c158b043, go1.26.8,
linux/amd64):
- TestWrittenAcrossBubbles (new), for Forget and for wake, each in
  bubbles of its own: two waits taken outside, two bubbles that each
  write, then a write outside; both waits are closed by the bubbles'
  writes, and the next one by the write after. Broken by hand, each put
  back after: c158b043's filememo.go under it, "fatal error: close of
  synctest channel from outside bubble"; Forget making the next channel
  again, the same; wake as on c158b043 (close, then make), the same, in
  wake's half; Written making a new channel on each call (two loops no
  longer share one), "Forget in a bubble left a wait taken outside it
  open"; endWaits without its nil check, "panic: close of nil channel".
  With the change ok, and -race -shuffle=on -count=20 ok. TestWritten
  and TestWatchWakesOnOthersWrites, unchanged, ok.
- TestUnreadLoginsWriteErrorsKeepCredentials: on c158b043 the fatal
  error in 4 of 4 runs; with the change it and the tests beside it
  (-run '^(TestUnreadLogins|TestReadableLoginsNotKeptAside)') ok at
  -count=20, and internal/provider whole ok with Bun 1.4.2.
- The probe above, not committed (with -v, since go test hides a passing
  package's output), over the tests with bubbles: Forget in a bubble 4,
  two in provider and two in filememo's new test; wake 2, filememo's;
  Written 0. Over the loops' packages (middleware, pluginrt, awake,
  agent), which have no synctest tests: nothing. In that run
  internal/plugin's TestPiPackage was red at its plugins' start
  ("starting plugins: context deadline exceeded"), #2865, and
  internal/agent with tests of #3141, #3398 and #3641; internal/plugin
  was ok in the suite below.
- gofmt -l clean; GOOS=linux, windows and darwin go vet -tags nogui
  ./..., GOOS=windows go vet ./..., GOOS=linux and darwin go build -tags
  nogui ./... and GOOS=windows go build ./...: exit 0 each. go vet and
  go build ./... without a tag on linux stop at pkg-config here (no
  GTK, WebKitGTK or fontconfig headers on this box, exit 1).
- Full suite, outside graftcp (the proxy this box wraps commands in),
  through systemd-run, umask 077, Bun 1.4.2 first on PATH as on CI,
  -timeout 45m, log kept: 66 ok, provider among them, and 6 red, none
  in what this changes:
  - agent TestInstalledVersion,
    TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
    TestQoderSettingsFromAnIDEPluginIsNotTheCLI,
    TestOmpDetectedWithPiDir and TestZedAppPath: #3141;
    TestCodexDriftReached: #3398;
    TestReasonixCLIRequiresSupportedNativeVersion and
    TestReasonixCLIRecoversAfterProbeTimeout: #3641.
  - davsync TestSync: #3420.
  - edit TestWriteAtomicReadOnlyHardLink and testenv TestProgram: this
    box's umask 077, #3640.
  - gateway TestPluginToldWhereTheAgentWorks: this box's /tmp/.git,
    #3675.
  - gui TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie:
    #3649.

Not tried: macOS and Windows, vet and build only here (nothing in the
change depends on the OS; CI's macOS job runs every package's tests, its
Windows job compiles them); an idle `magpie serve`'s wakeups as 091153bf
measured them (the loops take and are woken by the channel at the same
points), and Watch with a second process writing:
TestWatchWakesOnOthersWrites writes the files from the test.

Merged from JoeyWu-tech's fix/3632-filememo-synctest (0576b5893, ggbdpq's
pick on the issue), cherry-picked onto origin/main a1222c539. Run on mote
at this tree:
- go test -race -shuffle=on -count=10 ./internal/filememo/: ok.
- TestWrittenAcrossBubbles with a1222c539's filememo.go put back: fatal
  error: close of synctest channel from outside bubble. With the fix: ok.
- go test ./internal/provider/: no fatal; only #3854's three TestFetch*
  reds are left, the same as on main. internal/awake, middleware, otlp,
  pluginrt (the other Written users): ok. internal/agent -run CodexDaemon: ok.
- GOOS=linux and GOOS=windows go vet ./internal/filememo/ ./internal/agent/: ok.
skygunner's c9e34bbd has the same mechanism and wasn't taken.
2026-10-28 06:32:43 +08:00
yetone a1222c539f LESSONS: a mover's min moves to the code standards (third day), and red issues' patches sat unowned on 10-27
- A plugin version published with no mover min raised was seen on 10-16,
  10-18 (zed 0.1.9) and 10-24 (factory 0.1.38, raised four days later
  in 490c0a4ad). It moves to the code standards' release rules: the min
  is raised the same day the plugin version is published.
- 10-27 is the third day of the #1794 pattern: #3632 (internal/provider
  dies on main since 10-25, two complete patches, no owner), #3919 and
  #3924 (JoeyWu-tech's patches since 10-27) and #3854.

Checked: every mover's min against `npm view --prefer-online` (factory
was the only one behind; grok 0.1.16 was raised two hours after its
publish, cc8e8e3bd, so it is not evidence). #3632 red 2 of 2 on mote at
4b0a32e0f. TestLoopGuard* (reads both docs) ok on mote at this tree.
2026-10-28 06:28:17 +08:00
yetone 490c0a4ad0 provider: Factory's plugin min is 0.1.38 (plugins #349)
npm has @magpie-community/opencode-factory-auth 0.1.38 since 10-24
(plugins b04cca3): the "Standard usage only" plugin option, which stops an
account once its Standard window is used up and moves on to the next. The
mover's min stayed 0.1.37, and keepMovedCurrent only installs min, so no
moved user could get the option.

Run on mote at this tree (origin/main 4b0a32e0f + this line):
- go test ./internal/provider/: red on two filed reds unrelated to the
  mover, #3632 (filememo synctest fatal in
  TestUnreadLoginsWriteErrorsKeepCredentials, 2 of 2) and #3854 (the
  three TestFetch* shared-base tests).
- the same with those four tests skipped: ok (93s).
- GOOS=linux and GOOS=windows go vet ./internal/provider/: ok. gofmt clean.
Not tried: a real Factory account taking the update.
2026-10-28 06:25:42 +08:00
yetone 4b0a32e0f3 site: AIGoCode's two links carry its invite code and a utm tag per place
The owner asked for referral tracking on both. aigocode.net reads no
aff parameter: its attribution takes utm_source (or ref), utm_medium
and the other utm_* from the landing URL, and the referral is the
/invite/<code> path. So /go/aigocode/home and /go/aigocode/readme both
land on /invite/MAGPIE, with utm_source=magpie and utm_medium=home or
readme to tell the places apart.

Run: node --test site/*.test.mjs (45 pass). Both new URLs answer 200.
2026-10-28 06:16:59 +08:00
yetone 9e63476087 gui: on Windows only the window's frame resizes it, not the page's edges (shangyuan0818)
shangyuan0818 on Discord: the top of the page, just under Windows' title
bar, resized the window's height as the frame does. Cause: Wails' page
runtime (drag.ts, v3.0.0-beta.24) arms an edge resize SM_CYSIZEFRAME px
inside the page on every edge whenever the window is resizable on
Windows, framed or not (on Linux only when frameless, never on the Mac),
and posts wails:resize:<edge>, which Go turns into WM_NCLBUTTONDOWN
HTTOP/HTLEFT/... The main window is framed on Windows, so its top, left,
right and bottom page edges all resized it. On the main window, on
Windows only, magpie now turns that switch off once Wails' runtime is
ready (WindowRuntimeReady), wrapped so Wails' own setResizable(true)
right after, or on a reload, keeps it off. The native frame and window
resizability are untouched.

Run:
- Windows 11 box (xiaomi-gpu), sandbox HOME, GOOS=windows builds of
  origin/main dc1cfe015 and of this change, the real WebView2 page driven
  over CDP (mouse move, press, move, release via Input.dispatchMouseEvent,
  chrome.webview.postMessage recorded):
  - main: top (y=1) cursor ns-resize, posts wails:resize:n-resize; left
    posts w-resize; bottom posts s-resize.
  - this change: no resize cursor and no resize message on any of the
    three; the top drags the window as the rest of the header does
    (wails:drag). Hook present after a page reload.
  - native frame on this change, WM_NCHITTEST: frame top 12 (HTTOP),
    left 10, right 11, bottom 15, title bar 2 (HTCAPTION), page top 1
    (HTCLIENT); WM_NCLBUTTONDBLCLK on the caption maximises, restore
    restores.
- TestFrameOnlyResizeStaysOff (node, both orders, hook twice, no runtime).
  Broken by hand (wrapper removed, setResizable(false) only): red on
  "hook before Wails" and "hook twice".
- mote: go test ./internal/gui/ (gui tags), GOOS=windows go vet
  ./internal/gui/, GOOS=linux CGO_ENABLED=0 go vet -tags nogui, gofmt -l.
  Full suite -tags nogui -timeout 45m at dc1cfe015 + this change (which
  is !nogui only, so not compiled there): red TestWSLColdPlaceOpensNothing
  (#3924), TestPluginStreamsPastTheBudgetWait (#3946), internal/provider
  TestUnreadLoginsWriteErrorsKeepCredentials (#3632),
  TestTUIFetchesSubscriptionModels (#3919); all four red on dc1cfe015
  alone. internal/gui: TestMainWindowCorners/macOS_26_SDK red on macOS 27,
  same on dc1cfe015 alone, filed #3949.

macOS and Linux: the hook is registered only when GOOS is windows, and
drag.ts never arms on a framed window there.

Not tried: real mouse drags on the Windows box. A Windows Security dialog
was up over the whole screen, so synthetic clicks went to its dim layer
and the window did not move; the frame was checked by hit test instead.
2026-10-28 05:50:26 +08:00
yetone dc1cfe0156 site: AIGoCode on usemagpie.ai's Sponsored by and in the READMEs
AIGoCode took the home and README seats together (paid, Wise USD).
A fifth home card after SoleAPI, and a logo at the end of the Sponsors
row in README.md and README.zh-CN.md.

The logo is the 1280x368 PNG AIGoCode sent, cropped to its content and
scaled to 640x170. Its blue and purple mark sits on transparency and
reads on white, #1c1c1e and GitHub's #0d1117, so one copy serves both
themes. The en and zh taglines are AIGoCode's own; ja and de are
translated from them.

/go/aigocode/home sends the browser to https://www.aigocode.net/ and
/go/aigocode/readme to https://www.aigocode.net/invite/MAGPIE, the link
AIGoCode gave for the README (first top-up bonus).

Not tried: AIGoCode's API in a real agent. The owner chose to go live
without a test key; neither seat puts AIGoCode in the app.

Run: node --test site/*.test.mjs (45 pass). Logo rendered on light and
dark backgrounds and looked at.
2026-10-28 05:02:45 +08:00
yetone 88466f8bf2 provider: a ChatGPT account whose usage read says OpenAI signed it out reads as signed out, with Sign in again (charliepu on Discord)
charliepu (#general): a ChatGPT account sometimes shows no allowance;
OpenAI had signed it out, and it needed signing in again. The row said
nothing of that. 86b2f4d05 (#1793) marks a revoked sign-in, but only
from a gateway request: the usage read never reached it. /wham/usage
answering 401 token_revoked ("invalidated oauth token") was taken as a
bare "Unauthorized", with no refresh tried, and the refused refresh of
the account Codex is signed in to said "run codex login" on the
allowance line and nothing on the row.

Now, in the usage read (loginQuota -> codexSignInRead):
- a 401 with revokedWords is refreshed once, as a token_expired one
  already was (codexWindowsRenewing); a refresh that goes through is
  read again and marks nothing;
- the refreshed token turned away the same (revoked, or still called
  expired) is codexSignInGone, and the account is marked revoked for
  that token (markRevoked, split out of NoteRevokedSignIn);
- Codex's own account's refused refresh marks it the same; a saved
  account's refused refresh is savedRefreshFailed's lapse, as before;
- a read that goes through clears a mark (ServedSignIn);
- a plain 401, a 403, a 5xx or a network error is unknown and marks
  nothing, with no refresh.
The row's existing Sign-in required / Sign in again (revoked-signin-
account) then shows. Sign in again runs magpie's own sign-in for that
account (addLogin), which replaces its tokens, in Codex's auth.json too
when Codex is signed in to it; no second account is added.
No GUI change: the row reads l.lapsed, which this now sets.
docs/subsystems/providers-accounts.md updated.

What was run (mote, sandbox HOME per test, fake usage and token servers;
no live ~/.codex or Keychain):
- go test provider: new TestCodexUsageRevokedRefreshedFirst,
  TestCodexUsageRevokedSignedOutTillSignedInAgain (refused refresh, both
  rows signed out, the gateway would pass over the token, signed in
  again through addLogin: same two accounts, auth.json replaced, mark
  gone, read works), TestCodexUsageRevokedAfterRefreshSignedOut,
  TestCodexUsageOtherFailuresMarkNobody (plain 401, 403, 502, network);
  TestCodexUsageExpiredOnce updated (Codex's own refused refresh and a
  still-expired refreshed token now say sign in again); the #1793 and
  #2973 tests pass.
- Broken by hand, each red: codexSignInRead skipped (3 tests red), the
  revoked case dropped from the renew condition (3 red), the
  ServedSignIn clear dropped (AfterRefresh red).
- GUI (Chromium + WebKit, every language the files cover, en and zh
  included): revoked-signin-account, codex-*, signin-*, usage-accounts*:
  583 of 583 pass.
- gofmt; go vet provider darwin/linux/windows; go build darwin,
  linux and windows (nogui).
- go test -tags nogui -timeout 45m ./... at 82299480a (this change on
  7f32f0ec9): every package ok but agent, gateway, gui, tui and
  provider. Each red fails the same at a fresh origin/main f6ed2c99b
  (ran there alone), and each is filed: TestWSLColdPlaceOpensNothing
  #3924, TestPluginStreamsPastTheBudgetWait #3946,
  TestRestartHandsTheGatewayOver #3451, TestTUIFetchesSubscriptionModels
  #3919, provider's synctest crash in TestUnreadLoginsWriteErrorsKeep-
  Credentials #3632. With that test skipped, provider at the rebased
  head f6ed2c99b+1: only TestFetchAsksASharedBaseOnce and its two
  siblings red, the same on f6ed2c99b (#3854); cli ok.

Not tried: a real revoked ChatGPT account (none to hand); the words are
#1793's revokedWords, taken from real replies there. The Codex card's own line
(codexSubscriptionUsage) still says "codex login"; the account row is
where Sign in again is. The TUI has no per-account allowance rows;
`magpie accounts` already prints Lapsed, now for Codex's own too.
2026-10-28 05:02:12 +08:00
yetone f6ed2c99bc effort: a vendor's light and extra_high are low and xhigh, in dsh, Pi and the gateway
nianshou5 (Discord) runs Trae's DeepSeek V4.1 Flash through the Our Free
Model plugin (github:mu-zi-lee/magpie-our-free-model). Its variants are
Trae's own names, light, high and extra_high, and dsh offered only
default and high: dshModelLevels (and Pi's piThinkingLevels) matched a
model's efforts to pi-ai's level names only, so light and extra_high
were dropped. The gateway dropped them too: effortOf read "light" as no
effort, and NearestEffort fitted an agent's low or xhigh to the plugin's
high.

catalog.EffortAliases names light as low and extra_high as xhigh
(EffortLevel). NearestEffort places a model's levels by the level they
name and returns the model's own word; the gateway's effortOf reads an
alias as its level. dsh's reasoningEfforts and Pi's thinkingLevelMap map
dsh's low/xhigh to the model's own word (modelEffort), which llm-pi-ai
sends on the wire as written (resolveModelReasoning in dsh-llm-pi-ai
reads each value as "the spelling dispatch sends"). Levels a user kept
are untouched: only the names a model lists are mapped.

Tests: TestDshOffersTraeNamedLevels (agent), TestNearestEffortTakesVendorWords
(catalog), TestPluginThinkingOff's new fake-trae subtests (gateway, a
real plugin host with the fake plugin listing light/high/extra_high).
Broken by hand: modelEffort without the alias, dsh levels [high] (the
report's picker); NearestEffort without EffortLevel, low/xhigh sent as
high; effortOf without the alias, light/extra_high sent as nothing.

Run on mote at this tree (base e4ccf67b1): go build, GOOS=linux and
GOOS=windows go vet -tags nogui ./... ok; go test -tags nogui -timeout 45m
./... : 73 packages ok, three red that are red the same on origin/main
7f32f0ec9 run alone: internal/agent TestWSLColdPlaceOpensNothing (#3924),
internal/tui TestTUIFetchesSubscriptionModels (#3919), internal/provider
synctest crash in TestUnreadLoginsWriteErrorsKeepCredentials (#3632), so
the rest of internal/provider didn't run. No GUI file changed.
Rebased on 7f32f0ec9 (one agent file changed there): go build ./...,
internal/catalog whole and gateway/agent -run Effort|Dsh|Pi|ThinkingOff|Level
ok at this head.

Not tried: a real dsh session against the user's plugin (no Our Free
Model account here); dsh's parsing of a non-pi-ai wire value was read
from its source, not run.
2026-10-28 04:34:45 +08:00
yetone c752082e47 gateway: a turn's thinking goes back to Qoder's plugin; qoder min 0.2.42
uk.jent on Discord: Qoder dropped the model's earlier thinking. Qoder.app's
own client sends reasoning_content on every earlier assistant turn, and the
Qoder plugin left it out from its first version on; 0.2.42 sends it.
An Anthropic- or Responses-speaking agent's thinking reached the plugin
only when chatReplaysReasoning held, so qoder and qoder-cn are added
beside Command Code's plugin; a tool turn with no thinking gets the same
" " DeepSeek gets, which 0.2.42 reads as none. The qoder mover min is
0.2.42 (npm view --prefer-online: 0.2.42).

Run (mote): go build ./..., go vet -tags nogui on gateway and provider,
go test -tags nogui -timeout 45m ./internal/gateway/ (ok, 535s) and
./internal/provider/, which crashes in TestUnreadLoginsWriteErrorsKeepCredentials
on "close of synctest channel from outside bubble", #3632, open and not
this change. TestPluginStreamsPastTheBudgetWait, run alone, was red 2 of
3 with this change and 3 of 4 on clean dc1af8231 (connection reset by
peer, #3946). Real account, plugin side: DeepSeek-V4-Pro on Qoder recalls
a codeword its thinking before a tool call named with 0.2.42, not 0.2.41.

Broken by hand: TestCommandCodePluginReasoning with qoder and qoder-cn
added is red on the old chatReplaysReasoning (no reasoning_content).

Not tried: a Claude Code session through magpie onto Qoder end to end;
Qoder CN.
2026-10-28 04:32:30 +08:00
yetone 7f32f0ec93 i18n: ja's Keep on ChatGPT line names {agent} once, as en does
c54478904 gave ja's Keep on ChatGPT sentence {agent} twice; en has it
once, so gui-ja's placeholder check was red on main since. The second is
now そのアプリ (that app).

Run (mote): node --test gui-ja, gui-zh-tw, gui-de: 9 pass, 0 fail
(gui-ja red before on origin/main e4ccf67b1).
2026-10-28 04:18:21 +08:00
yetone 73fb77e1d0 sessions: a session's title keeps its room in a narrow Sessions list
cybercaius (Discord, Windows app, zh): at a narrow window a session row's
title shrank to one character ("7") while its tokens, cost and buttons
kept their width. The page's 560px media queries look at the viewport, not
at the list beside the sidebar, so they never fired.

.sm-tree is now a size container. Under 700px the token count goes and
the row gaps tighten; under 600px the row wraps: the title takes the
first line and the cost and buttons sit right-aligned on the second.

New sessions-row-narrow.test.cjs (zh title, tokens, cost, resume,
terminal, carry, delete; widths 1100 to 360): the title keeps at least
min(140px, 35% of the row) and ellipsizes, and nothing passes the row's
edge. Red before at every width up to 720 (title 0 to 100px); green
after in chromium and webkit, en and zh, on mote.
Not tried: the real Windows app (WebView2); Chromium covers its engine.
2026-10-28 04:18:21 +08:00
yetone 3e22123c9c usage: a deleted provider's calls stay apart from a new one under its id
cybercaius (Discord): after deleting a provider and adding a new one
that took the same id, the old provider's usage showed under the new one.

Delete now records the provider in providers.json ("deleted": id, name,
icon, when, its Was and Gave). UsageRenames gives a deleted id to
<id>~<when> only once something reuses it (a live provider, a later
deleted record, or a later Was), so a deleted provider nobody replaced
keeps its raw id and the existing probe/usage tests stay as they were.
/api/usage's provider faces name a deleted id from its record and set
Named.deleted; the Usage provider picker notes "Deleted {date}" (zh, zh-TW,
ja, de translated). Old deletes, made before this, have no record and
stay merged: nothing tells their calls apart now.

Run (mote): go test -tags nogui -run 'Deleted|Rename|NotSetUp|Probe'
./internal/usage ./internal/usageapi ./internal/provider ok; gofmt -l
clean; go vet -tags nogui ok.
Broken by hand: dropping the f.Deleted append turns
TestDeletedProviderKeepsItsCallsFromOneAddedUnderItsID and
TestDeletedProviderListedApartAndMarked red; restored, green.
Not tried: a real delete-and-re-add in the GUI app.
2026-10-28 04:18:21 +08:00
yetone 19fafad16f provider: a test holds a plugin model and a group of it to one window (#3654)
mycf_711 (#3654) saw loomy/DeepSeek-V4.1-Flash told 1000000 (the "*"
window typed on the provider) and its group told 1048576 (the plugin's
declaration), and dsh then sent two histories in one request.

On main the member's entry is already the typed window (WindowOf, since
#2112 and 7aad6a50e), and buildGroupEntries reads that entry, so a group
of it that names no size is told 1000000 too. This test holds that. A
group told more than one member is told is a group with a larger member
in it (#700/#712), which is by design.

The doubling itself was not reproduced: in a sandbox HOME, dsh
0.2.1-rc.2 against a fake server, with the window flipped 1000000 <->
1048576 on resume, live (reload on and off), mid-request, after a
compaction, and with the model id flipped between a group and its
member, every request grew by its own two messages only. dsh builds a
request from session.deriveMessages() alone; a window change only adds a
request/context event.

Run (mote): go test -tags nogui -run
'TestGroupOfAPluginModelToldTheWindowSetOnIt|TestPluginModelWindow'
./internal/provider ok.
Not broken by hand: the test passes on main as it was; it guards, it
doesn't fix. Not tried: dsh's desktop/web profile, and the reporter's
own group (its other members).
2026-10-28 04:18:21 +08:00
yetone 8fff54dab7 routing: a group in a group left on Smart is routed as the outer one (#3847)
mycf_711 (#3847): an outer group set to Free first held a group whose
routing was left blank (Smart); the inner group's free seat was tried
after its paid one, as if Free first stopped at the inner group.

provider.Group.Within: in membersOff's walk, a nested group with no
routing of its own takes the outer group's when the outer one pools its
members (Smart, Free first, Fastest, ... ; not In order, By weight or
Manual, which try each member whole by its own order, #576). A group
that sets a routing keeps it. The gateway, the trace's Subs and the
Routing page all read membersOff, so they agree; GROUP_NEST's help
sentence says so (zh, zh-TW, ja, de).

Run (mote): go test -tags nogui -run 'FreeFirst|Group' ./internal/gateway
./internal/provider ok; GOOS=linux and GOOS=windows go vet -tags nogui
on both packages ok; go build -tags nogui ./... ok; gofmt -l clean.
Broken by hand: without the Within call
TestFreeFirstReachesAGroupInItLeftOnTheDefault is red (paid seat first),
green with it.
Not tried: the reporter's own groups in the real app.
2026-10-28 04:18:21 +08:00
yetone e4ccf67b11 plugin: GitHub's search gets 60s a page, and a mirror is asked without the token (#3923)
MYCF711 (#3923) measured a page of GitHub's search from mainland China:
29-36s straight to api.github.com, 3-7s through gh-proxy. The Plugins
page's GitHub list was empty there, for two reasons:

- askTagged's taggedWait (8s) bounded the search pages as well as the
  wait for the repositories' reads. The first page timed out, the ask
  failed whole, and nothing was cached. Each search page now has its own
  taggedSearch (60s). taggedWait starts after the search and bounds only
  the reads, as before. Through a mirror, candidateContext gives the
  official address half of the 60s and the mirror the rest.
- source.Do never used a mirror for a request carrying Authorization,
  and ghtoken sets it on every api.github.com request when a GitHub
  token is set. With a token in Settings, MAGPIE_MIRRORS did nothing.
  A request to a GitHub host whose only credential is Authorization
  (bare) now goes to the official address with the token and to the
  mirror without it. A cookie, a key header, a token in the query, URL
  userinfo, or any other host still keeps the request official. The
  caller's request keeps its header.
- ghtoken.Do now reads who answered from resp.Request: a mirror's answer
  to the bare request doesn't count as carrying the token, and a 401 from
  a mirror doesn't mark the token refused.

Tests:
- TestTaggedReposSlowSearch: a search answering after 3x taggedWait
  still lists; one that never answers fails at taggedSearch.
- TestDoKeepsCredentialsOfficial, rewritten to the new contract: the
  official address gets the token, the mirror gets none, and the
  caller's request is unchanged. Cookie, query token and npm still stay
  official.
- TestMirrorAnswerIsNotTheToken (ghtoken).

Run on mote:
- go test -tags nogui -count=1 ./internal/source ./internal/ghtoken
  ./internal/plugin ./internal/library: all ok.
- Broken by hand: with the old source.go, ghtoken.go and github.go, all
  three tests went red ("requests = [https://api.github.com/repos/o/r]";
  "token=true"; "context deadline exceeded" at taggedWait).
- Locally: gofmt -l clean; go vet for linux and windows on the three
  packages; go build -tags nogui ./...

Not tried:
- The real network from mainland China.
- A live gh-proxy answer to an anonymous api.github.com search.
- Not changed: the mirror for api.github.com still waits for
  MAGPIE_MIRRORS. Without it, the 60s alone covers the ~30s page.
- No GUI file was run: the page's fixtures fake /api/plugins/github, and
  nothing in the window changed.

Reported by MYCF711.
2026-10-28 03:57:51 +08:00
yetone dc1af8231b ghtoken: a Settings token GitHub refuses is said, and requests go without one (#3926)
A GitHub token in Settings → Network and sharing that GitHub refused
(401, expired or revoked) failed every plugin and skill check, so a
stale token was worse than none. Now it is treated as an environment
token already was: the request is asked again without it, the token
isn't sent again while magpie runs or until the field changes, and the
anonymous answer (60 an hour) is the one taken. This overturns the
package comment and TestSettingsTokenRefusedStaysAnError: the token
being the user's choice is a reason to tell them, not to fail the
check.

The page stays honest about it:
- Settings › Network and sharing still shows the token, masked, with
  Remove, and says in red that GitHub refused it and requests go
  without one until it is replaced (/api/settings githubTokenRefused).
  Before, a refused token simply read as none being set.
- After a Settings token's refusal requests go anonymous, not with
  GITHUB_TOKEN/GH_TOKEN: the user put the Settings one ahead of those,
  and the page says "without one".

Patch by MYCF711 (fix/settings-token-fallback, 7d93f1b5): the ghtoken
change and its tests. Changed from it: the notice is in Settings' row,
where the token lives, instead of the patch's Plugins page note,
which cost ~630 bytes of core script the budget (28 bytes of room at
c54478904) doesn't have; the Library's skill checks reach Settings'
row too. Token() doesn't fall through to the environment; the
library's skill check test (the sibling the patch left red) expects
the anonymous answer; the unreachable new Refused() message is
dropped (Refused's "where" now holds for a refused Settings token).
app.js stays in its budget by shortening renderGitHubToken's comment.

Run at this tree (base c54478904), on mote:
- go test -tags nogui ./internal/ghtoken ./internal/plugin
  ./internal/library ./internal/gui: ok (TestCoreScriptBudget
  included; no budget raised). GOOS=linux and windows go vet, go build
  ./...: clean.
- github-token-refused.test.cjs (new; chromium and webkit, en and zh,
  1000 and 440px): red 8 of 8 against origin/main's assets, green
  with the change. With github-token and i18n-keys: 21 of 22; the red
  is i18n-keys "a plugin's words are its own" ("Runs as"), red at
  origin/main 74dcf40aa alone too (#3897).
- Every GUI file that opens Settings › Network and sharing
  (allow-ips, api-key-theme, bare-ids, browser-access, cors-origins,
  gateway-port, lan-docker, proxy-test, settings-proxy-auth,
  settings-proxy-remember): 126 of 126.
- Broken by hand: Token() falling through to GITHUB_TOKEN after the
  Settings token's refusal turns TestSettingsTokenRefusedGoesWithoutEnvToken
  red; MYCF711 showed TestSettingsTokenRefusedAskedAgainWithout red with
  from == "settings" back in Do.

Not tried: a real revoked token against api.github.com. The Plugins and
Library pages have no notice of their own (Settings' row says it).
2026-10-28 03:50:46 +08:00
yetone c544789047 agent, gui: the Codex takeover names browser use and offers Keep on ChatGPT
eddie.zhan on Discord (10-27): once Codex's allowance ran out, magpie
took it over and "many features stop working, browser use is blocked,
the agent says it has no permission".

Cause, from openai/codex 5a361b5: under the takeover magpie is Codex's
model provider without requires_openai_auth, so app-server's
getAuthStatus hands the app no auth token. The Codex app's Chrome
control needs that token, so browser use is off till the reset, with
cloud tasks, the usage meter and Log out. Image generation (actor
authorization header) and web search (provider default) stay. Bringing
requires_openai_auth back would bring back the greyed Send the takeover
exists to avoid, so it can't be kept by config.

The off switch existed (sign-in > Always ChatGPT, `magpie codex login
chatgpt`) but nothing under the takeover pointed to it. The default is
kept; the opened Codex row's takeover note now names browser use and has
a Keep on ChatGPT button (login=chatgpt) on its own line. In every
language.

Also fixed: Always ChatGPT picked while Codex was taken over on one of
its own models left model_provider = "magpie" for good. set now puts it
back on the sign-in as Join leaves it.

Run (on mote, at this tree):
- go test ./internal/agent ./internal/gui: ok except
  TestWSLColdPlaceOpensNothing (#3924) and TestMainWindowCorners/macOS_26
  (#2645), both red on origin/main f2b4b9894 too.
- TestCoreScriptBudget ok; app.js 1,310,432 under 1,310,460, not raised.
- GUI codex-app-out, codex-signin-always, i18n-keys in chromium and
  webkit at 980 and 440, every language: 95 pass, 1 red is #3897
  (i18n-keys plugin words, red on main).
- gofmt -l clean; go vet darwin, linux (nogui), windows on internal/agent
  and internal/gui.
Broken by hand: TestCodexOwnModelOutThenKeptOnChatGPT red on the old
set (model_provider = "magpie" left); codex-app-out red with origin's
app.js/i18n.js (no browser use in the note).
Not tried: the real Codex app, a real used-up account, the Windows box
and the Linux app.
2026-10-28 03:36:13 +08:00
yetone 74dcf40aac provider: WorkBuddy's mover asks plugin 0.1.40, which sends the current desktop client's headers
WorkBuddy accounts used through magpie are being restricted, and a report
on X says WorkBuddy changed how it checks request-header fingerprints.
The plugin sent WorkBuddy/5.5.6 as its User-Agent and IDE version. Each
build's current desktop app (China 5.9.3 with CLI 2.165.0, WorkBuddy AI
5.8.4 with CLI 2.161.0, read from their update feeds, never run) sends
"WorkBuddy/<app> <appName>/<app> CLI/<cli>", the app's version as
X-IDE-Version, X-Agent-Type on both builds, X-Agent-Runtime: local-agent
on 5.9, and the OpenAI SDK's X-Stainless-* headers. Plugin 0.1.40
(magpie-community/plugins b2fe48e) sends them; npm view --prefer-online
gives 0.1.40. keepMovedCurrent brings every moved user up to it.

Run at a42d90d7d plus this change, on mote:
go test ./internal/provider/ -count=1 -timeout 45m: crashes in
TestUnreadLoginsWriteErrorsKeepCredentials (filememo synctest close,
#3632, open). With that test skipped, three fetch tests fail
(TestFetchAsksOneListOnceForTwoBasesOfIt,
TestFetchUnionsProtocolListsWithoutChat, TestFetchAsksASharedBaseOnce);
they fail the same with this change stashed at a42d90d7d (#3854, open).
gofmt -l clean; GOOS=linux go vet ./internal/provider clean.
Not tried: a real WorkBuddy account's chat with plugin 0.1.40, and the
full go test ./... suite.
2026-10-28 03:31:14 +08:00
yetone f2b4b98948 routing: a pool's account list is the name's tooltip, not the row's (#3785)
renderPools set the account list (p.who) as the title of the whole
.rt-pool row, so the Routing and Stays segment buttons, which carry no
title of their own, inherited it: hovering either showed the account
names instead of nothing about the button. The title now sits on the
name cell (nm.title), the element that names what the accounts are
behind. The text is unchanged.

Patch by skygunner (fix/3785-pool-tooltip, a5f315a3), with only the
code comment reworded; MYCF711 found the bug and withdrew their own
copy for this one.

Run at this commit's tree (base a42d90d7d), on mote:
- routing-pool-tooltip.test.cjs (new): red 4 of 4 with client.js put
  back to origin/main ("the row itself carries no tooltip"), green 4 of
  4 with the change, chromium and webkit, en and zh.
- Every GUI file whose fixtures draw a pool row: rate-limited-sink,
  routing-manual, routing-js, routing-time-went, routing-mode-goes,
  routing-pool-tooltip, routing-steady, routing-weight-chip,
  stays-strict: 118 of 122. The 4 reds are routing-manual's webkit
  cases (#3409) and routing-steady's two (#3412); both files fail the
  same 4 at origin/main a42d90d7d run alone.

Not tried: the other ~160 GUI files that open the Routing page (the
change touches only the pool row's title); a real hover in the app.
2026-10-28 03:24:02 +08:00
ggbdpqandfactory-droid[bot] c2e3a057e9 provider: a pool's weekly window is reminded of its renewal too, as the alerts tell of it
What changed:
- dueReminders skipped every aside window, so an Antigravity account's
  pool weekly ones ("Gemini · 7 days", aside since g.pools began) were
  never reminded of their renewal, though #523 told the usage alerts of
  exactly those: toldAside is that exemption now, shared by both, so a
  week that renews with much of it left is said, and the pools' 5-hour
  asides and the rest stay untold (a 5-hour window renews too often to
  be news, #720).

Run:
- TestDueRemindersPoolWeekly is new: on the old condition it fails with
  "got []", the account's 7-day pool at 40% renewing in 20h saying
  nothing; with the change it is told once, its 5-hour pool still says
  nothing, and a nearly spent week still does. TestDueAlertsPoolWindows
  and TestDueReminders pass unchanged.
- go test -tags nogui -count=1 ./internal/provider passes; gofmt -l is
  clean; go vet -tags nogui passes on darwin and GOOS=linux and
  GOOS=windows; the three platforms' builds pass.

Reported by gua2100 (ggbdpq) on GitHub, #2197; the patch is theirs.

Run at this head on mote (review):
- go test -tags nogui -count=1 ./internal/provider ok, with the known
  reds #3632 (TestUnreadLoginsWriteErrorsKeepCredentials) and #3854
  (three TestFetch* tests) skipped.
- go vet -tags nogui ./internal/provider on darwin, GOOS=linux and
  GOOS=windows clean; gofmt -l clean.

Broken by hand: with dueReminders' condition put back to `w.Aside ||`,
TestDueRemindersPoolWeekly fails with "got []".

Not tried: a real Antigravity account's notification; a full
go test ./....

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-10-28 03:23:41 +08:00
yetone a42d90d7de usage: a test holds every Bedrock maker models.dev lists (#2199)
ggbdpq's change before this one adds xai, writer, moonshot and nvidia
to vendorDot, with six pairs read off the catalog. This test reads all
200 amazon-bedrock ids from models.dev's list of today (kept in
testdata) and checks that each one answered by its own name, or by
maker.name, is no swap. A maker the list gains later and vendorDot
lacks fails here once the testdata is refreshed. The four makers are
the only ones missing today: the list's makers are amazon, anthropic,
deepseek, google, meta, minimax, mistral, moonshot, moonshotai,
nvidia, openai, qwen, writer, xai and zai.

Reported by gua2100 (ggbdpq) on GitHub.

Run (on mote):
- go test -tags nogui -count=1 ./internal/usage ok.
- go test -tags nogui -count=1 -run 'Bedrock|Swapped|Served|RelayRenamed|Rename'
  ./internal/gateway ok.
- go vet -tags nogui of both packages on darwin, GOOS=linux and
  GOOS=windows clean; gofmt -l clean.

Broken by hand: with origin/main's served.go put back, this test fails
on 21 pairs (xai 10, writer 6, nvidia 4, moonshot 1), and
TestBedrockProfileAnsweredByItsModelIsNoSwap fails on ggbdpq's rows.

Not tried: a real Bedrock account; a full go test ./....
2026-10-28 03:17:14 +08:00
ggbdpq c2d6a64c7d usage: a Bedrock model of a newer maker answered by its own name is no swap
What changed:

vendorDot names Bedrock's makers so a reply saying the model's own id
reads as the model asked for (012be0fc, #1484). models.dev's bedrock
list has since grown makers the list did not have: xAI (xai.grok-4.7,
us.xai.grok-4.6), Writer (us.writer.palmyra-x5-v1:0), Moonshot
(moonshot.kimi-k2-thinking) and NVIDIA (nvidia.nemotron-nano-12b-v2).
A request sent as the geography.maker id and answered by the model's own
name was marked swapped — the route, its tries and the usage row — as if
the vendor had served another model. vendorDot takes the four makers
too, moonshotai kept before moonshot, so moonshotai.kimi-k3 strips
whole. Another model is still a swap (global.xai.grok-4.7 answered as
grok-4.6, us.writer.palmyra-x5-v1:0 as palmyra-x4).

Run:

- The new rows of TestBedrockProfileAnsweredByItsModelIsNoSwap fail on
  the old served.go, each with Swapped true where the model's own name
  answered (six pairs); with the change they pass, the two
  still-a-swap guards stay true, and the route and usage row of the
  anthropic run through the Bedrock preset stay unmarked.
- go test -tags nogui -count=1 ./internal/usage ok.
- go test -tags nogui -count=1 -run 'Bedrock|Swapped|Served|RelayRenamed|Rename'
  ./internal/gateway ok.
- gofmt -l clean; go vet -tags nogui of both packages on darwin,
  GOOS=linux -tags nogui and GOOS=windows clean.
- go build darwin, GOOS=linux -tags nogui, GOOS=windows ok.

Not tried: a real Bedrock account on xAI, Writer, Moonshot or NVIDIA
models; the pairs are read off models.dev's bedrock list of today.

Generated-by: GLM-5.3-Flash (ZCode)
2026-10-28 03:14:05 +08:00
ggbdpq eaa71168a2 import: OpenCode's ids for vendors magpie has a preset at the same address come in on it (#2405)
openCodePresets held 19 of OpenCode's provider ids. 15 more are at the
address of a magpie preset, and the import picker listed each as
skipped, "it has no base URL", which isn't so: zhipuai, zai, alibaba,
alibaba-cn, minimax, modelscope, kilo, cline-pass, kimi-code-plan-cn,
kimi-code-plan-global, stepfun-step-plan, stepfun-ai-step-plan,
volcengine-coding-plan, alibaba-token-plan-cn and tencent-token-plan.
Each now comes in on its preset, the way openai's key does.

Left out, where auth.json says nothing to pick a region by: the coding
plan ids of Zhipu, Z.ai, MiniMax and Tencent, the pay-as-you-go ids of
plan-first presets (stepfun, stepfun-ai, volcengine), and the Xiaomi
MiMo token plans, served by a plugin now.

Patch by ggbdpq (Discord gua2100), as posted in #2405. Review: each of
the 15 targets' default endpoints was printed from Preset() at this
tree and matches the host models.dev gives the id (zhipu and zai
default to the pay-as-you-go paas/v4, volcengine to api/coding/v3,
stepfun and stepfun-cn to step_plan, tencent-cloud to plan/v3), so no
key is sent to a host OpenCode wouldn't send it to. No preset added.

Run (sandbox HOME, at origin/main f8cd964ae plus this; the touched tests again on mote after the rebase):
- go test -tags nogui -run OpenCode ./internal/provider/: ok
- Broken by hand: import_opencode.go put back to origin/main, test
  kept: TestImportOpenCodeVendorPresets FAIL, 15 lines "skipped: it has
  no base URL". Restored: ok.
- go test -tags nogui ./internal/provider/ with the known main reds
  skipped (#3632 TestUnreadLoginsWriteErrorsKeepCredentials, #3854
  TestFetchAsksASharedBaseOnce and two siblings): ok.
- gofmt -l internal/provider: clean. go vet ./internal/provider/ on
  darwin, GOOS=windows, GOOS=linux: ok.
Not tried: a real OpenCode auth.json with these vendors' keys, a
request on each imported provider, the GUI import picker; go test
./... (one suite per machine).
2026-10-28 03:10:46 +08:00
yetone f8cd964aec plugin: a fetch past the host's 128 streams waits for one, not a local 502 (#3890)
The plugin host holds streamBudget/streamWindow = 128 streaming calls'
windows. begin(true) failed the 129th at once with errTooManyCalls, before
anything reached the plugin child, and the gateway counted it as a 502
try and sent the request again. The reporter's 192 concurrent MiniMax
streams through one plugin all came back 200, but over 298 local 502
tries that never reached MiniMax (65 requests retried).

Fetch now takes its window through beginStream: when all 128 are held
it waits for one to come free, outside h.mu (the transition that frees
one takes it), while its request's context lives, the host is up, and
for streamWait (1 minute) at most, past which it is errTooManyCalls as
before. RPCs keep their reserve and still never wait; begin(false) and
begin(true) are unchanged for their other callers.

Tests:
- TestHostFetchWaitsForAStreamWindow (internal/plugin): one window;
  a second fetch waits, runs once the first is released, gives up on
  a cancelled context and after streamWait, and leaves no window taken.
- TestPluginStreamsPastTheBudgetWait (internal/gateway, new file): 192
  concurrent streams through the real Bun plugin host to a local vendor
  that holds each open until 128 are live. Every request is 200 on one
  try, the vendor sees 192 requests and never more than 128 at once.

Run at this head (on ff7048dec):
- gofmt -l internal/plugin internal/gateway: clean
- go vet -tags nogui ./internal/plugin/ ./internal/gateway/ for GOOS
  linux, windows, darwin: ok
- go test -timeout 45m ./internal/plugin/: ok (99.0s, before the rebase
  over two usage/provider commits that don't touch plugin or gateway)
- go test -timeout 45m -run Plugin ./internal/gateway/: ok (52.0s, same)
- After the rebase: TestHostFetchWaitsForAStreamWindow,
  TestHostAdmission*, TestPluginStreamsPastTheBudgetWait: ok
- Broken by hand (beginStream returning errTooManyCalls at once, as
  begin did): TestHostFetchWaitsForAStreamWindow fails ("want it
  waiting"); TestPluginStreamsPastTheBudgetWait fails with 960 lines
  of "a try 502 too many plugin calls are in flight".
- Real account: a sandbox HOME with only the ZCode plugin and its
  account, this head's build on 127.0.0.1:3581, 8 concurrent streaming
  zcode/GLM-5.3-Flash requests: 8 of 8 200, each with its [DONE].

Not tried: 192 real concurrent streams against a vendor (the reporter's
MiniMax setup); the full gateway package (only its Plugin tests).
2026-10-28 00:58:50 +08:00
ggbdpq ff7048dece provider: a Command Code plan key's Credits window renews at the plan's period end (#2454)
#2451 drew a plan key's month of credits as a Credits meter beside the
5-hour and weekly windows. Those two say when they start again; the
Credits one said nothing, though cmdKeyPlanID already asks
billing/subscriptions for the plan id and threw its currentPeriodEnd
away. cmdKeyPlanID now keeps the period end beside the plan id (cached
the same ten minutes, and the pair read before kept while the endpoint
can't be read), and cmdQuotaOf puts it on the Credits window's
ResetsAt. No new request. The signed-in subscription's card is the
plugin's since be62bcf79; the plugin sets the same reset from
commandcode-auth 0.1.13.

Patch by ggbdpq (Discord gua2100), as rebased in #2454. Added in
review: a period end already past is dropped, so a pair kept while the
endpoint fails, or a renewal its reply doesn't show yet, never puts a
reset in the past on the card; the test has a case for it.

Run (sandbox HOME, at origin/main 85b45b4d7 plus this):
- go test -tags nogui -run 'CommandCode|KeyQuotas' ./internal/provider/: ok
- Broken by hand: ResetsAt: until taken out -> "the key card's credits
  have no reset" (ResetsAt nil); the past-end guard taken out -> "the
  key card's credits reset in the past". Each restored: ok.
- go test -tags nogui ./internal/provider/: two known reds on main,
  both filed and both red at 85b45b4d7 without this change:
  TestUnreadLoginsWriteErrorsKeepCredentials crashes the binary (#3632),
  and with it skipped the rest pass except TestFetchAsksASharedBaseOnce
  and two siblings (#3854).
- gofmt -l internal/provider: clean. go vet ./internal/provider/ on
  darwin, GOOS=windows, GOOS=linux: ok.
Not tried: a real Command Code plan key (none here), the GUI card, a
period that renews while the card is open; go test ./... (one suite per
machine). The key card only learns the period end when billing/credits
leaves the plan id out, which is what it does today; if it starts
sending the plan id, the reset is not read.
2026-10-28 00:58:06 +08:00
ggbdpq 85b45b4d71 usage: a window's dollar whole prices the model the reply named (#2488)
The ledger prices a call whose own id has no price as the model the
reply named (Served, #1498). A window's whole priced through apiPricer,
which looked only at Record.Model, so one such call in a window had no
API price, the window counted as unpriced and its dollar whole was left
out while its tokens stayed. apiPricer now tries Served through the same
chain (maker, the provider's list, Same as) when the asked id has none.
The asked id keeps its own price when it has one; a price the user set
or a rate still never enters the whole. Past cycles use the same
apiPricer and take it too.

Patch by ggbdpq (Discord gua2100), as posted in #2488. Review: the
pricer is a closure built once per query with its own cache, keyed now
on (provider, model, served); no shared or stateful call added. The
only conflict on current main was the test file, where the Antigravity pools test
(TestWindowHoldsReckonsAntigravityPools) landed in the same spot; both
tests are kept.

Run (sandbox HOME, at this tree on origin/main 02cbdf5bd):
- go test -tags nogui -count=1 ./internal/usage/: ok
- Broken by hand: window_holds.go put back to origin/main, test kept:
  TestHoldsPriceTheModelTheReplyNamed FAIL "the model the reply named
  wasn't its API price: <nil>". Restored: ok.
- gofmt -l internal/usage: clean. go vet ./internal/usage/ on darwin,
  GOOS=windows, GOOS=linux: ok.
Not tried: the GUI's Usage page with a real relay account whose reply
names another model; go test ./... (one suite per machine).
2026-10-28 00:51:58 +08:00
yetone 02cbdf5bdc pii: pf-serve-vulkan keeps the engine's 4096-token MoE chunk; 2048 was slower (#3682)
7279bdc28 gave pf-serve-vulkan PF_MOE_CHUNK=2048 on the strength of a
1.77x speed-up yunwang2442-creator measured on an RX 470 (Windows,
Vulkan). Their re-test on 0.1.1696 found that number came from runs
hours apart: the same version read the same 480 KB text in 67s at 07:44
and 128-135s after 16:00. Interleaved A/B in one session, same text,
4096 was faster every time:
  96 KB in pieces  2048 25.4-25.8s   4096 24.0-24.2s
  24 KB in pieces  2048 6.2-6.5s     4096 6.0s
  96 KB whole      2048 36.1-36.7s   4096 32.7-33.8s
  480 KB whole     2048 175.6s       4096 161.6s
with the same spans either way. On Metal 2048 was ~6% slower already
(7279bdc28's own numbers). So no pf-serve gets a PF_MOE_CHUNK from
magpie now; one the user set is still inherited through os.Environ,
as before.

moeChunk and vulkanMoEChunk are gone. TestVulkanServeGetsMoEChunk is
now TestServeKeepsMoEChunkUnlessUserSets: pf-serve-vulkan sees no
PF_MOE_CHUNK, and a user's 3072 reaches both.
docs/subsystems/gateway-routing.md says the same.

Run at this head (on 90258cf20):
- gofmt -l internal/pii: clean
- go vet -tags nogui ./internal/pii/ for GOOS linux, windows, darwin: ok
- go test -timeout 45m ./internal/pii/: ok (25.2s)
- Broken by hand: with HEAD's serve.go and the new test,
  TestServeKeepsMoEChunkUnlessUserSets/vulkan fails ("moechunk
  pf-serve-vulkan 2048", want no value); green with this serve.go.

Not tried: a Vulkan GPU here (none on this machine); the numbers above
are the reporter's, from their RX 470. Other GPUs aren't measured;
PF_MOE_CHUNK stays the override for one where 2048 is faster.
2026-10-28 00:50:09 +08:00
ggbdpq 90258cf20a agent: a Codex in a WSL distro stands in for a model it names from its own config.toml (#2198)
StandIn("codex", …) read this machine's ~/.codex/config.toml alone, so a
Codex wired in a WSL distro (model_provider = "magpie", the only shape a
distro under NAT is wired in since #2145) naming a model magpie doesn't
serve (codex -m <unserved>) was answered 404, where this machine's Codex
goes to its config's model and a Claude Code in the same distro goes to
the stand-in its settings name (wslClaudeStandIn, #254). On Windows, when
this machine's Codex names none, StandIn now asks wslCodexStandIn: the
first distro running now whose config.toml has magpie as its provider,
read as codexStandIn reads it. The collecting of running distros the
probe found a kind in is shared with wslClaudeStandIn (wslReady); a
stopped distro is never opened. Off Windows nothing changes.

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

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

Not tried: a real Codex in a real WSL distro naming an unserved model
(the distros are fakes, on the Windows box too); a Windows Codex wired to
another model still wins over the distro's, as for Claude Code; the full
./... suite (one suite per machine, others running).
2026-10-28 00:47:44 +08:00
yetoneandggbdpq 7f0f71a0ef gateway: a refused or empty-failed Codex relay's call carries its route (#2481)
The Routing page's "Request and response" finds a request's call by its
route (RouteCall). Of codexUpstreamOn's three record exits only the
success one set Call.Route, so a turn whose API key OpenAI refused (401)
or that the backend failed with nothing said opened as "the request is
gone" though its call was one of the last 40. Both failure exits now
carry the route through routeOf, which is 0 for a compaction: both exits
are reached by /responses/compact too, where no route opens.

Reported with a patch by ggbdpq (gua2100 on Discord). The patch set
Route: tr.ID unguarded on the empty-failure exit; since the
outrageous_piglet change that exit also takes a compaction, where tr is
nil, so that line panics on a compaction failed with an empty body.
routeOf guards both exits. gui-shell.md says which Codex exits carry
the route.

Run (sandbox HOME, caches pinned):
- TestCodexKeyRefusedCarriesItsRoute, TestCodexEmptyFailureCarriesItsRoute
  (ggbdpq's, the asserts moved into routeHasItsCall) and the new
  TestCodexCompactEmptyFailureRecordsNoRoute: ok.
- Broken by hand: with both exits back to no Route, the first two fail
  "route N: no call in the ring, so Request and response says the
  request is gone"; with the patch's unguarded tr.ID on the empty exit,
  the compaction test panics (nil pointer dereference). Restored: ok.
- go test -tags nogui -run 'TestCodex|TestRouting|TestArchive|TestRouteCall'
  ./internal/gateway: ok (31s).
- gofmt -l clean; go vet darwin, GOOS=windows, GOOS=linux -tags nogui on
  ./internal/gateway: clean.

Not tried: a real OpenAI 401 or a real empty ChatGPT backend failure
(fake upstreams); the GUI's routing-bodies test (the GUI is unchanged);
the full ./... suite (one suite per machine, others running).

Co-authored-by: ggbdpq <ggbdpq@gmail.com>
2026-10-28 00:41:37 +08:00