Commit Graph
2589 Commits
Author SHA1 Message Date
yetone 167f133166 gui: each of a provider's several keys has a Copy button on its row (#1480, IamMiao)
With one key, the provider editor has an API key field whose Show
reveals the key to copy. With more than one the field is gone and the
key rows had no way to copy a key, as IamMiao reported.

Each key's row now has the same Copy button the app uses elsewhere
(copy icon, tick on success, "<key name> copied"). It asks
provider/key for that row's key: the route takes the key's id in
"account" (as accountmodels already does) and answers through the new
provider.KeyOf, the first key included; without it, the provider's
first key as before; an id it has not is an error, never another key.
The route stays where Show's was, so nothing new is reachable.

Tests:
- gui TestEachKeyCopiesItsOwn: three keys, each row's id answers its
  own key, none answers the first, an unknown id fails.
- key-copy.test.cjs: every row has Copy; team-b's and the off key's
  copy their own key (asked with that id, /api/copy gets it), say so,
  open no rename and move nothing; rows fit 420px. Red on origin/main
  (no button) in all four; passes in Chromium and WebKit, en and zh,
  420 and 900px. No new strings ("Copy", "{what} copied" exist in all
  languages).

Run: go test -tags nogui ./internal/provider/ ./internal/gui/ (ok),
gofmt -l clean.
2026-10-10 20:00:38 +08:00
yetone 690bc352f2 gui, provider: a Codex reset spent on Usage shows at once in the Providers editor and in routing (#1491, isdou)
isdou spent a reset on the Usage page: Usage showed the windows at 100%
left and 2 resets, while the Providers editor still said the week was
used up with 3 resets, and Routing said the account's allowance was
unknown and sent requests on to the next account.

Two reasons, one per page:
- The Providers editor reads each account's windows itself
  (loginUsageOf, /api/login/usage) and keeps the reading a minute in
  the page. askReset reloaded Usage's quotas only. It now drops the
  editor's Codex reading too, and re-renders an open editor.
- UseCodexReset forgets the account's allowance (renewedNow), so until
  the next background reading routing had no windows for it: weighed as
  not known, behind the others, and a reading already out, begun before
  the reset, is dropped for it too. The codex-reset handler now waits
  (up to 10s) for provider.AwaitAllowance, which has the accounts read
  again and asks once more when a reading begun before the reset lands,
  so by the time the page hears "reset", routing knows the windows
  started again, and /api/login/usage has the new reading cached.

Tests:
- provider TestResetAllowanceKnownAtOnce: a fake reader, the reset
  spent with no reading out and with one out (held in the fake until
  after renewedNow). Red with AwaitAllowance a no-op (not known), and
  red with it asking one reading only (the in-flight case).
- reset-providers.test.cjs: Providers editor opened (3 resets), reset
  on Usage, editor opened again: says 2. Red on origin/main's app.js
  ("still says 3 resets", login/usage not asked again) in all four;
  passes in Chromium and WebKit, en and zh, 420 and 1000px.

Run: go test -tags nogui ./internal/provider/ ./internal/gui/ (ok),
-race -count=20 on the new provider test, gofmt -l clean.
2026-10-10 20:00:38 +08:00
yetone ad136426d2 gui: the context window's 400 cells and other entrance animations let go of their layers once played (#1481, hoffman24)
hoffman24's macOS app had a WebKit WebContent process over 1GB, 866MB of
it IOSurface graphics buffers for ~1,600 compositing layers. One clear
cause is ours: entrance animations played with fill "both" stay in effect
for good once finished, and an element with a finished transform/opacity
animation held keeps its compositing layer. The context window card's
waffle is 400 cells, each with ctx-cell (opacity + scale) and fill both,
so every card on Routing kept 400 layers alive.

Every one of these keyframes only says where the element starts (from),
or ends where its own style already is, so "backwards" draws the same
before and during the animation and lets go after:
- context.css: ctx-cell (waffle cells), ctx-grow (cache bar), ctx-arc
  (ring), ctx-draw (tune chart), ctx-pop (tune dots)
- library.css: lib-skel-in, .mk-card content-in (a market card's hover
  lift now shows too: the held animation overrode its transform)
- routing.css: .masking .pii rtpii

Measured on Routing with one context card (origin/main assets vs these):
- document.getAnimations(): 412 -> 13 (WebKit), 412 -> 15 (Chromium)
- Chromium CDP LayerTree: 421 layers -> 21

held-animations.test.cjs opens Routing with three traced requests,
waits for the cells to finish and asserts no finished animation is held
and the card looks the same (every cell opacity 1, no transform, cache
bar grown). It fails on origin/main ('ctx-cell': 400 held) in all four
cases and passes here: Chromium and WebKit at 420 and 1100px.

Run: the GUI tests touching ctx-/mk-card/lib-skel/masking/Routing/
Library (116 files): Chromium 576/576, WebKit 574/576. The two are one
case of routing-pointer-pin.test.cjs, whose card moved 588.56 -> 590px
under the full run's load; alone and 4-up it passed 3/3 and 36/36 here,
and 12/12 on origin/main's assets 4-up. Filed with the purpose-filter
WebKit 1px drift.
2026-10-10 20:00:38 +08:00
yetone 88bcced27e agents: a folder holding only logs, debug, diagnostics or cache left by an uninstalled agent no longer shows it as installed (#1495, v5tech)
v5tech's `magpie ls` listed six agents that were uninstalled, found by
the folders they left. agentDir already set aside a folder holding only
skills/ (made by skill installers); it now also sets aside the folders an
agent writes as it runs rather than as it is set up: logs, log, debug,
diagnostics and cache, as folders only (a file of that name still counts).

This machine has the same case: WorkBuddy.app is installed, the CodeBuddy
CLI isn't, and ~/.codebuddy holds only logs/ and diagnostics/ (dated from
WorkBuddy's install), so CodeBuddy Code showed as installed.

Not changed, and why: the reporter's Option A (count only the agent's
Path) would hide every freshly installed agent whose Path is the file
magpie itself writes (WorkBuddy's and CodeBuddy's models.json), and
~/.copilot/config.json or a QWEN.md is the agent's own file either way, so
those stay detected. The GUI already folds agents with nothing set under
Not set up and can hide one; `magpie ls` puts hidden ones last, dimmed.

TestWorkBuddyAIWritesItsOwnFolder's fixture had only logs/ and now holds
argv.json and device-id as well, as the China build's ~/.workbuddy does
(fixed up in the #1494 commit).

Run: TestLeftoverFoldersAreNotInstalled (codebuddy logs+diagnostics, qwen
debug, hermes cache+log+skills, a file named logs) red on the old agentDir
(3/3 subtests), green now; go test ./internal/agent; a sandbox HOME
`magpie ls` with ~/.codebuddy/{logs,diagnostics} and ~/.qwen/debug lists
nothing, and with ~/.qwen/QWEN.md lists Qwen Code. gofmt -l and
GOOS=linux/windows go vet clean.
2026-10-10 19:55:29 +08:00
yetone f3fa5a53ce usage: a relay's rename answered under the model's own name is not marked as another model swapped in (#1498, liuweifeng)
relay-a/moonshot-kimi-k3 answered as kimi-k3 was marked swapped in the
ledger, the CSV and the Routing trace, though it is the model asked for
under the relay's own name. The same held for #1383's
claude-deepseek-v4.1-flash answered as deepseek-v4.1-flash.

RelayRenamed: sent is served's own name (after bareModel, separators
squashed) with a relay's word and a hyphen in front; Swapped no longer
counts it, and a row kept marked swapped is read back as not swapped, as
SameSpelled rows are. What is left must have a digit and a letter, so a
bare word ("flash", "mini") is never taken for the model sent; another
version behind a relay's word (kimi-k2) is still a swap, and so is the
reverse (kimi-k3 answered as moonshot-kimi-k3).

Run: TestSwappedIgnoresARelaysRename, TestKeptRowRelayRenamedNotSwapped
(both red with RelayRenamed forced false), go test -tags nogui
./internal/usage, gateway tests. Sandbox magpie with the reporter's
record: `usage --csv` swapped false (true before). gofmt -l,
GOOS=linux/windows go vet clean.
2026-10-10 19:55:29 +08:00
yetone 34a6576cc4 usage: a relay-renamed model with no price is counted at the price of the model its reply said answered (#1498, liuweifeng)
A relay that sells kimi-k3 as moonshot-kimi-k3 answers as kimi-k3, and the
record keeps that as served, but the ledger priced only Record.Model, so
every such call showed "no price" and counted $0 although
relay-a/kimi-k3 has one ($3/$15, cache $0.3/$3 from models.dev).

pricer (which the ledger, the request page, sessions totals, OTel and
NewCoster all use) now falls back to EffectivePriceIn(provider, served)
when the model asked for has no price. The model asked for keeps its own
price whenever it has one, a zero set by the user included, so a ledger
that matched a vendor's bill still does; the served name is only used
where there was nothing. The cache key includes served. Documented
beside `magpie model price` in docs/reference.md.

Run: TestLedgerPricesARenamedModelAsTheOneServed (the reporter's record
byte for byte: priced at $0.0916398; a priced model keeps its own; a
user's 0 stays 0; a model priced by neither name stays unpriced), red on
the old pricer; go test -tags nogui ./internal/usage. Built magpie in a
sandbox HOME with the real models.dev cache and a relay-a custom
provider, the reporter's record in usage.jsonl: `magpie usage today`
shows "≈$0.092" where the old build shows "no price", and `usage --csv`
cost_usd 0.091640. gofmt -l, GOOS=linux/windows go vet clean.
2026-10-10 19:55:29 +08:00
yetone 5fb75d26cf agents: WorkBuddy AI, the international build, gets magpie's models in its own ~/.workbuddy-ai/models.json (#1494, ysicing)
WorkBuddy AI (www.workbuddy.ai, bundle com.workbuddy.workbuddy-ai) keeps
its data in ~/.workbuddy-ai: its cli/product.json sets dataFolderName
".workbuddy-ai", and the custom-models reader (getUserConfigPath in
5.6.2's app.asar) takes ~/<dataFolderName>/models.json when
WORKBUDDY_CONFIG_DIR isn't set. magpie only wrote ~/.workbuddy/models.json,
the China build's, so the reporter's WorkBuddy AI never listed magpie's
models although magpie said it was wired.

WorkBuddy AI is now its own agent, workbuddy-ai, built from the same code
as WorkBuddy (workbuddyBuild): its models.json in ~/.workbuddy-ai, a bare
list as WorkBuddy writes one, under its own key (magpie-workbuddy-ai).
WORKBUDDY_CONFIG_DIR stays WorkBuddy's, so the two rows never write one
file. Its MCP servers and skills go to its own folder too (library target),
and the library's "trust it in WorkBuddy" note names WorkBuddy AI when a
server is given to it. README agent lists and docs/reference.md list it.

Run: go test -tags nogui ./internal/agent ./internal/library
./internal/usage ./internal/gateway (sandbox HOME); new
TestWorkBuddyAIWritesItsOwnFolder (writes ~/.workbuddy-ai only, China
file untouched, env var ignored); GUI library-workbuddy-trust in Chromium
and WebKit, en/zh/zh-TW/ja/de, red on the old library.js for the
WorkBuddy AI case. A built magpie in a sandbox HOME lists "WorkBuddy AI
~/.workbuddy-ai/models.json", and `magpie workbuddy-ai provider magpie`
wrote deepseek/deepseek-chat there with key magpie-workbuddy-ai and no
~/.workbuddy. Not tried in the WorkBuddy AI app itself (needs a signed-in
account); the path is read from the installed 5.6.2's own code. gofmt -l,
GOOS=linux/windows go vet clean.
2026-10-10 19:55:29 +08:00
yetone 027ed37cec gui: a provider's models have Working only once tested, which unpicks every pick that didn't answer (H20)
H20 on Discord: after Test models many of a provider's picks turn out not
to answer, and each had to be unticked by hand. Beside Select all, Select
none and Free only, the model picker now has Working only (只选可用). It
is in the row only once a test has answered (Test models, or a chip's
right-click test). A click unpicks every pick whose last test failed and
keeps those that answered and those not tested (a model picked after the
test, or one never asked): nothing says an untested one doesn't work, and
its title says so. With none picked, the served list Test models asked
stands in for the picks. The status line says how many were unpicked, and
the button is off, its title saying why, while no tested pick failed.
Staged in the draft like the other bulk actions; the Save sends it.

Strings in zh, zh-TW, ja and de.

Run:
- models-works-only.test.cjs (new): Chromium and WebKit, en and zh, at
  900px and 420px: 8/8 pass. Not offered before a test; after one it sits
  last in the row styled as Select all; the click leaves exactly the
  answered and untested picks, says "Unpicked 2 models…", turns off, and
  moves neither the page nor the button; no border stripes; the Save sends
  those picks.
- Fails without the change: with app.js from origin/main it times out
  waiting for Working only; with untested picks dropped too
  (!got[id]?.ok) it fails "the failed picks unpicked, the rest kept".
- Whole GUI suite (incl. gui-zh-tw, gui-ja, gui-de, i18n-keys),
  concurrency 6: chromium 2513/2520, webkit 2503/2512. The failing files
  rerun alone: azure-endpoint passes 3/3 (red only under load), the rest
  pass except mobile-web, whose usage desktop screenshots fail the same
  with origin/main's assets (unrelated to this change).
- go test -tags nogui ./internal/gui under a temp HOME: ok; GOOS=linux
  and GOOS=windows go vet -tags nogui ./internal/gui: ok.
2026-10-10 19:53:15 +08:00
yetone 69c47c9e57 library, gui: the Library page is drawn at once from a glance, and the agents' own skills and out-of-date copies come in after it (#541)
Even with the memo, the first read after skills change still reads
them through, and before this the page showed only its outline until
the whole read was done (0day404, #541: minutes on Windows).

library.Glance (GET /api/library?glance=1) is the view without
FoundSkills and the skills' Behind, marked partial. The page asks for it
first, draws it, then asks for the whole read. The Skills tab shows "In
your agents · Looking through the agents' skill folders…" (aria-busy)
until the whole read comes. The other tabs aren't drawn again for it. A
whole read that a change answered first is dropped (take() counts the
answers), so it never draws an older library over a newer one.

Read now runs behind and foundSkills after letting go of the library
lock, so a change doesn't wait on them either.

New strings in zh, zh-TW, ja and de. docs/subsystems/library.md
describes the memo and the glance.

Tests:
- TestGlanceLeavesOutTheAgentsSkills (Go).
- library-loading.test.cjs: drawn from the glance, the wait row, then
  the found skill, with reads glance then read. Chromium and WebKit, 980
  and 420px. Red on the old library.js.

Run: go test -tags nogui ./internal/library ./internal/gui; node --test
for library-*.test.cjs, skill*.test.cjs, gui-ja, gui-de and i18n-keys in
both engines; gofmt; vet on darwin, linux and windows.
2026-10-10 19:53:02 +08:00
yetone 3a80ce7fa0 library: reading the Library page no longer reads every byte of the agents' skills each time; a folder unchanged since the last read isn't opened again (#541)
0day404 (#541, Windows): the Library page spins for minutes each time it
is opened. The page waits on GET /api/library, and library.Read, under
the library lock, compared every skill an agent has of its own with the
same name in each other agent byte by byte (foundSkills -> sameTree ->
sameFile) and hashed every library skill given as a copy (behind ->
libHash -> hashDir). Skills with node_modules or templates, given to
several agents, are hundreds of MB per read; on Windows each file opened
is scanned.

What sameTree and hashFiles found is now kept against a stamp of the
folders: each file's and link's path, type, size and mtime (stamper in
treememo.go). The walk that compares or hashes a folder stamps it as it
goes, before opening a file, so a folder seen for the first time is
walked once, as before; a later read walks it without opening a file, and
while the stamps match, the answer is reused. In foundSkills a skill held
by several agents is walked once per read, not once per pair.

What is never taken as unchanged:
- a folder that can't be walked, or a file in it that can't be read
  (compareTrees and sameFile now say whether they read everything): it is
  unknown, not the same, and compared again next time;
- a folder with a file written in the last 3s (a rewrite within a file
  system's time granularity can keep size and mtime);
- any change of a file's size or mtime, or a file added or removed.
A rewrite that keeps both size and mtime (cp -p of a same-size file) is
not seen, as with rsync's quick check. .git, .DS_Store and magpie's mark
aren't part of a stamp, as they aren't part of the compare. hashFiles'
hashes are byte-for-byte what they were (they are kept in library.json
and each copy's mark).

Measured on the Windows box (Windows 11 x64, test binary, 20 library
skills given as copies to 4 agents and 40 own skills in 3 agents, each
300 files of 8KB under node_modules), library.Read:
  before:  5.5-6.3s every read
  after:   5.0s the first read after start, then 2.0s
(Glance, the next commit, is 80ms.) The Mac was under load average ~118
from other work, so its timings weren't comparable.

Tests:
- TestPageReadDoesntReadUnchangedSkillsAgain: aged folders, the second
  read finds codex's copy the same with its files made unreadable; an
  edit afterwards is read again and found to differ.
- TestJustWrittenSkillIsReadAgain: a folder written a moment ago isn't
  taken from the memo.
- TestUnreadableSkillIsntRememberedAsDifferent (scripts/run.sh made
  unreadable; SKILL.md unreadable leaves the skill unlisted).
- TestEditedLibrarySkillIsHashedAgain: a library skill edited to the same
  size and aged an hour after a read: its copies are behind.
- TestHashUnchangedByTheMemo: hashFiles' value for files, a link,
  .DS_Store and .git; passes on the old code too.
Broken by hand, each goes red: stamp without mtime (PageRead,
EditedLibrarySkill), memo never hit (PageRead), unsure compares kept
(Unreadable), unsettled folders kept (JustWritten).

Run: go test -tags nogui ./internal/library ./internal/gui (macOS); the
library package's tests on the Windows box; gofmt; vet on darwin, linux
and windows.
2026-10-10 19:53:02 +08:00
yetone e280624a12 gui tests: skill-update-edited presses a dialog's button once the dialog has stopped moving, so the press no longer lands beside Update
The test presses with page.mouse at the button's bounding box. A dialog
opened again right after Keep mine comes in with a 570ms spring, so the
box read mid-animation is not where the button is a moment later, and
the press missed Update: no post was sent and the dialog stayed open.
It failed 1 to 4 of its 10 cases per run on origin/main (494dedcf) in
Chromium, every run.

press() now waits until no animation under #modal is running before it
reads the box.

Run: node --test internal/gui/tests/skill-update-edited.test.cjs, 6 runs
with the page as it is and 3 with 494dedcf's library.js, Chromium and
WebKit, en and zh, 860 and 400px: all 10 pass each time.
2026-10-10 19:53:02 +08:00
yetone d67a482908 provider: a Trae CN claim answered 9074 is final for the day and says to check in in the Trae CN app (#808)
When /status says the check-in is on and today's isn't in, and /claim
answers 9074 「当前参与用户太多,请稍后再试」, the check-in is now saved
with a new outcome, own-app, instead of failed. Like every answer other
than failed it settles the Beijing day: the loop doesn't claim again
after the 30-minute retry, and Check in now isn't offered (a press
wouldn't claim either). The next day is asked as before.

Why: Trae CN pays check-in credits only to a device registered through
its own device-register service and security SDK. The plugin's device id
isn't, so 9074 is permanent for it; across ~5 days on #808 no retry ever
succeeded, and repeated claims from an unknown device may read as abuse.

What the user sees, in en/zh/zh-TW/ja/de: the Usage card's check-in row
and the Settings "Daily check-in" line say "Trae CN only gives check-in
credits to its own app; check in in the Trae CN app" (zh: Trae CN 只给自己的
客户端发签到积分,请在 Trae CN App 里签到), with Trae's own message in the
tooltip. The TUI and `magpie accounts checkin` say the same.

Unchanged: 9074 on /status (before any claim) and every other code keep
their handling; WorkBuddy, MiniMax, Qoder and plugin check-ins untouched.
docs/subsystems/provider-plugins.md describes it.

Run:
- TestTraeCheckin9074IsOwnAppOnly with trae_checkin.go at HEAD fails:
  "same day, soon=false, asked again after 9074: [POST /status POST
  /claim]"; with the change it passes.
- usage-checkin.test.cjs new case on old app.js fails (row said "Check-in
  failed; magpie tries again later · 当前参与用户太多…"); with the change all
  28 pass in Chromium and WebKit, en and zh. plugin-checkin 16/16,
  i18n-keys, gui-ja, gui-de, gui-zh-tw pass.
- go test -tags nogui ./internal/provider ./internal/gui ./internal/tui .
  under a sandbox HOME: ok.
- gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui on the
  touched packages: clean.
- Not tried against a real Trae CN account (none here); the 9074 bytes
  are the reporter's from #808.
2026-10-10 19:50:16 +08:00
yetone 3d7acfb40f routing: the mode chip leads to where the routing is set, and a lone key names none
xczzhh on X: "这个路由策略能自己选吗,我的一直是smart,也改不了好像". The
Routing page's hub chip and the Accounts and keys heading said Smart for
every provider, even one with a single key on, where there is nothing to
route, and nothing on the page said where it changes.

Now, where routing can be changed (a group, or a provider listed in
/api/groups' pools: two or more accounts or keys on), the chip and the
heading are .rt-go controls (goTo/goRouting): a click or Enter brings the
group's card or the provider's row under Several accounts or keys into
view via scrollOnPurpose, marks it (rt-found, off under reduced motion)
and focuses its routing picker. A provider with one on names no routing,
and the mode paragraph says to turn on a second in the provider's editor
(LONE, in zh, zh-TW, ja and de). The header is drawn again when the
groups arrive (headOf).

routing-weight-chip's fixture now lists its two-key relay in pools, as
/api/groups does.

Run: routing-mode-goes.test.cjs 40/40 (chromium+webkit, en/zh/zh-TW/ja/de,
1100px and 420px); all 20 chromium cases fail on the old routing.js. All
routing-*, quota-pool*, rate-limited-sink, panel-routing, click-scroll,
view-scrollbar-drag and i18n-keys tests pass (group-fold, keys-fold,
flood and context-fold failed only under a 6-way parallel full run and
pass alone, as on main). go test -tags nogui ./internal/gui ok.
2026-10-10 19:49:14 +08:00
yetone e70e7ed46a routing: a routing group is made from a template in one click, of the user's own models: hard turns to the strongest and easy ones to a cheap one, cheap first, or never stuck
Making a group took the whole editor (owner, 10-10). Three templates are
made from the models the user has (provider.Templates, grouptemplate.go):

- smart (smart-split): an ordered group of the strongest model and a cheap
  one; a classifier sends a hard turn to the strong one and an easy turn or
  a compaction to the cheap one, images to a model that sees them. The
  classifier is the decision API when there is one, else the cheapest
  priced model that doesn't reason.
- thrifty (cheap-first): two cheap models of different providers, then the
  strongest, which also takes high reasoning.
- steady (never-stuck): the strongest model of up to three providers, each
  failing over to the next.

A model weighs by its maker's list price, else its provider's, else by its
id's size words; one over $100 a million output tokens is never picked. A
template that can't be made says what is missing. AddTemplate saves it
under a name and id no group has (freeGroupName, now shared with
CopyGroup), never over one.

GUI: before the user has a group of their own, the Routing page shows the
templates as cards (models, Add, Edit first); after, a Templates menu by
New group. CLI: `magpie group template [kind] [name]`, no args to list.
Pricing goes through priceOf with the served entry's provider, so
/api/groups pays ~75ms for templates on 203 models, not ~600ms.

Run, at this head rebased on origin/main 4e584faa: go test ./... green;
gofmt -l clean; go vet on darwin, GOOS=linux -tags nogui and GOOS=windows.
GUI: group-template.test.cjs and group-duplicate.test.cjs (Chromium and
WebKit, 5 languages, 420px) 30/30, the template test 3 runs in a row; it
skips WebKit's "ResizeObserver loop" notice as two other tests do. The
group-*/routing-* GUI tests ran before the rebase: 628/635, the 7 being
WebKit flights in routing-group-fold and routing-keys-fold, one Chromium
routing-proxy, and the ResizeObserver notice above; run alone at this head,
routing-proxy passes and the two fold files pass twice on WebKit, as on
origin/main. Real data in a sandbox HOME: `magpie web` on 3561, the
Templates menu added smart-split as GPT-6.1 Sol → GPT-6 Luna with 3 rules.
No real request was routed through the new group.
2026-10-10 19:46:58 +08:00
yetone ac79966a6d agent, gateway: Claude Code knows a relay's claude-opus-4.6 as Opus 4.6, not the retired Opus 4 (misteer_ti.)
Claude Code 2.1.296 parses a Claude model id whose version has a dot
(relay/claude-opus-4.6-us[1m], as many relays name them) as Claude Opus
4: it warns the model is retired, asks with max_tokens 32000 and offers
no effort. The same id with dashes (relay/claude-opus-4-6-us) is Opus
4.6 to it: max_tokens 64000, adaptive thinking, effort.

What changed:
- provider/claudedash.go: ClaudeDashed (a Claude-family version's dots
  to dashes; other vendors' ids untouched), ClaudeSpelled (dashed only
  when that spelling comes back to exactly this served id), and
  ClaudeUndashed/ClaudeRead (a dashed spelling back to the one served
  id; an id served as spelled always wins, two ids dashing alike are
  neither; :level and [1m] kept). ClaudeRead also knows a switched-off
  provider's models, so Reseat still moves Claude Code off one
  (TestReseatOff went red without it: opus read "", not
  cop/claude-sonnet-4.5).
- agent/claude.go: every model magpie writes into Claude Code's
  settings is spelled so: model, the ANTHROPIC_DEFAULT_*_MODEL tiers,
  ANTHROPIC_SMALL_FAST_MODEL, CLAUDE_CODE_SUBAGENT_MODEL, modelPicker.
  Every read of them (env, claudeMain, claudeStandInAt) takes the
  spelling back, so fields, applied state and Drift keep the dotted id.
  The user's own values are stashed and given back raw. A Sync rewrites
  what an older magpie wrote dotted. claudeName, the capabilities env
  and the compact-window lookup see the dashed spelling.
- agent/t3code.go and gateway/desktop.go (claudeLooking): T3 Code's
  Claude slugs and Claude Desktop's Code-tab ids without efforts are
  spelled dashed too. Desktop entries with efforts still use the mythos
  alias, which Claude Code doesn't misparse.
- gateway.go: validateModel and unprefixed take the dashed spelling
  back to the served dotted id, before key limits, middleware and
  usage see it.
- docs/subsystems agent-wiring and gateway-routing say so.

What was run:
- New tests: TestClaudeDashedIDsReachTheDottedModel (gateway),
  TestClaudeDottedVersionsGoInDashed, TestClaudeDottedServedDashedToo
  (agent), TestClaudeDashedOnlyClaudeVersions, TestUndashInExactWins,
  TestClaudeSplitKeepsEffortAndMark (provider).
- Break-it checks:
  - With ClaudeSpelled/ClaudeUndashed made identity:
    TestClaudeDottedVersionsGoInDashed fails ("the main model and its
    followers": model relay/claude-opus-4.6-us).
    TestClaudeDashedIDsReachTheDottedModel fails (sent
    "claude-opus-4-6-us", want "claude-opus-4.6-us").
  - With ClaudeRead alone made identity, the agent test fails at
    "read back" (model:relay/claude-opus-4-6-us).
- Real use: the installed claude 2.1.296 in a sandbox HOME and
  CLAUDE_CONFIG_DIR, against an in-process gateway on a free port and
  a fake Anthropic upstream. The settings.json was written by
  agent.Find("claude").Apply("model", "relay/claude-opus-4.6-us").
  - Dashed (magpie's write): the upstream got model claude-opus-4.6-us,
    max_tokens 64000, thinking adaptive, effort high. Claude Code
    reported canonicalModel claude-opus-4-6, maxOutputTokens 64000.
  - The same config with the dotted id by hand: max_tokens 32000,
    canonicalModel claude-opus-4-0.
- Full go test -tags nogui ./... (TestReseatOff red on the first
  run, fixed as above; agent, provider, gateway and main rerun green),
  gofmt -l, go vet, and GOOS=linux and
  GOOS=windows go vet -tags nogui on the touched packages.
2026-10-10 19:44:26 +08:00
yetone c112d2a448 gateway: the Claude subscription answers when magpie runs as root (FrierenF)
Run as root (a server, a Docker container), every Claude subscription
request failed with "Claude Code: exited before it answered magpie's
initialize request (exit status 1): --dangerously-skip-permissions cannot
be used with root/sudo privileges for security reasons".

Claude Code 2.1.296's setup refuses bypassPermissions/
--dangerously-skip-permissions when process.getuid() === 0, IS_SANDBOX is
not "1" and CLAUDE_CODE_BUBBLEWRAP is unset (read from the installed
binary; --permission-mode bypassPermissions is refused the same way). The
bridge's run has no tool of Claude Code's own that touches the machine,
only magpie's MCP tools, answered by the client, and Anthropic's web
search, so the bridge run as root is now given IS_SANDBOX=1
(claudeCLI.asRoot). Its args are unchanged, and a run as anyone else has
its env exactly as before. A WSL distro whose default user is root is the
same case: the WSL probe now prints `id -u` (wslrun.Tool.Root), and
IS_SANDBOX goes into the distro (WSLENV) only then. The warm-up and /usage
runs don't pass the flag and are untouched.

Run:
- Docker node:22-bookworm-slim as root, @anthropic-ai/claude-code@2.1.296,
  fake API: the bridge's exact argv refuses with the message above without
  IS_SANDBOX, and with IS_SANDBOX=1 answers from the fake API
  (permissionMode bypassPermissions).
- The gateway's serveClaudeSubscription as root in that container (linux
  test binary, real claude, no credentials): before, 502 "Claude Code
  ended without an answer"; after, it gets past the check to Claude
  Code's own "Not logged in".
- TestClaudeRunsAsRoot (a fake that refuses as root does) goes red with
  asRoot removed from the launch; TestClaudeAsRootEnv; TestParseProbe.
- go test -tags nogui ./internal/gateway ./internal/wslrun ./internal/agent,
  gofmt -l, go vet (darwin, GOOS=linux, GOOS=windows). WSL root path is
  unit-tested only, not tried on the Windows box.
2026-10-10 19:39:19 +08:00
wei 331b692d18 gui: Google Vertex AI's editor, row and errors read in Traditional Chinese (zh-TW), as every zh string must since main added it 2026-10-10 19:21:57 +08:00
wei 8f7d6ecd41 gateway: Vertex AI's minimal refused is read by geminiRefusedLevel, the same pattern #1062 added for Gemini's OpenAI-compatible API, rather than a copy of it
Rebased onto main by yetone: #1117 replaced geminiMinimalRefused with
geminiRefusedLevel(body), so the check is geminiRefusedLevel(b) != "",
as the PR description proposed.
2026-10-10 19:21:57 +08:00
wei 14255b532a docs: the reference says how to add Google Vertex AI, which models each location serves, and what to do about each of its errors; README lists the preset
The reference's new Google Vertex AI section: what to turn on in the
project and how to sign in, the CLI's pairs and the editor's fields,
the models each location answered with, how to ask for Priority PayGo
and Flex PayGo, and the fix for each failure a user can meet (no
credentials, a sign-in refused, a 403 from Vertex AI, a 403 from IAM
Credentials). Google's pages are linked where they are now, under
Gemini Enterprise Agent Platform, the name Google's documentation gives
Vertex AI today.
2026-10-10 19:21:57 +08:00
wei 0a706873fa cli, tui: magpie provider add google-vertex project=… adds Google Vertex AI, its location, credentials file and service account set as pairs
* magpie provider add google-vertex project=<id> adds it. location=,
    credentials= and impersonate= set the rest, on add or on set, and an
    empty value clears one (location= is global again). A relative
    credentials path is made full from where the command runs, since
    the gateway reads it from nowhere in particular.
  * A key is refused, given on add or with provider key, with the pairs
    to use instead. So is an address (url=, chat=, openai=, responses=,
    anthropic=, decide=), which would be dropped without a word, and
    region= or plan=, which point to location=. A pair of Vertex AI's on
    another provider is refused.
  * magpie providers and the TUI's list say "● Google credentials", with
    "as <service account>", where a key would be, and "○ needs a
    project" for one without (providers.json edited by hand). magpie
    provider <id> lists project, location, signs with and as, and how to
    set a missing project. magpie presets gives the add command with
    project=.
  * The TUI's a asks for the project and adds it there; e and w say which
    pairs change its credentials, and its project and location.

Verified: the CLI's and the TUI's Vertex tests (add, set, clear, the
refusals, a provider with no project); live, in a sandboxed HOME, add,
set location= and its clearing, credentials= and impersonate=, and
provider test at each location.
2026-10-10 19:21:56 +08:00
wei 21d0066232 gui: Google Vertex AI is added and edited with its Google Cloud project, location, credentials file and service account in place of a key
The Add sheet's Google Vertex AI tile opens an editor with Project ID,
Location, Credentials file and Service account where another provider's
has API key. The project is focused first, and a Save without one is
refused in the page's language. Endpoints shows the address the project
and location make as they are typed (Gemini generateContent), with its
Test, and is hidden until there is a project to make one of. Refresh and
Test before a Save ask with the values typed, spelled as a Save keeps
them (typed, Vertex.Normal); an edit that sends none keeps the saved
ones. The Providers row's pill names the service account requests go
as, else the credentials file, else "Google ADC", and "needs a project"
until it has one, never "needs a key". Add another and Duplicate say
they carry the project and credentials. zh, ja and de.
2026-10-10 19:21:56 +08:00
wei 5a27b924e2 providers, gateway: Google Vertex AI is a preset, Gemini in the user's own Google Cloud project, signed with their Google credentials rather than a key
Gemini on Vertex AI was reachable only through a proxy of the user's own
in front of Vertex AI's OpenAI-compatible endpoint, added as a custom
provider. The Google Vertex AI preset (google-vertex) asks Vertex AI
itself.

  * The provider holds a project, a location (global when none is given;
    us, eu or a region), an optional credentials file and an optional
    service account to go as (provider.Vertex). It has no key and no
    URL: Save refuses a key, normalize clears a key and the four URLs
    kept by hand, and its one address is
    https://<host>/v1/projects/<project>/locations/<location>, the host
    following the location (vertexHost). It is ready when it has a
    project, never for a key or an account, and an import link can't add
    it.
  * Each request is signed with a Google token (Sign), and the token goes
    to no other address. The credentials are found as Google's libraries
    find Application Default Credentials: the provider's file, else
    GOOGLE_APPLICATION_CREDENTIALS's, else gcloud's
    application_default_credentials.json. A GOOGLE_APPLICATION_CREDENTIALS
    that isn't a full path is an error, not unset, since gcloud's file
    read in its place may be another account's. authorized_user,
    service_account and gcloud's impersonated_service_account are read;
    external_account and another universe are refused by name. With a
    service account set, the token is traded at IAM Credentials'
    generateAccessToken for one of that account's, as gcloud's
    --impersonate-service-account does. Tokens are kept in memory per
    file and account, minted once for requests made together, again 5
    minutes before they expire or when the file changes (gcloud signed
    in again). A mint is given 30 seconds; one that fails fails the
    requests that waited through it too, and a request given up on
    stops waiting. A sign-in Google refuses says the command that makes
    that file again: gcloud's for its own files, impersonating as it
    did.
  * The gateway speaks Gemini to it alone. A Gemini client's request is
    relayed as it came, its thinkingConfig, safetySettings and schema
    with it: streamed to
    publishers/google/models/<model>:streamGenerateContent?alt=sse, or
    asked whole to :generateContent. Every other API's is translated
    (buildVertex), streamed, and read back with thoughts as reasoning,
    never as the answer. The path names a model by its upstream name
    when one is set, as the usage log's endpoint does. Gemini 3 is sent a thinkingLevel fitted to the
    model's levels, 2.5 a thinkingBudget in the model's range, off
    included (Pro's least, as Pro can't stop). A call's thought
    signature goes to the client in its id and comes back on the call;
    a 400 "Invalid thought signature." is asked again with every call
    waved through, for that request, and a 400 refusing minimal is asked
    again at the model's lowest level, kept until restart. Neither is
    tried for another provider.
  * Vertex AI has no list of the models a location serves, so each
    location has the ones it answered with on 2026-10-06: 12 at global,
    6 Flash at us and eu, the 2.5 trio at a region.
  * The preset offers Priority PayGo's and Flex PayGo's request headers
    (HeaderHints). GOOGLE_APPLICATION_CREDENTIALS and CLOUDSDK_CONFIG are
    in agentenv.Vars, so the desktop app takes them from the login shell
    and the tests clear them.

Not read: the metadata server of Compute Engine, Cloud Run and GKE;
workload identity federation; Vertex AI's express-mode API keys. No
quota project is sent.

Reference: docs/subsystems/providers-accounts.md (Google Vertex AI,
Vertex AI tokens, four constraints) and gateway-routing.md (Vertex AI).

Verified: go test ./... (nogui), -race -count=5 on the Vertex tests,
gofmt and vet. A fake Google (token endpoint, IAM Credentials, Vertex
AI) checks each credentials type, the mint shared, bounded and
re-minted, every refusal's advice and that no token reaches another
host. Each of 24 mutations made after review, of the mint, the key
rules, the advice, the upstream path and the retries, fails a test.
Live, against a real project through an impersonated service account,
with magpie in a sandboxed HOME: Chat, Anthropic Messages, Responses and
Gemini clients, streamed and whole, with thinking and with tool calls, a
whole Gemini call and its signature sent back streamed, at global, us
and us-central1, and with Flex PayGo's header. No token was found in its
files or logs afterwards.
2026-10-10 19:21:56 +08:00
wei feae87eea5 gui: Usage's Requests tag a request streamed on Gemini's streamGenerateContent as Gemini, not with no protocol
ledProtoOf matched generateContent case-sensitively, so a request Gemini
CLI streams (/v1beta/models/<model>:streamGenerateContent) had no
protocol tag in the Requests list and none in its details. A request
translated for Vertex AI, which is always asked on streamGenerateContent
(the next commits), would have had none either. GenerateContent matches
too now.

Verified: ledger-protocol.test.cjs's two new rows, Gemini CLI's streamed
path ("Gemini") and a Chat request sent on to Vertex AI ("Chat →
Gemini"), both come out untagged with the old pattern and pass with this
one, in Chromium and WebKit, en and zh.
2026-10-10 19:21:56 +08:00
yetone 4e584faa51 agent: a Codex the user disconnected stays disconnected through restarts and updates (paynezhuang)
paynezhuang on Discord: magpie's first start pointed Codex at the gateway
by itself; they switched Codex on, chose "Disconnect from magpie", and after
each update and restart config.toml had openai_base_url again.

Cause: Codex's Sync runs at every start (SyncCatalog) and calls failover(),
which writes openai_base_url whenever Codex is signed in to ChatGPT and
another of the user's ChatGPT accounts is on in magpie. Nothing told it the
user had taken magpie out. The same Sync's #701 branch (sign-in "magpie
API" on one of Codex's own models) wired a disconnected Codex again too, and
with magpie API Disconnect itself left failover's base URL behind (its own
model Set ran failover).

Fix: Disconnect marks the agent disconnected in the stash
(<id>.disconnected) before it writes anything; connect() and an Apply that
leaves the agent wired take the mark out. Codex's failover treats a marked
Codex as having no other account on (and takes out a base URL it owns), and
the #701 re-wire skips it. Failover for a Codex never disconnected, and a
base URL written by hand (#856), are as before.

Siblings: TestDisconnectStaysThroughSync connects and disconnects every
non-WSL agent with fields, then runs SyncCatalog and dsh's KeepDshWired
round twice: none is wired again and no file outside magpie's own changes.
It passes on the old code too (only Codex had the problem); it guards the
class. Cursor, Copilot CLI and Devin can't be connected in the sandbox and
skip; Native (Aside) and Launch agents don't Sync wiring.

Run:
- TestCodexDisconnectStaysWithAccountsOn (ChatGPT and magpie API) and
  TestCodexAPIDisconnectStays fail on the old code ("start 0 after
  Disconnect wired Codex again", "disconnect left magpie in") and pass now.
- go test -tags nogui ./internal/agent ./internal/gui . (sandbox HOME): ok
- gofmt -l, go vet, GOOS=linux and GOOS=windows go vet -tags nogui
  ./internal/agent: clean
- Real magpie (nogui build, `magpie web --gateway`) under a scratchpad
  HOME, gateway 127.0.0.1:3481, web 3482, fake ChatGPT auth.json plus a
  second ChatGPT login on: old build re-wrote openai_base_url 2s after a
  restart following Disconnect. New build: first run wires (failover),
  connect, disconnect, restart as 0.1.99998, then start as 0.1.99999
  (last-version moved): config.toml byte-identical to after Disconnect,
  no failover; connecting again wires it and a restart keeps it.
2026-10-10 19:17:53 +08:00
yetone 6d3bc9183d usage: the Usage and Requests pages count any days picked, from a Custom opt after All that opens a month to pick them on (#1492, nianlee-official)
The period bar had only Today, 7 days, 30 days and All. A Custom opt now
follows them. It opens the app's own menu (no native select): Yesterday,
This month, Last month and 90 days a click away, and a month of days to
pick the first day on, then the last. Days after today can't be picked;
arrows walk the days and Escape closes. Once picked, the opt names the
days ("Oct 1 – Oct 7"), and narrow windows show only its icon until then.

The backend takes the days as period "2026-10-01..2026-10-07", both
included, in the local time zone (usage.RangeOf, Period.Known/Until).
The summary, the Requests page (index and ledger fallback), Direct and the
CSV name count only calls from the first day's midnight up to the
midnight after the last. The chart is an hour each for one day, a day each
up to 60 days, and a week each from a Monday past that. A picked range is
summarised afresh each time, so ranges never pile up in the summary cache.
The credits-per-day card follows the days picked. New strings in zh,
zh-TW, ja and de.

Run:
- go test -tags nogui ./internal/usage ./internal/gui (sandbox HOME): ok.
- TestPickedDaysArePeriod with Until returning zero (no range end):
  FAIL, Summarize 5 calls / QueryPage 5 rows / LedgerOf 5 rows, want 3.
- usage-range.test.cjs, Chromium and WebKit, en and zh, at 390px: 4/4.
- Every GUI test touching period or the Usage view (87 files): Chromium
  388/388; WebKit 386/388, the two purpose-filter's Routing focus check
  (scrollTop off by 1px after a wheel), which then passed 52 of 56 lone
  runs here and 25 of 25 on origin/main; nothing in this change runs on
  the Routing page. gui-de, gui-ja, gui-zh-tw, i18n-keys: pass.
- gofmt -l; GOOS=linux and GOOS=windows go vet -tags nogui on both pkgs.
2026-10-10 19:15:12 +08:00
yetone a5114d931f agent: Claude Desktop from its MSIX isn't said to be off magpie when the package's copy is emptied, and Reconnect puts its gateway back (dumplings)
dumplings (Windows, Desktop 2.31226.0 from the MSIX) saw "Claude Desktop
已不经过 magpie:配置已变更" while Desktop ran on magpie, and Reconnect
didn't clear it; switching Desktop's provider off magpie and back did.
Two causes:

- Check went over both sets of folders magpie writes for a packaged
  Desktop (the package's LocalCache and the real ones, as which build
  is installed can't be told) and failed when either was off magpie.
  2.31226 reads the real %LOCALAPPDATA%\Claude-3p (bg5eau, already in
  desktopdir), so the package's copy, emptied, isn't Desktop off
  magpie. desktopRead now judges only the set whose Claude-3p Desktop
  ran in last ("Local State", desktopdir.LastRun), every set when it
  ran in none, as before.
- Reapply on an unwired drift re-set the field drift shows on and
  fields on magpie's models. Desktop's drift shows on a tier (sonnet,
  on a magpie model), and its provider field ("magpie") isn't a model,
  so the gateway was never written back. Reapply now also re-sets a
  field whose value is magpie itself, as Wired already counts it.

The reporter's analysis said 2.31226's AppxManifest excludes
Claude-3p from virtualization; that manifest wasn't seen here (the
Windows box has no MSIX Desktop), the fix rests on Desktop reading the
real Claude-3p, which bg5eau's case showed.

Run: TestClaudeDesktopMSIXChecksTheFoldersDesktopRuns (MSIX layout:
package Roaming\Claude and Local\Claude-3p with an older Local State,
the real Claude-3p newer); red with Check over every set, and red
with Reapply without the magpie-valued field. go test -tags nogui for
internal/agent, internal/desktopdir, internal/gui, internal/library;
the agent package's TestClaudeDesktop* built for windows/amd64 and run
on the Windows box, all pass; gofmt -l; go vet -tags nogui on darwin,
GOOS=linux and GOOS=windows for internal/agent, internal/desktopdir.
2026-10-10 19:01:11 +08:00
yetone 66f920e3a3 provider: a Claude account whose user picked every model is served Haiku 5.5 once models.dev lists it, beside the picks (wakaka)
9b51428e put Haiku 5.5 in the Claude account's list (Available), but
agents are served the user's picks (Exposed) when there are any. A user
who had picked every model (Select all, or the TUI's toggles) kept the
list as it was then. The owner's providers.json holds exactly that: all
16 Claude models up to Sonnet 5.5, not Haiku 5.5, which never reached
an agent; wakaka's file wasn't seen, so this is the likely cause there.

Save now keeps, beside new picks, the models listed when they were made
(PickedFrom); the same picks saved again keep it. withNewlyListed serves
a model listed since first beside picks that held every model listed
then; one listed then and left unpicked stays out, and picks that left
any out take nothing new. Picks saved before PickedFrom existed count as
"every model" when they hold every one released up to the newest of
them (models.dev's release_date), which is the owner's saved state. The
editor (providerJSON.Chosen) and the TUI start from Picks, so a later
Save keeps the new model picked rather than dropping it.

Run: TestClaudePicksOfEveryModelTakeOnesListedSince with the reporter's
16 picks and models.dev's Haiku 5.5 row (red with Exposed using the
picks alone); go test -tags nogui ./... under a temp HOME, all ok;
gofmt -l; go vet -tags nogui on darwin, GOOS=linux and GOOS=windows for
internal/provider, internal/gui, internal/tui.
2026-10-10 19:01:10 +08:00
yetone 53cce81664 gateway: Codex hears an event of its reply within its idle timeout while magpie holds its tries, instead of reconnecting on "idle timeout waiting for SSE" (fadenoob on Discord)
Codex counts only SSE events toward its stream idle timeout (300s by
default), not the ": keepalive" comments magpie sends while it holds a
try. Each try was bounded by itself (holdLead, 4 minutes since
1a5d7908), and a group's replan pauses (c43681d6) come between tries,
so held tries and pauses could add up past 300s with no event, and
Codex dropped the stream and reconnected. Reproduced against Codex's
own behaviour with a fake that sends only comments: the same error.

keptAlive now keeps the time of the request's start or its last event
(told) and whether the agent streams. For a streaming Responses agent,
once agentQuietMost (4 minutes) has passed with no event, the try in
hand is let through (scan, keepQuiet), and a replan or same-one retry
whose pause would end past the bound isn't taken, so the agent gets
the reply or the error in time.

Run: TestCodexHeardWithinItsIdleTimeout (agentQuietMost scaled to 1s;
a slow second member after a failed first: first event in ~1.0s,
bound 1.6s, old code 2.2s, red; every member overloaded with a 2s
replan pause: error reaches the agent in ~1.2s). Passed 3 times.
go test -tags nogui ./internal/gateway ./internal/provider ok; gofmt
-l clean; GOOS=linux and GOOS=windows go vet -tags nogui on both.
docs/subsystems/gateway-routing.md says the bound.
2026-10-10 18:54:16 +08:00
yetone 6d1c7df9e7 gateway: a reply looping on the same few words with no line or sentence's end ("mcp mcp mcp …") is found and ended, as a loop of lines is (#1489, bfxh)
bfxh: the model loops, saying "mcp" over and over. The loop guard cuts a
reply into lines and sentences and finds a loop in 256 of them. Words
repeated with no line break and no sentence stop form no such unit: the
text is cut only every unitMost (4096) bytes, so 256 units would be about
1 MB, far past any reply's output limit. A loop like that ran on to the
limit.

A unit cut at unitMost, with no break in it, is now read by itself
(runOnWords). It is a loop when it is one piece repeated (period of at
most 64 bytes, "mcpmcp…" or "重复说mcp重复说mcp…"), or when its words, at
least one per 32 bytes, are no more than 8 different ones. Two such units
in a row, about 8K characters or 2,000 tokens, end the reply. Text and
reasoning are both read. Reasoning that loops before anything is said is
asked again once, as 8424a004 does for a loop of lines. A loop broken
into lines longer than a unit still counts. The error says "the same over
and over without a break" and quotes the words.

Run:
- TestLoopGuardFindsARunOnLoop (new): spaced, comma, unspaced, a few
  words, Chinese; as text and as reasoning; found within 3 units.
- TestLoopGuardLeavesOrdinaryRepliesAlone also feeds, with no break at
  all: gateway.go, LESSONS.md, i18n.js, a log, a CSV, hex, table rules,
  and a one-line JSON array of 2,000 records. None trips.
- Break checks: runOnUnits = 1000 turns the new test red. No distinct
  limit and no word density check turns 10 of the ordinary texts red.

- TestArchiveWholeBodies' long vendor streamed "lorem ipsum dolor "
  25,000 times with no break, which is such a loop and is now ended.
  Its words are now word0 word1 …, still 450 KB, so it tests the
  archive again, not the guard.
- go test -tags nogui ./internal/gateway ./internal/provider: ok.
  gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui clean.
2026-10-10 18:54:16 +08:00
yetone e9ae12f8c4 gateway: a tool with a union at its root, refused in OpenAI's wording, is asked again folded (#1493, jevejoze)
Codex desktop's mcp__codex_app__automation_update has an anyOf root.
An upstream that validates tools the way OpenAI does refuses it with
"schema must have type 'object' and not have
'oneOf'/'anyOf'/'allOf'/'enum'/'const'/'not' at the top level" (the
reporter's message). OpenAI's own API refuses it with "schema must be a
JSON Schema of 'type: \"object\"', got 'type: \"None\"'" (asked today
with the fixture's schema, its bytes in the test). rootUnionRefusal
knew only xAI's and Anthropic's wordings, so these 400s went to the
agent. Both OpenAI wordings now match, so the request is folded and
retried as it already is for xAI and Anthropic. The retries only fire
when folding changes the request.

jevejoze's branch proposed the same regex change for the first wording.

Run:
- TestRootUnionFoldedWhereRefused now runs xAI, OpenAI-compatible and
  OpenAI refusals, passed through and translated.
- New TestRootUnionRefusalWordings, including two unrelated
  invalid-schema 400s that must not match.
- Break check: reverting object_root.go turns the four new subtests and
  the wording test red.
- Sandbox magpie on a real api.openai.com key: direct, the union gets
  400 (wording above). Through the gateway, the folded retry passed
  validation and reached the account's billing check (429 billing not
  active). No answer was possible on that key.
- go test ./internal/gateway: ok. gofmt -l: clean. GOOS=linux and
  GOOS=windows go vet: clean.
2026-10-10 18:54:16 +08:00
yetone 437bf023b8 codex, chatgpt-api: a conversation with tools reuses its cached prompt, its session sent in session-id/thread-id as Codex 0.162 sends it (#1473 inthink, #933 Scallions)
The ChatGPT backend looks up a conversation's prompt cache by the session
headers, not by the body's prompt_cache_key. I probed a real Pro account
(gpt-6.1-sol, 13 tools, about 7.6K-token prompt) directly:
- key in body only, 6 requests: cached 0 every time
- no key and no headers: 0 every time
- session-id + thread-id: 0, then 7552 x5
- old session_id/conversation_id: 0, then 7552
- a bare request with no tools: 4096 every time. That is the
  instructions' shared cache, so #1473's "bare requests hit" pattern
  fits this.
Codex CLI 0.162 (captured with codex exec against a fake server) now
sends only session-id and thread-id. It no longer sends the underscored
names, which a proxy may drop.

Changes:
- codexSign: sets session-id and thread-id from the prepared body's key
  (sessionHeaders). It drops the underscored names. A keyless body keeps
  the session the client named.
- codexHeader: relays session-id/thread-id from Codex clients.
- ChatGPT API (SIWC) provider: it sent only Authorization. Now it names
  the conversation (conversationKey for keyless clients) and sends the
  same session headers. Scallions' screenshots: chatgpt-api/ got 0%
  cache where codex/ got 10-99%.
  This was NOT tried against api.openai.com with a real ChatGPT API
  sign-in, since none is available here. Left for the reporter to
  confirm.

Run:
- Sandbox magpie on a real Codex account, client sending no key: old
  build cached 0/7296 erratically; new build 0, 0, then 7296 x4.
- go test ./internal/provider ./internal/gateway: ok.
- Break check: reverting codex_request.go and chatgpt_api.go turns
  TestCodexSignSessionHeaders, TestCodexSignAndBody and
  TestChatGPTAPISession red.
- gofmt -l: clean. GOOS=linux and GOOS=windows go vet: clean.
base_instructions and the identity line are unchanged.
2026-10-10 18:54:16 +08:00
yetone dbf0fefc60 usage: the page's tabs sit on the head's middle line beside the refresh, which ends at the content's edge when a tab has no sum
.segs sets align-self: flex-start everywhere, so in the 34px usage head the
tabs sat 4px above the refresh button and picker. The Context and Sessions
tabs leave #usageCost empty, and its gap plus the refresh's margin-right left
the refresh 20px short of the cards' right edge.

Measured in Chromium at 1024px on the Context tab: tabs 56-82 and refresh
61-85 before; both centred on 73, and the refresh ending at 1024 (the
content's edge), after.

Ran: 93 GUI test files (usage-*, context-*, header-*, and every file naming
.segs or the usage head), chromium and webkit: 953/956. The 3 failures were
timeouts under load from other sessions' GUI runs (a 5s click on the Usage
nav in usage-speed, search-first). Both files pass alone: 6/6 and 8/8.
2026-10-10 18:53:56 +08:00
yetone cb406c8425 plugins: a plugin can add an agent magpie has no setup of its own for
Plugins could be subscription providers or gateway middleware. Now a third
kind: an agent plugin, so a user whose agent magpie doesn't ship can still
put it on magpie.

- internal/agentplug: a plugin's magpie.agent module (or a *.agent.js file)
  exports agent = {id, name, config, format?, model, prefix?, bin?, dir?,
  ua?, icon?, notice?} and an optional connect({gateway, model, models,
  agent}) returning the other keys to write. Compiled in moejs, reloaded
  when plugins.json or the file changes; why one didn't load is kept.
- internal/jsmod: module compiling (imports kept inside the plugin), moved
  out of middleware so both share it.
- internal/agent/plugged.go: each becomes an Agent (Plugin set) after
  magpie's own. JSON, YAML and env files are edited key by key, comments
  kept; what each key held is stashed typed under plugin:<id>:<path>, and
  its own model or Disconnect puts every key back. A built-in id is
  refused; a connect that throws writes nothing. Key magpie-<id>; usage
  names it by key or ua (usage.PluginAgents).
- GUI Plugins page: an Agent kind chip and glyph, a Discover "Agents"
  section (market kind "agent"), and an installed row line "Adds X to
  Agents" or why it didn't load. zh, zh-TW, ja, de strings.
- Docs: site Plugins page (en, zh, ja) "Agent plugins", reference.md,
  agent-wiring.md, gateway-middleware.md.

Run:
- go test ./... (all ok); gofmt -l clean; GOOS=linux go vet -tags nogui
  ./... and GOOS=windows go vet ./... clean.
- TestPluggedYAML, TestPluggedJSONUnwire, TestPluggedRefused.
- GUI: plugin-agent.test.cjs 22/22 (en, zh, zh-TW, ja, de; 980 and 420;
  chromium and webkit); all plugin-*.test.cjs, i18n-keys,
  deprecated-subscriptions, filter-ime: 315 pass, 0 fail.
- Real use, in a sandbox HOME: an Aider plugin (~/.aider.conf.yml, prefix
  openai/, connect writes openai-api-base/key) installed in a dev build;
  picking DeepSeek V4.1 Flash on the Agents page wired the file keeping the
  user's comment and keys; real aider 0.86.2 `--message` answered through
  magpie from the real DeepSeek account; usage.jsonl recorded agent aider,
  provider deepseek, 200; Disconnect restored the file byte for byte.
2026-10-10 18:39:47 +08:00
yetone 61aa681e60 library: an MCP server, or the servers picked, are copied as an agent's project file has them, to paste into a project magpie doesn't keep (#1478, xiaozhu1337)
A project's MCP servers could only be given by adding the project to
magpie first. For a one-off (add them, then let the project keep them),
that is a detour. Now the servers page's Select bar, and a server's
editor, have Copy config…: a menu of the agents that read a project's
servers from a file (Claude Code .mcp.json, Codex .codex/config.toml,
Gemini, Cursor, OpenCode, ZCode, Pi), each with its file. A pick puts
that file's text on the clipboard and the status says where to paste it.

What changed:
- library.ConfigOfServers(agent, names): the servers written by the same
  code a project of magpie's is written with (mcpFile.put, through() for
  one magpie is signed in to, the agent's own variable syntax) into a
  fresh file in a temp folder, read back and removed. Nothing in the
  user's files is written. A server the agent can't take there (SSE for
  Codex or Pi, a ${VAR} it can't read) is left out and named, as a
  project's sync leaves it out.
- POST /api/library/mcp/config answers {file, text, skipped}.
- library.js: copyConfigButton in the pick bar and the editor's bar;
  strings in zh, zh-TW, ja, de.
- docs/subsystems/library.md says so.

Run:
- TestConfigOfServersIsTheProjectFile: for every agent in
  projectMCPFiles, the copied text equals byte for byte the file magpie
  writes into a fresh project with the same servers, the servers left out
  are those supports() refuses, a signed-in server is the gateway's
  /mcp/<name>; with through() taken out it fails.
- library-mcp-copy-config.test.cjs in Chromium and WebKit, en/zh/ja/de at
  440px: the menu's agents and files, the post, the clipboard text, the
  left-out status, nothing copied when nothing fits, the editor's button;
  no sideways scroll. The library and project GUI tests that draw the
  pick bar or the editor (18 files) pass in both engines.
- go test -tags nogui ./internal/library/ ./internal/gui/ under a temp
  HOME; gofmt -l; GOOS=linux and GOOS=windows go vet -tags nogui.
- Not clicked in a running magpie window; the page against a faked API
  and the library code under a sandbox HOME only.
2026-10-10 18:35:17 +08:00
yetone 067a0b7552 gateway: a search API takes several keys, and one out of credit hands the search to the next (#1477, bluesky4485)
Tavily's free credit runs out, and changing the key by hand each time was
the reporter's chore. A search API's key can now be several, split by
commas (or spaces, semicolons, lines): Settings › Search's key field says
so, and `magpie search add tavily k1,k2` takes them. Each search starts
from the key that answered last (kept per vendor in memory) and goes on to
the next only when the answer is about the key: 401/403 turned away,
402/432/433 out of credit (Tavily's plan and pay-as-you-go limits), 429
rate limited. Anything else, such as a 500 or no answer in time, isn't the
key's, and the other keys aren't spent on it. Keys are stored as one
comma-joined string in the same field, so nothing is migrated; the list,
CLI and Settings show each key masked.

Run: TestSearchAPIKeysTakeTurns (httptest Tavily answering 432 with
Tavily's own body, 401 and 500) passes and goes red with the hand-off
removed; go test -tags nogui -run Search ./internal/gateway
./internal/provider ./internal/gui . passes; search-api, searcher-pick,
gui-ja, gui-de, gui-zh-tw .test.cjs pass in Chromium and WebKit. Not tried
against the real Tavily with a spent key.
2026-10-10 18:31:32 +08:00
yetone a690d8d7a1 main: magpie web behind a reverse proxy prints its link through the proxy, key and all (#1479, uclort)
magpie web on a server, listening on 127.0.0.1:3430 behind nginx or
Caddy, printed only http://127.0.0.1:3430/?k=…, and the reporter had to
join "/?k=…" onto their domain by hand. It now also prints
"through your proxy https://magpie.example.com/?k=…" when it is told
the proxy's address: MAGPIE_WEB_URL (the page's own address there), or
else MAGPIE_PUBLIC_URL with no port of its own, which NetworkLinks
already takes as a reverse proxy for --lan (#372). A MAGPIE_WEB_URL with
a query, a fragment, credentials or another scheme is ignored.

Only the printed link changes: the key, its cookie and webGuard are as
they were, and nothing new is listened on. The key itself was already
fixed with MAGPIE_WEB_KEY (16+ letters, digits, - . _ ~); the usage text
and docs/reference.md say both.

Run: go test -tags nogui -run TestWebProxyLink . (red with proxyLink
returning ""); a built magpie web under a sandbox HOME with
MAGPIE_WEB_URL=https://magpie.example.com, MAGPIE_WEB_KEY set, on
127.0.0.1:3493 printed the proxy line, answered 401 with no key and 303
with the key under Host: magpie.example.com.
2026-10-10 18:31:32 +08:00
NorethSea 9ca4b9ec28 gateway: provider search can be Off in Settings, so a model's web search goes to the Search APIs alone (#1483, NorethSea)
Settings › Search gets an Off choice beside Automatic and the providers.
With it, no provider is asked to search for another model (no ChatGPT or
Claude account's allowance spent, no Kimi Code search service, no Google
sign-in's separate search), and the saved Search APIs are asked in their
order; one failing never falls back to a provider. With Off and no ready
Search API, magpie offers no search tool of its own. A provider's native
search on the client's own protocol is unchanged.

NorethSea's change (from their fork, feature/search-provider-off,
68fe54ff), cherry-picked onto main. On review one sibling was missing:
ownSearcher and webSearchOf (what this magpie's model list tells another
magpie about searching) still treated a Kimi Code plan or Google sign-in
as searching for its models with Off. Both now go through searchesOwn,
the one check canSearchFor uses, so with Off a remote magpie is told
there is no search instead of adding a tool that has nothing behind it.

Run: go test -tags nogui ./internal/gateway ./internal/gui
./internal/settings (sandbox HOME); TestSearchProviderOffTellsRemoteMagpie
goes red with webSearchOf's old check put back; searcher-pick, gui-ja,
gui-de, gui-zh-tw .test.cjs pass in Chromium and WebKit.

Co-authored-by: NorethSea <963979204@qq.com>
2026-10-10 18:31:32 +08:00
yetone 7aed4a1062 provider: importing from apps adds one relay once, so after it is removed it can be imported again (#1486, kk349958194)
The same relay with the same key is often both a CC Switch entry and
what Claude Code's settings.json points at (CC Switch writes it there).
The import picker lists it under both apps as new and turns both on, so
one import added it twice ("Some Relay" and "relay.example.com"). Once
the user removed one, the other copy made the CC Switch entry "Already
added" and it could not be imported again, which is what the reporter
saw.

ImportFromApps now skips an add whose account (key at the address,
sameProvider, as the list's "same" says) a provider already holds,
including one added earlier in the same import. The picker's "Already
added" row also says which provider holds it ("magpie has {name}
already", an existing string), so a leftover copy can be found.

Run: TestImportSameAccountFromTwoAppsOnce (CC Switch db + settings.json
fixtures, default picks) fails without the change ("the relay added 2
times: [some-relay relay-example-com]") and passes with it; go test
-run TestImport ./internal/provider passes. provider-discovery.test.cjs
in Chromium and WebKit (en, zh) passes 13/13, and fails 2 with the row's
new line taken out.
2026-10-10 18:31:32 +08:00
yetone 7450fa5f27 provider: a request header typed in lower case is sent once and is the user's, on the model list, the tests and requests (#1487, Dudung1018)
A provider's own headers were written into the request as typed
(req.Header[k] = …) to keep their case, beside magpie's own written with
Header.Set under the canonical name. A "user-agent" or "authorization"
typed in lower case, as devtools show headers, therefore went out next
to magpie's: two User-Agents, magpie's (or Go's Go-http-client/1.1, which
Go's HTTP/1 writer adds when it finds no canonical "User-Agent") first.
The reporter's relay checks the client and answered every probe 401
"unauthorized client detected", so the headers looked ignored.

catalog.PutUserHeader now takes every header of the same name in any
case off before writing the user's, and keeps User-Agent under its
canonical name so Go adds none. It is used everywhere the provider's
headers are applied as typed: Sign (forwarded calls, endpoint tests,
detection), the model lists (catalog FetchURL/FetchAt, Gemini pages),
Kilo's list and the Gemini image path. Azure's list merge drops an
api-key of another case too. The balance read already used Header.Set.

Run: curl against the reporter's relay (ps.air-outer.com, HTTP/1.1):
User-Agent "claude-cli/2.1.0 (external, cli)" alone gets past its client
check (to "无效的令牌" for a fake key); curl/8, or Go-http-client/1.1
ahead of the claude-cli one, gets "unauthorized client detected". A
scratch Go client confirmed Go sends "User-Agent: Go-http-client/1.1"
beside a lower-case "user-agent". TestUserHeadersInLowerCaseAreSentOnce
(HTTP/1.1 httptest server that refuses two User-Agents or two
Authorizations) fails without the change on list, endpoints and detect
(User-Agent ["Go-http-client/1.1" "claude-cli/…"], Authorization
["Bearer sk-test" "Bearer relay-own"]) and passes with it. Not tried
through a built magpie against the relay with the reporter's key.
2026-10-10 18:31:32 +08:00
yetone 1825d1e600 agent: Ante lists every magpie model whose reply limit reaches its window, told one token under it (#1179, liangkaichun)
Ante 0.2.9 skips a catalog entry whose max_tokens is not less than its
context_limit:

  warning: skipped catalog entry providers.magpie.preferred_models.b/eq:
  max_tokens (128000) must be less than context_limit (128000)

maxTokens caps the reply limit at the window (OutputWithin), so a model
whose list gives the same number for both, or a larger output, was
written with max_tokens == context_limit and went missing from Ante; the
reporter saw magpie's provider vanish from /provider. anteMaxTokens now
writes context_limit-1 in that case. Only Ante is changed: the other
agents magpie writes both sizes for (goose writes the window alone) have
no report or known check that turns away a reply limit equal to the
window; they were not each tried with equal values.

Run: real Ante 0.2.9 (darwin-arm64, download.ante.run) in a sandbox
HOME/ANTE_HOME: `ante catalog` printed the warning above for 128000/128000
and loaded the entry at 127999/128000. TestAnteMaxTokensUnderTheWindow
fails without the change (equal and over: max_tokens 128000 not under
context_limit 128000) and passes with it; go test -run TestAnte
./internal/agent passes.
2026-10-10 18:31:31 +08:00
yetone 27e69702e1 context: Tuned for you draws each setting's cost as a curve over the advice, its waste shaded, the window set now saying how much more
The small sparkline had no scale: it couldn't show how much a setting
costs over the one advised. The curve is now the row's width and measured
from the advice's own cost (tune takes the largest window within 1% of the
cheapest, so the cheapest point is not the level): the area over the
advice's dashed level is what the other settings spend past it, the window
set now and the costliest say how much more (+%), and the advice is marked
Leanest. The cache lifetimes get the same chart for their two choices, and
it shows at a phone's width too. The section note sits closer to its
heading and further from the cards.

Run: context-tune.test.cjs in Chromium and WebKit, every language, phone
and desk widths (22/22), with checks on the set window's +% and the
advice's level; a shot of the owner's real 7-day /api/tune.
2026-10-10 18:25:14 +08:00
yetone 0fb4ff17ba agent: Snow CLI's thinking level is set from the Agents page, from the levels magpie's model has (#1457)
zRain (#1457) asked for thinking.effort, responsesReasoning and
responsesVerbosity. magpie's profile asks the gateway on Chat
Completions (requestMethod "chat"), and on that protocol Snow 0.9.2
reads chatThinking only (api/chat.ts: enabled sends reasoning_effort;
unset or disabled sends thinking {type: "disabled"}). thinking.effort is
the Anthropic method's, responsesReasoning and responsesVerbosity the
Responses method's, so none of them would change a request of magpie's
profile, and they aren't written.

A "thinking" field, as Pi's and dsh's, writes chatThinking {enabled:
true, reasoning_effort: <level>} the way Snow's own settings screen does
(ui/pages/configScreen/useConfigState.ts), on magpie's profile only, and
copies it to config.json. Its levels are the catalog's for the model
picked through magpie, after a default that says Snow takes off then;
a model that lists none offers none. Clearing it deletes chatThinking.
A chatThinking the user had on the profile magpie's was made from comes
along and is shown as theirs; it is only changed when picked here.
Enabled with no level reads as "on". On a profile of the user's own the
field is empty, offers nothing and refuses a pick.

Tests: TestSnowThinking, with a user profile in Snow's own format
carrying chatThinking: shown as theirs, levels offered, a pick written
and mirrored, kept through Sync, none offered for a model without
levels, cleared to Snow's default, the user's profile untouched. Writing
a fixed level instead of the pick fails it ("chatThinking: map[enabled:
true reasoning_effort:high]"). TestSnow* and TestSync* pass under a temp
HOME with pinned caches.

GUI: snow-fields.test.cjs (Chromium and WebKit, en/zh/zh-TW/ja/de,
window at 1240 and 720, tray panel at 440): on magpie's profile the row
draws the small and thinking pills, the thinking default reads "default
(off)" in each language and no pill runs past the row; on a profile of
the user's own neither is drawn. With the small key taken out of app.js
none() it fails 5 cases. The agent field, layout, effort and subagent
GUI tests pass beside it (156 tests), and go test ./... passes under a
temp HOME.

Real Snow CLI 0.9.2 (sandbox HOME made by Snow itself): with magpie's
profile written by this code (model relay/glm-4.6, small relay/glm-4.5v,
thinking high) and its baseUrl pointed at a fake server, `snow --ask`
sent its turn as relay/glm-4.6 with max_tokens 131072 and
reasoning_effort high, and its light request as relay/glm-4.5v.
2026-10-10 18:20:56 +08:00
yetone e949c0ca8f agent: Snow CLI's light model (basicModel) can be picked apart from its main model on the Agents page (#1457)
zRain (#1457) asked for Snow's advancedModel and basicModel to be chosen
separately; magpie wrote the picked model to both. Snow 0.9.2 asks
basicModel for its summaries, compaction and file search
(utils/config/apiConfig.ts; agents/compactAgent, summaryAgent).

A "small" field, as OpenCode's and Crush's, sets basicModel on magpie's
profile (profiles/magpie.json, copied to config.json): a model through
magpie only, since both models go to the profile's one baseUrl, the
gateway. Empty, it follows the main model. A small model of its own stays
through a new main model and a catalog sync (snowProfileFor keeps a
basicModel that differed from the advancedModel it replaces), and one
the gateway no longer resolves goes back to following.

On a profile of the user's own the field reads empty, offers nothing and
refuses a pick: that profile's models are theirs to set in Snow. The
Agents row leaves a small field with nothing to offer and no value out,
as it does an effort with none (app.js none()).

Tests: TestSnowSmallModel (pick, read back, refuse a non-magpie model,
kept through a new model and Sync, follows again when cleared,
Disconnect). With the keep in snowProfileFor removed it fails "small
after a new model and sync". TestSnow* and TestSync* pass under a temp
HOME with pinned caches.
2026-10-10 18:20:56 +08:00
yetone 6ad5dc5855 agent: Snow CLI's window, output and image support follow magpie's model until the user sets them in Snow, and a vision model of theirs that would reach the gateway is left out (#1457)
zRain (#1457, Discord #feedback) asked that maxContextTokens / maxTokens
be synced when the model changes, and for Snow's vision settings.

magpie's profile (profiles/magpie.json) already took maxContextTokens and
maxTokens from the catalog on every pick and catalog sync, which also
wrote over a value the user had set on that profile in Snow's own
settings. Now what magpie last wrote of maxContextTokens, maxTokens and
supportsVision is stashed (snow:<dir>:wrote), and a value that differs
from it is the user's and is kept through later picks and syncs; the
others follow the new model. Leaving magpie's profile forgets the stash,
so connecting again starts from the user's profile.

supportsVision is now set as every agent is told a model sees (fx,
Copilot): true while magpie's Vision describes images at the gateway,
else the catalog's word; it used to be copied from the user's profile,
where it described their own model. Snow 0.9.2 sends images to the main
model only when supportsVision !== false (agents/visionAgent.ts).

The user's profile is copied into magpie's, vision settings included.
Snow's vision model takes visionBaseUrl || baseUrl and visionApiKey ||
apiKey (buildVisionConfigOverride), so one with no endpoint of its own
went to the gateway, which doesn't know it, and one with its own endpoint
but no key sent magpie's key there. snowOwnVision keeps only a vision
model with both, on the requestMethod and baseUrlMode it was asked with.

Checked against Snow CLI 0.9.2's source (6ef56454: utils/config/
apiConfig.ts ApiConfig, agents/visionAgent.ts, api/chat.ts).

Tests (temp HOME, pinned caches): TestSnowSyncedKeepsTheUsers,
TestSnowVisionThroughMagpie, TestSnowUsersVisionModel, with Snow's own
profile layout. With the stash check disabled TestSnowSyncedKeepsTheUsers
fails "the user's window was written over: 65536"; without
supportsVision TestSnowVisionThroughMagpie fails "supportsVision <nil>";
without snowOwnVision TestSnowUsersVisionModel fails "visionModel kept:
glm-4.5v". go vet (darwin, linux, windows) clean, gofmt clean.
2026-10-10 18:20:56 +08:00
yetone 7618f3dee2 provider: moved WorkBuddy users get plugin 0.1.13, where an enterprise account lists and uses the enterprise's models (plugins#75, seavenlin)
Plugin 0.1.13 sends X-Enterprise-Id and X-Tenant-Id for an enterprise
account, as WorkBuddy's own client does, so /v3/config gives the
enterprise's models rather than the personal plan's. The mover's min
makes keepMovedCurrent update moved users to it.

Run: go test -tags nogui ./internal/provider under a temp HOME; gofmt
-l; GOOS=linux and GOOS=windows go vet -tags nogui ./internal/provider.
npm view @magpie-community/opencode-workbuddy-auth version: 0.1.13.
2026-10-10 18:19:22 +08:00
yetone d4ffce1fba provider: moved Factory users get plugin 0.1.23, where a streamed Claude Code request with context management and a skill list sent alone as a system message are no longer refused (plugins#71, #72, Vigilans)
Factory's streaming route answers context_management with 400 "Extra
inputs are not permitted" (#71), and the update-config line in a skill
list Claude Code sends as its own system message, as text blocks or a
plain string, got 403 (#72). Plugin 0.1.23 (on npm) handles both; the
mover's min makes keepMovedCurrent update moved users to it.

Run: go test -tags nogui ./internal/provider under a temp HOME; gofmt
-l; GOOS=linux and GOOS=windows go vet -tags nogui ./internal/provider.
npm view @magpie-community/opencode-factory-auth version: 0.1.23.
2026-10-10 18:19:22 +08:00
yetone 250d3561cb gateway: a Codex subagent refused a sealed task no longer names a chat provider the lead used earlier as its sealer (plugins#70, yygutn)
yygutn's Codex lead ran on the Qoder plugin, then on one of Codex's own
models (GPT Sol), and spawned a subagent set to qoder/dfmodel in
~/.codex/agents. The ChatGPT backend sealed the task, and the refusal
said it "was sealed by the server that answered its lead (qoder)" and to
"use a model on qoder for the lead and the subagent", which can't work:
Qoder serves Chat Completions and neither seals a task nor opens one.
Affinity still had Qoder for the lead's thread, since magpie keeps no
record of Codex's own model answering it.

When the provider found for the lead couldn't have sealed the task
(canSeal: not a ChatGPT account, and not a provider of no sign-in on the
Responses API, the same line sealedReader draws), the refusal now says
the ChatGPT backend sealed it and that the provider answered the lead's
earlier turns only. Who may read the task doesn't change: it is still
turned away before Qoder is asked.

Run: TestSealedTaskNotPinnedOnALeadsEarlierChatProvider fails on the old
code with the reporter's message ("sealed by the server that answered
its lead (qdr) ... use a model on qdr"), passes with the change.
go test -tags nogui ./internal/gateway ./internal/provider under a temp
HOME, gofmt -l, GOOS=linux and GOOS=windows go vet -tags nogui on both.
Not run with a real Qoder account and Codex App.
2026-10-10 18:19:22 +08:00
yetone 9b6b996600 gui: TestTrayMenuOpenFrameIsWails finds Wails' source on CI, where go list -m names no folder for a module not unpacked yet
Red on ubuntu and macOS CI since 884dbdb2 ("open pkg/application/
systemtray_linux.go: no such file or directory"): go list -m -f {{.Dir}}
prints nothing when the module's source isn't in the cache, so the path
was relative. go mod download -json unpacks it and names its Dir.

Run: go test ./internal/gui -run TestTrayMenu with the normal cache, and
TestTrayMenuOpenFrameIsWails with an empty GOMODCACHE (CI's case): both ok.
gofmt, go vet ./internal/gui.
2026-10-10 18:17:13 +08:00
yetone f0c63264e5 plugin: a Node program a plugin starts takes magpie's proxy, as Node's fetch skips HTTPS_PROXY without NODE_USE_ENV_PROXY=1
larchsis on X (Windows 11, a proxy set in magpie, none in the system):
the "our free model" plugin's sign-in said 原渠道包下载失败. The plugin
downloads its channel pack in a Node program it starts. The host hands
such a program magpie's proxy as HTTPS_PROXY/HTTP_PROXY (since the grok
login fix), but Node's built-in fetch ignores those unless
NODE_USE_ENV_PROXY=1, so the download went direct and failed behind the
wall.

host.js's proxied() now also sets NODE_USE_ENV_PROXY=1 whenever it
hands the program a proxy, unless the plugin's env already names it
(a plugin's own value, 0 included, is kept). It is not lowercased.

Not changed: the Go side's netproxy.Env, which starts npm, Claude Code,
grok and devin. Those read *_PROXY themselves, and the proxy there may be
socks5://, which Node's env proxy does not take.

Run:
- TestPluginNodeTakesTheProxy (new) fails on the old host.js and passes
  now, on macOS and on the Windows box.
- go test ./internal/plugin/... passes.
- GOOS=windows and GOOS=linux go vet pass; gofmt is clean.
- End to end through the real host, on the Mac (Node 22.22) and on the
  Windows box (Node 22.22.2), with a throwaway plugin (not committed)
  that starts `node` to fetch https://raw.githubusercontent.com/ while
  magpie's proxy points at a fake 502 proxy:
  - old host.js: direct200, so it went past the proxy;
  - fixed: fetch failed at the proxy.
2026-10-10 18:11:00 +08:00
yetone 18d87fc51a usage: grok-4.7 answered as grok-4.7-build is the model asked for, not a swap (#1455, cybershape)
xAI answers a request for grok-4.7 with model grok-4.7-build (the
reporter's requests log; two relays' notes say the same for grok-4.6 ->
grok-4.6-build). Its own list (SuperGrok's, cached 2026-10-02) offers
grok-4.7 and grok-4.7-build-fast and no grok-4.7-build to ask for, so the
-build name is xAI's name for the build serving the model.

GrokServing reads past "-build" after a Grok model's version and joins
GeminiServing under ServingName, which Swapped, a kept requests-log row and
a kept route's try all use. Only names starting with grok count, and only
the same variant: grok-4.7 answered by grok-4.7-build-fast, grok-4.6-build
or grok-4.7-mini is still a swap, as is gpt-5 answered as gpt-5-build.

Run:
- TestSwappedGrokServingName, TestKeptRowGrokServingNameNotSwapped,
  TestRouteKeptGrokServingNameNotSwapped (new). With ServingName reduced to
  GeminiServing the usage tests fail ("grok-4.7 answered as grok-4.7-build
  is the model asked for", "serving name true, fast variant true").
- go test -tags nogui ./internal/agent ./internal/usage ./internal/gateway
  ok; gofmt -l clean; go vet for darwin, linux, windows clean.
- Not tried against xAI itself: no request was sent from the owner's Grok
  account; the served name is the reporter's.
2026-10-10 18:10:18 +08:00