Commit Graph
2357 Commits
Author SHA1 Message Date
yetone 5241308212 settings: a day can start at 0 to 6 o'clock (ssharpcc on X)
Settings > Usage > "Day starts at" (dayStart, 0 to 6, default 0; also
magpie settings set dayStart 4). With 4, a call at 01:30 counts toward the
day before: the Usage page (summary, charts, heatmap, ledger day filter,
hour labels of Today) and the daily and monthly key caps (access.Window,
provider.SpendCap.Window).

internal/dayzone makes a time.Location whose midnight is the real day's
hour:00 (TZif built from the zone's own offsets, same DST instants), so
every place that cuts days by a Zone's midnight follows without edits;
usage.Zone returns it and the "now" reads use it too.

Run (mote): go test usage, settings, settingsapi, access, provider, gui,
dayzone, also with TZ=UTC and TZ=Pacific/Kiritimati; gofmt; go vet darwin,
linux nogui and windows; day-start, currency, number-units and i18n-keys
GUI files in chromium and webkit, en zh zh-TW ja de; TestCoreScriptBudget.
Broken by hand: TestDayStartsAfterMidnight red with 9 failures when the
hour is ignored. New tests: dayzone over 5 zones x hours 1/4/6 x two years
of days, usage, limit window, spend-cap window, day-start GUI.
Not tried: a real log history in a real window.
Not shifted, filed as #6314: the Sessions page, TUI sessions filter,
davsync shared per-day files, gateway_sessions day keys, credits_daily.
Rows are never stored in the shifted zone.
2026-11-12 18:31:50 +08:00
yetone c5b9e448a8 gui: Codex's settings lines say less and say what a choice does (siantgirl on X)
siantgirl found the Codex settings block hard to follow when connecting
Codex to DeepSeek. Three lines were the cause: Codex subagent model (a
paragraph on resumed subagents and the pick rules), Codex subagents on
any model (named multi_agent_v2) and Long conversations (a list of which
models are and are not capped). Each now says what it does in one
sentence: the lead's pick or its own model, pick one here for every
subagent; a GPT lead can start subagents on other models, new threads
only; compact at 272K or the size typed, magpie's models only. Strings
changed in app.js, index.html and en, zh, zh-TW, ja, de, with the same
placeholders. No layout change.

Run (mica): codex-subagent-model 20 pass 0 fail (its pinned lines are red
on the old text), i18n-keys 4/0, gateway-mode 6/0 and the compact,
settings-general, agent-details-ready, context-tune and lang files ran;
agent-prefs 46 pass 10 fail, the same 10 on origin/main 2e92d71aa
(#6139, commented). The Go size-budget test is ok.
Not tried: the whole GUI suite, the real Linux app, a screenshot of the
new lines.
2026-11-12 18:15:24 +08:00
yetone d964031412 provider: a model's test can be sent to one chosen account or key (tmr11235 on X)
A provider with two or more accounts or keys that are on now offers
"Test on account..." in a model chip's right-click, an app menu (never a
native select) of those accounts' or keys' names. The pick is posted as
`account` with provider/test and pins the test (provider.TestOn,
accountNamed / keyNamed; an unknown or switched-off one is an error row,
not a silent fallback). Every result now names the account or key it went
to (Result.Account, set in probe), and the status line ends " - <name>"
for such a provider, whether the test was pinned or routing picked.
Test models and the CLI still test with routing's pick.

Core script budget raised 1,263,333 -> 1,263,700 (+367): the model chip
menu is core code and there is no page to move it to; the PLAY icon
literal was folded into one constant and the status call tightened first.

Run: gofmt clean; mote-run go test ./internal/gui ./internal/provider ok
(new TestModelTestPinnedToAKey, TestTestPicksNeedSeveral,
TestModelTestPinnedToAnAccount); model-test-account.test.cjs 10 of 10
(chromium and webkit, en zh zh-TW ja de) on mica. Broken by hand: with
the menu entry disabled the GUI test is 0 of 10. GUI batch model-*,
provider-*, i18n-*, gui-*: reds are the same on origin/main 2e92d71aa
(model-chip-steady, model-copy-id, provider-fetch-again, provider-max-
output, provider-many-keys, provider-mask, provider-typed, gui-de/ja),
all already filed (#4388, #4621, #3292, #6209, #5109, #4673, #5475).

Not tried: a real multi-account provider end to end; the CLI and the bulk
Test models button (unchanged); vet on windows/linux not rerun beyond the
earlier builds.
2026-11-12 18:09:14 +08:00
yetone 36eebea136 update: the header's Update pill waits until it is news (certhon520, jkd6688, Yuyuaneth, milianxinqi on X)
A release comes every few minutes, so a downloaded update was always
waiting and the pill (window and tray panel) never went out. /api/update
now says "quiet" while this version has been behind for less than 3 days
(update.Quiet, the Stable channel's soak; counted from the first newer
version seen, kept in update-behind.json for the version running), and the
pill stays away. An urgent release ("**Urgent release:**" in the latest's
notes or any release between, fetched once per check) lights it at once and
a dismissal does not hide it. The x dismissal now also starts the quiet over,
so the pill is not back with the next release. Settings > Version, the tray's
Restart to update, quit and Restart automatically are unchanged. Plugins'
dot is for plugins that do not update by themselves; left alone.

Run (mote): go test ./internal/update (ok), go test -run Update|Asset|Budget|Script ./internal/gui (ok),
gofmt, go vet darwin / linux nogui / windows clean, update-quiet.test.cjs 21/21 in chromium and
webkit across en, zh, zh-TW, ja, de, panel and window. Broken by hand: dropping
!u.quiet in app.js (11 red), forcing Quiet=false in jsonIn (TestUpdateQuietUntilBehindAWhile red).
Not tried: a real 3-day wait, and the urgent range lookup against the live site.
2026-11-12 18:00:00 +08:00
yetone 2a1111cbab library: an agent's profiles are one chip on a row, picked in the app menu (Yanzhongixuy on X)
With several Hermes profiles the Library listed each as its own icon on every
skill/MCP row (~20 identical glyphs). Profiles of one agent family
(hermes#, omp#, claude#, qwenpaw#, WSL variants too) now collapse into one chip
with a count; a click opens the app menu (openProtoMenu, multi-tick, live) to
pick profiles one by one. All still toggles every profile. Rows only; the
By agent view is unchanged. Other multi-profile agents (omp, claude, qwenpaw)
had the same problem and go through the same code.

Run on mote at the branch head: library-profile-chip.test.cjs (new, 12 cases,
chromium + webkit, en/zh/zh-TW/ja/de), red 12 of 12 with profileChip broken by
hand; library-*, group-skill-chips, skill-*, mcp-*, i18n-*, hermes-*, omp-*,
project-* GUI files: all green except library-loading (Claude plugins tab,
already #6204) and one webkit billion-context card case that passed alone
(load flake).
Not tried: a real Hermes install with 20 profiles, Linux WebKitGTK.
2026-11-12 17:57:13 +08:00
yetone cfd3367df8 usage: a request's details show its service tier (JackyFill on X)
The ledger has kept each call's service tier since #1784 (tier_asked,
tier_sent, tier_served in the log, the CSV and the JSON), but the
Requests page never showed it. A request's details now have a Service
tier line: "asked X", then "sent Y" only when it differs, then
"answered Z" only when the reply named a tier. A call with none shows
no line. Row flag bits are untouched: the tiers are string slots, so no
bit is taken.

Run, on mica: new ledger-service-tier.test.cjs (3 rows: all three tiers,
asked+sent without an answer, none) in chromium and webkit, en zh
zh-TW ja de, 12 of 12 green; with the add("Service tier") line removed
by hand it is 0 of 12; i18n-keys caught a duplicate "Service tier" key
(the core table already has all four languages), which is removed;
ledger-*, i18n-keys, i18n-en-no-cjk and gui-* files rerun green after
(ledger-cache-hit chromium was red once in the first batch, green on
rerun in the same batch's second run).

Not tried: a real Codex priority call end to end (the gateway side is
#1784's); the full suite runs after the tag.
2026-11-12 17:22:03 +08:00
yetone 4940aed1d8 gui: times follow the system's region, not the webview's (iXerol on X)
A Mac set to English with Japan as its region (AppleLocale en_JP, 24
hours) showed 12 hours: with neither AppleICUForce24HourTime nor
AppleICUForce12HourTime set, the page formatted in WKWebView's
navigator.language (en-US). boot.js now carries the system's own tag as
"locale" (macOS: `defaults read -g AppleLocale`, with @rg= winning;
Windows: Control Panel\International LocaleName; Linux: LC_ALL, LC_TIME,
LANG), and intlLang takes it over navigator.language for English. The two
forced clock switches still win over the region's clock. A browser tab
keeps its own locale.

Run (mica): go test -run 'HourCycle|LocaleTag|Boot' ./internal/gui ok;
gofmt -l clean; go vet darwin, linux nogui, windows on internal/gui clean;
GUI hc-clock, reset-clock-formats, dates-gui-lang, i18n-keys, header-relang,
desktop-lang in chromium and webkit: 0 fail. Real AppleLocale on this Mac
reads en_SG. Broken by hand: intlLang back to navigator.language turns the
new en-JP case red in both engines. Not tried: a real Windows or Linux
session with a regional format that differs from the display language; full
suite starts after the tag.
2026-11-12 17:16:34 +08:00
yetone 19a698d0f9 Plain wording for the held-compaction error and the account-switch hint (ccw1942796 on X)
The error magpie gives Codex when a conversation's compaction has failed 3
times now says what happened, how long magpie waits and what to do:
"Couldn't compact the conversation: <model> failed N times in a row (last:
<vendor's reason>). magpie waits <t> before asking it again. To compact now,
switch this conversation to another model." It is a 400 back to Codex
(codexCompact), never sent upstream as prompt.

The hover hint beside "Switch {agent}'s account automatically" is two short
lines per agent instead of three long ones, in en, zh, zh-TW, ja and de.
It still says it is the agent's own sign-in that moves, that the agent sends
the requests, and that sharing an account is against the vendor's terms.

Run on mote: gofmt -l, go vet (darwin, linux, windows) on internal/gateway,
go test -run Compact ./internal/gateway, and in chromium and webkit
i18n-keys, i18n-en-no-cjk, keep-login, pool-ends, sign-in-moves (84 of 84
GUI subtests ok, en and zh). The hold test now asserts the new wording.

Not run: the full suite before the tag (started after it); ja, de and zh-TW
screenshots of the hint; breaking the new assertion by hand (the old text
lacks the asserted words).
2026-11-12 16:37:49 +08:00
yetone 223b57ffa3 gateway: a turn waiting for its account's turn near a usage cap says queued, not routing (tmr11235 on X)
tmr11235 (Pi, Codex subscription, gpt-6.1-sol): the second request sat in
"routing" until the one before it was answered. Two Pi turns at once on a
Codex sign-in are both out at the vendor at once (HTTP and websocket
upstream, TestPiTwoTurnsOnCodexAreOutTogether, green on the old code too),
and no concurrency cap is set for Codex by default. What does hold a
second turn is an account within 5 points of a usage cap the user set
(nearCaps, one turn at a time). That wait comes before the first try is
begun, so the row had no try and read "routing", and the wait wasn't a
known one for the unrouted watch either (it could end the request as
unknown after 30s).

The wait now sets the route's Phase to "queue" and the request's phase
(notePhase, so it is a known wait). The Routing page says "queued…" and
its explanation says what it waits for, in en, zh, zh-TW, ja, de.
The one-turn rule itself is unchanged: it protects a cap the user set.

Run (mote): TestNearCap*, TestNearCapWaitSaysQueued, TestPiTwoTurns*,
go test ./internal/gui, routing-queued/routing-masking/routing-wait-dot
in chromium, routing-queued in webkit, i18n-keys, i18n-en-no-cjk, gofmt,
go vet darwin/linux nogui/windows of internal/gateway.
Broken by hand: showQueued replaced by a no-op, TestNearCapWaitSaysQueued
red ("never: the waiting turn's route says queued").
Not tried: a real Codex account near a real cap; full suite is started
after the tag.
2026-11-12 16:02:11 +08:00
yetone 5dd63727ce gui: a state sends each option once, its lists as indexes into them
After 647071f2b the real account's /api/state was still 346,210 bytes:
17 lists, 327KB, most of them each agent's 231-255-option catalog with a
few models of its own first, so no two were alike. The state now sends
each option once, in "options", and each list as the indexes of its
options ("optionLists"); api() in app.js looks each one up as it puts a
field's list back, a fastFor of "*" still given the agent's id.

shareOptions tells alike options apart by sorting pointers to them by
Value (slices.SortStableFunc on int32 indexes), not in a map, and each
list is a run of one []int32: a map sized for the options made
TestStateWriteGrowsNoBufferItsSize allocate 977KB for its 1.6MB state
(12,000 options unlike each other), the bar is half the state; now it
passes. writeStateJSON writes the indexes through one 512-byte buffer
and each option alone, as each agent is.

Run, at this tree on mote:
- go vet ./internal/gui; go test ./internal/gui: ok (TestCoreScriptBudget,
  TestStateWriteGrowsNoBufferItsSize, TestStateSendsEachOptionListOnce,
  which now also counts the 7 options its 4 lists name once each).
- state-option-lists.test.cjs: 16/16, Chromium and WebKit, 5 languages,
  1000px and 420px; crush's list now starts with one model of its own,
  an index past the shared catalog's. Broken by hand: without the
  options lookup in app.js, red (8 of 8 Chromium).
- Real account (sandbox HOME with its data), magpie-w19: GET /api/state
  159,767 bytes (689,949 before 57443ac5f, 346,210 at v0.1.3848),
  14,765 gzipped, 7-9ms a GET; ?last=1 159,779. Its agents, lists put
  back, are equal to w18's.

Not tried: the whole GUI suite; a real window drawing this state.
2026-11-12 14:24:46 +08:00
yetone 647071f2b9 gui: a state shares the option lists that differ only in their own agent's fastFor
9ed6a312b sent each fields' option list once, but the real account's
/api/state only went from 689,949 to 627,061 bytes: each agent's
catalog (231 options, ~51KB) marks ~34 of them fastFor its own id
("crush", "droid", …), so no two agents' lists were alike. shareOptions
now sends a fastFor naming the field's own agent as "*" before it
compares, and api() in app.js gives each agent its own copy of those
options with its id back, so a fast pick for one agent still marks that
agent's options only (setFast matches on fastFor).

setFast's three loops are one mark() over every list, the picked option
included, which pays for the expansion within the core script budget
(1,263,333, not raised).

Run, at this tree on mote:
- go vet ./internal/gui; go test ./internal/gui: ok (TestCoreScriptBudget
  ok).
- state-option-lists.test.cjs: 16/16 (Chromium and WebKit, en zh zh-TW
  ja de at 1000px, en zh at 420px), with a new check that codex's fast
  leaves crush's alone on a shared list.
- Broken by hand: without fastForSelf, TestStateSendsEachOptionListOnce
  is red (5 lists, want 4); without the "*" map in app.js the GUI test is
  red ("the kept state's lists put back").
- Real account (sandbox HOME with its data), magpie-w18: GET /api/state
  346,210 bytes (689,949 before 9ed6a312b, 627,061 after it), 30,390
  gzipped; ?last=1 346,222.
- fast-ultra.test.cjs and fast-pick are red with this app.js and with
  the one before 9ed6a312b alike: #6201 (an extra POST
  /api/update/using). With that one POST left out of their record (not
  committed), both pass 36/36 in Chromium and WebKit with this setFast.

Not tried: the whole GUI suite (mote over its cores); a real window with
this state. Lists of 231-255 options that differ in their first
entries are still sent whole (17 lists, 327KB); an option table is next.
2026-11-12 14:10:22 +08:00
yetone 57443ac5f5 gui: a state sends each fields' option list once
With real accounts /api/state was 689,949 bytes, and agents[].fields
carried 707,970 of them before escaping: the model field's options, the
whole ~51KB catalog, went once per agent, 13 of 16 agents alike (crush
and dsh twice). Each window shown, each click that answers with a state
and every start's kept state (agents-state.json) encoded, sent, parsed
and held it again per agent.

writeStateJSON now sends each list once, in the state's last field
optionLists, and a field names its list by "list" (from 1) in place of
"options" (shareOptions). The lists are encoded one by one, as the
agents are, so no buffer grows to their size. The kept file is written
the same way, so its sum still matches. api() in app.js puts each
field's list back before anything reads the state, so every reader sees
the state as it was; the agents now share one array, which setFast
already treated as one model in every agent's lists. POST answers that
write the state with writeJSON are unchanged.

Run:
- go vet ./internal/gui; go test ./internal/gui (mote) ok.
- TestStateSendsEachOptionListOnce: red with shareOptions returning s
  unchanged (0 lists sent), green with it.
- state-option-lists.test.cjs, Chromium and WebKit, en zh zh-TW ja de
  at 1000px and en zh at 420px: 16 of 16. Red with api()'s line taken
  out.
2026-11-12 14:10:22 +08:00
yetone 0af73f42b4 gateway: an app update asks its own background service to restart, and the page no longer calls it another program (Norethcy on X)
After an app update the service (`magpie daemon`, ~/.local/bin/magpie)
ran on as the old version until its own look at the disk found the gateway
idle, and `magpie daemon restart` by hand showed the app "Port 3425 is in
use by ~/.local/bin/magpie (pid N): quit it" while the new service came up.

- PortHeld.Own: a holder that is a magpie running this install's program
  (same file, symlinks followed) is marked; the Gateway card then says
  "Starting the gateway…" instead of the port-in-use error.
- The app asks an older service of its own install (the pid the service
  manager reports, program from the unit/plist: daemon.Program) to restart,
  once per process, through gateway.RestartPath, as `magpie update` does:
  it restarts into the new version once idle, bounded by its drain, under
  the same service manager.

Run on mote: go test of the new tests in internal/gui, internal/daemon,
internal/gateway; go vet darwin, linux nogui, windows; gofmt; gateway-*
and i18n GUI files in chromium and webkit. Broken by hand: dropping the
Older check makes TestNudgeAsksOwnOlderDaemonOnce red.
Not tried: a real app update over a real launchd service. The restart is
an in-place re-exec of the service, not a socket handover, so the port is
closed for the service's start-up.

GUI (mote, chromium+webkit): gateway-port-holder, older, skew, takeover, port, i18n-keys, i18n-en-no-cjk 36 of 36 ok. All gateway-* files: 30 reds, all in gateway-card (shares on the network, #6267) and gateway-key-arrange (420px, #6268); the same 30 with client.js reverted to origin/main, so not from this change.
Not tried: a real app update over a real launchd service; the daemon re-execs in place, it is not a socket handover.
2026-11-12 12:50:57 +08:00
yetone cc0d9c8b04 provider: a Gemini base typed without a version is kept as typed (JNDliuliuM on X)
GeminiBase gave every bare host /v1beta on Save (normalize), so a relay's
root typed in the editor came back as …/v1beta when reopened. Only Google's
own bare host (generativelanguage.googleapis.com) is given /v1beta now; any
other URL stays as typed. The detection (DetectBase), which proposes a base
rather than keeping one, still adds it (geminiVersioned). Siblings checked:
OpenAI/Responses bases are only trimmed on save (no /v1 added; fixV1 is the
5ba92aaf8 probe); the editor's respellURL runs only when the protocol is
switched or a URL pasted. Not changed: the Anthropic base still loses a
typed /v1 or /v1/messages, because requests add /v1/messages themselves and
the version would be sent twice.

Run (mote): TestGeminiBase and the new TestGeminiBaseSavedAsTyped red on the
old gemini_api.go/detect.go (relay root saved as …/v1beta), green after;
go test ./internal/provider ok; new GUI test provider-base-as-typed (save,
reload, reopen for gemini/openai/responses/anthropic) ok in chromium and
webkit, with provider-add-gemini, provider-base-api and provider-detect-draft
(46 tests; one failure seen on the first run was this file's own Escape
dialog, fixed by reloading). go vet darwin, linux, windows; gofmt clean.
Not tried: a real relay; the full suite runs after the tag.
2026-11-12 12:46:42 +08:00
yetone 32c592d3fb usage: a 5-hour window draws its current cycle only, not a comb of drops (@xxxxxthhh on X)
The "Left over time" curve drew one descending segment per recorded cycle
of every window. Over the cycle range of a weekly window, the 5-hour
window therefore showed a run of sawtooth drops, each resetting to 100%
and falling again. @xxxxxthhh: "the 5-hour window's lines dropping one by
one are too messy, like bugs crawling".

Chosen: a window far shorter than the span (the existing `short` case in
drawQuotaPlot) keeps only the points of its current cycle, so the plot has
one drop at the right edge and the legend carries its figure. Past 5-hour
cycles are not drawn faint or banded: they say nothing the weekly line
beside them doesn't, and a band or a second style would add marks to a
52px plot. Longer windows, the 2-day range, the picked past cycle, the
colours and the layout are unchanged; the short line is now one
segment, so it is a little firmer (1.25px, .7) than the faint comb was.

Run on mote: quota-curve.test.cjs in chromium and webkit (en, zh, zh-TW,
ja, de) with its 5-hour assertion now one subpath; it fails on the old
assets (two subpaths). Before/after screenshots in
magpie-wt/leftover-chart-scratch/shots. Whole GUI suite and
internal/gui Go tests are run after this commit; see the follow-up note.
Not tried: a real account's week of readings.
2026-11-12 10:36:47 +08:00
yetone 1e2857730a routing: a group's right-click menu has Remove (jimlee0824v2 on X)
Remove was only at the foot of the expanded card. The row menu now ends with
it, set apart, running the card's own groupAction("delete"): the same
question first, the same groups/delete call.

Run (mote): group-menu-remove (new, 10 tests: chromium and webkit, en zh
zh-TW ja de; cancel posts nothing, confirm posts groups/delete and the row
goes), group-share, group-duplicate, i18n-keys, i18n-en-no-cjk: 38 of 38.
group-*, route-menu-pointer, click-scroll and panel-routing* run next.
Broken by hand: with client.js at HEAD the new test is 0 pass, 10 fail.
Not tried: the real app; the item reuses "Remove", already in every language.
2026-11-12 10:30:41 +08:00
yetone 8ea5f67417 gui: an opened picker turns its chevron only, not the effort bars beside it (xMopf7RF on X)
.sess-pick.open svg rotated every svg in an opened picker, and the effort
icon (four bars, an svg) sits in the same button as the chevron, so Library
-> Memory -> Learn from conversations' reasoning-depth button spun its bars
while the menu was open. The rule now takes the button's direct svg, the
chevron. Every other sess-pick that opens a menu draws only a direct
chevron svg, so no sibling lost its turn.

Run: library-memory.test.cjs in chromium and webkit on mote (22 of 22 ok),
with a new check that the bars' computed transform is none while the
picker is open and the chevron's is not. On the old CSS the same file was
12 of 22 red. Not tried: the real Linux app, the other 10 sess-pick GUI
files (none reads the chevron's transform; grep for rotate(180 in tests is empty).
2026-11-12 09:58:36 +08:00
yetone c14fa0ce93 Bring back 919780414 and 88d2962e0, which 698ed4adb undid
698ed4adb (a busy port names its holder) was committed from a tree made
before 919780414 and 88d2962e0 landed (09:38, eight minutes before it),
and took both out with no word in its body: quotatable.js, the Usage
Cards / Table switch and its test, and sessions' 16-byte head and
prefix hashes (digest.go) were gone from main from v0.1.3823. This puts
both back as they were, on top of 698ed4adb's own change, which is kept.

Run at this tree, on mote (cherry-pick of both onto origin/main
db0c1b039, no conflicts):
- gofmt -l internal/sessions: clean.
- go vet ./internal/sessions ./internal/gui; GOOS=windows and
  GOOS=linux -tags nogui go vet ./internal/sessions: ok.
- go test -count=1 ./internal/sessions: ok 83.6s.
- go test -run 'Budget|Lazy|I18n' ./internal/gui: ok (the core script
  budget holds with both changes).
- GUI, chromium and webkit: usage-quota-table, gateway-port-holder,
  i18n-keys, i18n-en-no-cjk, old-webkit: 44 of 46. The two reds are
  old-webkit's "compat.js is the first" (headerpresets.js, #6030) and
  "the styles hold up in Safari 15.0" (#5919), red the same on an
  origin/main db0c1b039 copy.
Not run: the full Go and GUI suites.
2026-11-12 09:57:52 +08:00
yetone 698ed4adb5 gateway: a busy port names the program holding it, and Tailscale's serve gets its fix (pluoki on X)
The Gateway page, `magpie serve` and the app log said only "port N is held by another program". pluoki's was `tailscale serve` on the same port number.

proc.PortHolder reads the holder (lsof on the Mac, /proc on Linux, Get-NetTCPConnection on Windows). Tailscale's daemon is root's and often unreadable, so `tailscale serve status --json` is the fallback for the port. gateway.NoteHeld / PortHeld.Sentence say who holds it, and for Tailscale give `tailscale serve --https=<other> http://127.0.0.1:<port>`. Shown in the `magpie serve` standby line and bind error, the app log, `gatewayHeld` in /api/state (Gateway page) and Start's "taken" answer, in en, zh, zh-TW, ja, de. A holder that can't be read says nothing; the old wording stands. Nothing is killed or touched.

Run: gofmt clean; go vet darwin, linux nogui, windows (mica); go test ./internal/proc ok; targeted holder/gateway tests on macOS (mica), Windows (win-run) and Linux (wsl-run); parser tests with real lsof output; GUI gateway-port-holder, gateway-takeover, gateway-older, gateway-skew, gateway-port, i18n-keys, i18n-en-no-cjk in chromium and webkit. Real run on WSL: a holder named tailscaled on the LAN address with magpie on 0.0.0.0 gives the Tailscale sentence at the bind error; a Python holder on loopback gives "held by python3.12 (pid N)".
Broken by hand: each fix reverted in turn, its test went red.
gateway-card.test.cjs is red on origin/main too (#6029). internal/gateway, gui and cli package runs were still going at push; the full suite follows the tag.
Not tried: a real `tailscale serve` (changes live config), a real Windows holder end to end, the bind-error path on macOS (a wildcard bind coexists with a specific one there).
2026-11-12 09:46:34 +08:00
yetone 9197804144 gui: Usage allowances can be shown as a table beside the cards (zysicyj on X)
With a dozen accounts the packed card grid is hard to scan. The Usage
page's Allowances header now has a Cards / Table switch (a segmented
control, remembered per user in localStorage "quotaView"; the default stays
Cards, and nothing is written until the user picks). The table has one row
per account: subscription, account, then the four most common windows
(used % with a bar and the reset time), an Other column for extra windows
and balances, sortable by any column (click again to reverse, a third
time to clear; rows with no value stay last). Balance-only and error rows
span the window columns. Same data and helpers as the cards (quotaFill,
resetClock, quotaWho). At narrow widths the table box scrolls, not the page.

The code is a lazily imported quotatable.js, so app.js stays inside its
code budget. "Cards" and "Table" are translated in zh, zh-TW, ja and de.
quotatable.js is listed in old-webkit's lazy-script exceptions;
docs/subsystems/gui-shell.md has a paragraph on it.

Run (on mica/mote, Playwright): the new usage-quota-table.test.cjs, 22 of 22
in chromium and webkit, in en/zh/zh-TW/ja/de, at 1100px and 420px (14 faked
accounts: default is cards and saves nothing, row count and figures,
persistence across reload, sort cycle and account sort, no page overflow,
back to cards). TestCoreScriptBudget, i18n tests 8/8, gofmt, go vet for
darwin, linux -tags nogui and windows. Whole GUI suite (make test-ui)
at 1ad0f4cc4+this: started before the tag; first 890 results green except account-arrange (#6010, red the same on origin/main).

Broken by hand: with the default flipped to table, 10 of the new tests
failed; restored.

Not tried: the real app, Linux WebKitGTK, a real account's data (the
fixtures are faked, with the shapes the cards read).
2026-11-12 09:38:54 +08:00
yetone 908c9986cd templates: routing recipes — Plan first, Fastest first, Spread evenly (qhyqhy1s on X)
qhyqhy1s asked for best-practice templates in routing groups, as only
three were offered. The Routing page's template cards and Templates menu
(and `magpie group template`) now carry three more, each only a setting
the engine already has:

- Plan first (plan): the strongest model of up to three providers, the
  ones billed by a plan (Provider.BillingKind) ahead of pay-as-you-go
  ones. Not made when no provider is on a plan (NeedPlan).
- Fastest first (fast): the same members, routing "fast".
- Spread evenly (even): the one strongest model from up to four providers
  that serve it, routing "rotate" over all their keys and accounts.

Names, one-line descriptions and the new "Needs a subscription or token
plan" are in zh, zh-TW, ja and de. docs/subsystems/gateway-routing.md has
a Routing recipes section.

Run on mote at the pushed tree: go test ./internal/provider ./internal/cli
./internal/gui (Template|SizeOf|Group) ok; gofmt -l clean; group-template,
getting-started, i18n-keys and i18n-en-no-cjk GUI files, 98 tests, chromium
and webkit, 420px, every language, ok. Broken by hand: routing left unset
on Fastest first, TestRecipeTemplates red. Not tried: a real account
adding each template; the full GUI and Go suites are started after the tag.
2026-11-12 08:34:38 +08:00
yetone 40c8d0c81a routing: an account whose windows are all set aside shows what the Usage page read, not "not known" (@apple_test_src on X)
A Cursor account signed in through its plugin (pooled plan, or on-demand
or free credit that can pay) sets every window aside, since none can stop
the account. Routing's allowance then holds no figure for it, so the
Accounts and keys row (and the stage row) said "what's left not known
yet" while the Usage page showed its percentages. This is true of any
plugin-served subscription that sets all its windows aside, not only
Cursor.

Both Routing rows now say the card's first window (as Usage read it) when
routing has no figure, the rest on hover; with no card the unknown line
stays. Display only: how accounts are weighed is unchanged.

Run: new routing-pooled-card.test.cjs (5 languages, 1100/420px, chromium
and webkit) 22 pass; red 22 of 22 with client.js put back to origin/main's
(broken by hand). Routing, i18n-keys, use-first, account-mask and
codex-credits GUI files on mote: the only reds are in routing-context-fold,
routing-pin-away, routing-row-swap, routing-story-shrinks, many-keys and
accounts-narrow; the first four fail the same on the origin/main client.js
(umbrella #4494, #5475).
Not tried: a real Cursor account; the Go suite starts after the tag.
2026-11-12 03:51:33 +08:00
yetone 0d0a1a5678 balance probe: kept across restarts, Auto-detect switch, Detect again, not-detected line in the editor (#3146, Niapyaya on X)
A custom provider at a New API / Sub API / One API relay with no Balance URL
has its balance query found by magpie (provider/balance_probe.go). This keeps
what was found, or not found, in balance-probes.json (keyed by origins and a
hash of the key, written through temp-and-rename, an unreadable file read as
empty), so a restart does not probe again. The editor gets an Auto-detect
switch (NoBalanceProbe), a Detect again button (ForgetBalanceProbe) and a line
saying where the balance was found, or that none was, with the Balance URL
field as the way out. A found balance is a balance card on the Usage page.

Run at the rebased head (parent 6a3f162f0 = origin/main), on mica:
- gofmt -l: clean.
- go vet ./... (darwin), GOOS=linux -tags nogui, GOOS=windows: clean (at the
  previous base e6bf4adf1; go vet ./internal/... again at this head).
- go test -count=1 internal/provider internal/gui: ok, at this head.
- GUI, both engines, five languages: balance-found, gui-de/ja/zh-tw, i18n-keys,
  i18n-en-no-cjk, provider-billing, provider-detect*: all ok except gui-de and
  gui-ja "has every zh string" ({agent} twice in sessions' "isn't installed
  here"), which are red the same at e6bf4adf1 (filed).
- At e6bf4adf1, 79 provider/gui/i18n files: 80 reds, the same 80 on the
  unmodified base (provider-fetch-again #5232/#5057, provider-picks-stay
  #4397, provider-models-rest #4396, provider-typed #4673, menu-scroll #1550,
  provider-max-output and provider-many-keys filed with the rest).
Not tried: a real New API / Sub API relay with a real key; the full Go suite
(started after the tag).
2026-11-12 03:13:50 +08:00
yetone e6bf4adf1f usage: Claude Code's helper requests are labelled, the largest cache write is one click away (recih on X, #6199)
Claude Code's AgentSummary and its auto mode classifier name themselves
nowhere in the request, so there is no client marker to read. The gateway
tells them by their content (inferredKind: a claude-cli/ request on the
Messages API; the classifier by autoModeClassifierAsk, the summary by its
last user text "Describe your ... in 3-5 words") and records them as
agent_summary_inferred and auto_mode_check_inferred. The purpose catalog
names them "Progress summary (inferred)" and "Auto mode check (inferred)"
and puts each with its plain kind's purpose, so the existing Purpose filter
lists both; nothing known and nothing inferred share a name. A tool that
printed the same words, a chat, and another agent's request stay unmarked.

A requests page now also holds BigWrite, the gateway-served row that wrote
the most to the cache (cells, page-v1.json and pageFromLedger all carry it;
rows from session files have no request to open). The Requests line shows
it as "109K largest write", a button that opens that request through
openUsageRoute. settledCountVersion is raised to 3, which keys the cached
pages.

Not done: the per-request branch recovery result asked for in #6199. No
structured field holds it.

Run on mote (load 21-24 of 18 cores, mica was higher): go test ./internal/usage
./internal/usageapi, the gateway and gui purpose tests, go vet for darwin,
linux (nogui) and windows, gofmt; the GUI files usage-big-write (new),
purpose-filter, routing-kind, i18n-keys and usage-ledger in chromium and
webkit. Broken by hand: inferredKind returning "" turns
TestClaudeHelperRequestsAreLabelled red; the larger-than test of BigWrite.add
turned round turns TestRequestPageBigWrite red on both paths; the jump off
turns usage-big-write red. Not tried: a real Claude Code session against a
live subscription, Linux WebKitGTK.
2026-11-12 02:01:31 +08:00
yetone e174b55150 library: a Variables tab gives environment variables to Claude Code and Codex (paopao_baobao on X)
An environment variable is kept once in the Library and written into each
agent picked: Claude Code's settings.json "env", Codex's config.toml
[shell_environment_policy.set] (a sub-table or inline set is edited; a
dotted spelling is refused). It follows Hooks: Applied.Env records what
magpie wrote, so turning it off or removing it takes out only that, and a
value the user set or changed in the file is never overridden (a conflict
is a problem on the row). An unreadable file is an error, nothing is
written. The tab has name, value and agent chips, an edit sheet and a
row Remove with a confirm; its sidebar entry is in "Every agent". Not
carried in backups, as hooks first were. docs/subsystems/library.md updated.

Run (mica, sandbox HOME): internal/library and internal/gui go tests ok;
gofmt clean; go vet darwin, linux -tags nogui, windows clean; GUI
library-*, i18n-* in chromium and webkit (en, zh, zh-TW, ja, de, 440px):
all green except "the Library while it loads", red on the merge base too
(not from this change). Existing tab-list assertions in library-hooks,
-subagents, -groups, -loading now include Variables.
Broken by hand: syncEnv overwriting the user's value turns
TestEnvNeverOverridesTheUsers red.
Not tried: real Claude Code / Codex reading the written env; other agents
(Gemini .env, Qwen, Droid); WSL; env in backup carry.
2026-11-12 02:00:19 +08:00
yetone a5e805f574 Codex: Ultrafast beside Fast in a group member, and a Fast/Ultrafast setting per model (kdajenks on X)
kdajenks (magpie 0.1.3739, Codex on ChatGPT Pro) could set Fast only from a
routing group's member row and had no Ultrafast there, and no way to set the
speed in the model's own settings. Ultrafast exists: Codex's catalog lists
the `ultrafast` service tier, the code already sent it for agent picks and
Codex's service-tier row, and the live account's service_tiers hold it.

- Group member: the button steps Standard speed, Fast, Ultrafast (where an
  account offers it, `ultraOK`), back to Standard. `Group.Ultra` is a subset of
  `Fast`, kept through rename, fold, share, gone-filter and the CLI
  (`magpie group ... ultra=`). The gateway marks the candidate `ultra`.
- Per model: `settings.ModelTiers` ("<provider>/<model>" to priority or
  ultrafast), `provider.SetModelTier` (refused where CanFast/CanUltra say no),
  `ModelPref.Tier` in Model settings (Standard speed / Fast / Ultrafast, in
  modellimits.js), and `magpie model tier <provider/model> [fast|ultrafast|usual]`.
  The gateway sends it on a direct pick for an agent with no fast pick of its
  own, through fastPick, so an account without Ultrafast gets priority. A group
  member goes as the group says.
- Docs: gateway-routing, providers-accounts, reference.

Run (mica, at the rebased head over a6d84e13a):
- gofmt -l clean; go vet darwin, linux nogui, windows clean.
- go test internal/provider, internal/settings ok; internal/gui and
  internal/cli ran: the one red of mine (TestSettingsSaveKeepsWhatItDoesNotSend
  wanting ModelTiers) is fixed in this commit; the others are not mine and
  red on a clean origin/main: TestEveryRouteHasACommandOrIsNamed (#6202),
  TestPanelHiddenByWailsMarksPageOutOfSight (#6203, not checked on main).
- internal/gateway ok (984s).
- GUI, chromium and webkit: new model-speed.test.cjs (30, five languages, 1200
  and 420px), plus model-*, group-*, fast-*, i18n-*, text-size,
  codex-service-tier, panel-*, routing-group*, routing-save* files. Red and not
  mine, same on a clean origin/main worktree: fast-pick and fast-ultra (#6201),
  group-editor-selected (#5049).
- New tests TestModelTierSentToEveryAgent, TestGroupMemberUltrafast,
  TestCleanModelTier, TestSaveGroupUltra.

Broken by hand: removing the gateway's model-tier branch and the candidate
`ultra` copies turned both gateway tests red; turning off the Ultrafast choice
in Model settings turned 20 of 30 GUI tests red; reverting the member button to
two states turned 10 of 30 red.

Not tried: a real ChatGPT account sending Ultrafast through the new setting;
the agent picker's bolt does not show a model-level default; Windows and Linux
GUI runs.
2026-11-12 01:56:26 +08:00
yetone a6d84e13a9 agent: Claude Desktop can use this computer's LAN HTTPS address for SSH remote sessions (zyc-bit on X, #4546)
Desktop's built-in SSH remote sessions hand the profile's gateway address
and key to the remote host. magpie wrote 127.0.0.1 and this computer's own
key there, so the host refused it (provider_loopback; a non-loopback address
must be https), the gateway turned the key away from another machine, and
3p mode's sshHostAllowlist (empty) allowed no host.

Desktop's row gets a "gateway" picker, drawn only while LAN sharing is on
and an address of this computer is https (gateway.LANURLs: HTTPS on, or
MAGPIE_PUBLIC_URL): "This computer" (default, loopback) or that address.
The pick is settings.DesktopGateway (carried by the settings save, kept by
KeepOwn). desktopOn / desktopCheck / desktopKeyApplied write and compare
desktopGateway() and the key at it (agentKeyAt: the sharing key). On a
non-loopback address sshHostAllowlist is seeded once with ["*"]
(desktopSeedOnce; the user may narrow it, never rewritten). The pick holds
only while it is still one of the https addresses; Agent.Gateway is
desktopGateway, so Rekey (after the sharing toggle, and now after the HTTPS
toggle) sets Desktop again, back to loopback when sharing goes off.
desktopIsOurGateway takes this computer's LAN addresses; realReachProbe no
longer verifies the certificate (magpie's CA is not trusted on this
computer), which read a LAN https address as unreachable.

Run (mica, sandbox HOME): go test ./internal/agent ./internal/settings
./internal/settingsapi ok; ./internal/gui ok except
TestPanelHiddenByWailsMarksPageOutOfSight, flaky the same on origin/main
fc615339f (#5322); go vet darwin, linux (nogui) and windows on the three
packages; gofmt clean. TestDesktopPointedAtLANHTTPS is red when desktopOn
writes loopback and when the key is not the sharing key. GUI
desktop-gateway-address.test.cjs 20/20 (chromium + webkit, en zh zh-TW ja
de, 1100 and 420px), red 20/20 with the field left in the "nothing to pick"
filter's absence; i18n-keys, desktop-*, click-scroll files.

Not tried: a real Desktop SSH session to a remote host, the remote host
trusting magpie's CA (it must, or use an imported certificate), the real
Claude Desktop app. Windows and Linux runs only vetted.
2026-11-12 01:28:03 +08:00
yetone 319753d892 gateway: a key can follow, force on or force off masking (y0ngb1n on X)
A gateway key now carries Redact: "" follows the global setting, "on"
masks that key's requests even when masking is off, "off" sends them as
written. Trusted devices turn it off, external ones are forced on.

- access: Key.Redact, CleanRedact and the redact-key action; an issued key
  inherits "on" from its issuer and can't turn it off; the default key
  takes the same values.
- gateway: maskingFor(ctx) decides per request; every route that masked
  (chat, native, text hits, the Masked-As header) asks it. A local request
  with no key keeps the global setting. masking.WithForced carries "on"
  into the masker; the redact plugin's InUse counts keys set on.
- CLI: magpie gateway keys redact <key> follow|on|off.
- GUI: key-row badge and an app menu; 7 strings in zh, zh-TW, ja, de.
- docs/subsystems/gateway-routing.md: the Redact paragraph.

Note: "on" with global masking off masks secrets and personal data by the
defaults. An off key is still masked on a Remote magpie hop, which sends no
Masked-As header.

Run (mote-run): go test for access, masking, redact, cli, gui and
plugins/redact packages and the new gateway key_redact tests; gofmt -l and
go vet on darwin, windows and linux nogui, all clean; the new GUI test.
Broken by hand: maskingFor returning the global value goes red in
key_redact_test.go.
Not tried: a real remote-to-remote hop with two keys; the full suite runs
after the tag.
2026-11-12 01:01:32 +08:00
yetone 60fde6fb1a library: an MCP server holds several accounts, one in use, switched in place (Elorynth on X)
A remote server can hold several OAuth sign-ins or several sets of
headers (Authorization keys), one in use, which every agent given the
server follows.

- mcpauth: a server's sign-ins are kept with the one in use at m[name]
  and the others in Spare (Use, RemoveAccount, StartAccount); the gateway
  sends the one in use from its next request on.
- library: Server.Accounts and Server.Account; `live` lays the account's
  headers over the server's own in through, remoteHeaders and hubKey, so a
  switch rewrites each agent's file. A save from the editor keeps them,
  and a backup or sync carries no account's key (carry.go). Add, use and
  remove calls, POST /api/library/mcp-account, and mcp-signin takes add
  and label.
- GUI: a server with one set of headers or one sign-in looks as before,
  with a quiet "+ Add account"; with several, a list with the one in use
  marked, a click to switch, an x to remove. Four languages.
- mcp_rename tests compare mcpauth.Record with reflect.DeepEqual now, as
  Spare makes it not comparable (the windows one too).

Run (mote, at this tree): go test ./internal/library ./internal/mcpauth/...
./internal/gui; go vet darwin, linux nogui, windows; mcp-accounts.test.cjs
in chromium and webkit, five languages, plus the existing mcp-* and
library-mcp-* and i18n GUI files. Broken by hand: live() returning the
server unchanged turns TestServerAccountsSwitchEveryAgent red; the use
click removed turns mcp-accounts red.
Not tried: a real OAuth server with two real accounts; an agent's upstream
Mcp-Session-Id is not reset by a switch.
2026-11-12 00:57:23 +08:00
yetone 2bb2011621 gui: env lines pasted into the Add sheet or a key box open a provider (WJaunita45604 on X)
Pasting `export ANTHROPIC_BASE_URL=... / export ANTHROPIC_AUTH_TOKEN=...`
(also set, setx, $env:, Docker ENV, .env lines, and a JSON object of them
such as Claude Code's settings.json env) into the Add sheet's search box
opens a custom provider: name from the URL's site (api.moonshot.cn ->
Moonshot), API from the variable names (ANTHROPIC_* Anthropic, OPENAI_*
OpenAI chat, GEMINI_* Gemini), key, model, and the site's icon through the
existing /api/icons/favicon (it is sent the URL and name only; the key stays
in the draft until Save). Pasted into a custom provider's key or Base URL it
fills the form, as a curl command already did (curlOf). A key that only
stands for one (sk-xxxx, $VAR) is left out with a note. A bare host without a
scheme is https; a name with no dot (the tweet's example-xxx) is no address.

The curl and env readers moved to assets/pasteread.js, loaded when the
Providers page first draws, because the core script budget had no room and
raising it moves nothing out.

Run (mote, origin/main 8bc46b407 base, rebased clean): new
provider-env-paste.test.cjs, 18 cases (envOf on six forms plus a two-API
text, non-env text; Add sheet and key-box paste in en/zh at 900 and 440px,
chromium and webkit): all pass. provider-curl-paste, i18n-keys,
i18n-en-no-cjk, TestCoreScriptBudget pass. Broken by hand: with the search
box paste handler returning early, 8 of 18 go red. Provider/add/editor/custom
GUI files (92 files, both engines): 12 reds, all in provider-picks-stay
(#4397), provider-typed (#4673) and reset-providers (new #6196), and
all 12 fail the same in a clean origin/main worktree.

Not tried: a real vendor account with this paste, the favicon fetch against
the live site (the test stubs it), the full Go suite, Linux WebKitGTK.
2026-11-12 00:43:45 +08:00
yetone 7e3e0fec4f gui: put agents back as they were when magpie quits, connect them again at start (tudjam17795 on X)
New Settings > General switch, "Put agents back when quitting" (zh: 退出时还原 Agent 配置),
default off. With it on, quitting the GUI app runs the same restore Disconnect does
for every agent magpie has connected (*.before-magpie files back byte for byte), and the
next start connects those agents again. Off keeps today's behaviour: a connected agent
keeps magpie as it quits.

- agent.RestoreOnQuit disconnects each wired agent that the user did not disconnect, then
  forgets the <id>.disconnected mark, so the quit leaves no mark; it stashes the list of ids.
  agent.RewireOnStart takes that list once and connects those still unwired and not
  disconnected since. An agent the user disconnected stays disconnected.
- gui: OnShutdown restores only when the setting is on and this process served the
  gateway; start re-wires in the background (not while the gateway is paused). A restore
  on quit also quits at once without the ask.
- settings.RestoreOnQuit, settingsapi key kept unless sent, row in index.html, i18n for
  zh, zh-TW, ja, de, docs in gui-shell.md and agent-wiring.md.
- app.js: the repeated Off/On settings rows go through one helper (segsOO), 422 bytes
  smaller overall, so TestCoreScriptBudget passes without raising the budget.

Run (sandbox HOME, mica because mote was loaded):
- go test internal/agent, internal/gui, internal/settings, internal/settingsapi, internal/cli
  at the rebased head: the new tests and the budget test pass.
- GUI, chromium and webkit, five languages, widths 1100 and 420: restore-on-quit (new),
  quit-ask-setting, quit-ask, settings-general, settings-sections, settings-places,
  i18n-keys, i18n-en-no-cjk, gui-de, gui-ja, gui-zh-tw, and for the rows moved to
  segsOO: reduce-motion, skeleton-bird, lightweight, keep-login, checkin-at,
  update-auto, update-hide, update-restart, update-download, tray-bird, tray-logos,
  tray-cost, wsl-agents-setting, login-allow. All 0 fail.
- gofmt -l clean; go vet darwin, windows, linux -tags nogui clean.

Broken by hand: not forgetting the disconnected mark turns
TestRestoreOnQuitAndRewireOnStart and TestRestoreOnQuitLeavesUserDisconnected red;
dropping the Disconnected() checks turns TestRestoreOnQuitLeavesUserDisconnected red;
dropping the setting gate turns TestRestoreAgentsOnQuit red.

Known reds, not from this change (same on the base 60559ee73): 20 GUI failures in
settings-hints, settings-lines-wrap and settings-search (#6133, #6107, #6156, #6073);
internal/gui TestPanelHiddenByWailsMarksPageOutOfSight killed under load (#6063);
internal/agent TestPiGroupEntryKeepsItsMembers on mica.

Not tried: real agent configs (sandbox HOME only), a real Wails quit on a Mac with real
accounts, Windows via win-run, the Linux WebKitGTK app.
2026-11-12 00:19:34 +08:00
yetone fe20e4dbd8 sessions: an uninstalled agent's sessions can be deleted and are not offered Resume (_SekiBetu_ on X)
OpenCode (and Cline, Grok, Kimi, Hermes) keep sessions in their own
database, so magpie never deletes them and they stay listed after the
agent is uninstalled, with only Resume. When the agent's command is gone
from PATH, its rows now get Delete (Forget: hidden through the gateway
hidden list, a trash note marked forgot, the agent's files untouched,
Restore unhides) and no resume command. Installed agents are unchanged.

Run on mote: go test -count=1 ./internal/sessions ./internal/gui ok;
go vet darwin, windows, linux -tags nogui ok; gofmt clean; GUI files
sessions-forget (new, 5 languages x chromium+webkit), sessions-gateway-delete,
sessions-manage, sessions-folder-delete, sessions-purge, sessions-row-narrow,
i18n-keys, i18n-en-no-cjk all pass.
Broken by hand: removing the hidden-row filter turned the gui Go test red;
the old client.js turned sessions-forget red (5 of 5 chromium).
Not tried: a real uninstalled OpenCode on a user's machine; the Usage
page's /api/sessions list still shows a forgotten row (manage page only);
the whole GUI suite and full go suite run after the tag.
2026-11-12 00:09:56 +08:00
yetone d3aecfe958 test models: a plugin model its vendor queued answers OK, saying the queue (Mr7Faith on X)
Qoder personal_standard: qmodel_latest (shown as Qwen4-Max-Preview) and
dfmodel were queued (503 "queued the request for qmodel_latest (this
plan's queue: p4, 1 ahead); try again in 60s"). The test sends
X-Magpie-Fallback so the plugin says the queue at once, and the probe
counted that 503 a failure: red all day, and Working only unpicked the
models. The id in the error is the model's own id (the listing's display
name changed), not a mapping bug. A queued model is served and an agent's
turn waits it out, so the probe now sets OK with Result.Queued, which the
chip's title shows.

Run on mote: go test -run TestPluginModelTest ./internal/provider ok
(TestPluginModelTestSaysQueued now wants OK + Queued; build-red on the old
test.go); go vet darwin/linux/windows ./internal/provider; GUI
models-queued, model-test-one, i18n-keys in chromium and webkit ok;
models-queued red without the app.js line. models-works-only is red on
origin/main c43314792 too (#4391). Not run: full suite, real Qoder account.
2026-11-11 23:54:16 +08:00
yetone b52c711142 Restore what 85e6ec540 reverted: it was committed on a stale index and took out b587eb306's and earlier work (webview2, library skills, opencode endpoints, quotas); this puts the tree at b587eb306 plus the Paseo agent only 2026-11-11 23:09:15 +08:00
yetone 85e6ec5406 agent: Paseo's Claude model picker lists magpie's models (@TheMist016 on X)
Paseo (getpaseo/paseo) starts the same Claude Code, but builds its own model
list: first-party models plus settings.json's `model` and a few
ANTHROPIC_*_MODEL variables (providers/claude/models.ts). It never reads
Claude Code's modelPicker, where magpie writes every model, so the rest were
not selectable in Paseo. Paseo's own ~/.paseo/config.json takes
agents.providers.claude.additionalModels ([{id,label,description}], checked
against protocol/src/provider-config.ts) and passes each id to Claude Code as
written.

New agent "Paseo" (detected by ~/.paseo or PASEO_HOME): its switch writes the
models Claude Code's /model lists (same ids, [1m] marks, names; only the ones
picked for it) there, marked "via magpie" in the description; the user's own
entries and keys stay, off takes out only magpie's, a sync refreshes when on.
Claude Code must be connected to magpie as well.

Run (mote-run, sandbox HOME in tests): TestPaseoAdditionalModels,
TestStateListsPaseo, internal/agentenv, internal/gui full package ok;
internal/agent full run red only on TestPiGroupEntryKeepsItsMembers, which is
red the same on origin/main 12cd456f2 (passes alone; filed). gofmt clean,
vet darwin, windows and linux nogui on internal/agent. Broken by hand: Set
writing no models goes red.
Not tried: a real Paseo daemon reading the file (checked against its schema
source only); GUI browser suites.
2026-11-11 23:08:39 +08:00
yetone 12cd456f2c library: Skills > New skill makes a skill of the user's own (josephBenchap on X)
josephBenchap asked to create a skill in the Library; it could only
install or bring one in. Skills now has a New skill button beside Find
skills. A dialog takes a name, a description and the agents (the app's
chips, no select); Create writes skills/<name>/SKILL.md in the library's
folder with name and description front matter (YAML-marshalled, one line,
at most 1024 characters), lists it with no source, gives it to the agents
picked like any imported skill, and opens it in the reader, whose path
link opens the file in the user's editor. The name is checkName's, and
refused when the library or an agent already has one by that name
(compared without case) or a folder is in the way. The follow-the-server
note already sits above the Skills tab, so it covers this too. en, zh,
zh-TW, ja, de. docs/subsystems/library.md says so.

Run on mote at this head:
- gofmt -l clean; go vet ./internal/library ./internal/gui on darwin,
  GOOS=linux -tags nogui and GOOS=windows: ok.
- go test ./internal/library ./internal/gui: ok. TestCreateSkill is new.
- GUI node --test in chromium and webkit: library-new-skill (new; en and
  zh, 1100 and 420px: refusal stays in the dialog, agent untick posted,
  reader opens, no select, no sideways scroll), library-items,
  library-follow-server, library-all, library-discover-jump,
  library-groups, library-intro-width, library-linked-set,
  library-pick-remove, library-row-open-scroll, library-ime-scroll,
  library-desktop-skills, library-gone-agents, library-bar-more,
  library-chip-fan, i18n-keys, i18n-en-no-cjk, gui-de, gui-ja, gui-zh-tw:
  all pass.
- library-loading is red (2 of 6) on this tree and on origin/main
  e6fe481b3 alike: the tab list gained Claude plugins. Already #5997.

Broken by hand: the agents' own-skill name check removed:
TestCreateSkill red ("theirs" was taken).

Not tried: the real app; Windows run of the tests (vet only); the full
suite starts after the tag.
2026-11-11 23:01:12 +08:00
yetone 628f8fd840 gui: a plugin page's script hash is of the bytes served, not of the body (zhangly1 on X)
inlinePage wrote each script as "<script>" + body + "\n</script>" but hashed
body alone. A CSP hash covers the exact text between the tags, newline
included, so the browser blocked every inlined script (the bridge too) and a
plugin page opened in magpie web was blank. The hash is now taken from the
text that is written, in the one place that writes it. The siblings: no other
code hashes an inline script (grep sha256- in internal; the stylesheets go
under style-src 'unsafe-inline').

Run (mote): TestPluginPageWebComesAsOneDocument now hashes every served
<script> body and looks each up in the policy; red on the old pageinline.go
(all three scripts, the bridge included), green on the fix. internal/gui
package, vet on darwin, windows and linux nogui. New GUI file
plugin-page-csp-hash.test.cjs (chromium and webkit: hash of served bytes runs
with no securitypolicyviolation; hash of the body alone is blocked), with
plugin-page, plugin-page-cookie-proxy: green.
Not tried: the full suite before the tag (started after it); a real browser
against the live Go server behind a proxy.
2026-11-11 22:51:50 +08:00
yetone 9fcf6f1fa1 gui tests: the Sessions files take the speed note, the in-use ping and the agent menu (#5947)
Four Sessions GUI files were red on origin/main da169135a, run alone on
mica (Playwright 1.62.0, both engines, every language they cover):

- sessions-gateway-delete (10 of 10) and sessions-manage (4 of 4) read
  every .sm-note. e6f151507's speed note (sm-speed-note) is a second
  one when no row has a speed, so the exact-notes and textContent
  checks met two. They now read the notes other than the speed note.
- sessions-folder-delete (4 of 4) counted every POST as a delete call.
  10c4dc109's in-use ping, POST /api/update/using on a click or key,
  landed in "Cancel deletes nothing". It is left out of the count.
- sessions-export (4 of 8, en not-web, #5947): at 560px the head's tabs
  give way to the agent menu, so the OpenCode tab is hidden. The test
  now chooses OpenCode through whichever control is shown.

Test-only; no app code changes. Run: those four files on mica, 26 of 26
ok; at da169135a, 22 red.
2026-11-11 22:26:07 +08:00
yetone 7cd8bfc56f sessions: a page with no session's speed asks /api/speeds every 5s, not every second
The Sessions page asked /api/speeds once a second while open, whether
or not the gateway had heard any session. On a resting page the list
is empty, and each ask woke magpie through the whole web middleware
chain. On mote with the real-account copy, a 60s CPU profile with the
Sessions page open measured 0.50-0.56s, against 0.22-0.29s on Home. An
alloc_space diff over 55s showed /api/speeds allocating next to
nothing (21.7MB in all, 79% of it /api/drift). So the cost was the
62 wake-ups a minute, not their garbage. Old main de13afbf6 measures
the same 0.50/0.56s, so this is no regression; the page always
cost it.

While the last answer was empty, the page now skips four ticks before
asking again. A session that starts is kept by the gateway (its curve
is the last 120s), so its speed shows within 5s with its whole curve.
Once any session has a speed, the page asks every second again.
Opening the page asks at once.

Test: sessions-speed-rest.test.cjs (every language, Chromium and
WebKit). A resting page reads at most once in 3.5s, a session heard
shows within the rest, and then the page reads once a second. On the
old client.js it is red, 5 of 5 in Chromium ("read 3 times in 3.5s
with nothing heard").
2026-11-11 22:26:07 +08:00
yetone 0706d7a35a usage: a ChatGPT card has an image row: used up until the refusal's reset, else unknown (#6160, hqqqqqqqh on X)
ChatGPT's image generation has a quota apart from the 5-hour and weekly
windows. Neither /wham/usage (additional_rate_limits is null) nor the reply
headers (x-codex-primary-*, x-codex-secondary-*) tell it, so no remaining
count exists to show. Each Codex account's card (Usage page, magpie quota
--json, /v1/magpie/quotas, /v1/magpie/quotas/cards) now has an "Image
generation" row (provider.WithImageLane, Lane "images", Text and Aside so
routing, holds, history, tray and statusline never see it): "Used up" with
the reset time while the image model rests on that account after a refusal
(the #2244 drawing-lane rest, whose time is the refusal's resets_at), and
"Unknown" otherwise. Never a share or a count. Shown in en, zh, zh-TW, ja, de.

app.js: a Text row's display now goes through t(), a same-length change, as
the core script budget has 1 byte of room.

Run (on mote): go test -count=1 -run 'TestWithImageLane|TestCodexImageRow'
./internal/provider ./internal/gateway ok; codex-image-row.test.cjs in
chromium and webkit at 900 and 390px in all five languages ok;
TestCoreScriptBudget ok; go vet darwin, windows, linux nogui on provider and
gateway ok; gofmt clean; 158 GUI files matching i18n/quota/usage/balance
names in both engines (result in the follow-up).
Broken by hand: the GUI test is red with app.js's display line put back to
the old form; the Go row tests are red with imageRestOf returning false.
Not tried: a real ChatGPT account hitting its image quota (the row is
driven by a faked refusal's rest); the generated-image count the issue also
asks for is not built.
2026-11-11 21:59:36 +08:00
yetone da169135a0 usage: an empty page says session files aren't read yet, and allows them (simonzyzy on X)
Claude Code's and Codex's sessions, and each call's tokens and time, need no provider: with the consent given, a sandbox HOME with no providers lists both agents' sessions and /api/usage/requests returns their calls (source log, ms, tokens). The only gate is sessions/reads asked=false, which the Sessions page asks but the Usage Overview and Requests pages did not mention; they said to point an agent at a catalog model. Now they say the files aren't read yet and offer one button that allows the agents found. The Sessions page says live output speed is measured only on gateway requests and where the files' own figures are.
2026-11-11 21:49:11 +08:00
yetone f5124ea179 library: a computer that follows the server says its changes are replaced (JiuLiaowkvn on X)
With Settings > Sync > This computer set to Follows the server, a skill
or MCP server added in the Library is replaced by the next sync, and the
reporter read that as the update deleting their skills. The Library now
says it in one line above Instructions, MCP, Skills, Hooks, Subagents and
Plugins (Memory too while memory is synced), with a link that opens the
This computer row. Nothing is said when sync is off, the part isn't
synced, or the computer syncs both ways. en, zh, zh-TW, ja, de.

Run on mote: library-follow-server.test.cjs (new, 48 cases x en/zh, 1100
and 420px) in chromium and webkit; broken by hand (note not appended) it
goes 29 red. Also green in both engines: i18n-keys, i18n-en-no-cjk,
sync-follow-server, library-items, library-intro-width, library-hooks,
library-all (chromium).
Not tried: the full suite, the real app, a real sync server.
2026-11-11 21:46:26 +08:00
yetone 8016205e3f provider: trust a self-signed server's certificate by fingerprint, for Remote magpie and any https address of your own (Zhangzhangi on X)
Zhangzhangi on X couldn't add a Remote magpie at a domain with a
self-signed certificate ("x509: "api.magpie.local" certificate is not
standards compliant") and asked for a skip-verification option. A
follow-up asked for the same on other self-signed hosts.

This adds a pin (trust on first use), not a blind skip. It is off by
default and kept per provider:
- Advanced → Server certificate → "Trust its certificate…" fetches the
  certificate the server shows (provider/peekcert) and lists its SHA-256,
  subject, issuer and expiry. "Trust this certificate" keeps the
  fingerprint as the provider's serverPin.
- From then on only that certificate is accepted (netproxy pinTLS:
  InsecureSkipVerify plus VerifyConnection comparing the leaf's DER
  SHA-256). Another one fails with PinMismatchError, saying the server
  showed a certificate other than the one trusted.
- The editor shows a red "Certificate not verified: only this one is
  accepted" with the fingerprint, and "Verify it again" drops the pin.
- The pin is set only on the provider's own hosts (provider.PinHosts):
  - every address of Remote magpie and of a provider added by URL;
  - for a preset (Ollama, LM Studio, OpenAI at your own box), only https
    addresses whose host is not one of the preset's or its regions' own
    hosts. A vendor's host never takes a pin.
  - Never for an account, Vertex or a subscription. Save refuses one
    elsewhere.
- The client certificate and Server CA still go only to the providers
  that took them before (TakesClientCert). A preset gets the pin alone.
- The editor's certificate rows (Client certificate and the new Server
  certificate) are drawn by a lazily imported tlscerts.js. The Client
  certificate row moved out of app.js with it, so the core scripts stay
  under TestCoreScriptBudget without a raise.

Run (Go 1.26.8):
- WSL magpie-desktop, before the rebase:
  - go test -tags nogui -count=1 ./internal/netproxy ./internal/provider
    ./internal/gui all ok;
  - GOOS=darwin -tags nogui vet of gui fails on traywindows_darwin_test.go's
    undefined trayImagePNG, the same at the base (a cgo-only helper).
- mote and mica, after the rebase on ab5824aee:
  - gofmt -l clean; node --check app.js;
  - go vet darwin (cgo), GOOS=linux -tags nogui, GOOS=windows: ok;
  - go test ./internal/netproxy ./internal/provider: ok.
- mote, at the final tree: node --check app.js and tlscerts.js; go test
  ./internal/gui -run 'Budget|ServerPin|InsecureTLS|ClientCert|OnDemand|Lazy'
  ok (TestCoreScriptBudget under 1,533,802) at the base ab5824aee.
  Rebased on fe5a0cf6d, TestCoreScriptBudget is red, as it is on that
  main alone: main's core is 1,534,708 (16ed1a952 took it to 1,535,318);
  this change takes it to 1,534,484, 224 bytes less (#5918, commented).
  The rest of the run above passes at the pushed head.
- mica, GUI files at the final tree, both engines inside each file:
  - green: provider-server-pin (54), mtls-settings (16),
    provider-insecure-tls (60), provider-socket (60), provider-http1 (60),
    i18n-keys, i18n-en-no-cjk, editor-advanced-align, provider-advanced-fold
    (50);
  - old-webkit: headerpresets.js not loaded (#6030) and Safari 15's :has()
    (#5919), both on main too;
  - menu-scroll: 24 of 24 red on /api/update/using, the same alone at
    origin/main fe5a0cf6d (#5982, commented).
  - Earlier flakes of provider-http1 beside another session's suite:
    #6159.
- Broken by hand, each red:
  - presets never take a pin: TestServerPinSaveChecks,
    TestServerPinPresetAtOwnServer, TestServerPinNoVendorHost;
  - vendor hosts pinned (the own-host check dropped):
    TestServerPinNoVendorHost;
  - client cert and CA sent to presets: TestServerPinPresetAtOwnServer;
  - the pin never compared: TestPinOnlyThatCertificate,
    TestServerPinRemoteMagpie.
  Restored: both packages ok.

Not tried:
- a real self-signed domain from the macOS app (httptest servers with
  their own certificates only);
- the Responses WebSocket dial (read only: it takes the same netproxy
  transport);
- go test ./internal/cli and the whole GUI suite before the tag (the
  full Go suite runs after it, under suite.lock).
2026-11-11 21:13:43 +08:00
yetone fe5a0cf6d3 gui: the nav's groups and masking tabs fly with the rest as the layouts trade places (#5434, invzhi on X, patch by ggbdpq)
The morph gives each nav tab a view-transition-name of its own (app.css
.nav-morph), but the list stopped at the eight tabs that existed when it
landed; Routing groups and Masking came later and only faded with the whole
sidebar. Both are in the list now, in the nav's order (ggbdpq's analysis and
patch on #5434, which sat without a PR since 11-08).

side-toggle.test.cjs now holds the masking tab's group to animating and every
tab drawn in the nav to a name of its own, all different, so the next tab
can't be left out. Run on mote: red on the old CSS in chromium and webkit
(no nav-masking group), 26 of 26 green after. Durations and curve are the
morph's existing .32s strong ease-in-out, unchanged.
Not tried: the live app; Routing groups is display:none in the header
layout, so its group is a fade there, as before.
2026-11-11 21:03:00 +08:00
yetone 466cd4809f gui: a plugin page's Copy picture works where navigator.clipboard is missing (nivekxft on X)
The day card's copy button showed "Cannot read properties of undefined
(reading 'write')" in magpie web opened over plain http (a LAN address) or in
a webview with no async Clipboard API: pageshare.js called
navigator.clipboard.write unguarded. It now tries the API when it exists,
else copies the picture as a selected <img> with the copy command, else
throws a message that says to save it instead (translated in zh, zh-TW, ja,
de). The desktop window was not affected: it already hands the PNG to
/api/plugin-pages/image. app.js's text copy already falls back (/api/copy,
writeText, execCommand), so no sibling is left on the raw API.

Run on mote: page-image-no-clipboard.test.cjs (new, chromium and webkit, en
and zh, navigator.clipboard removed), 4 of 4 red on the old pageshare.js and
green after; plugin-page.test.cjs and i18n-keys.test.cjs green.
go test ./internal/gui: only TestCoreScriptBudget red, on main already
(#5918); pageshare.js and i18n.js are not counted in it.
Not tried: a real http LAN page pasting the image into another app; the
execCommand path was observed selecting the PNG, not read back from the OS
clipboard.
2026-11-11 21:03:00 +08:00
yetone a3f4aab12e routing: a Claude Code request's row says whether it ran in the TUI or as claude -p (Anotiaww on X)
startRun notes the entry on the request's context (noteEntry); serve copies it to Try.Entry and Try.EntryWhy (the claudePrint code). The Routing row shows a TUI or -p chip, with the reason in its title, in en/zh/zh-TW/ja/de. The bridge page also records the answer to Tossipe on X: a local Claude Code on a remote magpie sends its history each turn, and the remote resumes its session and types only the new turn, so the history isn't sent to Anthropic twice.

Run on mote: TestEntryNoted; routing-entry.test.cjs in both engines, five languages, 1000 and 480 wide; i18n-keys (a key repeating a Go string is reworded). Not tried: a real Claude Code run on each path.
2026-11-11 20:57:10 +08:00
yetone 98cff4b0d6 gui: Claude Code's mode is one row, and it switches in magpie web too (Anotiaww on X)
The provider editor's 'Claude Code runs as' row was disabled in magpie web as a gateway, so it read as a switch that doesn't switch, while a second Settings row for the same claudePrintMode was the one that worked there. The editor's row is enabled everywhere (savePrefs works in gateway mode) and the duplicate row and its CSS are gone.

Run on mote: claude-tui-setting.test.cjs rewritten for the one row, app and gateway, en/zh/ja/de, 1100 and 420 wide, chromium and webkit; the claude-*, routing-*, i18n-*, agent-*, codex-*, mobile-web, provider-*, settings-*, dsh-* GUI files in both engines against a base copy (the same reds on both; proxy-auth and Hide accounts differ run to run). Not tried: the real app's Windows and Linux webviews.
2026-11-11 20:57:10 +08:00
yetone 16ed1a9524 gui: a setting's hint card starts at the pointer, not at the row's name (mmmg_btc on X)
Resting the pointer on Settings › About's 更新内容 row put the hint at the
far left of the row. 5710283da lined its text up with the row's name; the
pointer is what asked, so settingshints.js now keeps the pointer's x and a
card the pointer asked starts there (12px left of it, kept 16px inside the
window), with its grow-from origin at the pointer. A card a key asked
(focus) still lines up with the name. Every row hint comes through this one
module (Settings, a provider editor's fields, Routing groups), so they all
behave the same; native titles already show at the pointer.

Run on mote: provider-prefs-layout (card at the pointer; red on the old
code, 5 of 10), editor-hints, settings-hints (its pointer and key checks
changed), searcher-pick, settings-lines-wrap, sign-in-moves, and the gui-*
and i18n-* files, chromium and webkit; TestCoreScriptBudget; gofmt.
Reds: settings-hints "Settings' explanations show on hover and focus"
(chromium and webkit) fails the same way on base before reaching the
changed lines ("the card doesn't say the row's line"), and editor-hints in
webkit ("Tab didn't come back") fails on base too; both are filed.
Not tried: a live Mac window.
2026-11-11 04:45:46 -08:00
yetone ab5824aeea gateway keys: a limit in total never resets by the period, only by Reset usage (Cyrus_4433 on X)
The Limit window menu gains "in total" (period "total", CLI: gateway-key limit <id> total). It counts from when it is set or last reset and ends a century off (access.Limit.Window), so only Reset usage starts it again; its 429 says it stays refused until reset or raised, the row reads "$0.00 / $300 · 总额" with no reset time, and a remote key's window is "Tokens/Spend in total" with no reset. Old settings files read the same (new period only). i18n in zh, zh-TW, ja, de; reference.md and gateway-routing.md say it.

Run: TestLimitTotal and TestTotalLimitNeverResetsByThePeriod, red on the old code (Valid refuses "total"); gateway-key-total.test.cjs red without the keys.js change (5 of 5). Not tried: a real key through a live gateway; full suite follows after the tag.

Run (before this push):
- gofmt -l clean; go vet darwin, linux (nogui), windows clean.
- go test: internal/access, internal/budget, internal/cli, internal/provider ok.
- Go tests for the total period are red on the old code (Valid refuses "total"); the GUI test is 0 of 5 languages passing without the keys.js change.
- gateway-key-total.test.cjs and i18n-keys: 9 pass in chromium and in webkit (zh, zh-TW, ja, de, en; 500px width; no native select).
- Full GUI suite on mica, chromium: 46 reds in files this change does not touch (accounts, Pi/OpenCode Go, panel sheet, check-in, Aside provider, API key theme, allowed addresses); none is a key-limit test. Webkit pass still running; reds are to be compared with origin/main and filed after.
- TestCoreScriptBudget is red on origin/main 2d12e8274 by 7 bytes (1,533,809 > 1,533,802); this change touches no counted core script (#5918).
Not tried: a real key through a live gateway; the full Go suite (started after the tag).
2026-11-11 20:35:13 +08:00
yetone d1a2e92e89 gui: a setting's hint card starts at the pointer, not at the row's name (mmmg_btc on X)
Resting the pointer on Settings › About's 更新内容 row put the hint at the
far left of the row. 5710283da lined its text up with the row's name; the
pointer is what asked, so settingshints.js now keeps the pointer's x and a
card the pointer asked starts there (12px left of it, kept 16px inside the
window), with its grow-from origin at the pointer. A card a key asked
(focus) still lines up with the name. Every row hint comes through this one
module (Settings, a provider editor's fields, Routing groups), so they all
behave the same; native titles already show at the pointer.

Run on mote: provider-prefs-layout (card at the pointer; red on the old
code, 5 of 10), editor-hints, settings-hints (its pointer and key checks
changed), searcher-pick, settings-lines-wrap, sign-in-moves, and the gui-*
and i18n-* files, chromium and webkit; TestCoreScriptBudget; gofmt.
Reds: settings-hints "Settings' explanations show on hover and focus"
(chromium and webkit) fails the same way on base before reaching the
changed lines ("the card doesn't say the row's line"), and editor-hints in
webkit ("Tab didn't come back") fails on base too; both are filed.
Not tried: a live Mac window.
2026-11-11 04:31:37 -08:00