Commit Graph
3445 Commits
Author SHA1 Message Date
yetone ef0c515eb0 provider: a sub2api or new-api account query left without its token asks the key's query instead (lx_78654 on Discord)
The editor's "Use …/api/v1/user/profile" sets the Balance URL to the
sub2api panel's account query, which only the login JWT can ask. Its
Remove button clears the token but not the URL, so the profile query was
then asked with the key, refused with 401, and the Usage card said
"Allowance unavailable" for good.

keyQueryOf now asks the same panel's key query when the Balance URL is
an account query (sub2api /api/v1/user/profile, new-api /api/user/self)
and no token is set: /v1/usage and /api/usage/token, with the key, their
own default field unless the user wrote another. The saved URL is left
as set, so pasting a token again asks the account query again. A
provider whose Headers carry its own Authorization or Cookie is asked as
set. It covers every reader: the Usage page and `magpie quota`
(KeyBalances), the editor's Check balance, routing's key windows
(sub2APIKeyLimits), and `magpie provider <id>`, whose "from" line now
says the query actually asked (BalanceQuery).

Run:
- TestAccountQueryWithoutTokenAsksTheKey (httptest sub2api + new-api):
  JWT, removed, JWT again; new-api without token; custom field kept;
  account query never asked with the key; own Authorization kept.
  With keyQueryOf a no-op it fails with the reporter's 401 card.
- Sandbox CLI (scratch HOME, fake sub2api on 127.0.0.1): old binary,
  after `provider set sub2 balance.token=`, `magpie quota` shows
  "401 Unauthorized…"; new binary shows "$7.25 left", from /v1/usage.
- go test -tags nogui ./internal/provider/ ./internal/cli/ ./internal/tui/,
  and internal/gateway's balance, allowance, quota and key-limit tests.
  The full `go test -tags nogui ./...` passed every other package;
  internal/gateway and internal/agent ran out of time (10m, then 40m)
  with the machine at a load average of ~300-370, the tests running at
  the deadline seconds old, so not a hang; neither run finished.
- gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows.

Not tried: a real sub2api or new-api account; the GUI not clicked
through (no asset changed, it reads the same KeyBalances).
2026-10-14 19:47:16 +08:00
yetone b8070cc6c8 tests: TestAgentGoneInTheRetryPause cancels once the last try is in its pause, not 100ms after the upstream counted it
CI on b75e21be3 (ubuntu, run 38549121391) failed group_replan: the last
try ended 499 "canceled" after 112ms with Again 0, so the agent had left
while the try was still in flight, not in the pause the test is about.
The test counted the upstream's request and then slept a fixed 100ms
before cancelling; on a loaded runner the gateway hadn't read the 503 by
then. It now polls the trace until the last route has its tries and the
last one carries Again (written just before the pause starts), then
cancels.

Run (worktree on origin/main 331c27703):
- Injected a 150ms sleep in the fake upstream between counting and
  answering: the old test fails both subtests with CI's exact shape
  (Millis ~110, Again 0); the new one passes, -count=3.
- Break check: with try.Gone = true taken out of both pause paths in
  gateway.go, the new test fails both subtests.
- go test -race -run TestAgentGoneInTheRetryPause -count=8: ok (116s,
  load average ~300).
- gofmt -l clean, go vet -tags nogui ./internal/gateway ok.
Not run: the whole gateway package (only this test file changed).
2026-10-14 19:46:29 +08:00
yetone 331c27703a gateway, provider: send no prompt_cache_options to Codex, and ask again without it when an upstream refuses it (#2154)
pi-ai sends {"prompt_cache_options":{"mode":"explicit"}} on the Responses
API. The ChatGPT backend behind a Codex subscription answers 400:

  {"error":{"message":"prompt_cache_options is not supported on this
  model","type":"invalid_request_error","param":"prompt_cache_options",
  "code":"invalid_parameter"}}

Probed on 2026-10-14 with a read-only use of the owner's Codex token
(never refreshed or written): gpt-5.5, gpt-6-sol, gpt-6-astra,
gpt-6-luna and gpt-5.6-sol all refuse it, and the same requests without
the field return 200.

- codexBody drops prompt_cache_options with the other fields the backend
  turns away. prompt_cache_key stays; the backend follows it (#1473).
- prompt_cache_options joins the gateway's optional fields. Its refusal
  names the field bare, at the start of the message, which none of the
  existing patterns read, so unsupportedOptionalField also takes
  "<field> is not supported/unsupported" when the message starts with
  it. Only at the start, so a field named inside an echo of the input is
  not taken for it. As for the other optional fields, the refusal is
  remembered per provider, though OpenAI's wording says "on this model";
  the cost of that is a cache hint left off, never a failed request.

Run: go test -tags nogui for internal/gateway (40m timeout; load ~380
from other sessions), provider, catalog, codexcat and agent; gofmt -l;
go vet darwin, GOOS=linux -tags nogui, GOOS=windows. With each fix taken
out by hand, TestRefusedOptionalNamesOnlyUnsupportedFields,
TestPromptCacheOptionsRefusedRetried and
TestCodexBodyDropsPromptCacheOptions go red.
Not tried: pi-ai itself against a Codex subscription.
2026-10-14 19:06:51 +08:00
yetone f51863b3da catalog: a relay channel's word before a known model is that model, so Codex lets it see images (#2157)
The reporter's relay lists nyro-gpt-5.5, nyro-gemini-3.8-flash and
nyro-deepseek-v4.1-flash. None of those ids is in models.dev, so magpie
knew nothing about them: magpie-models.json gave each one
input_modalities ["text"], no context window and no reasoning levels, and
Codex refused every image. The bare ids are known (gpt-5.5: images, a context
window and reasoning levels).

renamed now also takes a leading channel word off an unknown id: 2 to 24
lowercase letters and a dash, when what is left has a digit and is a
known model. models.dev's own data backs it: 147 of its listed ids have
the form word-<another listed id> (openai-, databricks-, anthropic-,
doubao-, zai-, ...), and each is the same model. A listed id is never
renamed, so a vendor's own chan-gpt-5.5 keeps its entry; nyro-auto,
ny2-gpt-5.5 and nyro-gpt-5.5x stay unknown. NameOf keeps the word, so the
shown name is still the relay's own.

TestRenameNeverTakesAModelForAnother (#1383) had
anthropic-deepseek-v4.1-flash as a near miss. By the evidence above, that
id is DeepSeek's model under a vendor word, so the guard row is now
anthropic2-deepseek-v4.1-flash, which the rule still leaves alone.

A model magpie still can't place stays text-only: telling Codex a
text-only model sees images makes it offer view_image and fails the turn
upstream. For those the per-model "sees images" switch already writes
image into the catalog, which TestChannelModelsReachCodexWithImages
covers along with the renamed ids.

Run: go test -tags nogui for internal/catalog, codexcat, provider,
gateway (40m timeout; load ~380 from other sessions) and agent; gofmt -l;
go vet darwin, GOOS=linux -tags nogui, GOOS=windows. With the channel rule
turned off by hand both new tests go red (nyro-gpt-5.5 images false,
window 0; input_modalities [text]).
Not tried: a real Codex image turn through the reporter's relay.
2026-10-14 19:06:50 +08:00
yetone bab1b30009 routing: the hub's mode chip is written only when it changes, so a press held over the once-a-second redraw still clicks in WebKit (#2151)
Cause: the routing view redraws every second (setInterval → render →
header). header() set chip.textContent and goTo() re-set data-go, tabindex,
role and title each time, even when nothing changed. Setting textContent
swaps the chip's text node. In WebKit, a press whose mousedown and mouseup
straddle that swap gets no click, so goRouting never ran and
routing-mode-goes timed out waiting for .rt-found (webkit zh 420 on CI).
A reader pressing the chip for a moment could miss it the same way.

Reproduced by injecting a delay: SIGSTOP/SIGCONT duty-cycling of WebKit's
UI process. At 10ms on / 490ms off, a MutationObserver on .rt-hub plus
pointer logging showed pointerdown at 2407ms, the hub's childList swap at
2869ms, pointerup at 2904ms, and no click. At 50/450, 1 of 30 runs timed
out at the rt-found wait on the old code; 0 of 30 do with this change.

Fix: header() and hubText() go through setText (write only if different),
and goTo() sets each attribute only when it differs. The activity list's
heading chips already keep equal nodes through patch().

Test: routing-mode-goes now holds a press over one redraw. It counts the
routing interval's ticks through a wrapped setInterval, then does
mouse.down, waits for a tick, does mouse.up and expects .rt-found. On the
old routing.js this fails in all 10 WebKit cases at that wait (chromium
passes, since it clicks the common ancestor); with the fix it passes.

Run (playwright 1.62.0, chromium + webkit):
- routing-mode-goes: 40/40, en zh zh-TW ja de at 1100 and 420.
- group-switch-add-many, group-share, routing-key-windows,
  routing-weight-chip, view-scrollbar-drag, routing-steady,
  routing-idle-frame and routing-shape all pass.
- routing-live-patch failed one folded subtest only with 9 files run at
  once. It passes 2/2 alone with and without this change: a fixed 400ms
  sample, filed as #2174.

Not tried: the desktop app's WKWebView by hand. At 2% CPU (10/490) the
chip now clicks, but the view's scroll guard can still refuse or put back
the scroll when the click is handled more than 1s late. I left that
alone; it doesn't appear at 10%.
2026-10-14 18:59:50 +08:00
yetone 0506f011d7 agent: a Codex reaching the gateway from another machine is never joined beside its ChatGPT sign-in (#2145, lazydao)
A Codex in a WSL distro under NAT (or with MAGPIE_ADDR pinned beyond
loopback) signed in to ChatGPT was joined beside its sign-in: it sent
its ChatGPT token to <gw>/backend-api/codex, and from another machine
the gateway takes a named key alone, so every request was a 401.

chatGPT() is now false when onAnotherMachine(at.gw()): such a Codex is
wired as one with no ChatGPT sign-in, magpie as its provider with gwKey()
(the LAN sharing key). One of its own models picked still goes straight
to OpenAI on its sign-in, as it does for a Codex with no sign-in.

Run: TestCodexBeyondLoopbackNotJoined (new; fails on the old code with
the joined config), go test -tags nogui -count=1 ./internal/agent (975s,
ok), gofmt -l, go vet darwin / GOOS=linux -tags nogui / GOOS=windows.
A first version forced magpie API under NAT and broke
TestWSLCodexProvider (own model refused); this one keeps that path.
Not tried: a real WSL distro under NAT with a ChatGPT-signed-in Codex.
A NAT Codex already joined is rewired on the next connect or model pick.
2026-10-14 18:44:45 +08:00
yetone a4d580fa24 gateway: a group skips Antigravity for the system prompt it just turned away (#2156)
Antigravity answers Claude Code's and the Agent SDK's system prompt (the
x-anthropic-billing-header line, "built on Anthropic's Claude Agent SDK")
with 429 "Resource has been exhausted" whatever quota is left (#666).
magpie already tells it as prompt_turned_away, rests nobody and hands it
on, but each Claude Desktop turn in a group waited on the same refusal
first (#2156: 429 in 1073ms, then cursor/composer-2.5 200).

Now, once Antigravity has turned such a request away (any of the three
paths that set holdWriter.turnedAway), for agForeseeing (6h) after, the
candidate loop skips an Antigravity candidate for a request that carries
the line, when someone is left after it (antigravityForeseen). The skip
goes in Fallback with the hint, sets `other` as the asked path does, and
changes no account state. The last one left is still asked and told the
400 with the hint. A request without the line (titles, Codex) still goes.
An old refusal foresees nothing, so a block Google lifts is noticed. The
lines are still neither rewritten nor hidden (#666). The stamp is per
Server, in memory.

TestAntigravityTurnedAwayRestsNobody's "asked first again" half now
checks it with a turn without the line, since one with it is foreseen.

Run:
- TestAntigravityTurnedAwayIsForeseen: fails with the skip turned off
  ("Antigravity was asked again for the prompt it just turned away"),
  passes with it; TestAntigravity* -count=3 green.
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows ok.
- go test -tags nogui ./... in a sandbox HOME at load average 140-220:
  everything green except 10m timeouts in agent, cli, gateway, library,
  provider and TestSetAnswersWhileDevinAndProvidersHang (#1375, noted
  there); those six packages rerun with -timeout 45m: all ok.
Not tried: the skip against the real Antigravity account (the refusal
itself was reproduced with a real account before: 400 with the line,
200 without), nor Windows/Claude Desktop as the reporter uses. No GUI
change.
2026-10-14 18:41:56 +08:00
yetone 9bc9a6e5e1 tests: TestRefreshInvalidationCancelsStaleCall gives the second ask 10s, not 1s, so a loaded runner doesn't read it as a stale listing left running
Seen red during a full run at load average 200-360 ("stale listing was not
cancelled and followed by the new state", 1.73s). The test's fake first ask
waits on its context alone, so a listing that invalidation fails to cancel
never ends; a 1s bound only measured how fast the second ask and the commit
ran. 10s keeps that apart with room on both sides.

Run: a 1.5s sleep injected into the second ask fails the old 1s bound with
the same message and passes the 10s one; with provCancel() taken out of
forgetProviders the test still fails (Fatal at 10s, then the package times
out on Settle, as before). go test -race -count=20 -run the test, go test
-tags nogui ./internal/plugin (179s), gofmt -l, go vet darwin, GOOS=linux
-tags nogui and GOOS=windows on ./internal/plugin pass. Test-only change;
./... not run. TestRefreshDeadlineBoundsRealProviderCall in the same file
still bounds a 100ms deadline against a 1.5s plugin call with a 1s wait
(900ms/500ms of room); not changed here.
2026-10-14 18:41:45 +08:00
yetone bc2d351337 gui: a routing group's member held at its cap, or used up and set not to spend credits, stays on the Routing stage (#2129, wyq0x55)
A member whose accounts were all held — Codex used up with "spend
credits" off, or an account past the usage cap set on it — went to the
route's left list, and the stage draws r.order only, so the member
vanished from the group on the stage (d-task's gpt-sol-6.1), while a
used-up Claude, resting, stayed there faded. The stage now seats left
entries held at a cap or for credits (not those a gateway key may not
use, nor those whose plan doesn't list the model, which 01cee5a26 kept
off on purpose) in their place among the group's members, faded with
the existing "held" wording. A fold of a provider's accounts counts them
apart: "1 available · 2 held" ({n} held in zh, zh-TW, ja, de).

Run: routing-held-member.test.cjs (new) in chromium and webkit, en zh
zh-TW ja de, 1100 and 420 wide: 20/20; with routing.js reverted it fails
10/10 in chromium. All routing-*, codex-credits, account-cap, window-cap
and i18n* GUI tests, 4-wide, both engines: 1032 pass, 13 fail, all in
routing-keys-fold and routing-model-rest, which fail the same alone on
origin/main bda271999 (9/52 there, load ~300; #1612, #2115), and use no
left entries. Not tried against a live gateway with a used-up Codex.
2026-10-14 18:40:39 +08:00
yetone 845b5c4ddd gui: Settings › General's Codex model rows and Open at login say what they do in their tooltip, and Lightweight mode that the gateway keeps running (#2120)
Anoninz asked on #2120 what the Codex model rows do, why Open at login
shows under App Background Activity on macOS, and what Lightweight mode
gives up. These rows were made to say their name alone in f36e744c3
(1ooogle's mockup, approved by the owner), so this adds no line under
them. The explanation goes into the row's tooltip, the way the text size
keys went in that same commit.
- Codex thread titles, descriptions, composer predictions, auto-review
  and memories model rows: what Codex uses the model for and when, and
  what "Codex's own" means. The facts are from settings.go and
  codexcat.go.
- Open at login: opens in the menu bar (tray) with no window. On a Mac
  it is a launch agent, which System Settings › General › Login Items
  lists under App Background Activity, not Open at Login. The section
  names are from macOS 26's LoginItems loctables.
- Lightweight mode keeps its one line. It now says the gateway and tasks
  keep running and only the page reloads (lightweight_rule.go: only a
  closed window's webview is let go). It still fits on one line at 1000px
  in every language. In de, "only the page reloads" didn't fit, so de
  says that the gateway and tasks keep running.
All five languages are covered: en, zh, zh-TW, ja and de.

Run: NODE_PATH playwright 1.62.0, chromium and webkit, all green:
- i18n-keys, bare-ids, gui-de, gui-ja, gui-zh-tw, search-keys
- lightweight, settings-general, settings-groups, settings-sections,
  settings-search, keep-login
- codex-titles, codex-descriptions, codex-predictions,
  codex-auto-review, codex-auto-reset-settings, codex-memories,
  codex-memories-settings, codex-subagent-model
A scratch check (not committed) loaded Settings › General in both
engines, at 1100 and 420, in all five languages, with Mac and non-Mac
platforms. It found each tooltip set and translated, the Mac/other
login text picked right, no sideways scroll, no row overflow and no
page errors (40/40).

Not tried: the tooltips weren't hovered in the real Wails window. No
Go code changed, so no go vet or go test was run.
2026-10-14 18:36:42 +08:00
Edward4226 52b5d9f83f gui: an allowance curve says when it runs out, so its 52px shape need not be read (#2079, #2146, Edward4226)
A window's curve is asked one question — will this run out before its reset,
and when — and answers it with the angle between two lines in a 52px box. In
the issue's card (a monthly window 13 days into 30, 28% used, under even
burn) the curve's own slope is 4.9° on the Usage page and 1.5° in the tray's
spark, against even burns at 7.8° and 2.4°: the two differ by 2.9° and 0.9°,
and in the panel their right-hand ends sit about 2px apart. 65a8365 has since
drawn that spark 30px tall and shaded which side of the burn it is on, which
answers "which side" at a glance; the hour is the half a shape still cannot
give. An axis fitted to the readings does not give it either: the dashes are
the cycle's even burn, a full-height diagonal from a window's start to its
reset, so fitting the axis pulls the burn out of the readings' own range and
inverts the reading. That change is right for a balance and wrong here (the
commit before this one).

So the answer is said, in the reader's own clock. Main grew a quotaPace of
its own — 3a7d031, "Pace +20%" on the reset line, the meter's share less the
share of the window gone by. That is where a window stands, which the eye
still has to turn into a rate; the hour is the missing half. The helpers here
are named quotaEta / quotaEtaText / quotaEtaSpan so as not to shadow that
quotaPace, and the two are meant to sit on one card: "Pace +9%" above
"Runs out Oct 26 13:22 at this pace".

- quotaEta: a window's recent run — the readings since it last refilled,
  within the week, walked back while each older one is the higher, as
  balance_history.go fits a balance's over balanceFitSpan — fitted to a line
  and carried to where it meets zero. {out} is that hour; {lasts} is whether
  it falls after the reset. Nothing is said with fewer than three readings,
  less than an hour of them, nothing left, a line that is not falling, or one
  already past zero.
- quotaCurve: the head carries the sentence, for the window whose deadline
  is furthest off, beside the range it already names; the title holds the
  full stamp. The plot itself is untouched, behind it.
- panelQuotaCard: the same sentence on the card whose deadline line it
  belongs to, for the window the thin spark draws. quotaWindowLine is the
  reading quotaSpark draws from, now shared by both, so the words cannot
  drift from the line they are about.
- "Runs out {when} at this pace" joins the existing "{in}" string, which the
  balance curve keeps, in all five languages: the hour is named (10月26日
  13:22) rather than counted to, since a counted-to run-out is the reader's
  arithmetic to do. "Lasts past the reset at this pace" is the other answer,
  and the one most windows should be giving.

Run (Node v22.20.0, Playwright 1.64, Chromium and WebKit, no backend, the
API faked), rebased onto 3b6ca05, whose own tray-spark-gap test still passes
underneath:

- node --test internal/gui/tests/quota-curve.test.cjs — 15 pass, both
  engines. Run against an LF copy of the assets: the file's quotaCycleBreak
  case slices app.js on indexOf("\n}\n"), so a checkout with
  core.autocrlf=true reads that function back as undefined and is red there
  whatever this patch does.
- node --test internal/gui/tests/quota-pace.test.cjs — 4 pass (the shipped
  Pace is unchanged by the rename and by the span beside it).
- node --test internal/gui/tests/balance-curve.test.cjs — 4 pass (the other
  commit).
- node --test internal/gui/tests/tray-spark-gap.test.cjs — 65a8365's 30px
  spark and its shading, unchanged, with the window line now coming from
  quotaWindowLine.
- With main's own app.js, app.css and i18n.js put back in place, both
  engines fail the new assertions by name: waiting for
  locator('.subscription-card').filter({ hasText: 'Codex' })
  .locator('.quota-curve').first().locator('.qc-pace').

Not tried: no real DeepSeek or Codex key, so the numbers behind the sentence
are only ever the fixtures'; a card whose window is read once every few hours
has three readings within the week and speaks, and nothing here decides
whether a run of one reading an hour is representative. The rate itself is
not shown (the balance curve's "about {amount} a day" is the precedent, and
a "%/day" unit for a 5-hour window reads oddly). No dark-theme-specific,
multi-account or pool treatment beyond what the shared card already does.

Review changes on merge (#2146), by the maintainer side:

- Rebased onto bda271999: main has dropped the box.title line beside the
  head, so the conflict there keeps main's (quotaCurveTitle draws it now).
- quotaEta says nothing for a cycle that is already over, and quotaCurve
  asks it only for the current cycle: a past cycle picked from the cycle
  menu has no pace left to tell. A unit case runs quotaEta in a vm (a
  falling run, one past its reset, too few readings, half an hour, nothing
  left, a flat run, and a past cycle flat and falling); with the guard
  removed it goes red.
- The tray card adds the sentence only when its reset line names the first
  window's deadline alone. With both Codex windows begun the line reads
  "↻ 14:26 · Weekly Oct 31", and the sentence (about the 5-hour window)
  after it read as the week's. The existing tray case now wants no sentence
  there, and a second fixture with only the 5-hour window begun wants it;
  with the old gate the first goes red in both languages. It is also left
  out while the curves are off, like the spark it speaks for.
- The Usage head keeps "Left over time" on one line and cuts the sentence
  short rather than wrapping it; its tooltip names the window (when the
  card has more than one) and the full stamp. German was cut at 420px
  ("Bei diesem Tempo leer um 15. Okt. 17:…"), so the German strings are
  shorter: "Leer ca. {when}" and "Reicht so bis zum Reset".
- Not taken: 25a2886 (the balance curve's axis fitted to its readings).
  The balance curve already says its run-out in words ("Runs out {in} at
  this pace", "about {amount} a day"), so the slope no longer has to carry
  it; a value axis that doesn't start at zero makes a cents-a-day drift
  look like a fall to empty; and valueBand only takes the floor in when the
  padded band already reaches below it, so when the dashes do reach zero
  inside the window they are drawn past the plot's foot instead of meeting
  it, the case its own comment promises.

Run on this tree (Playwright 1.62, Chromium and WebKit, load avg ~300):
quota-curve 28/28, quota-pace 4/4, balance-curve 6/6, tray-spark-gap
22/22, panel-usage 4/4, i18n-keys 3/3, usage-quota-head 4/4, quota-reads
22/22, quota-read-at 4/4, tray-usages 16/16, tray-usage-redraw 4/4,
quota-families 4/4, quota-pools 4/4, panel-balance-order 16/16,
quota-count-wrap 2/2, quota-name-translated 10/10, quota-credits 8/8,
quota-holds 2/2. An ad-hoc check (not committed) loaded the Usage page and
the tray in en, zh, zh-TW, ja and de at 1100 and 420 in both engines with a
falling week and a lone 5-hour window: the sentence is one line, nothing is
cut, no card or page overflows. gofmt, go vet (darwin, linux nogui,
windows) on internal/gui. go test ./internal/gui failed only
TestSetAnswersWhileDevinAndProvidersHang (#1375) and
TestMainWindowCorners/macOS_26_SDK killed at its deadline (#1936), both
already filed as load reds and neither touching these assets.

Not tried: real Codex or DeepSeek readings; dark theme beyond the shared
card; the full GUI suite.
2026-10-14 18:34:27 +08:00
yetone cf455ebd5f gui: a view at its top when a control is clicked stays at its top, what came in above moving the control down (#2134)
The click guard's own rule says "A view at its top stays at its top:
what comes in above the control there moves it down instead of
scrolling itself out of sight", but hold() only kept that rule for the
room at the foot. Anything that grew above the held control scrolled
the view to follow it. At 420 wide, Settings › About turning Automatic
updates Off gave the Version row its "are off" line ~2.3px tall once the
save answered, and the view slid from 0 to 2. hold() now keeps a view
that was at its top (h.top) at 0, so the switch moves down by those
pixels instead.

Tests:
- update-auto: a new case at 420x640 clicks Off with Settings at its top
  and checks scrollTop after the save's redraw (600ms), not only right
  after the click. On origin/main's app.js it is red in both engines
  (2 !== 0); with the change green.
- update-restart (#2096) held the switch to within 1px, which is the
  old behaviour at the top. It now checks the at-top rule when the view
  is at its top (scrollTop 0, switch down by at most 4px), and the old
  1px hold otherwise.

Run (load avg 200-340 from other sessions):
- update-auto + update-restart, chromium and webkit, widths 1100 and
  420, en/zh/zh-TW/ja/de: 32/32.
- 71 scroll-guard files (click-scroll, *scroll*, *steady*, *pin*,
  *profile*, settings*, stays-strict, held-animations, and every file
  checking "must not scroll the page"), both engines, 4 wide: 921 pass,
  11 fail. The fails are nav-sub-unroll, removed-groups-menu-scroll,
  settings-proxy-auth and text-size. Alone, settings-proxy-auth passes
  10/10 and nav-sub-unroll chromium 2 of 2; nav-sub-unroll webkit,
  removed-groups-menu-scroll and text-size are red alone on origin/main
  bda271999's app.js too (#1950, #1866, filed #2172).
Not tried: the real app window; only the Playwright engines.
2026-10-14 18:25:52 +08:00
yetone b75e21be31 agent: the Qoder app counts as Qoder again, found by the status file it writes to ~/.qoder (#2138, xiaozicoder)
xiaozicoder's Windows 11 has the Qoder app and the Qoder CN app
(Qoder-win-x64-user.exe, Qoder-CN-win-x64-user.exe from qoder.com and
qoder.cn) and no qodercli, and since v0.1.1220 magpie's Agents page lists
no Qoder at all. Qoder-win-x64-user.exe is the Qoder app (com.qoder.app,
qoder-app/releases/latest.yml at 0.4.7), not the Qoder IDE. Its app.asar
runs Qoder's CLI as its agent (qodercli 1.1.64's worker runtime, config dir
.qoder / .qoder-cn, QODER_CONFIG_DIR, with BYOK config management), so
~/.qoder/settings.json's providers.magpie reaches it. It writes the
enabledPlugins of its bundled qoder-context plugin to settings.json, which
alone stopped counting in the same change, so the app's Qoder was lost.

The app also writes .qoder-app-status.json (-canary-, -dev- for its other
channels) into ~/.qoder, or ~/.qoder-cn for the China product (the map is
in its app.asar; this Mac's Qoder.app 0.4.3 wrote one). Agent gets sign, one
more sign the agent is here for a dirShared folder, and Qoder's (both
builds) is that file. The JetBrains plugin's folder of #1495 has none, so it
still isn't Qoder.

Run: TestQoderAppIsQoder (both builds: plugin-only settings.json not
detected; each of the three status files detected; the status file with no
settings.json detected; a folder of that name not) red on the old code
(Qoder CN subtests fail), green now; TestQoderSettingsFromAnIDEPluginIsNotTheCLI
still green; go test ./internal/agent -count=1 -timeout 45m ok (1576s, the
machine at load ~350; a first run hit the default 10m package timeout mid
TestCodexAgentsV1WarnsWhenCodexOwnV2IsOn at 1s, not a hang). gofmt -l
clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows clean. A
nogui build's `magpie ls` in a sandbox HOME (PATH=/usr/bin:/bin) with
~/.qoder holding the plugin-only settings.json and a copy of this Mac's real
.qoder-app-status.json, and ~/.qoder-cn the same with a qoder-cn status,
lists Qoder and Qoder CN.
Not tried: the Qoder app on Windows itself, and whether its agent takes
magpie's provider from settings.json in practice (would need a live
~/.qoder changed).
2026-10-14 18:21:44 +08:00
yetone 6d19988416 usage: a provider the log names but that isn't set up now goes by its name, "Claude Code", not "claude" (@ByronVon1 on X)
The Requests page's Provider filter listed "claude" between named
providers. The usage log keeps the id of every provider a call went to,
and usageapi named those only from provider.All(). The Claude Code
subscription is in that list only while its account is discovered, so
after a sign-out, with account discovery off, or for a preset provider
removed since, the bare id showed. This happened in the filter, each
row's Provider column, the split-by-provider and model-at-provider
legends, the Account filter's provider notes, and the summary's model
and account subtitles (stateOf had its own copy of the same lookup).

- provider.KnownFace(id): the name and icon magpie knows an id by while
  it isn't set up. It covers the built-in subscriptions' card faces
  (accountCard: Claude Code, Codex, Copilot, Gemini, Antigravity, moved
  ones) and then the presets. A custom provider removed since stays its
  id, since nothing else knows its name.
- usageapi.providerFaces: one lookup for LedgerPage and stateOf, in
  order: the provider set up, "Local session" for session-unknown, then
  KnownFace, then the id.

Run:
- TestProvidersNotSetUpAreNamed (new, internal/usageapi). Fails on the
  old code with 13 errors across the filter, rows, both splits, the
  Account filter and the summary; passes with the fix.
- gofmt -l: clean. go vet for usageapi, provider, gateway, gui on darwin,
  and usageapi, provider on GOOS=linux and windows: clean.
- go test ./internal/usageapi ./internal/usage: ok.
- go test ./internal/provider ./internal/gateway ran at load average
  ~300 with other sessions' suites. Three timing tests went red, and each
  passes 3/3 alone (-count=3 -run): TestCopilotSecretToolUsername
  (#1627, commented), TestOTelFastRequestTranscriptDiscovery (#1811),
  and TestTranslatedStreamKeepsClientAlive (filed as #2169).
  TestUsageOverGateway and the gateway's TestUsage* pass.
- GUI: usage-ledger.test.cjs and usage-ledger-chart.test.cjs in chromium
  and webkit, 52/52 (playwright 1.62.0). app.js is unchanged, since the
  page already shows the name the API sends.

Not tried: the real GUI with a signed-out Claude account.
2026-10-14 18:19:16 +08:00
yetone bd4cb7a260 provider: moved Kiro, WorkBuddy and Factory users get plugins 0.1.11, 0.1.21 and 0.1.27 (magpie-community/plugins#120, #121, #119)
The movers' min, so keepMovedCurrent updates every moved user's plugin:
- kiro 0.1.11: a thinking model offers xhigh as its own level (50k
  budget), so Claude Code's xhigh isn't routed as max (plugins#120).
- workbuddy 0.1.21: a model free only at night (Hy4 preview, 23:00-08:00)
  is never said free, and a whole-day discount shows the price before it,
  from WorkBuddy's modelPromotions (plugins#121).
- factory 0.1.27: droid's Fast Mode models (Opus 5.5/5/4.8, GPT-5.5/5.4/
  5.3-Codex), and fast asked of a base model sent to its Fast Mode model
  (plugins#119).

All three are on npm (npm view: 0.1.11, 0.1.21, 0.1.27).

Run: gofmt -l, go vet ./internal/provider for darwin, GOOS=linux -tags
nogui and GOOS=windows, go test ./internal/provider (ok, 449s under load
~280). Not tried: a moved user's update in a running magpie.
2026-10-14 18:18:57 +08:00
yetone 1a33d22cca agent: an omp outside magpie's PATH (bun's ~/.bun/bin) is still found and asked its version on Linux and macOS, so its models offer max (whqtian on Discord)
whqtian: "ubuntu 24 版本的 omp 最大推理级别,还是xhigh,win版和 wsl版好了". omp
gets max in models.yml only when its version is known to be 16.4.0 or
later (ompTakesMax). The version comes from cliBin → binAt, which looks in
the user's tool folders (proc.FindTool: ~/.bun/bin, npm prefixes, every nvm
Node, mise, fnm ...) only on Windows. Elsewhere it uses the PATH magpie
was started with, and only the GUI and `daemon install` widen that. Under
`magpie serve`, web, tui, the CLI or a service, an omp installed by bun in
~/.bun/bin read as no version, so max was turned into xhigh. 31626c154
fixed only WSL's probe script, and Windows already had the fallback, which
is why only native Linux stayed on xhigh. cliBin now falls back to FindTool
on every system. proc.Version reads the npm package.json first, so it
doesn't need bun on PATH.

Verified:
- TestOmpVersionOffPath (a bun-layout omp 18.9.1 in a temp HOME, with
  PATH set to an empty dir) fails without the change (version "") and
  passes with it.
- Reproduced in Docker ubuntu:24.04 with real bun and omp 18.10.4, PATH
  without ~/.bun/bin, provider a/sol with efforts low..max, then
  `magpie omp a/sol`. The old linux/arm64 nogui build wrote efforts up to
  xhigh; the new one writes max. Control: the old build with ~/.bun/bin
  on PATH also wrote max.

Checks: gofmt -l is empty. go vet passes for darwin, GOOS=linux -tags
nogui and GOOS=windows. The GOOS=windows build passes. go test -tags nogui
-count=1 ./... was run under a sandbox HOME.
- The machine's load average was 200-360, so agent, gateway, library,
  plugin and provider ran out of the 10m timeout. Rerun with -timeout
  45m -p 2, all five pass.
- TestRefreshInvalidationCancelsStaleCall (plugin) and
  TestCopilotSecretToolUsername (provider) failed once under that load
  and passed on the rerun. Neither package depends on this change.

docs/subsystems/agent-wiring.md says where an off-PATH CLI is looked
for.

Not tried: the .deb GUI on a real Ubuntu desktop, or the reporter's exact
install.
2026-10-14 18:17:38 +08:00
yetone 8c5190a203 provider: a routing group keeps its thinking members' levels beside a member known not to think, so Codex shows its effort control (#2127, cnlove7777777-art)
#2127: with a routing group as its model, Codex showed an effort but no
control to change it, and new sessions and subagents ran at medium. A
group offers agents the levels its members have in common
(groupEntries), and a member magpie knows doesn't think (Entry.Quiet: its
vendor's list says no reasoning) counted as having none, so the
intersection came out empty. The group still reasons when one member
does, so Codex got its entry with reasoning but no
supported_reasoning_levels and no default_reasoning_level: no slider,
and Codex's own medium.

Since #950 the gateway sends such a member no reasoning ask at all
(withoutReasoningAsk, quiet.go), as it does a reasonless one (f074996d9)
and as it handles a member whose levels nothing knows (#597), so its
having no levels is no reason to take the others' away. groupEntries now
skips it like those two. The group's levels are those of its members
that think; Group.Levels and fixed-effort members are unchanged.

Tests: TestGroupQuietMemberKeepsCodexEffortControl builds the Codex
catalog (codexcat.Catalog(CodexListed())) for a group of a models.dev
reasoning:false model and one with levels, and wants the levels and
default (high, and max when config.toml asks max); TestGroupReasoningLevels
gains "quiet between". Both fail on the old group.go (levels [], default
""). TestGroupLevelsWithUnknownMember's "plain" group and
TestModelsListReasoning's group/auto-mixed encoded the old rule and now
want the thinking member's levels. docs/reference.md and
gateway-routing.md say the new rule.

Run (worktree on origin/main bda271999, private GOCACHE): gofmt -l clean;
go vet (darwin), GOOS=linux -tags nogui and GOOS=windows go vet of
internal/provider clean; go test -count=1 ./internal/provider
./internal/gateway ./internal/agent ./internal/codexcat ok.
Not tried: a real Codex session against the reporter's groups (their
config isn't known; a group with a non-thinking member is the case that
produces exactly what they describe).
2026-10-14 18:14:17 +08:00
yetone 778000326a gui: the sidebar sets off from rest and settles in a third of a second, as a Mac's does (wangye1644294 on X)
wangye1644294 (Windows, zh-CN, sidebar layout) found collapsing and
expanding the sidebar stiff. The morph ran .5s on cubic-bezier(.32,.72,0,1),
the spring the sidebar's lists open on. That curve leaves at speed: 8% of
the travel in the first frame, 92% by 184ms, then a 300ms creep. The frames
a webview drops as the view transition's pictures start to move (WebView2's
most) landed where the page moves most, and read as a jerk, followed by a
long tail.

The view-transition group, side-out and side-in animations now share
--morph-t (.32s) and --morph-ease (cubic-bezier(.42,0,.58,1), the Mac's
ease-in-ease-out). Largest per-frame step drops from 13.7% to 9% of the
travel, and the start, where frames drop, barely moves. End states,
reduced motion (no transition), Linux (no transition) and the 1500ms stuck
cut-off are unchanged. The other .32,.72,0,1 uses in app.js (lists, iOS
sheet, nav) are other animations and are left alone.

side-toggle.test.cjs now reads the running animations' computed timing:
the page, nav-usage group and side-out each last 250-350ms and their curve
starts from rest (x1>0, y1=0).

Measured (page card edge, 188px travel):
- Real WebView2 on the Windows box (Edge 155.0.4283.45, 125Hz, 1349x1128,
  DPR 1.1), 12 toggles each over CDP, a temporary build with
  AdditionalBrowserArgs (not committed):
  old: 63-67 frames over ~503ms, first step 7-8px, max step 14px, one 39px
       jump from frames dropped at the start
  new: 42-44 frames over 320-328ms, first step 0px, max step 9px, no long
       frames
- Mac, headed Chromium, ffmpeg avfoundation 60fps + mpdecimate, 3 rounds
  alternating:
  old: 25-27 changed frames over ~500ms, 4-7 gaps per toggle, first
       visible step 19-54px
  new: 14-20 changed frames over ~333ms, 0-5 gaps, first visible step
       4-18px (a busy shared desktop makes the gap counts noisy)

Run: side-toggle, side-width, header-centre in Chromium and WebKit, 44/44
pass (five languages; widths 1023 and 640 included). Broken by hand, each
red in the new test: the old .5s timing ("group(nav-usage) lasts 500ms"),
the old curve at .32s ("sets off from rest: cubic-bezier(0.32, 0.72, 0,
1)"), and side-out alone at .5s ("old(side) lasts 500ms").
No Go changed, so no gofmt/vet/go test. Not tried: the top-tab-bar layout
on Windows (it has no sidebar morph; covered by the existing tests), and
the reporter's own machine.
2026-10-14 18:10:48 +08:00
yetone bfef5d51b5 gui: Routing is back to v0.1.1231's layout; reverts dae2618ad (#1354)
v0.1.1233 shipped community PR #1354 (dae2618ad), which put "How the
last request was routed" in a right column beside the stage on wide
windows, split the context card into overview/contents columns, and
replaced the context card's own head with one lazily built disclosure
header. Two users on Discord asked for the old page back: wongxy
("这是哪个人才要改成这样的,丑死了", "UI方面的需求响应要克制一点", with a
screenshot of the new page) and molvqingtai ("v0.1.1231 没有这个问题").
The owner delegated the call: Routing goes back to v0.1.1231's look.

Only the lazy construction of the context body was a candidate to keep,
as it is invisible. It doesn't separate cleanly: it is built on the new
unified header (ctxSummary in the closed state, ctx-body/ctx-overview in
the open one), which is itself the visible change. So this reverts
dae2618ad whole: assets, its doc section, its README entry, the new
routing-context-layout test, and the test edits that existed only for
the new layout (wheel-scrolling to rows the right column pushed down,
mobile-web's skip of Routing in the pixel comparison). No later commit
on main is a follow-up of it.

Later commits touching the same files are kept: 20350dafa's subagent
reason in routing.js and README entry, a7a38193f/5fc2f87d1's gui-shell.md
lines, 00afcf97a's README entry. routing.css and context.js are now
byte-identical to v0.1.1231; routing.js differs only by later features
(#1068 folders, subagent reasons).

Run (worktree on origin/main 3ec45e715 + this revert):
- Routing page screenshots against v0.1.1231's assets with one counted
  request (the .rt card): Chromium and WebKit, en/zh/zh-TW/ja/de, 1100
  and 420 wide, plus 1440/1800 in en/zh: 0 pixels differ in all 28.
  origin/main differs in all of them (the folded header, the columns).
- node --test routing-*, panel-routing*, group-fold, held-animations,
  phone-rows, context-*: 1025 of 1034 pass. The 9 reds are
  routing-keys-fold's "a request that comes flies to the fold" (WebKit,
  and Chromium de) and routing-model-rest's "Try now" reach. Both files
  run alone fail the same way on origin/main bda271999 (12 fails there,
  11 here, different cases of model-rest each run), at load average
  ~350 from other sessions; filed as #1612 and #2115.
- mobile-web (pixel baseline) with BASE_REF=dae2618ad^: every phone
  case and Routing's desktop compare pass; the 8 reds are all Settings,
  changed since by #2073's colorblind switch, not by this.
- gofmt -l, go vet (darwin, linux nogui, windows) and
  go test -tags nogui ./internal/gui pass.
Not tried: the native Wails window; the complete GUI suite.
2026-10-14 18:07:59 +08:00
yetone 60fa582c80 gateway: a try is queued only for the time it stood in its lane's queue or waited for its minute, so a provider with no limit never reads as queued (#2153)
TestSentTellsMagpieFromEarlierTries failed on a loaded Mac with
"queued 1" for a provider with no MaxConcurrency and no MaxRPM. queued
was time.Since(waited) around the whole block: keepQueued's goroutine
starting, lanes.take, rpms.wait, and queuedAlive() waiting for that
goroutine to end. With no limit take returns at once, but starting and
stopping the keepalive goroutine on a busy machine took a millisecond,
and that read as a wait for a slot. Users saw the same: a 1ms "queued"
in a request's detail on a provider with no limit, taken out of
"In magpie".

lanes.take now answers how long it stood in the queue (0 on the fast
path, with no limit or a slot free), rpms.wait already answers how long
it waited for its minute, and queued is their sum. A lane wait that ends
in errQueueWait or the agent leaving still counts its time, which
laneMessage's "waited %.1fs" uses.

Reproduced by injecting a 3ms sleep at the end of keepQueued's stop
func: on the old code the test failed ("queued 7"); with the change it
passes with the sleep still in. The sleep is not committed.

Run: go test -tags nogui -count=1 ./internal/gateway/ (full package,
ok, 1833s on a machine at load ~220); gofmt; go vet darwin,
GOOS=linux -tags nogui, GOOS=windows. Not tried: -race on the full
package.
2026-10-14 17:58:41 +08:00
yetone 4faa931325 provider: Vertex AI's preset offers Gemini 4 Argon at global, and its test asks it at low (#2155, TomXPRIME)
Gemini 4 Argon went live on Vertex AI's global location on 2026-10-13
(gemini-4-argon), and the preset's fixed list (Vertex has no list to ask)
didn't have it, so a fetch never showed it. It is added to the preset's
models, which are global's; us, eu and the regions are left as they
answered on 2026-10-06, since nothing says Argon is served there (typed
in by hand it still goes).

Its metadata (1,048,576 context, 65,536 output, low/medium/high, $2/$10)
comes from models.dev's google-vertex entry, which lists it as of today,
so nothing is hard-coded here. The gateway already tells Gemini 4 a
thinking level at the level asked (52be997b3, #2083), medium as medium.

The model test (vertexTest) only told gemini-3* a thinking level; Argon
got none, so it would think at its default medium against a 16-token
budget. It is now told low like every Gemini 3 and later
(vertexGeneration), and an id naming no generation (gemini-flash-latest)
still gets none.

Run: go test -tags nogui ./internal/provider/ (full package, ok);
TestVertexTestRequest goes red on the old gemini-3 prefix check with the
new argon row; gofmt; go vet darwin, GOOS=linux -tags nogui, GOOS=windows.
Not tried: a real Vertex AI project (no Google Cloud credentials here).
2026-10-14 17:44:03 +08:00
yetone 50929661fe provider: a moved Devin gets plugin 0.1.16, where SWE-2 isn't held by a used-up quota
太陽と向日葵 on magpie's Discord: SWE-2 is free, but with the Devin
account's quota used up magpie said so and didn't route SWE-2 to it,
while a model test worked. The plugin's "1 day" and "7 days" windows
named no models, so a full window held the account for every model.
@magpie-community/opencode-devin-auth 0.1.16 (plugins cff78b3) reads
Devin's model_cost_tier from GetCliModelConfigs: SWE-2's variants are its
Free tier, the only ones of 262. It gives the day and week windows
notModels with their ids (quotaOfPlugin's idSet then leaves them out) and
lists them free: true (catalog Free, so PaidBesideFree rests only a paid
model on a quota refusal). Raising the mover's min updates moved users.

Run: gofmt -l; go vet for darwin, GOOS=linux -tags nogui and
GOOS=windows on internal/provider; go test -timeout 30m ./internal/provider
in a sandbox HOME, ok in 691s (the default 10m timed out at load average
~300, other sessions' test binaries running). npm view
@magpie-community/opencode-devin-auth@0.1.16 --registry
https://registry.npmjs.org --prefer-online returns 0.1.16. Not tried: an
account with its quota really used up, nor the moved plugin end to end
through a gateway.
2026-10-14 17:40:07 +08:00
yetone 7d4ad7c628 gui: the menu bar's total is every token, cache too, marked Σ, as the Requests tab sums it (NextCommit)
NextCommit on Discord: the menu bar's usage showed only input tokens, and
more input than the Usage page. It showed input + output, unlabelled, so
it read as the input and came out above the page's input. And it was summed
as the Overview sums (usage.SummarizeTop: the gateway's calls only, cache
aside), while a click opens the panel's Usage tab, which sums the ledger
(the agents' own session-file calls too) and counts the cache's tokens
in its Tokens. Two numbers under one name.

- trayTotalSum is the ledger's cached sum, usage.QueryPage(p, {}, 0, 1).Sum,
  the one the panel's Usage tab and the window's Requests tab show.
- The cell's top row is every token (in + out + cache read + write, as
  allTokens) prefixed Σ; the cost stays under it. The tooltip spells out
  "N tokens (a in · b out · c cached)".
- With the window as the tray's, a click opens the Requests tab at the
  period (quotaView), not the Overview, which sums differently.
- docs/reference.md and gui-shell.md say so.

Run:
- TestTrayTotalIsTheLedgers (new): a Codex session-file call of 1000 in,
  200 out, 8000 cache read; the menu bar's sum equals ledgerPage's and the
  cell reads Σ9.2K. With trayTotalSum put back to SummarizeTop it fails
  (menu bar all zeros, ledger 1 call).
- TestTrayTotals/BesideCards updated for Σ, the cache and tab=requests.
- go test -tags nogui ./internal/gui (sandbox HOME via the package): ok.
- tray-totals, tray-usages, tray-cell-click .test.cjs, chromium and
  webkit, five languages, 1100 and 420: 70 pass.
- The Mac cell rendered with trayImagePNG and looked at: "Σ6.3M" over
  "$3.40", "Σ47M" alone, both inside the row width.
- gofmt -l, go vet darwin, GOOS=linux -tags nogui, GOOS=windows; builds.
Not tried: the real menu bar on the reporter's data.
2026-10-14 17:29:43 +08:00
yetone bda271999f gui: the desktop window saving an allow list is this computer, not 192.0.2.1 (Mathresearcher)
Settings › Allowed addresses in the desktop app refused a list with "that
allow list would shut out 192.0.2.1, the address this page is open from"
(Mathresearcher on Discord). The window's requests reach the API through
Wails' asset server, which has no peer address and fills in
192.0.2.1:1234 (TEST-NET-1; assetserver_webview.go in wails v3
beta.24). KeepsOut took that for the page's address. The asset handler
handed to Wails is now wrapped in ownWindow, which marks its requests as
loopback: only the webview reaches it, never the network. magpie web
(web.go, AllowGuard) is unchanged and still judges the real peer.

Run:
- TestAllowIPsFromTheAppWindow (new): posts ["10.0.0.0/8"] with
  RemoteAddr 192.0.2.1:1234 through ownWindow(Handler). With ownWindow's
  rewrite taken out it fails (refused, saved []); with it, passes.
- go test -tags nogui -run TestAllowIPs ./internal/gui: ok.
- gofmt -l, go vet (darwin), GOOS=linux -tags nogui and GOOS=windows vet
  of internal/gui and internal/gateway; go build for all three.
Not tried: saving the list in a real desktop window (not launched).
2026-10-14 17:00:34 +08:00
yetone 3ec45e7155 gateway: a json_schema an upstream turns away is asked for as a JSON object, the schema in the system prompt, before the format is told in words alone (#2126)
klarkxy's Codex on Xiaomi MiMo's Token Plan got back "text.format type
'json_schema' is not supported, only 'text' and 'json_object' are
supported" and the turn ended there. Codex's /responses reaches the
upstream by passthrough when the protocols match, and passthrough never
looked at a format refusal; the translated path did, but only by moving
the whole format into the system prompt, which drops the object
requirement the vendor would have kept.

Now, on either path, a json_schema the upstream turns away is asked
again as {"type":"json_object"} with the schema appended to the system
prompt (Responses instructions, Chat's first system/developer message,
Anthropic system). If json_object is turned away too, the format field
goes and only the words stay. Each step is remembered per provider,
model and protocol once a request with it is taken, so later turns go
out already rewritten. Anthropic's output_config.format has no object
mode, so it goes straight to words. DeepSeek, which takes json_object
only, gains the same middle step on the translated path.

Run:
- format_refused_test.go, new:
  - TestPassthroughSchemaRefusedAskedAsObject replays the reporter's
    exact error and probe body through /backend-api/codex/responses.
    It covers object taken (2 asks, then json_object) and object refused
    too (3 asks, then no format). Turn 2 is checked to take 1 ask, the
    instructions to keep "You are Codex." first, and the input to be
    unchanged.
  - TestPassthroughFormatRefusedChatAndAnthropic.
- TestRefusedFormatToldInWords was rewritten for both outcomes on the
  translated path.
- Break check: with the old gateway.go, the passthrough test gets back
  the reporter's exact error.
- gofmt -l is clean. go vet passes for darwin, GOOS=linux -tags nogui
  and GOOS=windows. go test ./internal/gateway/ -count=1 is ok (1017s).

Not tried: a real Xiaomi MiMo key (none here; the error envelope is
assumed to be OpenAI's), and Gemini passthrough, which has no rewrite.
2026-10-14 16:42:56 +08:00
yetone 3e812ebde4 gateway: a provider that refuses a tool_result holding only tool_reference blocks gets them said as text too (#2124)
OpenDesign's Anthropic-compatible endpoint answers 422 "messages[4]:
missing field `content`" when a ToolSearch result carries only
tool_reference blocks, so every Claude Code turn after a deferred tool
loaded failed there.

The fix is a learned shape, scoped to the provider that refuses it, like
the deferred-tools one: refuseShapes marks shapeRefsOnly when a 400/422
says "missing field `content`" and the request held such a result, and
withoutRefusedShapes then puts a text block ("Tool X is loaded and can be
called now.") before the references in each refs-only tool_result,
keeping the references. Every Anthropic upstream route goes through
forward/forwardOnce, so /v1/messages, count_tokens and a group's member
all get it; a provider that takes the references unchanged never sees the
text. Requests translated to another API already rendered a reference as
text in stringOrText; it now uses the same sentence (toolLoadedText).

Run:
- TestRefsOnlyToolResultRefusedGetsText (fake vendor answering the
  reporter's 422 bytes, body from the reporter's repro.json): first ask
  refused, retried with the text; group member and count_tokens get it at
  once afterwards; a provider that takes them sees bare references.
- TestRefsSaidLeavesOtherResults: other results unchanged, two refs.
- Break checks: with the mark off, and with the mend off, the test fails
  with "status 422 ... missing field `content`".
- go test -tags nogui ./internal/gateway/ -count=1: ok (1069s, loaded
  machine; a first run with the default 10m timeout timed out under load).
- gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows.

Not tried: the real OpenDesign endpoint (no key); the fake follows the
reporter's own curl evidence.
2026-10-14 16:42:47 +08:00
yetone 54a2b0d05f gui: a provider kept for its usage alone is one click, Usage only, and its card says so (#2068, keleus)
keleus wanted a subscription's quota in the status bar without anything
routed to it. That has existed since #1818 (noModels), but getting there
took Picked only, then Select none, then Save, and the card then just said
"no models exposed". The models' serves control now has a third option,
Usage only: no picks, noModels on, nothing routed, balance and usage still
read, models the vendor lists later not added. The card's line says
"usage only" for such a provider. Picked only with none picked used to be
the same state under another name; it now starts from the models the
vendor's list serves (the dashed ones), so each of the three options is a
state of its own. Unpicking the last pick still leaves none (#1831),
which now reads as Usage only. Strings in en, zh, zh-TW, ja, de; the old
Picked only tooltip's second half moved to Usage only's.

Decision (owner delegated product calls): name the state rather than
document the path; the backend, CLI (`magpie provider models <id> none`)
and saved files are unchanged.

Run: provider-none-picked.test.cjs and i18n-keys.test.cjs, Chromium and
WebKit, 5 languages, 1100 and 420 wide: 33/33. With app.js put back,
provider-none-picked fails ("+ 'Picked only' - 'Usage only'"). The test's
saved-as-none fixture now has its models off, as /api/providers sends them
(Exposed is empty for it). No Go changed. Not run: the whole GUI suite
(no shared selector or API added).
2026-10-14 16:42:39 +08:00
yetone 1a5128747b cli: magpie provider refresh-every and auto-include set a list's schedule and rules (#2135)
`magpie provider refresh-every <id> 6h|1d|off` and
`magpie provider auto-include <id> 'gpt-*' 're:claude-.*'|none` set the
fields the previous commit added; `magpie provider <id>` shows them, and
`magpie provider refresh` prints the models its rules took.

TestRefreshEveryAndAutoIncludeCmds: a too-short or unreadable time and
a plain id as a rule are refused, the rule takes the current matches,
and none/off clear both while keeping the picks. Run with the go test
in the previous commit's body.
2026-10-14 16:40:24 +08:00
yetone ee4a7ab471 provider: a provider of your own can fetch its model list on a schedule and take newly listed models by rule (#2135, tianxia3111)
tianxia3111 runs a headless `magpie serve` with relays of 10–70 models.
A model the relay adds never reached the list until Fetch models was
clicked, and was then picked by hand.

- RefreshEvery (a Go duration or Nd, at least 10m): the gateway
  (KeepListsFresh, started beside KeepPluginsListed, so serve and the
  app) looks each minute and fetches a list once Fetched is that old,
  through the same Refetch as Fetch models, so dropped models leave
  the picks exactly as they do there. A failure waits min(every, 15m).
- AutoInclude (globs with *, or re: patterns, the same ones routing
  groups read; a plain id is refused): RefetchTaking adds a model the
  fetch newly lists that a rule matches. It starts from what is served
  now (Exposed), so nothing served is removed, and a model the user
  unticks stays out because it isn't new to the next fetch. Setting
  the rules takes the current list's matches. Rules only ever add.
- Only providers of the user's own take them: an account's list is
  fetched for it, and a plugin's by the plugin.
- Every save keeps them, the window's editor (/api/provider/save)
  among them, which has no fields for them yet.

Tests (each fails without the change, broken by hand and watched go
red: GUI keep line removed, takeMatching skipped, retry guard removed):
TestAutoIncludeTakesNewlyListedMatches, ...KeepsWhatIsServedWithNothingPicked,
...RefusesWhatIsNoRule, TestParseRefreshEvery, TestKeepListsFreshFetchesWhatIsDue,
TestSaveKeepsTheListsScheduleAndRules, gui TestProviderSaveKeepsListScheduleAndRules.

Run: gofmt -l; go vet ./... (darwin), GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./...; go test internal/provider internal/gui
internal/gateway internal/cli with pipefail in a sandbox HOME.
Not tried against a real relay; the GUI editor fields are not added.
2026-10-14 16:40:23 +08:00
yetone 00afcf97a1 provider, gui, cli: a Codex account's auto-use of its resets is two switches, its week used up and one about to expire (#2078, alanwalk)
alanwalk asked for "自动使用重置卡" to be split: they want a reset that is
about to expire used rather than lost, but a used-up week waited out rather
than spending a reset on it (and the other way round for others).

What changed:
- settings: codexAutoResetOnly narrows an account in codexAutoReset to
  "week" or "expiring". An account with no entry keeps both, so every
  existing config means what it meant: nothing to migrate, and no user
  value is rewritten. Load drops entries for accounts not in the list or
  with an unknown value.
- provider: CodexAutoResetWhen(user) reads both times. AutoUseCodexReset
  (the week used up, called from the gateway's autoReset and
  autoResetSignedIn through AutoResetsWeek) only acts when the week is on;
  SpendExpiringCodexResets and routing's resetRunsOut only count on the
  expiring reset when that is on. SetCodexAutoResetCase(user, when, on)
  sets one time and keeps the other; SetCodexAutoReset still sets both.
  Both off removes the account.
- gateway: POST /api/settings/codex-auto-reset takes an optional "when";
  POST /api/settings keeps codexAutoResetOnly, which the page doesn't send.
- GUI: the account's card (Usage page and the menu bar panel) says
  "Auto-use resets:" with each time on its own line and its own switch;
  the brief account's one switch still sets both, its title naming each
  time; Settings › Usage gives each account an Off/On per time. The status
  line says which times are on now. "· auto-used before it expires" on
  the resets held follows the expiring switch alone. Strings in zh, zh-TW,
  ja and de.
- CLI/TUI: `magpie quota auto-reset <account> week|expiring on|off`; the
  quota and accounts tables and the TUI say "auto", "auto when the week
  runs out" or "auto before one expires".

What was run (worktree on origin/main 2fbbd1694):
- gofmt -l on the changed Go files: clean. go vet ./... (darwin),
  GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: clean.
- go test -tags nogui ./internal/provider ./internal/gateway ./internal/cli
  ./internal/tui ./internal/gui ./internal/settings: ok. The gateway
  package hit go test's 10m default once while ~15 sibling sessions were
  building on this machine (no test failed; TestRemoteMagpieModels was
  merely running); with -timeout 30m it passed in 967s.
- New Go tests: TestCodexAutoResetCases (provider), a week-only step in
  TestSpendExpiringCodexResets, an "only before one expires" case in
  TestCodexAutoResetNot (gateway), CodexAutoResetOnly in
  TestSettingsSaveKeepsWhatItDoesNotSend. Broken by hand: making
  CodexAutoResetWhen ignore the narrowing turned all three reset tests
  red (the gateway case answered 200, a week-only account read 2 and
  spent 1); dropping the keep line in api.go turned the settings test red.
- GUI (Playwright, chromium and webkit): codex-auto-reset.test.cjs, now in
  en, zh, zh-TW, ja and de at 1100 and 420 wide, flips each time's switch
  on the card and the panel and checks posts carry "when", the other time
  is kept, the status, the resets-held line, the brief switch, fit at 420,
  no left border, no select; codex-auto-reset-settings.test.cjs does the
  same for Settings › Usage. Both, with codex-resets-used, routing-auto-reset,
  quota-curve (its class list now holds ar-split) and i18n-keys: 56 + 18
  pass. Broken by hand: posting without "when" turned 20 of 21 red.
  quota-curve failed 2 of 18 once while a go test build ran beside it; it
  passed 15/15 serially and 18/18 again at concurrency 4 just after.

Not tried: a real ChatGPT account using or keeping a reset; the times are
driven with the faked usage reads the existing tests use.
2026-10-14 16:37:59 +08:00
yetone 4f08533e86 agent: an update that exits 0 but leaves the CLI unable to run is mended once, else said as failed (#2128, leozejia)
The reporter clicked Update all. npm 11.19.0 ran
`npm install -g --prefix /opt/homebrew @anthropic-ai/claude-code@latest`,
logged "reify failed optional dependency …claude-code-darwin-arm64" and
exited 0. Claude Code 2.1.299's postinstall soft-fails without its native
package, so bin/claude.exe was left as the stub that says "Error: claude
native binary not installed." and exits 1. UpdateCLI saw npm succeed and
read the new version from package.json (proc.Version never runs an npm
CLI), so the update was reported as done.

Now, after an update that succeeds, UpdateCLI runs `<cli> --version` once
(runsBroken). It uses a 30s timeout, the update's env (npm's folder first
on PATH) and no stdin. Only a run that exits non-zero and prints no version
counts as broken. A run that didn't start, timed out, or exited 127
(interpreter not found) is unknown, not broken.
- npm installs that magpie runs as the user: the version just installed is
  installed once more with --include=optional, which is how the reporter
  mended theirs, and the check runs again.
- npm installs needing administrator rights get no second prompt.
- If the CLI still fails, or it was installed some other way (bun, pnpm,
  brew, self), the update fails. The message carries what the CLI said and
  how to reinstall it, e.g. `npm install -g --prefix /opt/homebrew
  @anthropic-ai/claude-code@2.1.299 --include=optional`.
Both Update all and a row's Update pill go through UpdateCLI, so both are
covered. The GUI already shows an update's error, so it is unchanged.

What was run:
- TestUpdateCLIChecksItRuns: a fake Homebrew prefix with Claude Code's
  package and the stub as the reporter found them. It covers the update
  mended by the second install, a working update that runs nothing more,
  and an update left broken that fails with the reinstall command. With
  the check disabled it fails ("not mended: <nil>").
- TestRunsBrokenOnlyWhenSure: a version said with a non-zero exit, exit 127
  and a silent exit 0 are not broken.
- gofmt -l; go vet for darwin, linux (nogui) and windows.
- go test ./internal/agent/ -timeout 45m passes (856s). The first run hit
  the default 10m timeout at load ~290 while in TestOmo, with no failure.
- go test ./internal/proc/ passes, TestNoCommandBypassesProc included.

Not tried: a real npm install that drops the native package, and Windows,
where the new tests skip because their CLIs are shell scripts.
2026-10-14 16:31:08 +08:00
yetone 26d11fb78f gui: a quota curve's tooltip follows colorblind mode as soon as it changes, not at the next redraw (#2073)
The colorblind patch set the curve's tooltip only when box.draw ran, so
with the mode turned off elsewhere (another window, read on focus) a
curve on screen kept the "dash shown beside its name" text until the
next state redraw. quota-curve's colorblind test caught it 1 time in 10
(webkit zh), and also read the curve while a state poll begun before the
change could still answer with the mode on (chromium zh-TW: the even
pace still dotted).

applyPrefs now sets the tooltip again on every drawn quota curve when
the mode changes (quotaCurveTitle, shared with box.draw). The test checks
the tooltip matches the mode right after it changes, then waits for the
plain curve rather than reading once.

Run (playwright 1.62.0, chromium and webkit, the test's 5 languages and
widths): api-key-theme, balance-*, context-*, gui-de/ja/zh-tw,
i18n-keys, omarchy, quota-*, seg*, settings-*, usage-ledger*: 651/651.
Taking the applyPrefs line out turns the colorblind test red (chromium
en, ja). Not tried: the real Wails window.
2026-10-14 16:28:06 +08:00
chenluzhou 5fc2f87d13 gui: in colorblind mode a quota legend key is its window's dash, the even paces are dotted, and the balance curve and the good grade keep their look (#2073)
A review of db25c4ee found that colorblind mode reached past the quota
curve and that its legend shapes matched nothing on the plot:

- The fallback rules `.qc-line:not([data-series="0"])...` and the
  matching `.qc-key` rule also matched elements with no data-series, so
  the balance curve's solid line became dashed like its fitted line, and
  its legend dot became a ring in var(--c4) while the line was var(--c1).
- A filled circle, hollow square or diamond in the legend appeared
  nowhere on the plot, so it didn't tell a reader which line was which.
  Series 3 and up shared one dash and one shape.
- The 7-day line's 6 2.5 dash sat beside its own 3 3 dashed even pace in
  the same colour, while the tooltip still said "Solid: what was left.
  Dashed: an even pace".
- The Context tab's "good" grade took var(--c2), which the palette turns
  amber, next to "fair" in --amber (dark #fbbf24 vs #f2b544).
- omarchy.css made the first legend dot round with colorblind mode off.
- The legend set its colour twice (--sw and background) and undid it
  with !important.

Now, with colorblind mode on:

- drawQuotaPlot tags each window's path.qc-line and line.qc-even with
  data-series (its index mod 7, the same slot as its colour), and the
  quota legend tags its key. Seven dash patterns, one per slot, apply to
  `:is(.qc-line, .qc-dash)[data-series=N]`, so a line and its key can't
  drift apart. Nothing else sets data-series, so the balance curve is as
  on main.
- Each quota legend key shows a 22px sample of its window's line
  (svg.qc-sample > line.qc-dash) in place of the dot; with the mode off
  the sample is hidden and the dot is as on main.
- The even paces are dotted (0 4, round caps), unlike every window's
  dash; the curve's tooltip, set in box.draw, says "Each window's line
  has the dash shown beside its name. Dotted: an even pace, ..." in en,
  zh, zh-TW, ja and de.
- `.ctx-ring.good` / `.ctx-grade-word.good` take --c1, the palette's
  blue.
- omarchy.css is back to main's; the legend's `--sw` and !important are
  gone.
- The Settings note now says what the mode does ("Colorblind-safe chart
  colors, and each allowance window's line in a dash of its own"), and
  gui-shell.md says the note is the Off/On control's tooltip, as the
  code has it.

Run on db25c4ee + this change (upstream/main f074996d9 unchanged),
Playwright 1.58.2, Chromium and WebKit:

- New tests fail without the change: with db25c4ee's assets the 10
  "colorblind mode separates quota windows by colour and dash, in the
  legend too" (both engines, 5 languages), the 2 "seven windows have
  seven dashes" and the 2 balance-curve "colorblind mode leaves the
  balance curve's solid line, dashed fit and dot" fail, 14/14 (e.g.
  "key 0 shows its line, not a dot"). Broken by hand on this change,
  each is caught: the good-grade rule removed ("good and fair too close:
  light: {good: 41.5, fair: 26.0}"), the dotted pace removed (pace dash
  equals its default), the colorblind tooltip removed ("the tooltip names
  the dashes and dots: Solid: ..."), the :not() fallback put back ("the
  balance stays solid: line 2.5px, 2px"), series 3-6 given one dash
  ("every window its own dash: 4 !== 7"), the sample's dash rule dropped
  (key 1's dash).
- quota-curve.test.cjs 27/27, balance-curve.test.cjs 6/6; the colorblind
  tests 14/14 three runs in a row at --test-concurrency=4.
- balance-currencies, context-window, quota-read-at, settings-general,
  usage-ledger-chart, api-key-theme, gui-de, gui-ja, gui-zh-tw,
  i18n-keys, keep-awake, lightweight, omarchy, seg-contrast, segs-glide,
  settings-search, settings-sections and usage-ledger*: with the two
  above, 305/315. The 10 failures are settings-general's WebKit cases
  ('English\n' for 'English' from #langPick's innerText, a span and an
  svg), which fail the same 10 on upstream/main f074996d9 in this
  Playwright's WebKit; not fixed here.
- node --check app.js, i18n.js and both tests: clean.
- Sandbox HOME, GOPATH/GOMODCACHE/GOCACHE pinned, set -o pipefail:
  gofmt -l on the changed .go files prints nothing; go vet ./...,
  GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...,
  go build, GOOS=linux go build -tags nogui, GOOS=windows go build and
  go test -tags nogui ./... all exit 0 (the only output is the existing
  cgo -Wenum-conversion warning in trayimage_darwin.go);
  TestSettingsColorblindMode passes.
- Not run: the whole GUI suite (707 files; only the files above), the real Linux app under
  WebKitGTK, and a check by a colour-blind reader.
2026-10-14 16:28:05 +08:00
chenluzhouandDevin a7a38193f5 gui, settings: colorblind mode for quota curves and chart series (#2073)
In Usage -> Allowances, the 5-hour and weekly quota curves and their
legend dots took --c1 and --c2, which are both shades of blue in light
(#4f46e5, #0ea5e9) and dark (#a5b4fc, #7dd3fc) themes, with identical
solid lines and 7px round dots and the 5-hour line dimmed to .45 over a
week (#2073, chenlz22550).

- settings.Colorblind ("colorblind" in settings.json), passed in GET
  /boot.js when on and applied before first paint by theme.js and on
  every state/settings read by applyPrefs as data-colorblind="1" on
  :root.
- Settings -> General adds a Colorblind mode row (#colorblindRow,
  #colorblindSegs) under Appearance, in en, zh, zh-TW, ja and de.
- Under :root[data-colorblind="1"], --c1...--c7 switch to an Okabe-Ito
  qualitative palette in both light and dark themes so adjacent series
  differ in hue and lightness across quota curves, tray sparklines, the
  usage ledger and context charts.
- drawQuotaPlot and quotaCurve's drawLegend tag each series with
  data-series on path.qc-line and .qc-key; in colorblind mode series 0
  and series 1+ use distinct stroke-dasharray patterns and legend swatch
  shapes (filled circle vs hollow square/diamond), and .qc-line.qc-short
  keeps .85 opacity so short windows stay legible over a weekly span.
- docs/subsystems/gui-shell.md documents the boot and Settings contract.

Run (on origin/main f074996d9, sandbox HOME, pinned GOPATH/GOMODCACHE/GOCACHE):
- quota-curve.test.cjs in chromium and webkit (en, zh, zh-TW, ja, de):
  25/25 pass; with HEAD's assets via MAGPIE_QUOTA_ASSETS, all 10 new
  colorblind subtests fail (TimeoutError waiting for #colorblindRow).
- TestSettingsColorblindMode (new in internal/gui): passes; fails when
  boot.js omits colorblind.
- i18n-keys.test.cjs, gui-zh-tw.test.cjs, gui-ja.test.cjs,
  gui-de.test.cjs: 12/12 pass.
- settings-general.test.cjs (chromium 10/10), settings-sections.test.cjs,
  settings-search.test.cjs, omarchy.test.cjs, lightweight.test.cjs,
  keep-awake.test.cjs, segs-glide.test.cjs, api-key-theme.test.cjs,
  seg-contrast.test.cjs, balance-curve.test.cjs,
  usage-ledger-chart.test.cjs in chromium and webkit: 140/140 pass.
- node --check on app.js, theme.js, i18n.js: clean.
- gofmt -l: clean. With set -o pipefail: go vet ./..., GOOS=linux go vet
  -tags nogui ./..., GOOS=windows go vet ./..., go build, GOOS=linux go
  build -tags nogui, GOOS=windows go build: all clean.
- go test -tags nogui ./...: all packages ok.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-10-14 16:28:05 +08:00
yetone 9a0d723d4d gateway: a request whose kept-alive connection was dropped is sent again at once on a new one, not failed as a 502 and asked after a pause (#2136, jiangkoumo)
The reporter's Pi -> Codex routes showed "POST …: EOF" and "write:
broken pipe" before any reply, each answered as a 502 and asked again
after retryPause. Both are a kept-alive connection to the vendor that a
proxy (Clash here) or the vendor's front closed while it sat idle: the
request is written into it and the read finds EOF. Go's Transport sends
such a request again on a new connection by itself, but only when it
counts as replayable, and a POST doesn't unless it carries an
Idempotency-Key or X-Idempotency-Key header.

upstreamTransport is now wrapped in replayable, which marks every
upstream request with a body Go can send again (GetBody set) with
X-Idempotency-Key = nil: Go's mark, never written on the wire, so no
vendor sees a new header. Go only replays a request on a reused
connection when nothing came back on it, so a cut mid-reply is not
replayed (that stays the retry loop's, as before).

Run:
- TestDroppedKeepAliveIsAskedAgainAtOnce (new): a raw TCP fake answers a
  connection's first request and drops it on the second. Without the fix
  it fails: "the dropped connection took 2 tries (502 Post …: EOF; 200 ),
  want 1". With it, passes, also -race -count=3 and -count=10.
- Broken by hand: giving the header a value fails on "the vendor was
  sent an X-Idempotency-Key".
- go test -tags nogui -count=1 ./internal/gateway/ ./internal/netproxy/:
  netproxy ok; gateway all pass but TestSentTellsMagpieFromEarlierTries
  ("queued 1" under load; passes 10/10 alone with and without this
  change). Filed as #2153 with its cause.
- gofmt -l, go vet darwin, GOOS=linux -tags nogui, GOOS=windows; go build
  for darwin, linux (nogui), windows.

Not tried: real Codex through Clash; the mid-reply "unexpected EOF"
after reasoning had flowed is not changed by this (see #2136 reply).
2026-10-14 16:23:26 +08:00
yetoneandTryWorld 8e2c1bd2a4 tui: u on the Usage page follows the app's "how much is left", and writes it back (#1070)
The TUI read Settings' quotaLeft nowhere: a user who had picked "left" in
the app saw the used share on every start, and u only turned it in memory.
newModel now seeds qleft from settings.QuotaLeft, and u saves the pick
through the same Load/Save pair POST /api/settings/quota-left uses.

TryWorld2026's yetone/magpie#1070 (head 91430684e), squashed onto main by
hand: GitHub couldn't merge it, as usage_test.go conflicts with #1856's
TestUsagePageSaysCallsUnpriced appended at the same spot. Both tests kept.

Run: gofmt -l; go vet ./internal/tui for darwin, and -tags nogui for
darwin, linux, windows; go test -count=1 ./internal/tui ok. Main's pages.go
fails TestQleftWritesBack, main's tui.go fails TestQleftSeededFromSettings.
Real use: magpie tui (nogui build) in tmux under a sandbox HOME, starting
from settings.json quotaLeft true; on Usage, u wrote false, u again wrote
true.
Not tried: the headline line (no subscription accounts in the sandbox), and
a running tray following a TUI change before its next refresh.

Co-authored-by: TryWorld <tryworld@foxmail.com>
2026-10-14 16:21:30 +08:00
dgmico 1c98e0d7e8 sessions: the Routing page names a PI-Desktop chat by its PI-Desktop title (#1967)
PI-Desktop sends its chats through magpie with X-Magpie-Session, and keeps their
names only in its own pi.sqlite. cdb7b5ff7 read those names for the Sessions and
context pages, through desktopExternalTitles, but the Routing page asks Titles
with agent:id keys instead, and Titles only knew Claude Desktop’s prefix — so a
PI-Desktop row still went by its session id.

Titles now looks PI-Desktop’s names up for pi-desktop:id and pi:id, as the context
page already does (a request PI-Desktop sent before it had a User-Agent of its own
was counted as Pi’s).

Run: go test ./internal/sessions; red without the change
(TestPIDesktopTitlesNameGatewaySessions).
Reviewed and run by the maintainer on 63ad2b7c7: the patch posted on #1967,
cherry-picked as is. Titles now names PI-Desktop chats the same way
desktopExternalTitles already does for the Sessions page (same isPIDesktop,
same PIDesktopTitles), and a native pi session's own title still wins,
since the files' titles are written over it afterwards. Run in a sandbox
HOME: go test ./internal/sessions (ok); with sessions.go put back,
TestPIDesktopTitlesNameGatewaySessions fails ("Titles[pi-desktop:…] = "",
want the PI-Desktop name", the same for pi:); go test ./internal/gui fails
only TestMainWindowCorners/macOS_26_SDK, killed at its 40s deadline at a
load average of 328 (#1936, open); gofmt -l; go vet darwin, GOOS=linux
-tags nogui and GOOS=windows for internal/sessions. Not tried: a real
PI-Desktop here (the reporter ran it against theirs on 0.1.1230).
2026-10-14 16:20:47 +08:00
yetone 536b15a8e9 gui: Settings › Proxy has a Test that says whether requests leave through it (#2076)
c4ex: the proxy setting gave no way to see whether it takes effect, and
suggested asking a Cloudflare address.

What changed:
- POST /api/proxy/check (proxycheck.go) asks Cloudflare's trace page
  (www.cloudflare.com/cdn-cgi/trace) twice at once, 10s each: once as a
  vendor request without a proxy of its own goes (http.DefaultClient,
  netproxy's Settings / *_PROXY / system proxy), once direct
  (netproxy.With "direct"). Each answer is the ip= and loc= Cloudflare saw,
  and the ms. With no proxy in force (source off/none) only the direct one
  is made. The proxy is reported redacted (Describe); a failure's text has
  user:password taken out.
- The Proxy row gets a Test button; the result goes on a line under the
  row's text: works (two addresses), the same address both ways (shown as
  a failure: the proxy isn't taking the requests), the proxy failing (with
  the direct address), no proxy in force, the check failing. Testing… while
  it runs; the result outlives a redraw and goes when the proxy changes.
  Strings in zh, zh-TW, ja, de.

Decision (delegated): compare against a direct request rather than only
show the proxied address, since an address alone can't say whether the
proxy was used; Cloudflare's trace page as the reporter suggested (plain
text, no account, served worldwide).

Run:
- go test ./internal/gui -run TestProxyCheck: 5 tests (proxy vs direct;
  no proxy asks only direct; a refusing proxy, password not in the error;
  a page with no ip= fails; ALL_PROXY global proxy is gone around for the
  direct leg). All loopback/.invalid, nothing leaves the machine. Broke
  the direct leg's With("direct"): the global-proxy test goes red ("the
  proxy asked 2 times").
- go test ./internal/gui -count=1: all pass except TestMainWindowCorners,
  the load red filed as #1936 (same on origin/main).
- New proxy-test.test.cjs (5 languages x 1100/420, 6 cases each): chromium
  11/11, webkit 11/11; with the same-address branch broken 0/11.
- proxy-test, settings-proxy-auth, proxy-own-wording, i18n-keys and six
  settings-* tests: chromium 63/63; webkit 62/63, the red being
  settings-proxy-auth zh once under the 2-wide run; it passed alone 5/5
  and three more 2-wide runs with proxy-test 3x0 fails (noted on #2142).
- gofmt -l clean; go vet darwin, linux -tags nogui, windows clean.

Tried: checkProxy against the real www.cloudflare.com trace page, direct
leg only, from a temporary test (not committed): ip and loc read, 1.2s.
Not tried: a real proxy (Settings, *_PROXY or system) through to it.
2026-10-14 16:14:54 +08:00
yetone b2d558db97 gui: on the Mac the quick panel opens over a full-screen app, on the Space the user is on, not on the desktop it was first shown on (#2141)
With Chrome full screen and Settings > Click the tray icon set to the
quick panel, a click on the menu bar icon flashed the icon and showed the
panel on the non-full-screen desktop instead, out of sight until the user
swiped back (witt-bit, macOS 27.0.1, v0.1.1230). The panel's window had no
collection behaviour of its own, so Wails gave it FullScreenPrimary alone:
an ordinary window, kept on the Space it was first ordered in on, and not
allowed on a full-screen app's Space. It now has CanJoinAllSpaces |
FullScreenAuxiliary, as a menu bar extra's panel (and Wails' own notch
window) does, so it is on every Space, full-screen ones too. It never
moves to the active Space as well (AppKit refuses that pair), and nothing
calls setMovesToActiveSpace on it (showHere is the main window's only).
The panel lightweight mode makes again takes the same options.

Tests:
- TestPanelOnEverySpaceOnMac (panel_options_test.go) checks the options.
- TestPanelJoinsFullScreenSpaces (AppKit, runAppKit) makes the real panel
  through panelWin, at start and again after lightweight mode let it go,
  shows and hides it, and reads NSWindow.collectionBehavior
  (joinsFullScreenSpaces).
- Without the change both fail: "panel collection behaviour 0 is not on
  every Space and over full-screen ones" and "made at start: the panel
  isn't on every Space and over full-screen ones".

Run: gofmt -l (clean); go vet ./internal/gui/ (darwin),
GOOS=linux go vet -tags nogui, GOOS=windows go vet; go build,
GOOS=linux go build -tags nogui, GOOS=windows go build; go test
./internal/gui/ under a sandbox HOME with pinned caches. In the package
run, at load average ~300-420 from other sessions, two tests unrelated to
the panel failed: TestMainWindowCorners (40s deadline killed; fails the
same on clean origin/main c4c3cafa2, filed as #1936) and
TestSetAnswersWhileDevinAndProvidersHang (filed as #1375; passed on clean
c4c3cafa2 right after). Panel, dock and Space tests pass.

Not tried: a real full-screen Space. A test can't make one, and doing it
by hand would take over the owner's screen; the reporter is asked to
confirm on the next release.
2026-10-14 16:12:44 +08:00
yetone 644ad1ed7a provider, gui: a model listed only on APIs the provider has no URL for isn't offered to agents, and Select all and Free only leave it (#2094, wangjianjq)
A key provider's live list says which APIs each model is served on
(supported_endpoints). Command Code lists its Claude models on /messages
only. A provider with just a chat URL still offered them: Select all ticked
all 89, the top-24 default took Claude models first, and every request to
one failed upstream, because usable() falls back to Speaks() when nothing
matches.

- provider.NoAPIFor(model): a key provider (not a sign-in, whose APIs come
  from magpie's own code) has no URL for any API the model is listed on.
  It uses APIs(), so the user's per-model API in Names & levels wins.
  A model with no listed APIs is unchanged.
- Exposed() drops those models from the picks and from the default before
  taking the first 24, so Catalog() and agents' lists drop them too.
- /api/providers sends each model's noAPI and the key provider's speaks.
  In the editor, Select all, Free only and the dashed default chips skip
  them. Their chips are dimmed with a tooltip that names the provider and
  says how to fix it. A model the user picked before stays picked (dimmed),
  so saving doesn't drop it.

Tests that fail without the change:
- TestExposedOnlyOnTheAPIsTheProviderHas serves testdata/commandcode_models.json
  (the real list) to providers with chat+responses, anthropic only and all
  three URLs. On the old code it fails "with none picked, exposed
  claude-sonnet-5-5", "with every model picked, exposed 87, want 77".
- TestExposedKeepsTheUsersAPIAndUnlistedAPIs: the user's API override and
  unlisted models.
- models-select-all-api.test.cjs: chromium and webkit, en/zh/zh-TW/ja/de,
  1100 and 420, 20/20. It fails with app.js stashed, and with only the
  Select all filter removed.

Run: gofmt; go vet darwin, GOOS=linux -tags nogui and windows for provider,
gui, gateway and cli; go test provider, gui, cli, gateway and tui in a
sandbox HOME, all ok except gui's TestMainWindowCorners (#1936, killed at
its 40s deadline at load ~380, fails alone too) and
TestSetAnswersWhileDevinAndProvidersHang (#1375, passes alone 3/3). 44
related GUI test files: 463/465. The red was quota-reads webkit de 360
under load, filed as #2150, passes alone 3/3.

Not tried: a real Command Code key end to end. The owner's Command Code is
a sign-in, which this filter skips on purpose. The live unauthenticated
list (89 models: 11 /messages, 70 chat+responses, 8 chat) has the
testdata's shape.
2026-10-14 16:11:58 +08:00
yetone 3b6ca05571 gateway: /v1/magpie/concurrency tells the whole gateway's requests in flight, waiting and tool turns, 0 when idle, with or without a limit (#2132, bigbitbox)
A status bar (SketchyBar) polling /v1/magpie/concurrency got
{"data":{},"object":"concurrency"} with no limit set: the lanes hold only
keys and accounts with a limit, so an idle gateway and a busy one with no
limits read the same. The answer now carries, beside data:
- requests: Busy().Requests, every agent request in flight, those waiting
  for a slot among them; a GET (this poll included) is never counted;
- waiting: how many of those wait for a slot, summed over the lanes;
- tools: Claude subscription turns waiting on their caller's tool results.
Each is 0 when idle. Access is unchanged: this machine, another only with a
gateway key, a held key refused (refuseHeld). docs/reference.md says so
beside the usage API.

Run: TestConcurrencyTellsTheWholeGateway (new) fails without the change
("idle: tools = <nil>, want 0 (map[data:map[] object:concurrency])") and
passes with it, -count=5; it covers no limit anywhere (the reporter's
case), and three in flight on a one-slot provider with one waiting.
gofmt -l (nothing); go vet, GOOS=linux go vet -tags nogui, GOOS=windows go
vet on internal/gateway (ok). go test -tags nogui -count=1 ./internal/gateway
in a sandbox HOME: ok in 835s with -timeout 40m (on 0ad9661b6; the default
10m ran out while three other gateway suites ran on this machine), then
the concurrency, busy, held-key and LAN tests -count=3 after rebasing on
63ad2b7c7 (ok).
Not tried: SketchyBar itself.
2026-10-14 16:05:13 +08:00
yetone 1015fbab7f gui: a part kept in place is put back to the nearest whole pixel, so WebKit's dropped fraction no longer adds up (#1804)
backToReader set scrollTop to a fractional target. WebKit truncates
scrollTop, and the early return let anything under 1px stand, so the
part kept in place (the Routing groups under the live stage) could sit
up to just under a pixel off either way. Two of those apart moved it by
nearly two. routing-steady caught it as "the editor at 334.33, not
332.64": rt-cols grew by 40.72px and the view followed by 40.

A probe of every layout showed it isn't load. Each request's growth
above the groups has its own fraction, and how far they drift depends
only on which fractions happen to come in. Rounding to the nearest
pixel, with a 0.5px early return, keeps the part within half a pixel
of where the reader left it.

Run:
- routing-steady (WebKit, alone, load ~150-170): 8 of 8 green. Without
  the change, on 019404940 under the same load, 5 of 10 were red.
- The 32 GUI files that check scrollTop (routing, scroll, pin, reader,
  agents) in Chromium and WebKit: all green except
  routing-mode-goes "webkit zh 420px", a 5s waitForFunction timeout at
  load avg 390. It passes alone 2 of 2.
2026-10-14 16:02:08 +08:00
yetone 63ad2b7c76 provider: a moved ZCode updates to plugin 0.1.18, which reads ZCode 3.15's plan key from config.json (#2130)
Plugin zcode 0.1.18 (magpie-community/plugins 5c0aebc, on npm) gives moved
users the built-in's 1d8e83a79 fix. ZCode 3.15 keeps the GLM Coding Plan
key only in config.json's provider options.apiKey, so a valid plan read
as "no plan, Start Plan ended". keepMovedCurrent now updates every moved
ZCode user to it.

Run: npm view @magpie-community/opencode-zcode-auth@0.1.18 resolves;
gofmt -l; go vet for darwin, linux (nogui) and windows;
go test ./internal/provider/ -run 'Move|Migrat|Plugin|ZCode' passes.
2026-10-14 15:50:26 +08:00
Haogao Gu 20350dafaf gateway, agent, gui: Claude Desktop's subagents can be held to one model, set in its row on the Agents page
Claude Code in a terminal holds every subagent to one model through
CLAUDE_CODE_SUBAGENT_MODEL (its "subagents" field), and Codex through
magpie's own setting (settings.CodexSubagentModel). Claude Desktop runs
its Code tab's Claude Code with CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST=1,
and Claude Code 2.1.295 then ignores CLAUDE_CODE_SUBAGENT_MODEL,
CLAUDE_CODE_SUBAGENT_MODEL_FORCE and the tier variables in its settings
files ("Ignoring … this session's provider routing is managed by the
host"). The env Desktop 2.31226 builds for the Code tab has no key for it
either. So Desktop's subagents ran on the lead's model or on a tier's, and
only the tiers could be picked.

Claude Desktop's row now has a "subagent model" square, the same square
and strings as Codex's. It is magpie's setting
(settings.DesktopSubagentModel), which the gateway applies
(desktopSubagentPick):

- Only a claude-desktop request with x-claude-code-agent-id and tools is
  moved: a subagent's turn. The lead's turns, the tool-less helper calls
  Claude Code makes inside a subagent (on the haiku tier's model),
  terminal Claude Code and every other agent stay as asked.
- It is applied after desktopTurn, the tiers and the groups. A turn
  already on the model set isn't marked as moved. Route.Subagent,
  Route.Model and the ledger's Requested keep the model asked for; Kind
  stays empty.
- The model set must be served by its exact id (Resolve takes any model
  name under a provider that is on), enabled, and allowed to a gateway key
  held to some models (groupAllowed for a group). Otherwise the subagent
  stays on the model asked for and the trace says why, in the reasons
  Codex's subagent model already has.
- count_tokens counts on the same model.
- It is read on each request, so Desktop needn't restart. The field is
  Live (a new Field flag): /api/set and `magpie <agent> <field> <value>`
  leave Desktop's restart notice out after it, unless the pick connected
  Desktop. Codex's subagent model is unchanged.
- The getter follows a provider renamed since it was set (RenamedRef).
  The setter takes any provider/model or group/<id>, also one not served
  now (a restored profile), refuses a bare name, and keeps a Desktop
  alias by its catalog id. Options are shown while Desktop is on magpie.
- POST /api/settings keeps it; a stopped WSL distro's field copy keeps
  Live.
- The Routing page says why a Desktop subagent was moved or kept
  (subagentWhy, for a route with a subagent pick and no kind). "it is
  disabled in magpie" gets its zh, zh-TW, ja and de, which Codex's kept
  reason lacked as well.
- Unset, the pick costs one held settings read (no body decode, no
  catalog build).

Not changed: a Desktop on another computer that reaches magpie with a
named gateway key is read as Claude Code (agentOf), so none of Desktop's
routing applies to it, this included. There is no fallback when the model
set has a smaller window than the lead's.

Verified at this head, on 20769439, under a temporary HOME with Go's
caches pinned:
- Each new test fails with the guarantee it names broken by hand (a real
  FAIL, not a compile error), then passes restored. 48 Go breaks were
  first run on 8f34bbcd: settings trim and bare-name refusal; setter
  validation and clear; RenamedRef in the getter and in Unserved; the
  exact served check and served groups; the serve pick, each guard
  (agent id, tools, claude-desktop only, unset, same and resolved model);
  the named id kept in Route.Model, Kind and the ledger's Requested; each
  kept reason (unserved, disabled, held model, held group); groupAllowed;
  the next request reading a change; the session pick kept; count_tokens;
  the unset pick allocating; Live on the field, not on the tiers or on
  Codex's, copied by WSL; options while unwired and wired; alias
  conversion; the settings keep line; the GUI and CLI notice rules.
  Re-run at this head:
  - no tools guard: TestDesktopSubagentLeavesOtherRequests/helper,
    `sent "m2", want m1`
  - no agent-id guard: TestDesktopSubagentLeavesOtherRequests/lead,
    `sent "m2", want m1`
  - no count_tokens pick: TestDesktopSubagentCountTokens,
    `count sent "m1" to "/v1/messages/count_tokens", want m2`
  - Resolve instead of the exact served check: TestDesktopSubagentUnserved,
    `fake/missing: "", want "magpie doesn't serve it now"`
  - no Live rule in /api/set: TestDesktopSubagentModelNotice (gui),
    `wired Live pick notice "Claude Desktop reads this at start-up …"`
  - no keep line in POST /api/settings: TestSettingsSaveKeepsWhatItDoesNotSend,
    `DesktopSubagentModel:  after a save of the Settings page, was fake/m2`
  GUI breaks (0 pass / 2 fail in each engine): renderSteps' new aside
  removed (Desktop's moved story missing); the four "it is disabled in
  magpie" translations removed (the kept story keeps the English reason);
  the Default note's translation removed.
- go test -tags nogui ./...: 52 packages ok, no failure.
- go test -race -count=20 -run '^TestDesktopSubagent' ./internal/gateway: ok.
- gofmt -l on the changed files: nothing. go vet ./...,
  GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...,
  go build, GOOS=linux go build -tags nogui, GOOS=windows go build: exit 0.
- Playwright 1.62.1: desktop-subagent-model.test.cjs (en, zh, zh-TW, ja,
  de; 1100 and 560 wide) with codex-subagent-model, codex-subagents-lead,
  codex-start-model-field, desktop-tiers, desktop-model-menu,
  subagent-effort and every routing-*.test.cjs: 472/472 in Chromium and
  in WebKit. The whole suite: Chromium 4580/4580; WebKit 4570/4572. The
  two are red on 20769439 untouched as well: group-fold.test.cjs 3 of 3
  alone (195a1009b, fixed upstream since by a125d5c9), usage-fold.test.cjs
  4 of 9 alone there and 4 of 9 here ("as many accounts on the first
  screen as before the curves: 12 of 29").
- The built binary in a temporary HOME, `magpie serve` on a free port, a
  fake Anthropic upstream, requests shaped like Desktop's Claude Code:
  `magpie claude-desktop subagent_model fake/m2` printed no restart
  advice; a subagent's turn and its count went to m2; the lead's turn,
  a subagent's tool-less call, terminal Claude Code's and a subagent turn
  after `… subagent_model default` went to m1; claude-desktop.model stayed
  fake/m1; the ledger kept requested fake/m1.
- Not tried: a real Claude Desktop or Cowork (that needs the live
  gateway), Linux and Windows machines (GOOS vet and build only),
  WebKitGTK.

Maintainer's review on origin/main c4c3cafa2 (#2081), under a scratchpad
HOME with Go's caches pinned, machine load 120-330:
- Claude Code 2.1.299's bundled source has the "Ignoring … this
  session's provider routing is managed by the host" path, with
  CLAUDE_CODE_SUBAGENT_MODEL_FORCE in the set it ignores.
- Breaks re-run: no tools guard -> TestDesktopSubagentLeavesOtherRequests/
  helper `sent "m2", want m1` and TestDesktopSubagentCountTokens helper
  count; no count_tokens pick -> TestDesktopSubagentCountTokens `count
  sent "m1" … want m2`; the Routing page's subagentWhy aside removed ->
  desktop-subagent-model 0 pass / 2 fail (webkit, zh).
- go test -tags nogui ./internal/{gateway,agent,settings,gui,cli,provider}:
  ok on 2fbbd1694 (agent with -timeout 40m: 1857s under the load; the
  default 10m timed out mid TestClaudeNewSessionEffortLastsModelSwitch, a
  test this change doesn't touch). After rebasing onto c4c3cafa2, the
  Desktop/Subagent/SettingsSave/Live/Notice tests of those six packages: ok.
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./..., go build, GOOS=linux go build -tags nogui,
  GOOS=windows go build: ok.
- desktop-subagent-model.test.cjs now runs at 1100 and 420 (was 560):
  20/20, chromium and webkit, en zh zh-TW ja de. codex-subagent-model,
  desktop-tiers, routing-purpose-state, routing-request-model,
  routing-sealed-task: all pass in both engines.
- usage-fold's "29 accounts" case passed 4 of 4 alone in WebKit here.
- Not repeated: the author's built-binary run; a real Claude Desktop or
  Cowork; Linux and Windows machines.

Decisions on the author's questions: Live is kept as named, and Codex's
subagent model is left as it is; a subagent's tool-less helper calls stay
on the model they asked for, being Claude Code's own housekeeping rather
than the subagent's work.

Reported-by: Koohoko (#2081)
2026-10-14 15:48:19 +08:00
Haogao Gu 5c458996db gateway: a Claude Desktop subagent's turn no longer becomes the session's model, so Desktop's titles stay on the lead's
Desktop's Code tab runs Claude Code, whose subagents send tool turns too,
marked with x-claude-code-agent-id. desktopTurn kept the model of every
request with tools as the session's (claude-desktop.model), so a subagent
on another tier's model (opus picked as a routing group of its own) took
the session's place until the lead's next turn. Titles and unserved
Claude ids asked for in that window went to the subagent's model. In the
reporter's usage log the saved model flipped between the lead's and a
subagent's while both ran.

desktopTurn now takes bySubagent (serve passes subagentOf != "") and
keeps only a lead's turn as the session's model. A subagent's aside or
unserved model still goes to the session's model, as before.

Verified, under a temporary HOME with Go's caches pinned:
- TestDesktopSubagentTurnKeepsSessionPick (desktopTurn) and
  TestDesktopSubagentTurnLeavesTitleOnLead (through New().Handler(): a
  lead turn on fake/m1, a subagent turn on fake/m2, then Desktop's title
  request) pass.
- desktopTurn recording every tool turn again: both FAIL,
  `subagent true: picked "fake/m2\n", want "fake/m1"` and
  `title after a subagent's turn: sent "m2", want the lead's m1`.
- serve passing false for bySubagent:
  TestDesktopSubagentTurnLeavesTitleOnLead FAILs the same way.
- go test -tags nogui ./internal/gateway: ok. gofmt -l: nothing.
- The whole suite, vet and the three builds were run on the next commit,
  which contains this one.

Reviewed and re-run by the maintainer on origin/main c4c3cafa2 (#2081),
under a scratchpad HOME with Go's caches pinned:
- desktopTurn recording every tool turn again: both tests FAIL as the
  author wrote (`subagent true: picked "fake/m2\n", want "fake/m1"`,
  `title after a subagent's turn: sent "m2", want the lead's m1`), and
  pass restored.
- Claude Code 2.1.299's binary sends x-claude-code-agent-id with a
  subagent's requests (checked in its bundled source).
- The suite and builds were run with the next commit.

Reported-by: Koohoko (#2081)
2026-10-14 15:48:19 +08:00
yetone 1d8e83a797 provider: ZCode 3.15's GLM Coding Plan key is read from its config.json, so a valid plan no longer reads as "no plan" (#2130, Hanhan758)
ZCode 3.15 keeps no coding plan key in credentials.json any more. The key
it uses is in config.json, at provider["builtin:bigmodel-coding-plan" /
"builtin:zai-coding-plan"].options.apiKey (ZCode 3.15.3's host reads that
value as it is). zcodeOwn found no key, so a signed-in BigModel GLM Coding
Pro account went on to the Start Plan and read as "this account has no GLM
Coding Plan, and ZCode's Start Plan has ended or was never started".

zcodeOwn now falls back to config.json when credentials.json has no key:
Z.ai's first, as before, then BigModel. It also accepts the provider ids
ZCode 3.15 normalizes to (account:*-individual-coding-plan) and a value
written encrypted. A value that isn't a key, such as "{env:...}", is
skipped. A key in credentials.json still comes first, and so does a team
switch.

What was run:
- TestZCodePlanKeyFromConfig uses the reporter's layout: credentials.json
  with BigModel sign-in data and no key, and config.json with the key under
  builtin:bigmodel-coding-plan. The account reads as GLM Coding Pro with
  two windows and never asks the Start Plan. Without the zcode.go change
  it fails, with the key empty.
- gofmt -l; go vet for darwin, linux (nogui) and windows.
- go test ./internal/provider/ passes.

Not tried: a real ZCode 3.15 account. The fix rests on the reporter's
account of their config.json, which they verified against the plan
endpoints with the key, and on ZCode 3.15.3's extracted host code.
Moved users get the same fix through the plugin, in a separate commit.
2026-10-14 15:44:00 +08:00
yetone c4c3cafa27 gateway tests: TestClaudeRunEndsAfterStructuredOutput waits for the bridge to let its runs go, not only their processes
CI's macOS race shard failed it on main at c8c3ce9a9 ("2 runs kept, want
only the one waiting on read"). A run leaves s.subscription.runs in
removeRun, after its claude process is reaped, so the test's count read
straight after leftover() saw the processes gone and the runs still held.
The count is now polled for up to 3s, as the processes are.

Run, in a worktree on origin/main 62378c5f8, sandbox HOME:
- Cause: a 300ms sleep injected before removeRun turns the old test red
  3 of 3 ("9 runs kept"); with this change it passes 3 of 3 with the
  sleep still in.
- Guarantee: removeRun skipped by hand, the new test is red ("9 runs
  kept, want only the one waiting on read").
- go test -tags nogui -race -count=10 -run
  'TestClaudeRunEndsAfterStructuredOutput$|TestClaudeParkedRunsAreBounded|TestClaudeIdleRunKept'
  ./internal/gateway: ok. gofmt -l clean; go vet -tags nogui
  ./internal/gateway clean.
Test-only; the bridge's own code is unchanged.
2026-10-14 15:37:56 +08:00
yetone d4a9cb5cb0 provider: moved WorkBuddy users get plugin 0.1.20, so Claude Code's tool results reach WorkBuddy AI's gemini-3.8-flash (magpie-community/plugins#113)
0.1.20 (plugins a4f8178) resends a chat that gemini-3.8-flash refused
with 11153 "the conversation must end with a user message". The resend
puts an empty assistant message between the tool results and the
user's message. a4f8178's body records the test on the owner's real
WorkBuddy AI account. npm view shows 0.1.20 published.

Ran: gofmt -l; go vet on darwin, GOOS=linux (nogui) and GOOS=windows
for internal/provider; go test -tags nogui -run
'Mov|Migrat|Plugin|Keep|WorkBuddy|WB' ./internal/provider, ok.
Not tried: a moved user's live update to 0.1.20 through keepMovedCurrent.
2026-10-14 15:37:31 +08:00
yetone 65a83656d3 gui: the tray's quota line is taller and shades its gap to the even burn (#2079)
maidangdang1: the tray card's line of a window's cycle was 16px tall across
the card, so a month read as one straight line lying on its dashes, and
whether it was above them (lasts the cycle) or below (runs out first)
couldn't be told.

What changed:
- quotaSpark draws 30px tall (CSS box 30px, line 1.4px).
- sparkGap shades the area between this cycle's readings and the even burn
  (the diagonal from full at start to empty at reset): green where it is
  above, amber where it is below, nothing on the far side. Two clipPaths
  split one polygon at the diagonal, so a line that crosses it shows both.
  Only when the reset is known and the cycle has 2+ readings.
- The spark's tooltip adds the window's Pace (the existing "Pace {n}"
  string and quotaPace), so the number is a hover away.

Decision (product call delegated): Edward4226 offered an ETA/balance-axis
branch on the issue. Pace (3a7d031) already gives the number, and the
balance axis is a separate goal; this answers the report's question
(which side of the dashes) at a glance. Their idea is credited on the issue.

Run:
- New tray-spark-gap.test.cjs (5 languages x 1100/420): reads the spark's
  screenshot pixels, green above / amber below / plain on the far side,
  height 28-32, tooltip says Pace, no overflow, no page errors. Chromium
  11/11, WebKit 11/11; with the old app.js 0/11 (broke it by hand).
- quota-curve.test.cjs updated for the height (<= 31) and green.
- tray*, quota*, panel-usage/balance/fold/arrange, i18n-keys, credits*,
  usage-* at --test-concurrency=4: chromium 407/408, webkit 407/408. The
  two reds (usage-checkin zh Qoder tab, usage-sum-whole de) touch neither
  the tray nor the spark, pass alone and 4-parallel; filed as #2142.
- gofmt -l clean; go vet darwin, linux -tags nogui, windows for
  ./internal/gui clean (JS/CSS only).

Not tried: the real tray on macOS/Windows with live quota history; the
fixtures are faked.
2026-10-14 15:35:47 +08:00
yetone f70c0525aa access, gui, cli: a gateway key's limit can run every N hours, a 5-hour cycle among them (#2102)
A key's limit window was a calendar day, week or month, or every N days
(#1509). #2102 asks for a shorter cycle, every 5 hours, like a vendor's
own 5-hour window. Limit gains period "hours" with Hours (1..8760),
counted in absolute time from Since, as the N-day cycle is; a change to
N or from days restarts the cycle, a cap change keeps it, Reset starts
a new one. Budget status, the 429's wording ("this 5-hour cycle"),
X-Magpie-Limit-Reset, /v1/magpie/limit and a remote magpie's key card
carry Hours. The GUI's window menu has "Every N hours" with an Hours
field beside it (no native select); the CLI takes `<N>h`
(magpie gateway-key limit <id> 5h --tokens 200k). Docs: reference.md
and docker.html (en, zh, ja). Strings in zh, zh-TW, ja, de.

Run:
- go test ./internal/access (TestLimitHoursCycle across NY DST, UTC,
  UTC+8; TestLimitHoursSetAndReset), -tags nogui ./internal/cli
  (5h, rejects 0h/8761h/xh/1.5h/hours), ./internal/gateway
  (TestKeyLimitHoursCycle: 429 and reset header, /v1/magpie/limit,
  Reserve at the boundary, Reset; remote key card 5h), plus the full
  access, budget, cli, gateway, provider and gui packages. The gateway
  package hit go test's 10-minute default once with the load average
  near 270; rerun with -timeout 40m it passed in 1536s.
- Broke cycle() for hours by hand: TestLimitHoursSetAndReset and
  TestKeyLimitHoursCycle went red; restored.
- GUI: gateway-key-cycle (extended with the hours case: menu, field,
  validation, Save body, badge, Reset confirm, one-column at 500px)
  in chromium and webkit x en/zh/zh-TW/ja/de, 10/10; i18n-keys,
  gateway-key-limit, gateway-caller-keys, phone-rows, gateway-keys-off,
  gateway-own-key, api-key-theme 63/63; an ad-hoc check of the hours
  editor at 1100 and 420 in both engines and 5 languages (no overflow,
  screenshots looked at).
- gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows.

Not tried: a real gateway under load across a 5-hour boundary; the
Windows box.
2026-10-14 15:34:31 +08:00