Commit Graph
2128 Commits
Author SHA1 Message Date
yetone 648cd3fdbb gateway: the management API leaves other keys that manage magpie alone
727e23637 added /v1/magpie/admin/ and left admin-key out of it so that "a
key can't give another more than it was given". But rotate-key was served
on any key: a key allowed to manage magpie from this computer only
(Admin local) could rotate a key allowed from anywhere (Admin any) and was
handed its new secret, or set one of its own choosing ("secret" in the
body). It then held a key that manages magpie from the network. It could
also turn off or remove that key, locking its owner out.

- internal/gui/admin.go adminMayChangeKey: a POST /gateway-keys/{action}
  naming another key that has Admin is 403. The caller's own key, keys
  without Admin and add-key go on as before. A gateway-keys file that
  can't be read is refused (unknown), not let through.
- docs/subsystems/gateway-routing.md says so.

Run (mote, at 2bcbae35e + this change):
- go test -count=1 -timeout 45m ./internal/gui/: ok 138.6s
- go vet ./internal/gui/ darwin, GOOS=linux -tags nogui, GOOS=windows: clean
- gofmt -l clean
Broken by hand: with the check skipped, TestAdminAPILeavesOtherManagingKeys
is red. A local key rotated the any key and got its secret
(sk-magpie-key-…), set "chosen-by-the-caller-1234" as its secret, turned it
off and removed it.
Not tried: a real gateway run over HTTP. The test drives serveAdmin with
the caller's identity in the context, as the gateway's admin() passes it on.
2026-11-13 03:49:41 +08:00
yetone 926b1e7dfb provider, gui: put back what 8c7328f3a took out of main by mistake (35aaaa4b9, 2fa79aef3, 797a23cad)
8c7328f3a (remote quotas: a Remote set to Select none still tells its
cards) was committed from a stale tree. Beside its own three files
(docs/subsystems/providers-accounts.md, remote_quotas_scope.go,
remote_quotas_test.go) it wrote 21 files back to their state before
35aaaa4b9, which took out:

- 35aaaa4b9, the Codex client setting (codex_request.go, codex_tier.go,
  settings.go, settingsapi.go, api.go, app.js, i18n.js, index.html,
  codex-client.test.cjs and the rest);
- 2fa79aef3, a save of the bytes a file already holds changes nothing
  (#6289: logins.go, logins_unchanged_test.go);
- 797a23cad, the tray's words (traywords.go, traytip_words_test.go).

The 21 files are checked out from 8c7328f3a^. After this commit
`git diff 8c7328f3a^ --stat` names only the three remote-quota files,
so main is the three lost commits plus 8c7328f3a's own change.

Run (mica, at this tree): gofmt -l clean; go test -count=1 -tags nogui
./internal/provider ./internal/settings ./internal/settingsapi ok.
./internal/cli and . are red on main already, not from this: the
codex-client and codex-open routes have no notYet entry, and
catalog.go's mmddSnapshot is compiled at launch (1ca2c62c4). Both are
fixed in the next two commits.
2026-11-13 02:00:40 +08:00
yetone f1f512c1ec library: a repository's heading folds an agent's profiles into one chip, and a row's profiles chip lines up with the hand (Yanzhongixuy on X)
0.1.3926, several Hermes profiles: the Skills page's source headings
(anthropics/skills ...) drew one icon per profile, a long strip, and the one
chip 2a1111cba made on a row sat out of line. That commit said "Rows only":
groupChips never set change.rows, so headings kept every profile. The row's
chip had data-members, not data-agent, so the fan/stack translate rules in
library.css never reached it.

groupChips now sets change.rows, and its profiles chip is half lit when a
profile has some of the skills. library.css applies the fan rules to
[data-members] chips too. docs/subsystems/library.md says so.

Files: plugins/library/client.js, plugins/library/library.css,
tests/library-profile-group.test.cjs (new), docs/subsystems/library.md.

Run on mote: library-profile-group.test.cjs (new; chromium + webkit, en/zh/
zh-TW/ja/de, 420 and 980px, 22 cases): 22 of 22 green; broken by hand (old
client.js and library.css) 22 of 22 red (13 Hermes chips, not 1); old
library.css alone 22 of 22 red (chips out of line). The Library GUI files,
group-skill-chips and i18n-keys ran in both engines: the only reds are
library-loading's chromium and webkit cases, red on origin/main
8c7328f3a6 too (run there alone, 2 of 6
red), filed as #6204.
Not run: the full Go suite and the 113-file GUI run's final tally (still
running when pushed), Linux WebKitGTK, a real Hermes install with many
profiles.
2026-11-13 01:42:52 +08:00
yetone 8c7328f3a6 remote quotas: a Remote set to Select none still tells its cards (@LOYSoLuI4PG4WlN on X)
On 0.1.3929 a Remote magpie added for the Usage page's quotas showed none
of the remote's subscriptions any more. cfd49e36a made a Remote's cards
follow its enabled models, and remoteCardWanted answered no card at all for
a provider that serves no model (Select none). Select none is documented to
serve no model while its balance and usage are still read and shown
(Provider.NoModels), and a Remote kept only to read quotas is set that way.
Now every card is wanted then; picks still narrow cards by their whole
provider path (93b855d90), and a list not read leaves all shown.

Run (mote): TestRemoteSelectNoneStillShowsItsCards is red on origin/main
797a23cad's scope file put back by hand ("map[]") and green with the fix;
-run 'Remote|Quota|Card' in internal/provider and internal/gateway ok;
go vet darwin/linux/windows of both packages ok; gofmt clean. GUI: remote-*,
usage-*, routing-remote-windows, panel-usage*, name-suffix-remote and
statusline-remote files in chromium and webkit: 74 red, all in usage-agents-hide,
usage-cards-hide, usage-fold, usage-hidden-way-back, usage-ledger,
usage-range-times, usage-speed-all-models, usage-compact-counts and
remote-magpie's address test; the same files are red the same on origin/main
797a23cad (75 red), already filed (#6003, #5475, #3414). The change is Go only.
Not tried: a real second magpie in sandbox HOMEs (a fake peer in the test),
the full Go suite (started after the tag).
2026-11-13 01:25:57 +08:00
yetone 35aaaa4b94 codex: a setting for which client the requests to ChatGPT say they come from, CLI or Codex Desktop (ouhthuo on X)
ouhthuo wants the originator "Codex Desktop", with which, they say, a
high-effort gpt-6.1-sol request is routed to a newer model. magpie sent
codex_cli_rs on every request, and codexSign even overwrote a real Desktop's
own originator.

Settings > Codex > "Codex client" (CLI, the default, or Codex Desktop; the
settings key codexClient is "" or "desktop", POST /api/settings/codex-client,
no free text). codexClientHeaders is the one place that sets originator and
User-Agent, so the model requests, the /wham usage and reset calls, the token
refresh, the device and code sign-in exchanges and "test as" all follow it.
Desktop sends originator "Codex Desktop" and the UA shape codex-rs builds for
it: Codex Desktop/<codex version> (<os>; <arch>) unknown (Codex Desktop; <app
build>). Source: codex-rs login/src/auth/default_client.rs and a captured
Desktop UA. The default is unchanged; base_instructions and the identity
prompt are untouched. The OAuth authorize URL keeps codex_cli_rs.

The row sits in the Codex agent preferences, 5 languages. The two Codex menu
buttons share one helper (codexMenuPick) so app.js stays inside its budget
without raising it.

Run (mote): TestCodexClientSetting (red with codexClientHeaders ignoring the
setting), settings, settingsapi, gui and provider Codex tests ok; gofmt clean;
go vet darwin, windows and linux nogui clean; GUI codex-client,
codex-service-tier, codex-open-button, i18n-keys, i18n-en-no-cjk,
settings-general, click-scroll in chromium and webkit ok. Real Codex account
in a sandbox HOME: gpt-6.1-sol and gpt-6-sol at high effort answer under both
identities with identical usage; the reply's model field only echoes the
requested name, so whether the served model differs can't be told from here.
Red and not mine, already filed: settings-search (#6133, #5982) and
agent-prefs "Settings line" (#6139) fail on origin/main, TestMoveToPlugin
#5524.

Not tried: the real Desktop app (not installed here); the app build number
in the UA is the newest seen in local logs and can go stale.
2026-11-13 01:17:30 +08:00
yetone 8097860ab1 gui: put back what 76ceff87c took out of main by mistake
76ceff87c was built on an older base and its tree dropped the Linux
backdrop-blur rule (7c37424fc) and Codex seats change (d6b5f24db) with
their tests, docs and history.go edits. This restores those files from
d6b5f24db; the diff against d6b5f24db is now only the hours feature.
Run: git diff d6b5f24db --stat lists the usage files alone.
2026-11-13 01:01:43 +08:00
yetone 76ceff87c9 usage: a number of hours the reader sets, beside the calendar (eachg0 on X)
The range menu behind Custom has a top row, "[N] hours back". Enter asks
the Usage page for the rolling window last:Nh (1 to 720), which the
backend already answers for every view (totals, chart, models, accounts,
Requests); the chip reads "Last 30 hours". The pick and N are kept on this
device (magpie.usagePeriod, magpie.usageHours). 24 stays the preset's
chip, and an empty page, the credit days and the menu-bar way in know the
new period. zh, zh-TW, ja, de strings added.

Run (mote, at the rebased head): usage-hours, usage-24h, i18n-keys in
chromium and webkit, en and zh. Broken by hand: keptPeriod limited to the
presets turned usage-hours red (expected last:30h, got today).
Not tried: the whole GUI suite (queued on mote's suite.lock behind other
sessions, still running), narrow widths by hand, the tray panel (it has no
24h chip and is unchanged).
2026-11-13 01:00:14 +08:00
yetone 7c37424fcf gui: the Linux app draws without backdrop blur, which WebKitGTK repaints on the CPU each frame (Lsheng2012 on X)
Lsheng2012 (CachyOS, KDE, i7-12700H, RTX 3070 Ti Laptop) found the UI laggy.
webkit_linux.go turns accelerated compositing off under Wayland and without a
GPU, and there every backdrop-filter is software-painted for its whole box
each frame. body.linux now drops it on .modal, .pop, the panel's profile
chips, Settings' sticky head and the confirm ::backdrop. Layout unchanged.

Measured (WebKitGTK 2.52.6, Xvfb on magpie-desktop, 240 rAF scroll frames of
600 rows, 1100x760): no blur 16.2ms, sticky head blur 16.2ms, full-window
modal blur(8px) 25.0ms with compositing off (16.4ms with it on).
Run: linux-no-backdrop-blur.test.cjs in chromium and webkit on mote (green;
red with the rule removed by hand), go test ./internal/gui asset tests.
Not tried: NVIDIA, Wayland/KDE, the omarchy VM, a full suite. The sticky head
cost nothing in the probe, so the modal is the measured gain; if the reporter
is still laggy the cause is elsewhere (CPU painting at HiDPI), and we ask for
their session type, driver and version.
2026-11-13 00:47:41 +08:00
yetone 6edf7a69e5 usage: hide and show single quota rows of an Overview card (wangshaowei39 on X)
Antigravity's card lists Claude & GPT, Gemini and more. A row group can now be
hidden from Usage > Overview the way a card can: right-click or long-press a
row, or use the card's "..." menu, and choose "Hide <group> from Overview". The
"Hidden" line under the cards lists hidden cards and rows with an Unhide button
and Show all. The last group of a card cannot be hidden (use the card's own
hide). Persisted as settings usageWindowsHidden ("<card>|<group>"), changed
through /api/usage/arrange { windowsHidden } and kept by the Settings save.
Table view and tray panel are untouched.

Run (on mote):
- go test: TestUsageArrange*, TestUsageArrangeWindowsHidden (new), TestSettingsSave*,
  settings_keep guard, TestCoreScriptBudget, ./internal/settings, ./internal/settingsapi;
  gofmt clean; go vet darwin, linux nogui, windows.
- GUI, chromium and webkit: usage-rows-hide (new, 5 languages x 1200/560/390;
  32/32), usage-card-more 32/32, usage-arrange, usage-all-accounts 24/24,
  i18n-keys 4/4.
- usage-cards-hide and usage-hidden-way-back: "de 560" red (no sideways scroll
  635 vs 560); the same red on a clean origin/main a5e5f539a, filed as #6294.
Broken by hand: withoutHiddenRows returning its input turns usage-rows-hide
16/16 red in chromium.
Not tried: a real Antigravity account (fixtures only); full suite starts after
the tag.
2026-11-12 23:45:43 +08:00
yetone e18aca1038 agents: an agent's own context window, and a routing group's own Compact at (ul3140773077392, NovaStudiosss on X)
ul3140773077392 on X: dsh compacts earlier than other harnesses at the same
window, so one global size per model fits none. An agent's sheet (Agents,
the agent's Settings line) now holds "Context window": a size for every
model, or model=size pairs (provider/model, group/<id>, provider/*, a bare
model id, *). Empty follows each model's own window. It is applied in
provider.CatalogFor, the choke point every agent's model list goes through,
so dsh's contextWindow, Codex's catalog and Claude Code's window all read
it, and a window set this way makes Codex/Claude compact at that window
(Entry.WindowSet). Stored in settings.AgentContexts, kept by a general
save (settingsapi); POST /api/settings/agent-contexts and
`magpie model window <agent> [model=size...|off]`.

NovaStudiosss on X: Routing, a group's Edit, Advanced already had "Context"
(the window agents are told). It now has "Compact at" beside it
(Group.Compact; compactSet reads it before the members' smallest), also
`magpie group ... compact=`.

GUI: agentwindow.js, loaded on demand through agentcompact.js so app.js
stays inside its budget (TestCoreScriptBudget passes; the "Context window
in {agent}" label reuses the existing "Context window" key). Every agent
with fields now has a sheet; agent-prefs' Pi expectation says so.

Run at the pushed head, on mote: go vet (darwin; linux -tags nogui;
windows) on provider, agent, cli, gui, settings, settingsapi; gofmt clean;
go test provider, cli, settings, settingsapi, gui (TestCoreScriptBudget
and cli's route table fixed here), agent -run Dsh; node --test agent-window
and group-compact (chromium and webkit, en zh zh-TW ja de, 900 and 420px),
agent-compact, agent-prefs, compact-at. Reds seen identically on a
detached origin/main 4e0026661: agent-prefs webkit "in the panel a
Settings line..." (#6139) and old-webkit "compat.js is the first" / "styles
hold up in Safari 15.0" (#5919, #3403).

Broken by hand, each red then restored: withAgentWindows out of CatalogFor
(TestAgentOwnContextWindow, TestDshOwnContextWindow); the group branch in
compactSet (TestGroupOwnCompactAt); the settingsapi keep line
(TestSettingsSaveKeepsWhatItDoesNotSend); the window row in the sheet
(agent-window tests); compact dropped from the group save
(group-compact tests).

Not tried: a real dsh with a real account (its compaction is dsh's own;
the test reads the window magpie hands it), the full GUI suite (queued
behind another run on mote), Windows and Linux runs of the new tests.
2026-11-12 23:01:29 +08:00
yetone 477bbb7a15 usage: GET /v1/magpie/usage/requests?cursor= reads requests as changes, with stable ids (rdsaltbo on X, #6060)
A program keeping a ledger of its own (a WakaToken plugin) can now read the
requests incrementally: cursor=start or cursor=now, then each next_cursor.
Rows carry a stable content-derived id (same after a restart), origin, and
original_ids (request_id, response_id, client_response_id, message_id,
session_id, native_session_id), each only when the source gave it. A call
read late, a corrected row (same id, higher seq) and a native row replaced by
the gateway's (deleted, with seq) all come through a persisted journal
(usage-feed.jsonl, appended and synced before answering). Cursors magpie
cannot resume from are refused: 400 cursor_invalid / cursor_filter_changed,
410 cursor_expired / cursor_reset. A held key sees only its own rows and
tombstones. Without cursor, offset/limit mode is unchanged.

Also: Record.MessageID (not persisted) from the agent file's message id, and
usageapi's row decoration moved into a namer shared by both modes.
Docs: reference.md, integrating.md, gateway-routing.md, gateway-sessions.md,
site remote.html (en/zh/ja), llms-full.txt.

Run (mote, this tree): go vet darwin, GOOS=windows, GOOS=linux -tags nogui on
usage, usageapi, gateway (gui on darwin); go test -count=1 for
internal/usage, usageapi, gui, gateway: all ok. New tests: resume gets exactly
the new rows, ids and cursors survive a restart, correction keeps the id,
gateway takeover retires the native row, refused cursors, expiry, now cursor,
identical records, and the feed over the gateway (held key, 401 without key,
offset mode). Broken by hand: an unconditional memo made the new-rows test
red (fixed to memo only the next page).
Not tried: real Claude Code/Codex session files, a huge (700k+) history,
Windows run of the tests, GUI browser suites (no GUI file touched).
2026-11-12 22:40:15 +08:00
yetone 59c9887f65 search: web_search takes sites, recency and images; the ChatGPT backend gets them as its own fields (LBM_OASIG on X)
The web-search MCP tool gains optional allowed_domains, blocked_domains,
recency_days, images and search_context_size. Codex search (/alpha/search,
codex-rs codex-api search.rs) gets them as the fields web.run has: a
query's domains and recency, image_query for images, settings.filters,
search_context_size, image_settings. Every other searcher is asked the
sites as site:/-site: operators and ignores the rest. Image results read
as pages whose text starts "Image: <url>". Arguments travel in ctx, never
in a request body. Schema text names neither magpie nor a vendor.

Run: real Plus account, curl to /alpha/search with image_query and with
domains+recency+filters: both accepted, image reply shape recorded in
TestImageResultsReadAsPages. New tests (search_scope_test.go) use the
fake backend; go test ./internal/gateway full on mote: only the count
schema tests red (a boolean default), fixed, then -run Search|Codex|
ChatGPT|ImageResults ok; vet linux/windows clean.
Not tried: through a running sandbox magpie end to end; GUI untouched.
2026-11-12 22:26:45 +08:00
yetone c96f33d659 agent: Hermes is one entry in the Agents list and the model pickers; its profiles are not rows (geekbb on X)
7050da0a4 (Norethcy on X) made each other Hermes profile an agent
hermes#<name> so the Library could give it its own skills and MCP servers,
and that also put one row per bot, each with its own model pick, in the
Agents list. geekbb: Hermes should have one entry; the bots Hermes made are
Hermes's to manage.

The profile agents stay, as the Library's targets (Norethcy's request keeps
working), but are now marked Agent.Nested: DetectedIn (the Agents list, the
tray panel and every picker built from it) and ClientsIn leave them out.
All and Find still reach hermes#<name> by id.

Existing settings: a model a user set on a profile lives in that profile's
config.yaml and is not touched, so it keeps applying; a profile on magpie
still follows the connected config's model unless it was picked, and a
picked one stays picked (hermes:<path>:picked). Nothing is dropped or
rewritten; what goes is only the extra row and its picker.

Run on mote: go test ./internal/agent ./internal/library; new
TestHermesProfilesAreNotListedAsAgents, red with Nested off and green with it;
GUI hermes-profile-row (rewritten: one Hermes row, no "Hermes ·" text),
hermes-profiles, i18n-keys in chromium and webkit, five languages; gofmt;
go vet darwin, linux, windows for agent and library.
Not tried: a real Hermes with several bots; the full suite before the tag.
2026-11-12 22:23:54 +08:00
yetone 3bbd8ceaaa routing: Least used first counts a small check-in reward about to lapse (kudi3699 on X)
kudi3699 again: v0.1.3877's Lapsing faded the lost share across the
week and needed 0.5 points. A WorkBuddy check-in reward is a few dozen
credits (20 of a 5100 pool is 0.39 points, less the fade), so it stayed
under the threshold until its last hours and the half-used account was
still never picked. The plugin side is fine: mover min is 0.2.29, past
0.2.27 that reports check-in rewards' runsOutAt/runsOut, so no plugin
change.

Allowance.Lapsing is now the whole loss in points when RunsOut is within
7 days, none past it (no fade); routes.lapsingMin is 0.1 points. A seat
at 90%+ is still not helped.

Run (mote): go test internal/routes, internal/provider -run
"Lapsing|LeastUsed|Allowance", internal/gateway -run
"WorkBuddy|LeastUsed|Smart|Pace|Routing"; go vet -tags nogui for linux,
windows, darwin on the three packages; gofmt clean. Broken by hand:
lapsingMin back to 0.5 turns TestLeastUsedSpendsSmallCheckInRewardSixDaysOut
red (20 credits, 6 days out, old 50% vs new 20%). Not run: the full suite
(after the tag), real WorkBuddy accounts.
2026-11-12 22:14:40 +08:00
yetone 10a27651f0 usage: a window's whole is kept across its reset until the new one tells its own (Musikrv77852 on X)
After Kimi Code's 7-day window reset with nothing used, the card lost its
"Whole ≈ N tokens" until the new week passed 5% used. The reckoning is
every provider's (usage.WithWindowHolds), so the fix is too: carryHolds
keeps the last whole told for each account's window (window-holds.json,
temp-and-rename) and, where the new window is under the floor or has none
routed yet, shows it with holds.prevAt set. The tooltip reuses the past
cycle's "Estimated from the window that began X, read Y" line; no new
label. The new window's own figure replaces it as soon as it can be told.

Run (mote): TestWholeKeptAcrossReset (reset with 0% and 2% used, restart
from disk, same-window under floor, other account, new window with data),
go test ./internal/usage ./internal/provider ./internal/gui (only
TestCoreScriptBudget red until its +10 here), quota-holds and quota-curve
GUI files in chromium and webkit (all 5 languages x 360/1000px for the new
case), gofmt, go vet darwin/linux/windows for usage and provider.
Broken by hand: carryHolds returning early reds the Go test and the GUI
case; dropping the prevAt branch in app.js reds the GUI case.
Not tried: a real Kimi account across a real weekly reset; a full
./... suite before the tag.
2026-11-12 21:48:04 +08:00
yetone fd9033cbfd library: a synced skill keeps its library group (ConatusMoon2222 on X)
Cause. A skill's group is traced (tracer.repoOf) from files that belong to
one computer: the skills CLI's lock, a git checkout, CC Switch's record,
and Skill.From noted by an install-again or Group again. The sync bundle
carried none of it (CarriedSkill had Source, not From), and Put built every
skill as a new Skill, so the other computer had nothing to trace and put
the skill under "this computer". Group again only fetches repositories some
skill is already traced to, so with no skill traced it had nothing to start
from; and where it did group, the next sync's Put wrote the skill new again
and took it back out.

Change. Collect carries the traced repository as CarriedSkill.From for a
skill with no source of its own (none, or a folder). Put writes it as
Skill.From. When the bundle has none (made by a magpie before this), Put
keeps the From this computer already found for the same skill, and keeps
Skill.Gone ("kept on this computer only") for one with the same source.

Old data. Skills synced before this stay in "this computer" until one of:
the computer that has the trace updates and syncs (its bundle then carries
From, and Put applies it here), or Group again here, which works as soon as
one skill of the pack still names the repository (a skill installed from
GitHub carries its source); the result now survives later syncs. A pack
with no skill traced anywhere on the receiving computer has nothing to start
from there until the first computer has synced with this version.

Tests (library/carry_from_test.go), each red on the old code:
TestSyncedSkillKeepsItsRepo (lock-traced skill A -> B -> C),
TestSyncKeepsRepoFoundHere (old bundle, From found here kept),
TestRegroupAfterOldSync (old sync, Group again, then the same bundle
again). Broke Put's From by hand: first two go red.
Run on mote: go test ./internal/library ./internal/davsync ./internal/backup
./internal/gui ok; Library GUI files in chromium and webkit (see below).
Not tried: two real machines through S3 (the fake-S3 davsync tests pass);
a copy Group again bound to its repository is still unbound by a sync from
a computer that has it unbound (filed).
2026-11-12 19:33:39 +08:00
yetone 05cadcafd4 sync: a provider can stay only on this device (treydtw on X)
Providers sync between computers (WebDAV, S3, GitHub), so a model served
from one machine's localhost reached the others, where it can't be
reached. A provider now has "Only on this device": sync neither sends it
out nor lets a copy from another computer replace or delete it.

Provider.ThisDevice is set from the provider row's right-click menu
(Only on this device, a check when on) or `magpie provider this-device
<id> yes|no`, over POST /api/provider/thisdevice. davsync's collect drops
those providers and their order entries (provider.SyncedOnly); Mirror
skips an incoming copy of one and keeps the local ones; Restore keeps a
local mark. A normal editor save keeps the mark. File backups still carry
the provider with its mark.

Default is off for every provider, localhost included. A 127.0.0.1
provider is also what another computer runs for its own copy of the same
local server, and default-on would remove those copies on their next
sync; a LAN address is reachable from the other computers. Turning it on
at one computer removes the synced copy at the others on their next sync.
docs/subsystems/sync-backup.md says so.

The menu item gives no toast: its check mark is the answer, which also
keeps the core script budget at +151 bytes (1,263,700 to
1,263,851).

Run, on mica: new davsync TestProviderOnThisDeviceStaysOnIt (two
computers over a fake DAV) and this-device.test.cjs (chromium and
webkit, en zh zh-TW ja de, widths 1100 and 420); provider-find updated
for the new menu entry; davsync, provider, backup, cli, gui Go packages
ok except TestCoreScriptBudget, then fixed; vet on darwin, windows and
linux nogui clean. Broken by hand: SyncedOnly made a no-op turns the
davsync test red ("a sends its own model out"), and the Mirror skip
removed turns it red ("b after a's model synced"). GUI files that fail
in a loaded run (claude-quota-onboarding, provider-find, skill-fold-all,
usage-agents-hide, usage-cards-hide, usage-hidden-way-back) were run
alone on origin/main 5e933e153: usage-hidden-way-back (#6295) and
usage-agents-hide (#3414) are red there too, the rest pass; this branch
gives the same result. gui-de and gui-ja "has every zh string" are red on
5e933e153 as well.

Not tried: a real WebDAV/S3/GitHub server between two real computers;
the CLI command has no test of its own.
2026-11-12 19:31:11 +08:00
Flandern1211 5e933e153a agent: ZCode gets a Restart when magpie's models change while it runs (Flandern1211 on X, #5662)
ZCode reads its providers at start. Its Agents row now offers Restart for a
model list magpie changed while the app runs, as Claude Desktop's, WorkBuddy's
and OpenMausBot's do: restartApps has ZCode.app (dev.zcode.app) and
ZCode.exe, appReads covers config.json and provider_config.json, and
zcodePart hashes only magpie's provider, provider rule and model rules,
without the key or another provider's rules.

Patch by Flandern1211 (fork branch fix/zcode-restart-5662, 7b663fea9), read
line by line: three files in internal/agent, no network, credential, dependency
or .github change. Kept as written; this commit only adds the Restart line to
docs/subsystems/agent-wiring.md.

Run (mote, at this tree on origin/main 5a3d73039):
- TestZCodeRestartOnWindows red with the zcode restartApps entry renamed away
  by hand ("behind: <nil>"), green with it.
- go vet darwin, darwin nogui, linux nogui, windows on internal/agent: ok.
- GUI agent-app-restart, restart-app, agent-notice-lang, agents-last-known in
  chromium and webkit: 100 of 100 pass.
- internal/agent package: started, result follows in the tag's suite record.
- gofmt -l: clean.

Not tried: a real ZCode on macOS. dev.zcode.app is the patch's bundle id and
could not be checked here (no ZCode.app on the Macs); a wrong id leaves the
Mac row without a Restart, as before, and does not close anything. Real
Windows ZCode.exe was reproduced by the author on 3.17.2, not by me.

Co-authored-by: Flandern1211 <163982805+Flandern1211@users.noreply.github.com>
2026-11-12 18:59:53 +08:00
yetone 45dfdd9985 gateway: a conversation stays with who answered it for 30 days, 4096 kept (npikng161274 on X)
stickKeep was 24h and sticksKept 512. A long task picked up again after a
weekend lost its binding, the request went to another provider, and that
one refused the reasoning the first had sealed (invalid_encrypted_content).
Every answer already renews a binding, so only a gap over the keep let it
go. stickKeep is now 30 days and sticksKept 4096. No setting: the larger
default fits every case. Docs line in gateway-routing.md updated.

Run: TestStickSurvivesDaysAway (a 4-day-old binding saved and read back)
is red on the old 24h value ("a 4-day-old binding was lost") and green
now. Stick/Affinity/Sticks-named tests in internal/gateway pass via
mote-run; gofmt -l clean.
Not run yet: the full internal/gateway run and darwin/linux/windows go vet
were still going when this was pushed; results follow in a later commit
or note. Not tried: a real multi-day session. No GUI files touched.
2026-11-12 18:58:25 +08:00
yetone 900d1673d3 claude-desktop: a model listed by its 1M id runs to 1M, not the 272K working window (henglu486729 on X)
With Only each model's largest window (DesktopLongest) a 1M model is listed
by its "[1m]" id, but Full window off still gave it the working window as
its autoCompactWindow, so Desktop's Code tab compacted and showed it at
272K. desktopPlan's work() now leaves such a model at its whole window.
A threshold typed in magpie (CompactAt, per model or provider), the user's
own autoCompactWindow and a typed window still win. Listing and
inferenceModels already carried the 1M (supports1m/prefer1m, max_input_tokens).

Run (mote): TestClaudeDesktop* in internal/agent and Desktop|Claude in
internal/gateway ok; go vet darwin, GOOS=windows, linux nogui ok; gofmt
clean. New TestClaudeDesktopLongestRunsTo1M red on the old claude.go
(glm entry ""), green after. Not tried: the Windows Desktop 5.1231.2 app
itself (only 2.7032's bundle read); full suite is run after the tag.
2026-11-12 18:53:30 +08:00
yetone 67f61bd789 gateway: a Claude account's plain rate limit on one model rests that model, not the account (kaitokiku on X)
v0.1.3817 and the fixes after it scoped Fable's quota refusals ("hit your
limit", "reached your Fable limit") to Fable. A plain 429 rate_limit_error
is failRate, and restAfterMarked rested the whole account for it, with its
backoff ladder and sink: Fable rate limited showed "限流 · 42 分钟后恢复" on
the account's Opus row too.

claudeModelRate: a Claude account's failRate that names no window that
counts every model (5-hour, session, weekly, usage limit, organization,
overage, or a representative-claim header of five_hour/seven_day) rests
that model only, in restAfterMarked, rateRest and the sink. Anthropic counts
rate limits per model. Quota refusals and account windows rest the account
as before. Messages, Chat Completions, Responses, groups and the Routing
rows share restAfter.

No real Fable 429 was available: ~/.config/magpie/usage.jsonl, rests.json
and app.log hold none, and Claude Code's bridge keeps no response headers,
so the rule is not checked against real anthropic-ratelimit-unified-*
headers. The account-wide limit the logs do hold ("You've hit your weekly
limit · resets 2pm") is in the test and still rests the account.

Cost if the guess is wrong (Anthropic applies a plain 429 to the whole
account): the next Opus request to that account gets its own 429, rests
Opus there, and falls over to the next account in the same client request,
as any rested candidate does; the user sees no error. One extra refused
request per model per rest. The test checks Opus's own rest and that
Fable's stays and a second account is not resting.

Run at this tree (mote): TestClaudeModelRateRestsThatModelOnly red with
claudeModelRate returning false (account rests, Model empty), green with
it; TestFallback* ok; gofmt. Package internal/gateway and internal/provider
run, and vet on darwin, linux and windows, were still running at commit;
results follow. Not tried: a real Fable-limited account.
2026-11-12 18:34:34 +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 409581c053 routing: Least used first spends credits about to lapse first (kudi3699 on X)
kudi3699: a WorkBuddy account with a 5000-credit pack ending next March,
half used, plus check-in credits ending soon, was ranked by the whole
pool's used share in "Least used first", so it was never picked and the
check-in credits were lost. Smart (Renewal, Lapse) and Use before expiry
(Pace) already went by the plugin's runsOutAt/runsOut; Least used did not.

Allowance.Lapsing is what a window loses at RunsOut (RunsOutLeft of Of, at
most what is left) as points of the used share, fading to nothing a week
out; an amount not told is 0. routes.Seat.Lapsing at >= 0.5 points puts a
seat with room ahead of the rest, soonest Lapse first, then Used as before.
A seat at 90%+ is not helped. It is the shared runsOutAt/runsOut field, so
any plugin that sends it gets this. The WorkBuddy plugin already reports it
(0.2.27, the soonest pack incl. check-in rewards), so no plugin change and
no mover min change.

Run (mote): go vet routes/provider/gateway; GOOS=linux -tags nogui and
GOOS=windows vet; go test internal/routes, internal/provider (all),
internal/gateway -run "WorkBuddy|LeastUsed|Smart|Pace|Routing". Broken by
hand: urgent() forced false turns TestLeastUsedSpendsLapsingFirst and the
gateway test red. Not run: the full suite (started after the tag), real
WorkBuddy accounts, the plugin's bun tests (plugin untouched).
2026-11-12 17:56:38 +08:00
yetone 727e236378 gateway: a management API for providers, accounts and gateway keys, for a key set to manage (ljayic on X)
ljayic asked for a complete, stable management API so nothing needs a
hand-edited file. /v1/magpie/admin/ now serves the app's own /api handlers
(providers and their keys and accounts, OAuth sign-in start/poll/cancel,
gateway keys, account groups) to a gateway key set with
`magpie gateway-key admin <id> local|any`. Routes and actions not in
gui/admin.go's adminRoutes are 404, so a provider's saved key, a gateway
key's secret, sign-in export and actions on this computer's apps are not
served; "admin-key" is not served either, so the API can't raise its own
caller. Sign-in returns the vendor's page and code, opens nothing, takes no
password.

Guard (gateway/admin.go), in order: any Origin or Sec-Fetch-Site/-Mode is
403 with or without a key (Origin null, foreign, listed, *.localhost, an
app scheme); no key 401; a key without Key.Admin 403; from loopback the Host
must be ownHost (a rebound page's GET has no Origin); from the network the
key must be "any"; a proxied request counts as remote. Key.Admin is dropped
(adminOf) for a read-only, Browser, issued, expiring or default key, and
setting read-only clears it. The route is in readOnlyRefused and keySlotFree.

Docs: docs/reference.md "Management API", gateway-routing.md, and the
remote page in en, zh and ja. Routing Groups, sign-in export and a GUI
switch for the level are left to #6307.

Run (mica, the worktree before the rebase onto 9 newer commits): go vet of
access, cli, gateway, gui (darwin), GOOS=windows vet of the same four,
GOOS=linux -tags nogui vet of access, cli, gateway; gofmt -l empty;
go test -count=1 -timeout 45m ./internal/access ./internal/cli
./internal/gateway ./internal/gui: all ok but TestKeySlotEveryRoute, which
named the new route and is fixed here, then it and the read-only, admin and
guard tests pass again. After the rebase the same tests ran again.
Broken by hand, each red in TestAdminAPIGuards: browser check off (a
browser case served), Admin check off (a key without it served), Host check
off (a rebound name served), the "any" requirement off (a local-only key
from the network served, and a proxied request).
Tests: TestAdminAPIGuards (no key, unknown key, non-admin, read-only,
local/any, x-api-key, 8 browser headers x 3 callers, rebound Host, proxy,
no handler), TestAdminKey (access: levels, read-only, Browser, issued),
TestGatewayKeyCLIAdmin, TestAdminAPIGatewayKeys / Providers (a canary key
is never told) / SignIn, TestAdminRoutesEveryAPIRoute.
Not tried: a real sign-in against a vendor through the API, a request from
a second computer on the LAN, the GUI suite (no page or app.js changed), a
Linux/Windows run of the new tests.
2026-11-12 17:47:11 +08:00
yetone 4a5e58a04f gateway: one account held only by Codex credits being off is sent at once, not queued (tmr11235 on X)
tmr11235, after v0.1.3857: "没有设置上限或者并发,只有一个号,这个号额度用了95%,
但我不希望排队". v0.1.3852/3857 made a turn that waits for its account's one
turn near a usage cap say "queued". The wait itself is nearCap: an account
within 5 points of a cap holds one turn at a time. HoldCaps counts a Codex
account set not to spend its credits as capped at 100% of any window
(Credits), though the user set no usage limit, so such an account at 95%
was near its "cap" and its second turn waited for the first, with no other
account to send it to.

Now a try near its cap takes the account's turn only when the user set a
usage limit on it (a share or an amount: userCapped) or the turn has another
candidate to go to (it is sent there first, the account kept behind). A sole
account whose only hold is credits off is sent at once; the 100% hold itself
still applies at the try (capHeld). A cap the user set keeps its one turn at
a time, as dyzdyz010 asked for.

Run (mica): TestNearCap*, TestFarFromCap*, TestPiTwoTurns*,
TestNearCapOnlyCreditsOffOneAccountSendsAtOnce (a single account at 95%,
credits off, no cap: both turns out at the vendor at once, none waiting);
gofmt; go vet darwin, linux nogui, windows of internal/gateway.
Broken by hand: the userCapped condition removed, the new test red ("never:
both turns out at the vendor at once").
Not tried: a real Codex account; I could not tell from the report whether
tmr11235's account has credits off or a cap they forgot: with a cap set,
a sole account still queues, by design. Full suite after the tag.
2026-11-12 17:37:42 +08:00
yetone 4718943432 gateway: a small reply limit sent to Tencent's DeepSeek has room to think above it (WaiooT on X)
WaiooT (Tencent Cloud Token Plan, deepseek-v4.1-flash, an agent named
nowledge-mem): requests often ended "an empty reply (the model answered
nothing; try again) -- cut at its length, the whole output spent on
reasoning". Output 4,096, reasoning tokens 4,096, finish length. The
request named max_tokens 4096 (the memory tool's own setting; magpie adds
no limit to it) and no reasoning. Tencent's DeepSeek runs thinking by
default (docs 1823/132248: thinking "enabled", reasoning_effort "high",
"max_tokens >= 2048 advised in thinking mode") and counts it in
max_tokens, so the thinking spent the whole limit before an answer.

A Chat or Responses request to a tencentmaas.com provider's DeepSeek model
that names a reply limit of 16384 or less, names no reasoning of its own
(reasoning_effort, thinking, enable_thinking, reasoning...) and has no Max
output set by the user is sent that limit plus a high effort's room
(replyRoom, as side calls are), within the model's own limit where known
(withThinkingRoom, maxoutput.go). Scoped to that host and DeepSeek models.

The failure itself, a cut void, was already failed at once and asked
nowhere (#2972): its text now names the limit the request set and what to
do ("raise max_tokens in the agent, or ask for less reasoning"), still
holding cutVoidWords, so the group and patience matching is unchanged.

Run (mica): TestTencentDeepSeekCapGetsThinkingRoom (4096 gets room;
max_completion_tokens too; effort asked, thinking off, a large limit, no
limit, and another vendor's DeepSeek go as they came), TestChatLength*
(the error names the limit), TestShortDefault*, and gateway tests matching
Void|Length|Empty|Cut|Tencent|Output|Thinking|Reasoning; gofmt; go vet
darwin, linux nogui, windows of internal/gateway.
Broken by hand: withThinkingRoom's call removed, the new test red
("4096 and no reasoning: max_tokens 4096, want 28096").
Not tried: a real Tencent Token Plan key (none here), so that the 4096
came from the agent and not a Tencent default is read from the docs and the
reporter's numbers, not seen on the wire; an Anthropic-protocol client in
front of Tencent's DeepSeek is not covered; full suite after the tag.
2026-11-12 17:37:04 +08:00
yetone c1a91b5a52 agents: Mistral Vibe is an agent, and a Library target (alterxyz4 on X)
Vibe (mistralai/mistral-vibe, the `vibe` CLI) keeps its settings in
config.toml in $VIBE_HOME, else ~/.vibe. magpie now connects it: a
[[providers]] entry named magpie (the gateway's /v1, api_style openai,
backend generic), one [[models]] entry per catalog model aliased
magpie/<provider>/<model>, and active_model set to the alias, with the
previous value stashed and put back on Disconnect. Vibe reads keys only from
the environment, the keyring or ~/.vibe/.env, so the key naming Vibe goes in
the provider's extra_headers as an Authorization header; nothing is put in
the user's environment. Avibe's `vibe` command is turned away by binNot.

Library (#5595): instructions are $VIBE_HOME/AGENTS.md and skills
$VIBE_HOME/skills (vibe/core/system_prompt.py,
vibe/core/config/harness_files/_paths.py, read at 3.1.2). VIBE_HOME is in
appdir's usable list and agentenv. README (en, zh), docs/reference.md and
docs/subsystems/agent-wiring.md list it; the restart notice is in zh, zh-TW,
ja, de.

Run (mica, sandbox HOME):
- go test -count=1 ./internal/agent ./internal/library ./internal/appdir
  ./internal/agentenv ./internal/gateway ./internal/gui: ok.
- gofmt -l clean; go vet darwin, linux -tags nogui, windows on the touched
  packages: clean.
- Real vibe 3.1.2 (uv tool install mistral-vibe) with the file shape magpie
  writes, against a fake OpenAI upstream: the alias with slashes resolves as
  active_model, the request goes to /v1/chat/completions with model kimi/k2,
  Authorization: Bearer <key> from extra_headers and user-agent
  Mistral-Vibe/3.1.2.
- GUI: agent-notice-lang, i18n-keys, i18n-en-no-cjk, gui-zh-tw pass.
- Broken by hand: vibeMine returning false fails TestVibe,
  TestVibeOwnModelTakesMagpieOut and TestVibeSyncKeepsTheirs.

Not tried: the file written by the built magpie binary itself (the unit tests
write it through the same code), Windows runs of the new tests, a Vibe
signed in to Mistral with its own models alongside. gui-de and gui-ja
"every zh string" were red on the base for the "{agent} isn't installed
here" string, not for this change.
2026-11-12 17:07:23 +08:00
yetone 327da691ae gateway: the Codex app's list stands on Codex's cache while the backend can't be reached (not_4O4 on X)
Beside the ChatGPT sign-in the Codex app's picker reads
magpie-desktop-models.json, written only once the ChatGPT backend's model
list is known. not_4O4 (Windows, Codex App 26.1106.6628.0) had no such file:
the backend's ask never succeeded from there, so the file was never written
and the picker showed GPT alone while the account had room, magpie's models
only (and no GPT) once it was used up and magpie became the provider.

After an ask has failed with no list from before for that sign-in,
CodexDesktopCatalog now hands Codex's own models_cache.json entries and
magpie's models (the revoked sign-in's path), told once through
CodexDesktopChanged; the backend's list replaces it when it answers. With no
cache the file stays as it was, and a 502 after a revoked sign-in is still
no answer.

Run (mote): go vet gateway and agent (darwin), GOOS=windows and linux -tags
nogui vet of gateway, go test ./internal/gateway ./internal/agent;
TestCodexDesktopCatalogBackendUnreachable is new and TestCodexDesktop*,
TestCodexDesktopCatalogRevokedSignIn still pass. On the Windows box
(win-run) the agent's Codex desktop tests passed and a used-up probe wrote
magpie-models.json with relative key as in the report.
Broken by hand: the stand-in only for revoked, the new test went red.
Not tried: the real Codex app on the reporter's network; the reporter's
used-up half (GPT missing from the provider catalog) did not reproduce, the
catalog carries codex/<slug> entries in the probe on macOS and Windows.
2026-11-12 16:54:10 +08:00
yetone 531b277836 claude: an idle run's session survives a restart, so the next turn resumes it (recih on X, #6292)
As the gateway ends (abortAll), keepShelf shelves every run idle between
turns and writes the shelf to claude-shelf.json (temp and rename): per
entry the conversation fingerprint (turnKey: account, model, settings,
messages), Claude Code's session id, its project folders (config folder
and work folder), the account, tools and cache marks. The next gateway's
unshelve reads the file once when its shelf has nothing for the turn
(loadShelf, which takes the file away) and starts Claude Code with
--resume, told the turn alone, instead of the whole transcript (~100k
cache-write tokens on a long conversation). A file that does not parse
whole, another version, a missing session file, a folder that is not a
Claude project folder, or an entry older than idleLongest is unknown and
falls back to today's replay. Rewritten-turn matching (looseTurn) is not
kept; runs in a turn or parked on tool results at the stop are not
either; a crash writes nothing.

Run (mote): gateway "Claude|Subscription" tests green (90s), gofmt, go vet
darwin/linux/windows (nogui) and gui. TestClaudeIdleRunSurvivesARestart
(two Servers on one HOME, fake claude) is red with keepShelf off (session
removed as the gateway ended) and green with it; the unreadable-file
cases fall back to replay. TestClaudeSessionFilesAreRemoved now expects
the sessions to stay until the shelf discards them.
Not tried: a real Claude Code (a sandbox HOME has no sign-in), the
full ./... suite before the tag, Windows.
2026-11-12 16:25:28 +08:00
yetone 4b283e4f2c gateway: a Claude refusal for one model's limit rests that model, not the account (YsiCing on X)
Claude Code's "You've reached your Fable limit. Run /usage-credits to
continue or switch models with /model" read as a plain rate limit: the
"reached your ... limit" wording was in none of the quota word lists (only
"hit your ... limit"), so the whole account rested and Opus was refused
with Fable though its quota was left.

The four lists in routing.go and fallback.go's quotaWords take "reached"
as they take "hit". modelNamed (so every rest path that asks modelLimited)
reads a Claude account's "reached/hit your <family> limit" as that model's
when the family is in the model's id (claudeFamilyLimit); "usage",
"session", "weekly" and the like, and "You've hit your limit", stay the
account's. Messages, Chat Completions, Responses, the group fallback and
the Claude Code bridge all rest through restAfter.

Run at this tree (mote): TestClaudeNamedModelLimitRestsThatModelOnly red
without claudeFamilyLimit (rests the account, Why rate), green with it;
internal/gateway and internal/provider, gofmt, vet on darwin, linux and
windows (results below). Not tried: a real Fable-limited account; the
family word is Claude Code's wording as the screenshot shows it.
2026-11-12 16:15:49 +08:00
yetone 4028687b8c memory: dates in memory_search and the dream's notes are the user's local time, with the hour and offset (Norethcy on X)
memory_search printed a memory's Updated as a bare UTC date, so a memory
saved at 04:30 on the 11th in Shanghai read as the 10th, and the stored
times were written in UTC. Now:
- every memory time is written in the local zone (now() instead of
  now().UTC()): created, updated, edited, used, sync tombstones, digest
  publish time;
- memory_search shows 2026-11-11T04:30+08:00 (memoryStamp);
- the dream's notes list the creation day in local time, as "Today" there
  already was.

Old data: the file already held full timestamps, only in UTC ("...Z").
They parse as the same instants and are shown in local time, so no
migration; they are rewritten with a local offset when next changed.
There is no date filter in memory_search, and the Memory tab shows no
dates, so nothing else read the UTC day.

Tests: TestMemorySearchDatesInLocalTime (gateway) with time.Local at +08:00
reads an old "Z" memory and checks a new save is stored with +08:00. Red on
the old code both halves, broken by hand: the DateOnly line printed
2026-11-10, and now().UTC() in memory.go failed the saved-zone check.
Run with TZ=UTC and TZ=Asia/Shanghai on mote: internal/memory,
internal/memdistill, internal/gui (memory tests) ok; gofmt clean;
go vet ./..., linux nogui, windows ok. Not run: full ./... suite before
the tag (started after it), GUI browser tests (no assets changed).
2026-11-12 15:54:34 +08:00
yetone d91720d406 gateway: a Claude Desktop turn's run keeps Claude Code's hour of cache, not the 5 minutes its marks name (DIYgod on X)
Claude Desktop reaches magpie with a gateway key, which Claude Code takes
for an API key (docs: automatic is 1 hour on a subscription, 5 minutes on
an API key) and marks with no ttl. runTTLFor read that as the client's
word, since claudeTTLOf gave Desktop no pick, and the bridge's run wrote
5-minute caches. Desktop with no pick now gets "default" (this computer's
Claude Code pick, else an hour); a 1h mark and a magpie's header stay as
they are.

Run: TestClaudeCacheTTLOf and TestClaudeDesktopRunKeepsAnHour (both red on
the old code, checked by reverting remote_magpie.go), go test -run
'Cache|TTL|Claude' ./internal/gateway ok on mote, gofmt, go vet darwin,
linux, windows.
Not tried: a real Claude Desktop turn and a usage row's ephemeral_1h in a
sandbox (needs Desktop signed in to a gateway and a live account). A
Desktop user who picked 5m in its own config is now given an hour: its
marks can't tell that from the API-key default.
2026-11-12 13:07:24 +08:00
yetone 80dcd34729 codex: connect Codex through codex -p magpie alone (hpnjstar on X)
The Codex agent gets an "applies to" field: All of Codex (as before) or
"codex -p magpie only". In the second mode magpie writes
<CODEX_HOME>/magpie.config.toml (model_provider, model, effort,
model_catalog_json, its own [model_providers.magpie]) and a catalog beside
it, and never touches config.toml: its top-level model_provider, model and
openai_base_url stay the user's. Disconnect deletes that file and magpie's
catalog (kept if the user added to it). Plain `codex` keeps its own provider.

Codex 0.165 reads `--profile NAME` from NAME.config.toml and refuses -p while
config.toml holds a legacy [profiles.NAME] or profile = "NAME", so this is
the file form, not a [profiles.magpie] table. Codex without profile files
(older than the May 2026 removal of legacy profiles) isn't served in this
mode. The choice changes only while Codex is disconnected, so the two wirings
never share a config. Only magpie's models are offered in this mode; no
joining, failover or subagent fields.

Run (mote, at the rebased head): go test ./internal/agent ./internal/gui ok;
gofmt clean; go vet darwin, linux nogui, windows ok; GUI i18n-keys,
i18n-en-no-cjk, gui-zh-tw, codex-signin-always, agent-connect,
agent-disconnect in Chromium and WebKit. Real codex 0.165.0 in a sandbox
CODEX_HOME against a fake server: `codex -p magpie` sent one request
(Bearer magpie, model fake/m1); plain `codex` sent none; config.toml was
byte-identical after connect, effort change, sync and disconnect.
Broken by hand: letting scope change while connected turns two
TestCodexProfileOnly tests red.
Not tried: a real account, the Codex app, the GUI row in a live window, an
older Codex without profile files. gui-de and gui-ja "has every zh string"
are red on main without this change (#6234).
2026-11-12 10:10:28 +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 47128ffa59 gateway: a remote client's effort reaches Claude Code from every route (amhcwushuang on X)
amhcwushuang on X runs Claude Code -> new-api -> magpie on a server ->
the Claude subscription, and says the thinking level is lost.

Read from new-api (QuantumNous/new-api main): a Claude channel keeps
thinking and output_config as written (relayconvert shared/claude
ApplyReasoning passes a native request through), including the
{role: system} turn's output_config; an OpenAI channel turns the request
into Chat with reasoning_effort (reasoning.ApplyToOpenAIChat), and an
OpenRouter-dialect channel into a `reasoning` object. Claude Code's own
fixture (claude-code-2.1.296.json) carries top-level output_config.effort,
thinking adaptive, and the same effort on a system turn.

magpie already passed, to the spawned Claude Code's --effort: Messages with
a thinking budget or a top-level output_config, Chat reasoning_effort,
Responses reasoning.effort (checked by the new test on the old code).
It did not take the level from:
- a Messages request whose only effort is the last turn's output_config;
- a Chat request with reasoning.effort (an object), output_config.effort
  or a thinking budget in place of reasoning_effort.
Those now set the request's effort. reasoning_effort, when present, stays
the client's word; no setting of the user is read or overridden.

Run: TestClaudeBridgeTakesTheEffortOfEveryRoute red on the old chat.go and
decide.go (4 of 9 cases), green now; gofmt; go vet darwin, linux nogui,
windows on internal/gateway; internal/gateway full package on mote.
Not tried: a real Claude subscription behind new-api; Claude Code's
interactive mode with a message-only effort (the -p stand-in was used).
2026-11-12 08:30:48 +08:00
yetone 3af8fe9cf7 gateway: a Claude account's Fable week used up rests Fable on it, not the account (kaitokiku on X)
Claude Code's refusal for a used-up window is "You've hit your limit" and
names no window, and its rate_limit_info may carry no rateLimitType (the
transcript's rejected row). restAfter read the account's windows as they
were cached before the Fable week filled (Fable 60%, nothing full), so
Pooled said no and the whole account rested for the refusal's time:
Opus, Sonnet and Haiku with it, though the other weekly quota was left.

A quota refusal on an account whose reading holds a window of some models
only that counts the model, none known full, now asks for the reading
again and narrows the rest to the model when it shows that pool full
(narrowWhenRead, as for an unread account, #2036). Every route rests
through restAfter, so Messages, Chat Completions, Responses and the group
fallback share it; Claude is not a plugin.

Run at this tree (mote): TestClaudeFableWeekRestsFableOnly red on the old
routing.go (rests the account), green with the fix; internal/provider,
gofmt, vet on darwin, linux and windows. Full internal/gateway follows.
Not tried: a real Fable-limited account; a usage reading that keeps
failing leaves the account resting whole, as before.
2026-11-12 08:27:46 +08:00
yetone 7b5c069c3a gateway: Vertex AI gets a tool's image in a user turn of its own, no "Requests ending with a model turn" after view_image (Voo_Ler on X)
What the user saw: Codex on Google Vertex AI stopped right after "Viewed an
image" with "Requests ending with a model turn are not supported".

Why: Codex's view_image answers with a function_call_output whose output is
[input_text, input_image] (as ~/.codex/sessions rollouts record it). The
Gemini build kept a tool's images in the same user turn as its
functionResponse. Vertex AI answers a response turn mixing in anything else
with that 400 although the last role is user (#1533 showed it for text, and
ce11b1801 split the text out but left images with the response).

What changed: buildCodeAssistSent, for Vertex AI, puts a tool's images in a
user turn after the responses (with what the user said, if anything). The
image and the words are kept. AI Studio, Code Assist (Gemini CLI,
Antigravity) are unchanged: Gemini CLI itself sends a read image beside the
response, and no refusal is known there. Chat and Messages clients reach the
same builder, so they are covered; the image-under-assistant and trailing
model turn cases already end with a user turn (continueText).

Tests: gemini_view_image_test.go posts Codex's real view_image shape (array
output, image-only output, image in a following user message, image in a
model-role message) to /v1/responses against a fake Vertex that refuses as
the real one does; vertexTurnsAway now also refuses an image beside a
response. Reverting codeassist.go makes it fail with the reporter's exact
message, and TestGeminiToolResponseTurnHoldsNoText fails too.

Run: go test ./internal/gateway ./internal/provider on mote, gofmt -l, go vet
-tags nogui for darwin, linux and windows.
Not tried against real Vertex AI: no Vertex credentials on this machine.
2026-11-12 07:50:22 +08:00
yetone 5d5d57cbbb library: Variables are carried in backups and sync, keys only with keys (onducoder on X)
A skill's key set once as a Library variable (ANYSEARCH_API_KEY and the
like) now goes with the library: Bundle.Env carries name, value and agents
(nil from an older magpie, and Put then keeps this computer's). It follows
how servers' tokens are carried: a backup or sync without keys keeps the
names and empties every value (whatever the name, since a variable's name
says nothing of its value), WithSecrets fills them from this computer's, and
one with keys is sealed under its passphrase. A variable with no value is
not written into an agent (syncEnv), and a value the user set in the agent's
file is still never overridden. Not built: showing the variables a skill
needs on its sheet; nothing in a SKILL.md says them reliably.

Run (mote): go test ./internal/library ./internal/backup ./internal/davsync
ok; gofmt clean; go vet darwin, windows, linux -tags nogui clean.
Broken by hand: WithoutSecrets leaving the value turns TestEnvIsCarried red.
Not tried: real Claude Code / Codex reading the carried key; a real WebDAV
or S3 round trip; the full suite; GUI tests (no GUI file touched).
2026-11-12 02:59:41 +08:00
yetone a1a3b6fadb library: DeepSeek Harness folds its context with billion-context through its /bili/ prefix (VantH_off on X)
VantH_off asked for DeepSeek Harness in billion-context's support.
Library's billion-context tab offered Pi, omp, OpenCode, Claude Code, Hermes
and Zed. bili's dsh route is `dsh plugin add billion-context` (billion-context
0.1.213 README), which loads in dsh's process and takes traffic by proxy
settings; magpie's dsh route is baseURL http://127.0.0.1:3425/v1, plain http
on loopback, so that never sees it and the plugin would add tools and fold
nothing (the Hermes case, 00e8242e8). dsh's route baseURL is editable, so it
takes the route Zed and Hermes take, bili's documented /bili/ prefix.

Turned on, magpie runs `bili start --port 8787` and writes magpie's route
baseURL in every dsh profile and the home layer as
http://127.0.0.1:8787/bili/<gateway>/v1 (Anthropic route: no /v1)
(agent.DshThrough: dshSyncFresh with the prefixed gateway). dshReach reads the
prefix back from the profiles' routes (loopback path before the gateway's
address) and Check, Sync, a pick and the serving round (dshWiredWith, which
read gateway.URL() directly) keep it; an address that isn't a local proxy's
goes back to the gateway. Off writes the gateway back. Empty-list string (en,
zh, zh-TW, ja, de), docs (en, zh, ja), llms-full.txt and
docs/subsystems/library.md name dsh. bili's dsh plugin installer is never run
for it. The remaining agents are #5915.

Run (mica, at the pushed head unless said):
- TestDshThroughBili, TestBiliDshThroughPrefix: ok
- see below for the packages and GUI files
Broken by hand:
- dshReach returning gw: TestDshThroughBili red (a sync drops the prefix)
- no "dsh" URL lane: TestBiliDshThroughPrefix red (dsh not offered)
Not tried:
- a real dsh and a real `bili start`; tests fake bili and the probe, so
  whether dsh's SDK sends to the prefixed address is by analogy with Hermes
- Windows run (vet only)
2026-11-12 02:24:10 +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 fc615339f0 provider: Alibaba Cloud Token Plan quota read with the account's AccessKey; intl Token Plan preset (pppMathew on X, #2940)
Cause: a Token Plan sk-sp- key only authorizes inference. The plan's
usage sits on the Bailian console gateway, which wants a console token
(the key gets BailianGateway.Login.NotLogined) that Alibaba's own `bl` CLI
makes from the account's AccessKey through GenerateCLIAccessToken (ACS3
signed). magpie had no such path, so the usage card showed no quota.

Change:
- alibaba_usage.go: ACS3-HMAC-SHA256 signing, the console token (kept 20
  minutes per AccessKey and region, made again once on NotLogined), the
  personal plan's usage API, and per<N><Unit>Percentage/ResetTime read as
  5 hours / Weekly / Month windows. Hooked in as AccessKeyVendor "alibaba"
  (editor asks AccessKey ID and Secret, a keyless card says so),
  accountPlanOf (routing), PlanQuotas and the key card tag.
- Hosts: token-plan.cn-beijing.maas.aliyuncs.com (bailian-token-plan) and
  the new token-plan.ap-southeast-1.maas.aliyuncs.com preset
  alibaba-token-plan (Alibaba Cloud international Token Plan, #2940), also
  an OpenCode import target.
- Editor hint in zh, zh-TW, ja, de; docs (providers-accounts, reference).

Not covered: qwen-token-plan (Qwen AI platform) and qwencloud-token-plan
have no AccessKey route (browser-session console, #5829); team plans.

Run on mica at this tree: go test ./internal/gui ./internal/provider ok;
go vet darwin, linux nogui, windows on provider/gui clean; GUI files
i18n-keys, i18n-en-no-cjk, tencent-access-key, volc-access-key,
usage-access-key-card, tencent-cloud in chromium and webkit: 60 of 64 pass,
the 4 reds are tencent-cloud's "region clicked right after the strip
scrolled", red the same at origin/main 319753d89 (filed: #4321, #4399,
#4625). Broke it by hand: dropping the *100 on the percentage turns
TestAliReadWindows and TestAliPlanQuotas red.
Tests never reach the network (httptest behind a rewriting transport).

Not tried: no real Alibaba Cloud account, so neither the mint nor the
usage reply was seen live; the field names and the envelope come from the
official client's source. The international gateway host
(bailian-singapore-cs.alibabacloud.com) and the RAM-user case are the least
certain. The full suite was not run before the tag.
2026-11-12 01:20:52 +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