4794de398ea8337d223a91e207181c56fcf4ad76
521
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
10d60b1899 |
provider: a provider saved with Select none serves no models, unlisted or not (#1818)
Select none saved `models: []`, which omitempty wrote as no models key at
all, so the provider read back as "no picks" and served the first 24 of
the vendor's list on /v1/models, in auto groups and on the card, while
the editor said none would be served.
What changed:
- Provider.NoModels (json noModels) records the choice; ServesNone() is
NoModels with no picks. A file with no models key still serves the
vendor's list as before.
- Exposed() is empty for it, so the catalog, /v1/models and auto groups
leave it out; resolveIn refuses an explicit pid/model to it; listedBy
and Deciders skip it (a decide-only provider is still a decider).
- SetModels and normalize clear NoModels once there are picks.
- GUI: the editor sends noModels on Save, an edit that omits it keeps it,
the card's exposed count is 0, the hint says nothing is served; with
unlisted the dashed chips explain they are only for groups. Strings in
en, zh, zh-TW, ja, de.
- CLI: `magpie provider models <id> none`.
- docs/subsystems/providers-accounts.md describes it.
Decision (owner delegated): Select none means none, whether or not
unlisted is on; unlisted keeps meaning "hide from the list, still
usable by groups that name it".
Run:
- go test ./internal/provider ./internal/gui ./internal/cli -count=1
(green; second pass ran too) with private GOCACHE and sandbox HOME.
- Broke Exposed's ServesNone check: TestSelectNoneServesNone red
("exposed 24"); broke resolveIn's: red ("watched/m0 resolved"); broke
the GUI keep line: TestProviderSaveSelectNone red ("exposed 24").
- GUI tests chromium + webkit, 5 languages: provider-none-picked 20/20,
provider-draft-picks 10/10 (red with noneChosen broken), plus 12
related model/group/editor tests green.
- gofmt -l clean; go vet darwin, linux -tags nogui, windows clean for the
three packages.
Not run: the gateway package; Codex native model narrowing is unchanged.
searcher-pick.test.cjs fails 3 webkit cases (hover timeout) identically
on the unmodified base
|
||
|
|
7d9382db23 |
gateway, settings: an unreadable settings.json keeps the allow list read last, or lets in only this computer, never every address
Follow-up to
|
||
|
|
3f5c3b0553 |
plugin: the host keeps reading a plugin's stderr after a line over 4 MiB, so the plugin host no longer hangs (Windows) or keeps the unread output in memory (Linux)
The host logged the plugin child's stderr with a bufio.Scanner capped at 4 MiB. On the first longer line Scan stopped with ErrTooLong, the goroutine returned, and nothing read the pipe again. host.js sends console.log and process.stdout.write to stderr, so one long line from any plugin was enough. Now the reader drains the pipe past an overlong line and logs what it can, so the output stops being dropped silently. Measured on Bun 1.4.2 (Windows and Linux, official binaries, sha256 checked): on Windows the plugin host stopped answering init when a plugin wrote one long line while loading; on Linux a script writing 200 MiB to stderr with no reader went from 18 MiB to 412 MiB RSS. Each of those reproduced at HEAD and is gone with this change; the Linux memory number comes from that Bun-only measurement, since magpie's own RSS did not differ at this scale. Run before this commit: go test -tags nogui ./internal/gui ./internal/plugin is ok on Linux (WSL2 Ubuntu 24.04, go1.26.8) both on HEAD and on this change. On Windows, go test -tags nogui ./... (49 packages): every failing test also fails at |
||
|
|
3c4f8f9aed |
gateway: the models added to Codex's spawn_agent are headed neutrally, naming neither magpie nor Codex's limit (Gearclickist on Discord)
|
||
|
|
6ccf23efa6 |
gui: the Library's Backups button is at the top of every tab, after Library folder (Dade on Discord)
Dade: each Library tab's 备份 (Backups) sat at the very foot of the page,
under the whole list, and was hard to find. It is now a button in the
Library's head strip, on every tab (Instructions, MCP servers, Skills,
RTK). That strip stays at the top as the page scrolls. The button sits
right after 资源库文件夹 (Library folder) and looks the same: a small
glyph (a clock with a turning arrow, as macOS draws backups) and a label.
- It opens magpie's backups folder.
- Its tooltip keeps the sentence the foot had ("magpie keeps a copy of
every file before it writes it.") with the folder's path.
- It is disabled until the library has loaded, as Library folder is.
The foot line and its .lib-foot/.lib-link styles are removed. Two
messages that pointed to "Backups, at the foot of the Library" now say
"at the top", in all five languages. The page with no agents, which had
no foot, now has Backups too.
Run:
- library-backups-top.test.cjs covers chromium and webkit,
en/zh/zh-TW/ja/de, each of the four tabs, and browser 1000/420px plus
window 1000/800/560px. It checks the button comes right after Library
folder on the same line and looks the same, waits for the library, has
a label that doesn't wrap, has no left border, causes no sideways
scroll and nothing at the foot, opens the backups folder, and doesn't
move the page on click. 10/10 pass. Without the button appended, red.
- library-loading, library-discover-jump, library-all, library-items,
library-rtk-gain and library-own-folder pass (138).
- go test ./internal/gui -count=1 under a sandbox HOME: ok.
- mobile-web.test.cjs: the phone widths pass. Its desktop 900/1280
comparison with origin/main fails only on the library page (about 650
pixels: the new button in the strip). Its before/after screenshots show
nothing else changed, and it matches again once this is on main.
|
||
|
|
5d33f060b7 |
gateway: Codex's spawn_agent names every model a subagent may be put on, not only the first five (Gearclickist on Discord)
Gearclickist turned on "Codex subagents on any model", but when Codex dispatched subagents only a few models could be picked. Codex itself caps the list: spawn_agent's description names only the first five show_in_picker models of its catalog (codex-rs child_config.rs MAX_SPAWN_AGENT_MODEL_OVERRIDES, multi_agents_spec.rs spawn_agent_models_description), Codex's own ahead of magpie's. Yet it takes any catalog model by name (find_spawn_agent_model_name). So the lead saw none of magpie's models. spawnAgentModels (codex_spawn_models.go) adds the rest of the catalog Codex was handed after Codex's own list, under a line of its own, at most 200. It covers spawn_agent at the top level and in Codex's multi_agent_v1 namespace, at CodexPath (codexBackend) and at /v1/responses for Codex (handle). - At CodexPath the list is Codex's own listed models less those hidden on the Agents page, then CodexListed unless Codex is held to its own. - At /v1 it is CodexCatalog under the key's allowance. - A lead the ChatGPT backend answers in multi-agent V2 seals its subagents' tasks for a ChatGPT account (#619), so it is offered Codex's own only. Only the tool's description changes, never base_instructions. With V1 on, it does change in requests to the ChatGPT backend too. Not covered: the model_catalog_in_context feature (under development, off by default) puts a five-model catalog in context, and it is not widened. Run: - go test ./internal/gateway ./internal/agent -count=1 under a sandbox HOME: ok. - TestSpawnAgentNamesEveryModel uses 40 models on a real Codex 0.162.0 request (testdata/workdir/codex-0.162.0.json). Its 4 subtests are CodexPath, /v1, a sealed V2 lead and a V1 lead, and all pass. - With spawnAgentModels returning body by hand: CodexPath, /v1 and V1 go red. - With the sealed rule taken out: V2 goes red. - go vet on darwin, GOOS=linux -tags nogui, and GOOS=windows; gofmt -l is clean. Not verified: a real Codex lead picking one of magpie's models past the fifth from the longer list. |
||
|
|
7639c1d8db |
gateway, gui: a web search made in place of the picked searcher says in its Routing row which searcher failed or found nothing, and why (Gearclickist on Discord)
Gearclickist picked Grok as the web-search model (代搜). In Codex, a web_search did go to Grok, but Codex's default search model then searched, and nothing said why. modelSearch asks the searcher picked in Settings first. When it errors, or its reply names no page it found, the next of Searchers() searches in its place (#669, up to three). The first error was dropped, so the Routing row only showed the model that answered. Falling back stays. searchingInstead now puts on the search's CallFor the searcher asked first (instead), whether the user picked it (picked), and its error (why) or that it found nothing (nothingFound, from a new errFoundNothing that searchWith and kimiSearch wrap). Routing's kindWhy says "<grok>, the searcher picked in Settings › Models › Web search, didn't search for Codex's <model>: <why>. So magpie had <next>, the next searcher it can use, search in its place." There are 7 new strings, in zh, zh-TW, ja and de. Grok itself: magpie's exact search body was sent to real Grok (4 models, 6 queries) through the built-in, and replayed through the plugin. Every time it answered with pages, so no Grok or plugin cause was found, and there is no plugin publish or mover min raise. The next time Grok fails for Gearclickist, the row now names the error. Run: - go test ./internal/gateway ./internal/agent -count=1 under a sandbox HOME: ok (933s, 720s). - TestSearchInPlaceOfPickedSaysWhy (found nothing, failed) passes. With the searchingInstead call taken out by hand, both subtests go red. - search-instead.test.cjs: chromium and webkit, en/zh/zh-TW/ja/de, at 1100 and 520px: 10/10 pass. With kindWhy's new branch turned off by hand: red. - search-mcp, routing-side-calls, provider-search and routing-kind GUI tests pass. - go vet on darwin, GOOS=linux -tags nogui, and GOOS=windows; gofmt -l is clean. Not verified: a real Grok search failing for Gearclickist's account, since it couldn't be reproduced. |
||
|
|
7a9490638d |
gateway, gui, settings: an IP / CIDR allow list for the gateway, from MAGPIE_ALLOW_IPS or Settings beside Share on local network (lc on Discord)
What changed: lc runs magpie in Docker on a public host and asked that
only some addresses reach it at all. With a list set, a request from an
address outside it is refused 403 ("magpie answers only the addresses on
its allow list ..., and this request came from <addr>: add it there to
let it in") before its gateway key is looked at, so a leaked key is no use from
elsewhere. No list is as before.
- internal/settings/allowips.go: SplitAllowIPs, ParseAllowIP (an IP or a
CIDR range, v4 or v6; zones dropped, v4-mapped unmapped), CleanAllowIPs.
Settings gets AllowIPs (allowIPs).
- internal/gateway/allow.go: MAGPIE_ALLOW_IPS (comma or space separated)
sets the list in place of Settings'. The address judged is the
connection's own (r.RemoteAddr); X-Forwarded-For and the rest are never
believed (magpie has no trusted-proxy list; MAGPIE_TRUST_PROXY never
reads forwarding headers, and this follows it). Loopback and this
computer's own interface addresses always pass. An entry that doesn't
read lets nothing in and is logged once, so a typo never opens magpie
to every address. lanGuard checks it after the OAuth callback and
before the rebound-Host and key checks; `magpie web` is wrapped with
AllowGuard too.
- GUI: Settings > Network shows an "Allowed addresses" row under Share on local
network when sharing is on, the page is open from another computer, or
the env var is set (then read-only, saying so). POST
/api/settings/allowips saves it, refuses it while the env var is set,
refuses an entry that doesn't read, and refuses a list that would shut
out the address the page itself is open from (KeepsOut). The generic
settings save keeps AllowIPs. Strings in zh, zh-TW, ja and de.
- Docs: the Docker page (en, zh, ja) lists MAGPIE_ALLOW_IPS with a note
that a request from the host itself arrives from the bridge's gateway
(172.17.0.1), that Docker Desktop and rootless Docker show clients as
one address of their own, and that behind a proxy every request comes
from the proxy; docs/reference.md and docs/subsystems/gateway-routing.md
describe it. The READMEs list no env vars, so they are unchanged.
Why: a gateway key is the only lock on a public host; an allow list keeps
everyone else from even trying it.
Run (machine load average 75-140 from other sessions, so the large
packages ran in slices of their top-level tests, each slice
-timeout 9m, private GOCACHE, sandbox HOME):
- New tests: internal/gateway/allow_test.go TestAllowList (allowed,
denied, CIDR v4/v6, IPv6 literal, link-local with zone, v4-mapped,
loopback and own address always in, on the list still needs a key,
a typo shuts everything out, env over settings), TestAllowListServed
(a real connection from loopback passes lanGuard under a list naming
nothing of this computer's; a request from elsewhere is 403 naming its
address and MAGPIE_ALLOW_IPS), TestKeepsOut; internal/settings/allowips_test.go
TestCleanAllowIPs; internal/gui/allowips_settings_test.go
TestAllowIPsSetting; internal/gui/tests/allow-ips.test.cjs (14/14 in
chromium and webkit, at a 390px panel, en and zh, keys in zh, zh-TW,
ja and de). Broken by
hand: with lanGuard's check removed TestAllowList and TestAllowListServed
FAIL; with KeepsOut skipped TestAllowIPsSetting FAILs; with renderAllow
not called the GUI test has 5 failures. Restored, all pass.
- internal/gui/settings_keep_test.go gains AllowIPs:
TestSettingsSaveKeepsWhatItDoesNotSend failed without it, as it should
for a new field.
- go test -tags nogui: every package ok. internal/gateway (4 slices),
internal/agent (4), internal/provider (3), internal/gui (2),
internal/plugin (2), the rest whole. GUI Network-settings test files
(11) 98/98 and i18n-keys ok, both engines.
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./... ok; linux and windows builds ok.
- Not tried: a real Docker container on a public host (the bridge note
is from Docker's docs, not checked here); behind a real reverse proxy.
|
||
|
|
908c910931 |
gateway, gui: Stays: Strict keeps a conversation on the account or key that answered it, even past its cap, and passes its error on rather than moving it (#1797)
miniers asked that a conversation never move to another account: a
move changes the account a vendor sees mid-conversation and loses its
prompt cache. Session affinity keeps the account while it can answer,
then moves on.
The new affinity mode "strict" (Stays: Strict) does what session does
for a new conversation. Once one has an account, strictKeep asks that
account alone (its other models too) and no other account, key or
provider:
- one resting or spent is still asked, and its error (429, 402, 5xx)
goes to the agent rather than to the next candidate;
- one over a user cap is asked past it (plan's capped candidates,
capHeldOnly);
- one held for credits answers 429 naming Stays: Strict rather than
moving;
- one removed, turned off, barred or not allowed for the key counts as
gone, and the conversation is routed as usual.
A last try that fails verification is not rested for a strict
conversation that had nowhere else to go.
Set in the provider editor and the Routing page's pool row (GUI, all
five languages), `magpie groups ... stays=strict` (strict-session,
never-move), and the TUI ("stays strictly"). Documented in
gateway-routing.md, reference.md and the site's start pages (en, zh,
ja).
Run:
- go test -tags nogui ./internal/gateway (-timeout 30m under load ~150),
./internal/provider ./internal/tui ./internal/cli: ok. The three
TestStrictAffinity* tests fail on the code before this commit (200
where 429 was expected, acct-2 answering).
- GUI: stays-strict.test.cjs, chromium and webkit, 900 and 560px, en,
zh, zh-TW, ja, de: 30 of 30. On the assets before this commit it
fails 15 of 15 in chromium. routing-*.test.cjs pass but for
routing-steady's webkit 1.69px shift, which fails on the old assets
too: filed as #1804.
- gofmt -l, go vet (darwin, linux, windows), full go test ./... before
the push.
Not tried: a real agent conversation held on a real rate-limited
account.
Known and left: planLevel doesn't merge a nested group's sub.held, as
before this commit.
|
||
|
|
7f03d320d0 |
agent: a Codex thread started on CC Switch's OpenAI mirror goes through magpie while a magpie model is on, so reopened it isn't refused by ChatGPT for the magpie model picked in it (#1796)
WardLu's old threads say model_provider "custom": CC Switch's mirror of the official OpenAI provider ([model_providers.custom], name "OpenAI", requires_openai_auth, no base_url). magpie takes Codex onto a magpie model by openai_base_url, which Codex applies to its built-in "openai" provider only. A thread resumed on "custom" therefore went straight to chatgpt.com with the magpie model picked in it, and ChatGPT answered "The 'group/intent-auto' model is not supported when using Codex with a ChatGPT account"; magpie's log never saw it. While Codex goes to magpie by the base URL, takeMirrors now gives each such mirror magpie's ChatGPT backend (codexURL) as its base_url, as failover already does for a mirror that is Codex's current provider, and records the ids in the stash (codex.mirrors). giveMirrors takes the base URL off again when Codex steps off magpie (one of its own models, reset, Disconnect), leaving one changed since as it is. A mirror a profile names is the user's and is left alone. isCCSwitchMirror still counts a taken mirror as a mirror, so its models stay grouped under OpenAI and ccSwitchTables doesn't treat it as a relay. No detection or guide was added: with the requests reaching magpie the old threads keep their history and model. Moving them onto another provider is already the Sessions page's Move (#887), which rewrites every rollout of the thread (resumed _segment files too) and the state DB row. Run: - go test -tags nogui ./internal/agent -run 'CCSwitch|Mirror|Codex': ok. TestCodexTakesCCSwitchMirrorForItsThreads fails on the code before this commit ("the mirror isn't through magpie"). - gofmt -l, go vet (darwin, linux, windows), full go test ./... before the push. Not tried: a real Codex resuming a "custom" thread against a real ChatGPT account. The same base_url on a requires_openai_auth mirror is what mirror failover (#504) has written since it shipped. |
||
|
|
ce71b22cfe |
gateway: a Claude model a provider writes with a dot (Copilot's claude-opus-5.5, claude-sonnet-5.5, claude-haiku-4.5) is listed to Claude Desktop by its dashed id, so Claude Code knows it (#1819, mdwsk88)
Claude Desktop's Code tab runs Claude Code on the id magpie lists a model by. claudeLooking lists a Claude model with reasoning levels as magpie-<n>.anthropic.<model>, which Desktop and Claude Code read as that Claude model, but claudeModel matched dashed versions only. Copilot writes a version with a dot, so each of its Claude models fell to mythos-magpie-<n>, a model Claude Code doesn't know: Opus 5.5 ran at 32000 output tokens and effort high (128000 and medium for the model it knows), and Haiku 4.5, the haiku tier, was sent output_config.effort, which Copilot answers with 400 "model claude-haiku-4.5 does not support reasoning effort". claudeModel now dashes the version first (provider.ClaudeDashed). A request is still served by <n> alone (aliased), so Copilot still gets its own claude-opus-5.5. An id with a suffix (claude-sonnet-4.5-thinking) and other vendors' ids are listed as before. This is mdwsk88's fix from mdwsk88/magpie@51a5ad80, reviewed line by line and taken with its tests. Sibling: ClaudeDashed and ClaudeUndashed knew opus, sonnet, haiku and fable but not mythos, while desktopClaude, claudeLine and claudeVersion know it. Claude Code 2.1.296 (read from its binary) matches claude-mythos-5-1 by substring before claude-mythos-5, so a dotted claude-mythos-5.1 would read as Mythos 5; it is now dashed like the others, in Claude Code's settings and in Desktop's list. The other matchers of Claude ids (agent's claudeName, gateway's claudeFamily, claudeVersion, claudeLine, provider.sameModel) already take a dot. ClaudeFast's list is dashed but applies to api.anthropic.com alone, which never writes a dot. Run (go1.26.8 toolchain, sandbox HOME, private GOCACHE/GOMODCACHE, -tags nogui): - With the old desktop.go and claudedash.go put back, the new tests fail: TestClaudeDesktopEffortIDs "copilot/claude-opus-5.5 listed as mythos-magpie-5238445297, want ^magpie-\d{10}\.anthropic\.claude-opus-5-5$" (and the opus-4.6, sonnet-5.5, haiku-4.5, dated sonnet-4.5 and mythos-5.1 rows), TestClaudeDesktopDottedClaudeReachesItsModel "listed as mythos-magpie-9584025798", TestClaudeDashedOnlyClaudeVersions "ClaudeDashed("claude-mythos-5.1") = "claude-mythos-5.1"". Green with the change. - go test ./internal/gateway ./internal/provider: ok; -run 'Desktop|Claude' over internal/agent too: ok. -race -count=3 -run TestClaudeDesktop ./internal/gateway: ok. - gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: clean. Not run: a real Copilot account or the real Claude Desktop through this build (the reporter's own run used a stub upstream and real Claude Code 2.1.295); Windows and WSL; the full go test ./... (machine loaded). Co-Authored-By: mdwsk88 <11055210+mdwsk88@users.noreply.github.com> |
||
|
|
1b8f674aaf |
gateway: a WorkBuddy model searches the web with WorkBuddy's own search service, so Claude Code's WebSearch on it gets results (#1798, lemonwater379)
What was wrong: WorkBuddy's models have no search tool of their own.
When magpie had nothing else that searches (no Claude or Codex account,
no search API), canSearchFor was false. magpie then took the
web_search_20250305 server tool out of Claude Code's WebSearch request,
the model answered from nothing, and WebSearch showed no results.
WorkBuddy's own client searches through a service of its plan.
Its CLI's WebSearch tool (WorkBuddy.app's
app.asar.unpacked/cli/dist/codebuddy.js, WEB_SEARCH_API_PATH) sends
POST <site>/agenttool/v1/search with
{"query","type":"text2text","max_results":5}.
What changed:
- search_workbuddy.go: wbSearch asks that service. Provider.Sign
signs the request as the plan's chats are signed, and Provider.Do
sends it, so it works the same for the built-in and for a WorkBuddy
moved onto its plugin (the plugin's fetch signs it, as for
/v3/config and images). No plugin change is needed.
- searchesOwn includes a WorkBuddy plan, as it does a Kimi Code plan.
Its own models' searches go there first, before magpie's picked
searcher and the search APIs. Other providers' models never use it.
It is off when provider search is off in Settings.
- A {code, msg} refusal (15001 is its search quota) is reported as an
error, not as an empty result.
- docs/subsystems/gateway-routing.md: new section, tests added to
Verification.
What was run:
- The real service, read-only, with the owner's desktop sign-in (China
build) and the plugin's WorkBuddy AI sign-in. Both answered 200 with
results, including with only the built-in's smaller header set. The
test fixture is WorkBuddy AI's real reply bytes.
- End to end with the real China-build account: a throwaway program
(not committed) under a sandbox HOME holding a copy of the desktop
sign-in. It sent Claude Code's literal WebSearch request through
gateway.New().Handler() to workbuddy/deepseek-v4.1-flash and got 200
with one web_search_tool_result block holding real URLs.
- New tests: TestWorkBuddySearchesForItsModels (built-in, Claude Code
2.1.285's literal request) and TestWorkBuddyPluginSearches (plugin).
- Broken by hand (wbSearches returning false): both go red. The
built-in test's reply is the model's "I can't search." with no
web_search_tool_result, which is the reporter's case.
- go test ./internal/gateway -run 'Search|WorkBuddy|Kimi|Vision|Spent|PassesOver'
- gofmt -l, go vet ./... (darwin), GOOS=linux go vet -tags nogui ./...,
and GOOS=windows go vet ./... are all clean.
- Full go test -timeout 40m ./... in a sandbox HOME at load 66-100:
47 packages ok. internal/gateway and internal/agent hit the 40m
package timeout. Gateway also had failures, each filed:
- TestOTelWaterfall* (#1794, fixed on main since).
- TestCodexHeardWithinItsIdleTimeout (#1800).
- TestIntentClassifierGroup (3.17s against a 3s bound, filed as
#1813).
All of them pass alone, and go test ./internal/gateway on its own is
ok (982s).
Not verified: WorkBuddy AI end to end through the gateway (its desktop
sign-in in the sandbox wasn't picked up; the service itself answered).
Not tried through a running magpie app with the plugin installed.
|
||
|
|
b5d7f0574c |
gateway: image recognition and web search that magpie picks pass over a model out of its allowance, and ask none when every one is out (#1801, hibaliqya-yonma)
What was wrong: AutoVision (the model that describes images for models
that can't see) and autoSearcher (the model that searches for models
that can't) pick a provider and model before routing runs. They never
looked at routing's allowance state. That state covers accounts barred
at a usage cap, rests for quota or credit, and full key or subscription
windows. Routing then had one candidate and tried it all the same. Each
image or search was sent to the account that had run out and got the
same 429 again, while another provider with allowance sat unused.
What changed:
- fallback.go: spentModel(p, model, from, now). A model is spent when
every candidate routing would try for it (perKeyBarred) is capped,
resting for quota or credit, or has a full window (candidate.full,
model-aware for pools). It also says when the first one is back. A
rate rest doesn't count.
- search.go: smallModel goes through smallReady, which prefers models
that aren't spent (pickSmall keeps the old choice among them).
autoSearcher ranks a searcher with allowance before searchRank.
modelSearch doesn't ask a spent searcher that magpie picked
(searcherSpent), tries the others with allowance first, and adds why
it skipped to its error. A searcher named in Settings is asked as
before.
- vision.go: AutoVision ranks ready first, then tier and cost. When
every describer is out it still names one, so seer and Described
(which tell agents every model takes images) don't flip with a
window. askVisionWith (gateway and MCP) answers an auto describer
that is spent with the reason and when it is back, and doesn't call
upstream. A describer named in Settings is asked as before.
- Image and video generation (AutoDrawer, AutoVideomaker) are left
as they were.
- docs/subsystems/gateway-routing.md: new section, tests added to
Verification.
What was run:
- New tests in side_spent_test.go: TestAutoVisionPassesOverOneOut,
TestAutoVisionTierAmongThoseWithAllowance,
TestSpentModelAcrossAccounts, TestVisionDoesNotAskSpentDescriber and
TestSearcherPassesOverOneOut.
- Broken by hand three ways:
- spentModel returning false: all five go red.
- Only autoSpent's check in askVisionWith removed:
TestVisionDoesNotAskSpentDescriber goes red (200 from upstream).
- Only modelSearch's skip removed: TestSearcherPassesOverOneOut goes
red.
- go test ./internal/gateway -run 'Search|WorkBuddy|Kimi|Vision|Spent|PassesOver'
- gofmt -l, go vet ./... (darwin), GOOS=linux go vet -tags nogui ./...,
and GOOS=windows go vet ./... are all clean.
- Full go test -timeout 40m ./... in a sandbox HOME at load 66-100:
47 packages ok. internal/gateway and internal/agent hit the 40m
package timeout. Gateway also had failures, each filed:
- TestOTelWaterfall* (#1794, fixed on main since).
- TestCodexHeardWithinItsIdleTimeout (#1800).
- TestIntentClassifierGroup (3.17s against a 3s bound, filed as
#1813).
All of them pass alone, and go test ./internal/gateway on its own is
ok (982s).
Not verified: not tried with a real account that has run out. Windows
was only vetted.
|
||
|
|
bc5a9371f8 |
gui: turning subscription accounts off asks first, naming the subscriptions that stop working in magpie (#1761)
The reporter turned Settings → Privacy → Subscription accounts off and every subscription they had stopped working, with nothing to say why, and asked for the switch to go. It stays: #1535 asked for it so that magpie can run on a managed or shared machine as a gateway for API-key providers alone, without reading any agent's credential files or the Keychain, and that reporter confirmed it on v0.1.1176. What reading those files means is a privacy question, so it stays on the Privacy page too. What went wrong is that one click took them all away. Off now asks first in a dialog (confirmAction, as Remove does), titled "Turn off subscription accounts?", that names the subscriptions in use it stops (switched-off ones and API-key providers aren't named; the Providers list is read for it when no page has yet) and says API-key providers go on. Cancel leaves it on with nothing saved. On, and the CLI's `magpie accounts discovery off`, don't ask. New strings in zh, zh-TW, ja and de. docs/subsystems/providers-accounts.md says so. Run: - account-discovery.test.cjs, chromium and webkit, en/zh/zh-TW/ja/de at 900 and 360: the dialog's title and button in each language, the two subscriptions in use named and the switched-off one and the API-key provider not, the dialog inside the window, Cancel posts nothing and leaves On, then taking it posts {off:true}; the rest as before. 32 pass; with app.js put back, the dialog never comes and it goes red. - gofmt -l, go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., sandboxed go test ./... at the rebased head. Not run: the desktop app's webview by hand. |
||
|
|
e6753190cd |
agent: a model picked for omp's default role joins its enabledModels list when there is one, so omp starts on it and doesn't pick another (#1769)
real-jacket: with enabledModels in ~/.omp/agent/config.yml, magpie wrote only modelRoles.default, and omp kept starting on a model of the list. omp holds a new session's default role to that list while it names anything (main.ts buildSessionOptions, sdk.ts resolveAllowedModels and pickDefaultAvailableModel); its other roles resolve against every model it has, so only the default role is held to it. Pi had the same rule, fixed in #160. omp_scope.go: a model picked for the default role is added to the end of a list that doesn't already take it in, by name or by one of omp's globs (Bun.Glob, where * doesn't cross "/"), comments and order kept (edit.EditYAMLNode, new). No list, or an empty one, is left as it is: omp then takes every model. Entries scoped to folders ({path, models}) are the user's and never changed. Disconnect takes the plain magpie/... entries out once nothing else in config.yml is on magpie (a list left empty goes, never []); a scoped entry on magpie still counts as in use. A renamed provider's entries are renamed once (ompScopeOnce). Check reports a default role on magpie the list leaves out as drift, which Reapply mends. docs/subsystems/agent-wiring.md says the same. Run: - omp_scope_test.go: the default joins the list (plain, glob, level suffix, comments kept), a list that takes it in or none is left alone, Disconnect clears magpie's entries and keeps the user's and scoped ones, and the leaving-out is drift. Each goes red with its part taken out (ompScopeWith not appending, dropMagpie not calling ompScopeWithout, Check without the list). - go test -tags nogui ./internal/agent ./internal/edit. - gofmt -l, go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., sandboxed go test ./... at the rebased head. Not run: a real omp binary starting a session on the config written. Pi has no RenameRefs, so a renamed provider's magpie/<old>/... entry stays in Pi's enabledModels (not changed here). |
||
|
|
f36e744c30 |
gui: Settings › General says each setting's name alone where it says enough, and Language is one menu (1ooogle on X)
1ooogle's mockup on X redrew Settings › General the way macOS System
Settings reads it. The owner approved, and this follows it.
Rows that now show only their name:
- Appearance, Text size, Interface and Code font, the tray click,
Provider in model names, the Codex titles, auto-review and memories
model rows, Open at login and Show in Dock.
- A font row's line shows only while its fonts are loading or have
failed.
- The text size keys (⌘0 / Ctrl+0) move into the choices' tooltip.
Rows that keep one short line, because the name alone doesn't explain
the setting or what it costs:
- Codex subagents, Long conversations, Lightweight mode, Prevent sleep
and Session terminal.
Renames:
- "Tray icon" becomes "Click the tray icon to", with the choices "Open
the quick panel" and "Open the main window" (点击托盘图标: 打开快捷面板 /
打开主窗口).
- "Keep awake while agents work" becomes "Prevent sleep" (防止休眠: 在
magpie 运行任务时,让电脑保持唤醒状态).
- "Dock" becomes "Show in Dock" (显示程序坞).
Language is one button showing the language picked (renderLangPick).
It opens in the app's own menu (openProtoMenu, styled like Session
terminal's sess-pick), not a native <select> and not six segments.
Every language gets the same text: en, zh, zh-TW, ja and de. The 25
strings no longer used are removed from all four translations.
Tests:
- New: settings-general.test.cjs. In Chromium and WebKit, en, zh,
zh-TW, ja and de, at 1000 and 440 px, on a Mac, it checks that:
- the rows that should show only their name have no line;
- the kept lines are one line each, and none is cut short at 1000px;
- Language is a button showing the language, and its menu lists all
six;
- a pick saves lang and redraws the page in that language, with the
button staying under the pointer;
- nothing has a left stripe and nothing scrolls sideways.
I broke it by hand twice and saw it fail both times: once by giving
the Dock row a line back, once by making the pick save nothing.
- Updated to the new text and controls: codex-titles,
codex-auto-review, codex-memories-settings, model-suffix-own,
plain-names, lightweight, keep-awake, text-size, gateway-mode,
omarchy, settings-search, gui-zh-tw (Language's button and menu fit
at 1000/440px), header-relang (picks through the menu) and
readable-focus (the first shown line).
- German's long-conversations line was shortened to fit on one line at
1000px.
What was run:
- go test -tags nogui ./internal/gui passes; gofmt -l is clean; go vet
passes on darwin, linux and windows.
- The whole GUI suite (601 files, --test-concurrency=4): 6584 passed,
33 failed. Every failing file was then run alone:
- mobile-web fails on purpose. It compares desktop screenshots with
origin/main, and only the Settings page differs.
- routing-group-fold, text-size, routing-sessions and pick-skills
are #1672; searcher-pick is #1745. Each also fails alone on
origin/main
|
||
|
|
e3a497d7a2 |
library, gui: Hooks are a fifth Library category, kept once and written into each ticked agent's own hooks file (#1790, AllenReder)
What: the Library page has a Hooks tab beside Instructions, MCP, Skills
and RTK. A hook is a command, an event, an optional tool filter, a
timeout and the agents ticked for it. magpie writes it into each agent in
that agent's own file and shape:
Claude Code <claude dir>/settings.json hooks.<Event>[{matcher, hooks[]}]
Codex <codex home>/hooks.json same shape
Gemini CLI ~/.gemini/settings.json same shape, timeout in ms
Cursor ~/.cursor/hooks.json flat entries, version 1
Portable events (turn end, after a tool, before a tool, prompt sent,
session start) map to each agent's own name; "shell"/"edit" map to each
agent's own tool names. An agent's own event (codex:PermissionRequest,
cursor:afterFileEdit, ...) is offered too and given to that agent only.
Rows have agent chips (All first), Select + bar, and Remove all, like
skills and servers. An agent that can't take a hook has its chip greyed
with the reason: every agent but those four ("has no hooks magpie can
write"), an agent in WSL (not yet), and another agent for a native event.
The page also says when an agent has all hooks turned off
(disableAllHooks, hooksConfig.enabled=false, [features] hooks=false).
Why these choices (product call delegated to us): the four agents are
the ones with a documented, file-based command-hook API whose events line
up; others (OpenCode's JS plugins, dsh, ...) have no comparable file, so
they're named as unavailable rather than half-supported. Removal is
exact: Applied.Hooks records each entry as written (canonical JSON), and
only an entry still exactly as written is taken out; one the user edited
is theirs, and their own hooks beside it are never touched. A hooks file
that doesn't parse is a problem, never treated as empty or written over.
Codex keeps trust per hook in config.toml keyed by group position, so
taking a group out re-keys the user's trust for the groups after it
(codexRekey) instead of silently untrusting them. Carried bundles
(backup/WebDAV/S3) don't carry hooks in this first version.
Run:
- go test ./internal/library ./internal/gui (sandbox HOME): pass. New
hooks_test.go: each agent's shape; the user's edited entry stays and is
no longer recorded; an unparseable file is left alone and reported;
Codex trust moves with its groups; native events/unavailable agents;
hooks-off reported.
- library-hooks.test.cjs: 12/12 in chromium and webkit, at 440px, in en,
zh, zh-TW, ja, de; against the old library.js it fails (timeouts on the
missing tab). All 52 new strings translated in the 4 languages.
- library-loading.test.cjs expects the Hooks tab in its tab lists
(it failed on this change before; 6/6 now).
- Every library-*/skill-* GUI test in chromium and webkit: all pass but
WebKit timeouts in library-mcp-tool-switch/library-mcp-tools, which fail
the same on origin/main
|
||
|
|
50eeaae6ce |
gateway: a turn that names no reply limit is sent the model's own as max_tokens on Anthropic's API, not a flat 16384 (#1792, tensornull)
Anthropic's Messages API needs max_tokens. A request that names none (Codex's Responses turns, a Chat client's) was always sent 16384, so a long thinking and tool turn on a Claude-shaped relay hit the limit, and Codex showed "Incomplete response returned, reason: max_output_tokens". Now such a request is sent askedOutput(p, model). That is the plain Served entry's PublishedOutput(), the same number the agents are told: the user's Max output first, else the vendor's list or models.dev, within the window. 16384 (defaultMaxTokens) is used only when nobody knows the limit. A limit the client names still goes as it is. The thinking budget is still fitted under max_tokens (anthropicBody), whatever the limit is. Both places that build an Anthropic body are covered: forwardTranslated, for every translated route, and serveZed for a Zed subscription's Claude models. The provider editor's Max output hint now says this number is also sent as max_tokens (en, zh, zh-TW, ja, de). docs/reference.md and docs/subsystems/gateway-routing.md no longer say the gateway never uses the limit. Run: - TestAnthropicMaxTokensIsTheModels covers: the user's 65536 (Responses plain and streamed, and Chat), models.dev's 64000, a 500000 limit held to the 100000 window, an unknown model at 16384, the client's own 1000, and thinking under 8192. - TestZedClaudeMaxTokensIsTheModels expects 40000 when the client names no limit and 1000 when it does. - Both tests fail on the old code: 16384 where the model's number was expected. - go test ./internal/gateway/ passed (1270s, under load). - provider-max-output.test.cjs passes 28/28 in chromium and webkit: 5 languages at 900 and 420px. The hint names max_tokens and Anthropic, is translated, and doesn't overflow. - gofmt -l is clean. go vet passes on darwin, on linux with -tags nogui, and on windows. Not tried against a real Anthropic-compatible relay with a real Codex session. |
||
|
|
556c01c803 |
gateway: a provider that refuses auto mode's safeguards is asked again without them and not sent them again, so Copilot's claude-opus-5.5 answers Claude Code (#1756)
Pylogmon's Claude Code on Copilot's claude-opus-5.5 got 400 invalid_request_error "Copilot: safeguards: Extra inputs are not permitted" on every turn, which magpie labels "request format not accepted". Their Sonnet worked. Claude Code's auto mode adds a top-level `safeguards` field for the API's review of its actions. magpie passes it on to any Claude model (automode.go), and Copilot's Messages API checks its fields strictly and turns the field away. The fix uses the existing class for Claude Code's newer fields that a relay refuses (anthropic_shapes.go: thinking.display, a turn's output_config). On a 400 naming `safeguards` with "Extra inputs are not permitted", forward asks again at once without the field and remembers that the provider refuses it (shapeSafeguards), so later requests leave it out the first time. Claude Code, finding no safeguard_results, reviews its actions locally, as it does for every non-Claude model. The fix sits in forward/forwardOnce, so it reaches every route to an Anthropic endpoint: relayed and translated (buildAnthropic), any provider, not only Copilot. What was run: - TestSafeguardsRefusedLeftOut (refusal text as the reporter quoted it): on the old anthropic_shapes.go the agent gets the same "Cop: safeguards: Extra inputs are not permitted" 400; now it gets 200, asked twice the first time and once after that. - TestSafeguardsKeptWhereTaken: a provider that takes the field still gets it. - The shapes, system-message and auto mode tests pass. Not verified: no Copilot account with claude-opus-5.5 was available, so Copilot's raw error body is assumed. The match is on the words the reporter quoted, which magpie shows after "Copilot: ". |
||
|
|
af7d97fa2f |
gateway: a Responses provider set codex=as-sent gets Codex's requests as Codex sent them, for a relay that checks they are Codex's own (#1758)
A relay that checks a request is Codex's own answered magpie 400 "Codex 客户端请求特征无效" (10014). magpie fits every Codex request for a Responses backend that isn't OpenAI's: Responses Lite's additional_tools item is lifted into tools (#350), the tool search goes as a function, and OpenAI-only fields such as stream_options.reasoning_summary_delivery are left out. The reporter found that the relay takes the request when additional_tools is left as an input item, and that the lifted shape is what it refuses. The lifting stays the default, because backends that aren't OpenAI's refuse additional_tools or silently drop it (#350). A provider can now opt out: `magpie provider set <id> codex=as-sent` (`codexAsSent` in providers.json; `codex=default` turns it back off). With it on, a request from Codex (fromCodex: Codex's User-Agent or originator) goes as Codex sent it, with only its model name swapped. Codex's own headers go with it as before. A subscription account is never sent this way, and the GUI's provider save keeps the setting. What was run: - TestCodexAsSent: by default the request is still fitted; with codexAsSent the upstream gets exactly what Codex sent, with model m1, X-Codex-Turn-Metadata and the Responses Lite header. It fails on the old gateway.go and passes now. TestAdditionalTools and the gateway's Codex tests pass. Not verified: not tried against the reporter's relay. Their check was made by hand outside magpie, so which other fields that relay looks at is not known. There is no GUI control for the setting (CLI or providers.json only). |
||
|
|
cb40e26ec2 |
gateway: a refusal's note keeps Anthropic's stop_details category and explanation, on the Routing page's try and in the agent's error (#1768)
jingchangshi's sessions got "claude-opus-5-5 refused this request (safety filter: refusal) via Claude Code" 19 times, with nothing to say which of Anthropic's classifier categories (cyber, bio, frontier_llm, reasoning_extraction, general_harms…) it was. Anthropic sends that in stop_details beside stop_reason "refusal"; magpie read only stop_reason. Rather than the separate opt-in JSONL sink the issue proposes, the category goes where every refused attempt is already recorded: the note of that try on the Routing page, including a try a later key or group member answered after, and the error the agent gets when nobody is left. It is the vendor's own words, so nothing of the user's request is stored anywhere new. What changed: - refusedDetail: "safety filter: refusal (category cyber: <explanation>)", the explanation whitespace-folded and cut at 200 characters; a null or missing category or explanation adds nothing, an unknown category is kept as given. Used for a streamed message_delta and a whole reply. - stop_details is carried through the IR (Event.StopDetails, Result.StopDetails) from an Anthropic upstream's stream and from the claude CLI's stream-json (a Claude subscription), and written back into an Anthropic client's message_delta or whole reply, as safeguard_results already is. What was run: - TestRefusalKeepsStopDetails (stream, whole, nulls, absent, unknown category, long explanation), TestRefusalCategoryOnTheTry (refused key then an answering one: the refused try says "category cyber") and TestClaudeSubscriptionRefusalMovesToNextAccount (now with stop_details in the CLI's refusal) fail on the old code and pass now; the refusal, safeguard and Anthropic tests pass. Not verified: no real Anthropic refusal with stop_details seen (the bytes follow Anthropic's documented shape); a Codex or Chat client served by Claude gets the category on the try only when the hold writer sees it in its own protocol, which Responses and Chat have no field for, so their try notes stay "safety filter: …" as before. |
||
|
|
ff930886a2 |
gateway: keys all out of their allowance are answered from their rests with a Retry-After, not asked again on every request, and a key listed twice is asked once (#1772)
A fleet on four Ollama Cloud keys, every one out of its weekly allowance:
each new request asked every key again (the first twice) and answered
429 with no Retry-After, so an agent that waits as told asked again at
once, and the vendor saw four refused requests a turn.
What changed:
- The first key twice: the reporter's providers.json named the first key
in "keys" as well as "key". KeysOn now lists a key once.
- When every key left for a request rests out of its allowance (a 429 or
402 that failure() calls quota or credit, keys only), the request is
answered from the rest without asking: the vendor's own words, "not
asked again before HH:MM", and Retry-After until the first of them is
back (quotaHeld, soonestBack). Accounts are left out, so autoReset
can still spend a reset for them; a 403 or 400 worded as quota is
asked as before.
- The last key out of its allowance now rests as the ones before it do
(before, the last one left was never rested), and a 429 the vendor gave
no Retry-After for gets the soonest rest's end as one.
- A provider can set how long its keys rest when the vendor says nothing
of when the allowance is back: quotaRest (minutes) in providers.json,
or `magpie provider quota-rest <id> 7d`; default stays 15 minutes, at
most 8 days. A time the vendor names (resets_at, Retry-After, a
window) still wins. A GUI save keeps it.
What was run:
- TestAllRestingAnswersFromRest, TestFirstKeyListedTwiceAskedOnce and
TestOwnQuotaRest fail on the old code (no Retry-After, keys re-asked;
"dead-1 dead-1 dead-2 ok-3", the reporter's log); they pass now, with
TestQuotaHeldOnlyForKeysOutOfAllowance, TestDeadChainWalksEachOnce and
TestRestMinutes. The mock answers with the reporter's literal 429 body.
- go test -tags nogui ./internal/provider ./internal/gui pass. A gateway
package run at load ~60 hit its 20m timeout mid-suite with only
TestMaxRPM* red; those pass 8/8 alone here and on origin/main
|
||
|
|
f2400f679b |
gateway: another model's reasoning_details goes to Kimi as reasoning_content, so a conversation MiMo began is no longer refused 400 on every turn (#1765)
What changed: a Chat request to Kimi (isKimi: the Kimi platform's or a Kimi Code membership's host or preset) has each message's reasoning_details left out, its thinking put in reasoning_content when the message has none (reasoningDetailsAsContent). refusedInMessages also reads Kimi's own wording, "the <field> at position N", so another upstream that refuses the field that way (a relay in front of Kimi) is asked once more without it and marked; the retry and the remembered mark keep reasoning_details' thinking as reasoning_content too (withoutMessageReasoning). Why: Leo-origin's session was answered by MiMo through Command Code, whose reasoning_details entries carry a stream's index; pi sends them back, and Kimi Code answered 400 "the reasoning_details at position 2 entry 0 must not contain streaming index" on every turn. Probed against the real api.kimi.com/coding/v1 on 2026-10-12: Kimi refuses reasoning_details in every shape tried (with index: "must not contain streaming index"; reasoning.text, reasoning.summary, reasoning.encrypted, text, thinking without it: "has an invalid type"), and passes reasoning_content, reasoning and an empty list through validation. Run: TestKimiGetsReasoningDetailsAsContent and TestReasoningDetailsRefusedAtPosition (fake Kimi answering with the probed bytes) fail on the old gateway.go/chattidy.go: 400 "Kimi Code (China): the reasoning_details at position 1 entry 0 must not contain streaming index" after 1 call, the reporter's message, and "400 after 1 calls (want 2)". They pass with the change, as do TestMistral*, TestMessageReasoning* and the other *Reasoning* tests. Not verified: a real k3 reply through magpie; the owner's Kimi Code subscription has lapsed, so the real probe reached only validation (a valid request got 403 "does not have access"). A 400 magpie doesn't recognize still ends the request rather than failing over; that is unchanged. |
||
|
|
c59b808c99 |
gateway: an MCP request longer than its route takes is refused whole with 413, not run as the part that fit (#1766)
What changed: serveMCP (magpie's own web-search and vision MCP servers)
and the signed-in MCP proxy (/mcp/{name}) read the body through
readMCPBody, which reads one byte past the limit and answers 413 when the
body is longer, or when Content-Length already says so. Before, a plain
io.LimitReader ended at the limit as if the body had, so a valid JSON-RPC
message padded with whitespace past the limit, or followed there by a
second message, was parsed as its prefix and run: an analyze_image call
reached the image model, and the proxy sent the cut body on to the
signed-in server with the user's token. A body exactly at the limit still
works.
Why: #1766 (ggbdpq) reported it for the two own MCP routes with a patch;
the proxy's read was the same shape and is fixed beside them.
Run: TestOwnMCPRejectsOversizedBody (the reporter's test, extended to a
known Content-Length too) and the new TestMCPProxyRejectsOversizedBody
fail on the old search_mcp.go/mcp.go with HTTP 200 instead of 413, the
image model called 1 -> 5 times, and the proxied server seeing the cut
"tools/call"; they pass with the change. TestMCPProxy*, TestVisionMCP*,
TestSearchMCP* pass. Full suite and vets are recorded on the push.
Not done: the GUI's local /api handlers decode JSON through LimitReader
too; they take only the first JSON value whatever the length and are
not reachable by another machine, so they are left as they are.
Co-authored-by: ggbdpq <ggbdpq@gmail.com>
|
||
|
|
e4134d1fb7 |
agent: Codex's proxy is worked out from the login shell's NO_PROXY and HTTP_PROXY and macOS' HTTP entry alone, as its reqwest reads them, so "Codex 经代理连 magpie" no longer shows while Codex goes direct (liu_dyj on X)
liu_dyj: with the VPN on, magpie said Codex reached magpie through a
proxy that didn't pass its requests on; versions before
|
||
|
|
974aaf7e22 |
gateway: an account out of credits on a model that costs them still serves its subscription's free models (Creat.wu on Discord)
Creat.wu (WorkBuddy AI) spent the credits on glm-5.3-flash, switched to a
free model, and magpie skipped the account. An out-of-credit refusal
rested the whole account (restKey) for 30 minutes: through the WorkBuddy
plugin, whose `explained` passes 14018 on as insufficient_quota, and on the
built-in, whose raw 429 {"error":{"data":{"code":14018,"msg":"Credits
exhausted…"}}} matched no credit word and was read as a rate limit, the
account benched a minute and longer on repeats.
- provider.PaidBesideFree: the model costs credits while the subscription
lists others Free (catalog.Model.Free: WorkBuddy's x0.00, Qoder's
is_free, Cline's free models, Command Code's).
- restAfterMarked: out of credit or quota on such a model rests that model
alone (restID). A free model the vendor still refuses (WorkBuddy refuses
0-rate models to an account with no package) rests the account on its
own refusal, as before.
- brokeWords takes "credits exhausted", so the built-in's 429 is out of
credit, not a rate limit. A rate limit naming credits in passing stays one.
- The fix is in the gateway, which both moved (plugin) and built-in users
go through, so no plugin release or mover min is needed.
- docs/subsystems/gateway-routing.md says so, with the tests to run.
Tests: TestCreditsExhaustedIsOutOfCredit (literal 14018 body, raw and as
the plugin passes it) and TestOutOfCreditLeavesFreeModels (fake plugin,
two keys, deepseek-v4-pro answered 429 with the plugin's body, then fake-1
must go to the first key). With the restAfterMarked change taken out the
second fails (fakeco@api key rested 30m for credit); with brokeWords back
as before the first fails (rate, want credit). Both pass with the fix.
Not done: credit windows still count free models in Smart/Pace order and
the 98% affinity stop; the account isn't held out there (Credits has no
reset, so Full is 0), only ordered later. Not tried with a real WorkBuddy
AI account. gofmt, vet and the full suite: see the next commit's body.
|
||
|
|
260ded9af4 |
sessions: the Sessions page's search finds a session by what was said in it, and a gateway session is titled by what it was first asked (YOU on Discord)
Why: the filter matched only titles, folders, ids and models, and a session the gateway recorded was listed under its bare ses_… id, so one couldn't be found by anything a person remembers about it. What changed: - sessions.GatewayTitle: the first user text of a recorded session (not a <…> context tag, # AGENTS.md or an image), made one line. It reads at most 8 complete turns of the oldest file of it, caches a finished file's answer by path, and costs one stat when nothing is recorded. gatewayListed applies it in every list (/api/sessions, /manage, /one, the stats summaries); ExternalSession gained Title. - GET /api/sessions/search?agent=&q= (searchSessions): an agent's sessions, newest first, read by up to 4 workers, each only to its first match. Native files go through a byte prefilter (mayHold: the query's longest word, ASCII case folded without a copy, 1 MiB chunks, skipped for zstd and for queries JSON may escape), and of a Claude or Codex file only the lines holding every word are decoded (readTranscriptOf; claudeContentOf/codexContentOf take an optional line test, nil for every other caller); gateway sessions, and an unreadable agent's sessions (unread: true), through their recorded transcript. System prompts, tool definitions and images never match. It stops at 200 hits or 8s (cut, searched of total) and when the request's context ends. Each hit carries the match with 36 runes before and 120 after. - sessions.js: the field says "Search sessions"; title/folder/id/model matches show at once, the server is asked 300ms after the last keystroke, a new query aborts the request in flight and its answer is dropped, under 2 letters asks nothing. A session found shows a line of the words round its match with the match in <mark> (text nodes, no innerHTML). A note says when it is searching, cut short, failed, or limited to recorded text. New strings in zh, zh-TW, ja and de. - docs/subsystems/gateway-sessions.md describes both. Run: - Go: TestSearchSession* (snippet, case and line breaks, said text preferred over a tool call, cut ends, cancelled context, a Codex file, only matching lines decoded: 1 part of 3), TestContainsFold, TestMayHoldSkipsAFileWithoutTheWords (incl. a match across chunks), TestGatewayTitleAndSearch (context tag and system prompt skipped), TestSessionsSearchFindsGatewaySessionsByWhatWasSaid (endpoint + manage titles), TestSessionsSearchStopsWhenItsRequestEnds. Without the endpoint/title they fail (404, id as title). - GUI: new sessions-search.test.cjs in chromium and webkit, en/zh at 1100, zh-TW/ja at 560, de at 420: title shown, one letter no request, one debounced request, snippet mark, cancelled earlier request never shown, cut note, empty state, Escape, every language's strings, no overflow; 12/12, and 0/12 with the old sessions.js. The sessions-*, sess-*, session-* and i18n-keys tests pass in both engines (sessions-manage's placeholder updated to "Search sessions"). - gofmt -l, go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., the builds: clean. go test -tags nogui ./... at load ~25-60 (other sessions' runs): every package passed but internal/agent and internal/gateway, which hit the 30m timeout; run again alone, agent passed and gateway's only red was TestOTelWaterfallIncludesUnbilledFallback, filed as #1794 (passes alone, -count=3). - Real data, read-only (a temporary probe, not committed, pointed at the owner's ~/.claude and ~/.codex; one worker, 8s, load ~50): Claude, 58 sessions / 3 GB: before the line filter one 1.3 GB session took the whole 8s ("redis": 1 of 58); after, all 58 in 4.7s ("redis", 13 hits), 7.4s ("gateway session"), 2.8s (no match). Codex, 11534 sessions / 65 GB: 245-656 sessions in 8s either way, which is what the cut note ("latest n of total") is for. Not verified: the endpoint and page against a real recorded gateway store (only fixtures and temp homes); the timings above were taken on a machine at load ~50 and vary run to run. |
||
|
|
61a0a69b5c |
gui: Routing, Usage and Sessions keep to the width the other pages do on a large screen, centred (面条 on Discord)
What changed: the window's page-width rule (#860), padding each view to max(16px, calc(50% - 600px)), now names #view-routing, #view-usage and to edge while Agents, Providers, Library, Gateway, Plugins and Settings sat in a 1200px column in the middle. A narrow window keeps the 16px gutter it had. Routing's two columns, the Usage cards' packing and the requests ledger lay out by the room they get (byWidth, packUsage), so they follow the narrower box: at 1920 Routing still gets its two columns (min1150) and the ledger fits 1200 without a sideways scroll. sess-agent-strip.test.cjs asserted that eleven long agent names fit a 1600px window's Usage page in one row. With the page kept to 1200px they were 8px too wide in WebKit zh (its scroll bar takes width), which is the strip's designed overflow; the first two names are shortened so the "fits" case is still one that fits, and the narrow case still overflows. One word off the first name left it 0.34px of room (1159.66 in 1160), which went red once in WebKit en under load; two names shorter leave 135px, and it passed 3 runs in a row in each engine. sessions-toolbar.test.cjs asserted that ten agents' tabs fit an 1800px window; in a 1200px page they need 1115px of 912, so the page shows the compact agent menu (its designed overflow). The fixture now has eight agents (829px), so the wide case still tests tabs that fit. Run: - new page-width.test.cjs: every view's content width 1150..1200 and centred at en 1920, zh 2560, zh-TW 1920, ja 2560, de 1920; 16px at en 900; every view's left edge and padding equal Agents'; chromium and webkit, 14/14. Without the CSS change it fails ("sessions: 1676 wide at 1920"). - before/after screenshots of Routing, Usage cards, the ledger, Sessions and Providers at 1920, 2560, 1100 and 800 (chromium). - GUI regression set, both engines: click-scroll, editor-short-window, ledger-*, panel-usage, quota-*, routing-*, usage-*, sessions-*, sess-agent-strip and sessions-toolbar (after the fixture changes). routing-group-fold (webkit en/ja/de) and routing-sessions (webkit en) fail the same with origin/main 17c12621b's own assets, run alone: already filed as #1612 and #1672. usage-ledger's webkit "dark, and narrow" failed once in the full run; it fails the same with 48e59c5b8's assets (the view left scrolled 32px after the resize, the tab under the header), noted on #1671. - Go: gofmt -l, go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., the builds: clean. go test -tags nogui ./... at load ~25-60 (other sessions' runs): every package passed but internal/agent and internal/gateway, which hit the 30m timeout; run again alone, agent passed and gateway's only red was TestOTelWaterfallIncludesUnbilledFallback, filed as #1794 (passes alone, -count=3). Not verified: real WebView2 or WebKitGTK windows; layouts were checked in Playwright's chromium and webkit only. |
||
|
|
66ec713af7 |
gui: a short window's sidebar has no scroll bar beside its pages, a thin one shows over them while they scroll and fades, as on a Mac (xybio and MOMO on Discord)
In a window shorter than the sidebar's pages, .side-scroll (scrollbar-width: thin) and .side-foot kept a native bar and its gutter at rest on Windows and Linux. On Windows this was MOMO's report (v0.1.1207, WebView2): a classic, always-visible bar with arrows between the sidebar's items and the page, because Chromium drops every ::-webkit-scrollbar rule on a box with scrollbar-width set and draws the system bar. Both boxes now hide their native bars (scrollbar-width: none and ::-webkit-scrollbar display:none, which Chromium/WebView2, WebKit and WebKitGTK each honour), and app.js sideBars lays a thin overlay bar inside, shown on scroll, faded ~900ms after, kept while hovered or dragged, the thumb draggable with pointer capture, a click off it pages the box, hidden when the box fits. ResizeObserver/MutationObserver keep it placed as the nav's sub-tabs open and fold. gui-shell.md describes it. Run: new sidebar-overlay-scrollbar.test.cjs (chromium with native bars on, webkit; en, zh, zh-TW, ja, de at 1100x320 and a tall window) 14/14; it fails without the change (no bar shown while scrolling, 5/5 languages both engines). Its drag step first measured the thumb before the scroll event had moved it, pressed the bar below the thumb and paged the box (3 of 6 webkit runs red, "162 of 191"); it now waits for that scroll, and 8 webkit and 5 chromium runs in a row pass. sidebar, side-width, side-toggle, strip-scrollbar, view-scrollbar, view-scrollbar-drag, click-scroll all pass in both engines. Screenshots at rest and mid-scroll in both engines checked by eye. Windows: on the Windows 11 box, headless Edge 155 (WebView2's engine) rendered a sidebar box with origin/main's app.css and with this one. Old: 10px gutter and the classic bar with arrows, as in MOMO's screenshot. New: 0px gutter and no bar, with an unstyled overflow box beside it still drawing its 10px bar, so system bars were on. Not tried: the overlay bar's JS inside a real WebView2 or WebKitGTK window (it ran in Playwright's Chromium and WebKit only). |
||
|
|
24350a3722 |
agent, gateway: Claude Code on a model Anthropic doesn't review gets auto mode's server review turned off, so it no longer says magpie isn't eligible (1EFLOPS on X)
1EFLOPS runs Claude Code through magpie on Codex's gpt-6.1-sol. In auto mode, Claude Code 2.1.296 says "this session isn't eligible because your requests go through 127.0.0.1:3425 ... ask your gateway to implement https://code.claude.com/docs/en/auto-mode-classifier-billing". What the page asks of a gateway: pass the anthropic-beta header (dangerous-tool-use-2026-09-03), the request's `safeguards` field, and `safeguard_results` in the reply through unchanged, and leave tool-use ids alone. The results are verdicts from Anthropic's own safety classifier. For a gateway that can't provide them, the page's remedy is CLAUDE_CODE_AUTO_MODE_SERVER=0. Pro, Max and Team plans never see the notice. In the bundle, Claude Code falls back on server_unsupported, server_unavailable_disabled or server_no_result, and the notice shows whenever there's no real verdict. Only that variable removes it. Per route: - Claude subscription bridge, Anthropic API key, relays in front of Anthropic, Bedrock and Vertex: already pass the beta, `safeguards` and `safeguard_results` through ( |
||
|
|
0db8112afe |
omarchy: on Hyprland the tray panel opens under the click on a monitor that isn't at 0,0, not off the screen (#1785)
PanelAt answered where the panel goes in coordinates across the whole
layout (the cursor's, from hyprctl cursorpos), and PlacePanel handed them
to Hyprland's move rule. Hyprland counts a move from the corner of the
window's monitor (CDefaultFloatingAlgorithm::newTarget in 0.56.2:
COMPUTED + MONITOR_POS), so the monitor's place was added twice. The
reporter's click on the right of two 1920-wide monitors asked for
3238,40 and got 5158,40, off every screen. The monitor at 0,0 hid it,
and the only setup tried before (
|
||
|
|
86b2f4d053 |
provider, gateway, gui: an account whose sign-in its vendor revoked or refused reads as signed out and is passed over, not asked on every request (#1793 ysicing, echo_ts on Discord)
What changed, one fix for the class:
- ChatGPT and the other built-in subscriptions (#1793): ChatGPT answered
401 token_revoked on every request, request after request (~18 rows in
the reporter's log), because a refused sign-in was just "other" and
rested a while, then asked again. Now a 401 whose words say the sign-in
is gone (provider.SignInRevoked: token_revoked, token_invalidated,
invalid_grant, refresh_token_reused/invalidated/expired; never
token_expired, a 403, a 5xx or a network error) marks the account for
the credential it was sent with (a 12-byte hash of the header, never the
credential), in logins.json as Refused "revoked:<mark>" plus Lapsed.
A saved ChatGPT account is refreshed first, as Codex does on a 401; a
refresh that goes through marks nothing. The routing loop fails it as
failAuth (next member at once, no rest); forwardOnce answers its later
requests with magpie's own 401 without asking the vendor; compaction
on a magpie account (compactOn) picks a marked one last. Signed in anew
(upsertLogin with another credential, addSideLogin), refreshed, or a
request served, the mark is gone. Claude, Copilot and plugins keep
their own marks; a key's provider answering the same words rests as
before.
- Copilot (echo_ts): a built-in Copilot account whose GitHub token GitHub
refused (401/403 on the token exchange, the CLI stand-in or the usage
read) is marked lapsed on its own account (copilot_lapsed.go), unless a
working CLI stand-in serves; cleared when a token is served or it signs
in again. 5xx and network errors never mark it.
- GUI: such an account's row says Sign-in required with Sign in again
(Copilot's on its GHE.com host) and Remove, the reason on its allowance
line in the user's language (zh, zh-TW, ja, de added); the card says
Signed out once every account in use is.
- docs/subsystems: providers-accounts "A revoked sign-in", gateway-routing.
What was run (sandbox HOME, caches pinned, worktree only):
- go test -race on the new tests: provider TestSignInRevokedWords,
TestRevokedSideLoginMarkedTillSignedInAgain, TestRevokedCodexRefreshedFirst,
TestRevokedSignInLeavesOthersMarks, TestUpsertLoginKeepsRevokedMarkForTheSameSignIn,
TestCopilot* (7); gateway TestRevokedSignInPassedOverTillSignedInAgain
(fake ChatGPT backend, zstd, real routing: turn 1 asks acct-1 then
acct-2, turns 2-4 and after a restart acct-2 only with no rests, after a
new auth.json acct-1 again and the mark gone),
TestRevokedSignInNotCompactedOnAgain, TestRevokedWordsFromAKeyRestAsBefore.
- Broken by hand, each turned a test red: the forwardOnce short-circuit,
the failureOf clause, noteSignIn in codexUpstreamOn, compactOn's skip,
ServedSignIn, its in-memory delete, the 401-only check, refresh-first,
upsertLogin's keep and its sameAuth, sideLogins' Lapsed and
addSideLogin's clear; and the six Copilot breaks. GUI: the signedOut
and quotaError lines each turn revoked-signin-account red.
- GUI (Chromium and WebKit, 420 and 1100, en/zh/zh-TW/ja/de):
revoked-signin-account (new), copilot-signed-out-account (new), and the
account-*, claude-*, codex-*, plugin-*, quota-*, signin-*, routing-*,
usage-accounts* suites: 1605 pass, 7 fail. Six are WebKit
routing-group-fold/routing-sessions/routing-steady cases that fail the
same on a clean
|
||
|
|
d7a1fcd41a |
library, gui: a skill pack added a while ago is grouped whole, and the Skills head has Group again (White Immortal on Discord)
Of mattpocock/skills' 38 skills only 20 were grouped with the repository on the Library page; the rest sat under On this computer, and nothing could trace them again. Cause: installing from a repository again (noteFrom) grouped a library skill with it only when its SKILL.md was byte for byte the repository's. A pack added a while ago is mostly older copies: of the copies at mattpocock/skills 3cca18b3 (2026-09-04), 18 of 37 match HEAD; at 8b78b531 (2026-08-13) 2 of 35. The GUI's parts draw all 38 when the data has them (checked with a Playwright run against 38 skills in the repo's real folder layout, github, lock-traced and mixed paths, both engines). noteFrom now also notes a skill traced to nowhere by a name the repository has, when the library has others from that repository (same file, or traced there already). A skill traced to another repository, and a same-named skill when the library has nothing from there, are left alone. RegroupSkills (POST /api/library/skills/regroup) fetches each GitHub repository the skills are traced to and runs the same; it fails only when no repository could be fetched. The Skills head has Group again (busy while it runs, status says how many joined), en/zh/zh-TW/ja/de. Run: TestRegroupOlderCopies (fails with the name match off: edited and later stay ungrouped), TestInstallAgainNotesFrom, TestSkillRepoTraced; skill-regroup.test.cjs in chromium and webkit, en/zh/zh-TW/ja/de at 1100 and 440 wide (red on the old assets: no Group again); skill-parts and i18n-keys pass; go test -tags nogui ./internal/library ./internal/gui ok; gofmt, go vet. Not tried against the reporter's library or real GitHub. |
||
|
|
ff49ca72fe |
gui: Windows without the WebView2 runtime says so in a message box and offers the download page, instead of a double-click doing nothing (#1806)
magpie's windows are WebView2, which Windows 10 doesn't always have. Without it Wails handed the failure to ErrorHandler and exited, and the desktop build (-H windowsgui) has no console for the log line to land in: ufec's double-click came up to nothing at all. ufec found the cause, that Wails' own Env.Info().PlatformInfo["WebView2"] answers "" then, and that a box can't come from ErrorHandler (it runs on the thread Wails makes its windows on); this takes both from their branch. Run asks webView2Check right after application.New, before any window. Missing, it logs it and shows MessageBoxW (Yes/No, error icon, topmost) in the reader's language (trayLang): the runtime is missing, Microsoft's page https://developer.microsoft.com/microsoft-edge/webview2/, that "magpie web" and "magpie tui" work without it, and whether to open the page now; Yes opens it (ShellExecute), and Run ends. A key Wails doesn't set is read as present: refusing to start a magpie that would have worked is worse than the silent exit. The tray isn't kept: its panel is a WebView2 window too. Run: TestWebView2Missing and TestWebView2Notice (all OSes); TestWebView2MissingFromWails on the Windows box (10.0.0.132, Windows with WebView2 installed): a child process with Wails pointed at a folder that isn't a runtime reads missing, the machine's own runtime reads present. TestWebView2Missing goes red with webView2Missing made to answer false. On the box, a throwaway -H windowsgui test binary calling webView2Check with that bogus runtime path, run in the desktop session: the box came up titled "magpie 需要 WebView2" with the Chinese text, the page and 是/否 buttons (read back from the dialog's controls), the log line was written, pressing 是 opened the page in Edge and the check answered false. go test -tags nogui ./internal/gui in a sandbox HOME; gofmt -l clean; go vet ./... on darwin, GOOS=linux -tags nogui and GOOS=windows; windows and linux builds. Not tried: a machine that really lacks the runtime (the box has it; the missing case is Wails' lookup failing on a path that isn't a runtime, the same failure), nor a real magpie.exe start through Run. |
||
|
|
b1d8717107 |
provider: a switch of Claude Code's sign-in takes the account's own proxy into its env, and out again for one without (#1807)
kensenzhao signs Claude Code in to several accounts in direct mode and gives each its own proxy in magpie (AccountProxies). Those proxies were only ever honoured on what the gateway sends; Claude Code signed in to its own subscription asks Anthropic itself, through the proxy its env names, so a switch (by the user, or SwitchWhenSpent) left every account on one route. Decision: while the Claude subscription has a proxy for any of its accounts, settings.json's env names the proxy of the account Claude Code is signed in to: its own, else the subscription's (ProxyOfLogin, which also covers the first account whose proxy is kept as the sub's, #1663). None for "direct", and none for a SOCKS proxy, which Claude Code can't use (logged). HTTPS_PROXY and HTTP_PROXY are written, with NO_PROXY set to loopback so the gateway and local MCP servers are reached straight. With no account proxy at all nothing is written: the subscription's proxy alone was never Claude Code's, and turning it on now would change every existing user's route unasked. A proxy the user set themselves wins. magpie records the values it wrote (claude-proxy-env.json beside providers.json) and a key is its own only while it still holds that value; any proxy key that isn't (in either case) means the route is the user's, so magpie writes none beside it and takes out only its own. A NO_PROXY/no_proxy the user set stays. A settings.json or record that can't be parsed is an error, never empty: the file is left as it is. It runs on every switch (switchLogin), on Save of the Claude subscription (a proxy picked for the account it is on), and on the gateway's 5-minute KeepOnAnAccountWithRoom tick (a sign-in made in Claude Code itself). Claude Code reads its env as it starts, so running sessions keep the old route; the log says which proxy new ones take. Run: go test -tags nogui ./internal/provider (676s, ok) in a sandbox HOME. TestClaudeSwitchTakesTheAccountsProxy fails with the sync call taken out ("on b, HTTPS_PROXY = "", want b's proxy"); TestClaudeAccountProxyKeepsTheUsersOwn and ...EditedByTheUserStays fail with the user-route check forced off, and EditedByTheUserStays with ours() always true. gofmt -l clean; go vet ./... on darwin, GOOS=linux -tags nogui and GOOS=windows; windows and linux builds. Not tried: a real Claude Code session going through a real proxy after a switch, and a remote LAN gateway's address isn't added to NO_PROXY. |
||
|
|
6c9048db51 |
gateway: a request asks only the resting member back soonest, not every resting one, so a failing member isn't hammered by each request (#1799, dbydd)
dbydd: a group's routing still goes over its members in order however they have been failing, and with providers magpie can't read a quota from, that is close to a DDoS of the ones that are down. What was there: a failure rests the member (credit 30m, quota till its reset, rate by Retry-After, anything else 1m doubling to 10m), and one answer clears it. But restLast only moved resting candidates behind the ready ones. Once the ready ones failed, every request went on to ask each resting member in turn, so the rest kept nobody back: in an outage of the whole group each request went to all N members, and the last one again on its retries. Now (probeOne, fallback.go): of the candidates resting, a request asks only the one whose rest ends soonest (the first in order on a tie), at its place. Every ready candidate is still asked in the user's order. A lone candidate is always asked. A group that is down whole takes one upstream request per request, and the backoff grows with each real probe instead of each request. The trace still lists every member, the resting ones with their rest. The same is applied where the other paths go over candidates: count_tokens, embeddings/rerank, image accounts (drawOnAccounts) and a group's System One decision models. Codex autoReset still looks over the whole list (all), so a week used up on every account still spends a reset. Default on, no switch: it only reads rests the user's order already demotes, and only within a rest's cooldown; once a rest ends, the member is back at its place in the user's order. Each request still makes at least one real upstream attempt and returns the vendor's own error. Scoping: only rests are read, and a failure about the request's content or its model rests no member (failShape, prompt, overflow, refused, loop, auth, proxy...; a model refusal rests only restID), so neither leaves a member out. Borrowed from AxonHub's error-aware load balancing (looplj/axonhub, docs/zh/guides/load-balance.md, ErrorAware), which dbydd pointed to: a failed channel's score drops and recovers as its penalty decays, rather than it being sent every request. magpie's rest and backoff already are that decaying penalty; asking the one back soonest is how it recovers. Not taken: a success-rate memory that keeps a member demoted after it answers. One answer means it serves now, a flaky member already rests at least a minute per failure, and holding it down past that would override the user's order beyond a cooldown. Unchanged: the last candidate still isn't rested by its own failure, and the Patience rounds (#1418) and retries on the last one re-ask only candidates already in the trimmed list. Tests (resting_probe_test.go): TestGroupAsksOneRestingMemberNotEach (three resting members, minutes apart: only the soonest is asked; with a ready member, it then the soonest), TestRetrievalGroupAsksOneRestingMember (embeddings), TestLoneRestingMemberStillAsked, TestProbeOne. With probeOne returning its input (the old behaviour), the first two fail: "resting members asked map[a:1 b:1 c:1]". TestSystemOneDecisionGroupFailsOver held the old behaviour (all failing: kb, ka1, ka2 asked, ka2's 503 back); it now wants kb then ka1, the one rested first, and ka1's 429 back. Run: gofmt -l (clean); go vet (darwin, GOOS=linux -tags nogui, GOOS=windows); GOOS=linux -tags nogui and GOOS=windows go build; go test -tags nogui ./... -timeout 40m under a sandbox HOME at load average ~100: every package ok but gateway and agent, which hit the 40m timeout mid-run (TestZenUnsupportedModelLeavesTheListAlone and TestSnowNoProfiles running, a few seconds in), and plugin, where TestNPMInfoDeadline hung on its own failed 2s check (filed #1808). Rerun alone with -timeout 80m: gateway ok (1896s), agent ok (1811s), plugin ok (746s). Not run: a real upstream outage, the Windows box; count_tokens and image accounts have no test of their own. |
||
|
|
897f6d32f1 |
gui: on Linux the tray panel is a solid window with an opaque page, as the main window is, so scrolling it leaves no ghost of the old position (#1803)
MizuIro-H (Bazzite / Fedora 44, KDE Plasma 6, Wayland) saw the panel's Allowances tab leave a fainter copy of what it showed at the old scroll position, on Wayland and under GDK_BACKEND=x11, with WEBKIT_DISABLE_COMPOSITING_MODE=1 (which magpie already sets under Wayland, so that try changed nothing), at scale 1, and without KWin's corner effect. The main window, with the same page, never did. The panel was the one window with per-pixel alpha: Wails' BackgroundTypeTranslucent on Linux makes it an app-paintable GTK window on the screen's RGBA visual under a 0-alpha webview, and body.panel painted --bg at 93% over it. Paint not cleared before a scroll repaint shows through 93%, which is the fainter copy. The main window is a plain solid window painting --bg whole. On Linux only, panelOptions now makes the panel BackgroundTypeSolid, and body.linux.panel paints --panel-tint as --bg (no alpha). The Mac (tinted by tintPanel) and Windows keep the translucent panel. The corners are square on Linux now (the body's paint fills the canvas). Run: gofmt -l internal/gui (clean); go vet darwin ./internal/gui, GOOS=linux -tags nogui ./..., GOOS=windows ./... (clean); go test ./internal/gui under a sandbox HOME (ok); node --test internal/gui/tests/panel-*.test.cjs, chromium and webkit (74 pass), the new panel-linux-opaque test across en/zh/zh-TW/ja/de and light/dark. Broken by hand: TestPanelSolidOnLinux fails without the panelOptions change, and panel-linux-opaque fails without the CSS rule (the Linux body read color(srgb ... / 0.93)). Not tried on the reporter's setup. A repro of the panel's window (GTK3 + WebKit2 4.1, RGBA visual, 0-alpha webview, 93% page) under Xvfb with picom, on Ubuntu and on Fedora 44 (WebKitGTK 2.54), scrolled by JS and by a real X wheel, with compositing mode on and off, showed no ghost either way: software rendering there doesn't reproduce it, so whether the opaque panel ends it rests on the reporter's KDE/GPU machine. No real Linux magpie build was run. |
||
|
|
3e88fc09dc |
agent, gateway: Claude Code on a model Anthropic doesn't review gets auto mode's server review turned off, so it no longer says magpie isn't eligible (1EFLOPS on X)
1EFLOPS runs Claude Code through magpie on Codex's gpt-6.1-sol. In auto mode, Claude Code 2.1.296 says "this session isn't eligible because your requests go through 127.0.0.1:3425 ... ask your gateway to implement https://code.claude.com/docs/en/auto-mode-classifier-billing". What the page asks of a gateway: pass the anthropic-beta header (dangerous-tool-use-2026-09-03), the request's `safeguards` field, and `safeguard_results` in the reply through unchanged, and leave tool-use ids alone. The results are verdicts from Anthropic's own safety classifier. For a gateway that can't provide them, the page's remedy is CLAUDE_CODE_AUTO_MODE_SERVER=0. Pro, Max and Team plans never see the notice. In the bundle, Claude Code falls back on server_unsupported, server_unavailable_disabled or server_no_result, and the notice shows whenever there's no real verdict. Only that variable removes it. Per route: - Claude subscription bridge, Anthropic API key, relays in front of Anthropic, Bedrock and Vertex: already pass the beta, `safeguards` and `safeguard_results` through ( |
||
|
|
94aa153973 |
tui, provider, serve: a signed-in account's models are fetched at start, so Routing offers Cursor's whole list without m (#1789, reyoung)
The terminal and `magpie serve` never called provider.FetchNew, which the window calls at start: a signed-in Cursor account's list exists only at Cursor, so the TUI's Routing pickers (and a headless gateway's /v1/models) offered the fallback cursor/auto alone until the list was fetched by hand with m on the Providers page. - tui: Init fetches the new lists (fetchModelsCmd, alongside the catalog sync). A model picker open when they arrive (Routing members, the classifier, a provider's models, an agent's model field) is filled in place through its relist, keeping its filter and the model under the cursor. A list left missing (no network) is asked for again a minute later (modelsRetry). Built on reyoung's branch and test. - serve: FetchNew at start, again each minute while a list is missing. - provider: FetchNew reports whether a list is missing, and waits for a CLI asked who is signed in for the first time (awaitIdentities), then lists the accounts again. With the real Cursor account in a fresh sandbox, `cursor-agent about` answered after a look's 3s firstAsk, so FetchNew saw no Cursor account and `magpie serve` still listed 1 model with the TUI fix alone. The window's startBackend gets the same wait. - docs: providers-accounts.md says who fetches the lists and when. Run: - internal/tui TestTUIFetchesSubscriptionModels (6 views) and TestTUIAsksAgainForAMissingList, -race x3; red with the Init fetch, the relist, the cursor restore or the retry tick each removed by hand. A first `about` slowed to 12s injected: passes (the test re-asks). - internal/provider TestFetchNewWaitsForASlowSignIn: red without awaitIdentities (no provider "cursor"); TestFetchNewAccount covers the missing result. - Real Cursor account, sandbox HOME with a keychain holding only Cursor's two items: TUI on main showed cursor/auto only in Routing; the fix shows the full list and "24 models" on Providers. `magpie serve`: main 1 Cursor model at /v1/models, the fix 24 within 5s. - gofmt -l, go vet (darwin, GOOS=linux, GOOS=windows), go test ./... in a sandbox HOME. Not tried: Linux and Windows real Cursor CLIs (the fake CLI tests skip on Windows); Devin's CLI identity goes through the same wait but wasn't tried with a real account. |
||
|
|
23e764d0e0 |
cli: magpie's commands move from the root into internal/cli; the root keeps only main.go
The root held 89 .go files (30 commands, 59 tests). They move as they are to internal/cli (package cli), with git mv so history follows them. The only code change is main() becoming cli.Main(version): the root's new main.go keeps `var version` in package main, so -ldflags "-X main.version=…" in the Makefile, the Dockerfile and magpie-releases, and every workflow, work unchanged. go-winres's rsrc_windows_*.syso still land next to package main in the root. Tests that read testdata by a root-relative path now go up one level (../plugin/testdata/fake, ../sessions/testdata). Five subsystem doc links point at internal/cli/. Run: - go build ./..., gofmt -l, go vet on darwin, linux and windows (nogui) - builds with tags production, dev, "production nogui"; windows -H windowsgui; linux CGO_ENABLED=0 - make release-cli TARGETS="darwin/arm64 linux/amd64 windows/amd64 android/arm64" VERSION=9.9.9-tidy: all four built, binary prints "magpie 9.9.9-tidy" - docker build --build-arg VERSION=7.7.7-tidy: container prints "magpie 7.7.7-tidy" - go test ./internal/cli (default and nogui): 152 tests, the same count as the root on main - go test ./...: all packages pass (agent, gateway, library, provider timed out at 10m under other sessions' load and passed rerun alone with -timeout 40m; none of them changed) - the built binary in a sandbox HOME: version, help, ls, providers, claude, and an unknown command's error |
||
|
|
f8214ec972 |
provider: a third-party Anthropic API that refuses x-api-key and Authorization together is sent one, picked in the editor or learned from its 401 (Aloha on Discord)
magpie sends a user's own Anthropic-compatible provider its key in both
x-api-key and Authorization: Bearer. Some relays answer 401 "鉴权 header,
x-api-key 和 Authorization 不可以同时存在", so every request failed.
- Provider.AuthHeader ("" both, "x-api-key", "bearer") picks which
AuthHeaders sends on the Anthropic protocol. Anthropic's own API,
Bedrock, Azure, Vertex and subscription accounts are untouched: they
send x-api-key alone (or their own) whatever it says, and BothAuth()
is false for them.
- Left at both, a 401 whose body catalog.BothAuthRefused tells as that
refusal (names both headers and says they can't be together, Chinese or
English) is asked once more with x-api-key alone, then Bearer alone
(RetryOneAuth, in the gateway's forwardOnce and the provider test's
probe; the model-list fetch through catalog.fetchOne too). The first not
answered 401/403 is saved (LearnAuthHeader), never over a pick the user
made. A request carrying the user's own Authorization/x-api-key header
is never retried; any other 401 is passed on as it came, asked once.
- The editor has a "Key header" row (Both / x-api-key /
Authorization: Bearer, the app's segmented control) while the provider
has a third-party Anthropic URL; strings in zh, zh-TW, ja, de.
- docs/subsystems/providers-accounts.md: an "Anthropic key header" row.
Run (sandbox HOME, GOCACHE/GOMODCACHE pinned, set -o pipefail):
- gofmt -l; go vet ./...; GOOS=linux go vet -tags nogui ./...;
GOOS=windows go vet ./...; GOOS=linux/windows go build.
- go test -tags nogui ./...: 47 packages ok; agent and gateway timed out
at 10m under load average ~50-98 (other sessions' test runs), so rerun
with -p 1 -timeout 60m: agent ok; gateway ok but for
TestOTelWaterfallIncludesUnbilledFallback, a load flake unrelated to
this (it reads only the first 200ms OTel export; passes 5/5 alone),
filed as #1794.
- New tests: internal/provider/authheader_test.go (official Anthropic and
Bedrock unchanged for every pick; Aloha's 401 body retried with
x-api-key and kept; Bearer-only relay learns bearer; the model list
learns; another 401 and the user's own header aren't retried; a user's
pick isn't overwritten), internal/gateway/authheader_test.go (a
/v1/messages turn through the gateway to such a relay succeeds and the
next Chat Completions turn goes with one header first).
- Broken by hand: RetryOneAuth returning at once and AuthHeaders ignoring
the pick -> TestAuthHeaderChoice, TestRetryOneAuthLearns,
TestRetryOneAuthBearer, TestOneAuthHeaderRelay FAIL; the list retry off
in live.go -> TestListLearnsOneAuth FAIL.
- GUI: provider-auth-header.test.cjs 20/20 in chromium and webkit, en and
zh, 390px wide; the editor's other tests (provider-*, nokey-editor,
editor-short-window, segs-*, vertex-editor) 439/440, the one
(provider-discovery, chromium zh) passing 26/26 alone.
Not tried: a real relay of Aloha's; the retry is built from the body the
user quoted.
|
||
|
|
aafddbe589 |
gateway: a Claude Code turn after its prompt suggestion goes on in its run, taken back from the suggestion; a turn that finds no run says why (#1638, chicring)
Cause (case 2: 41 messages told to a new Claude Code at 02:40:00, minutes
after the last reply at 02:37:13, no stop log). Claude Code 2.1.290 asks
its prompt suggestion after each turn: the conversation so far, with the
turn's system prompt, tools and thinking, and one more user message,
"[SUGGESTION MODE: ...", with no system message after it. That request
goes on from the turn's reply, so resume handed it the conversation's
run, and ended kept the run waiting at the suggestion's reply. The user's
real next turn didn't follow the suggestion, found no run under its key,
and was told the whole conversation in a new run (88k tokens written to
the cache again). Nothing was logged because nothing ended.
Fix. ended keeps, beside the run's new key, the key it went on from
(behindKey) and the turn's uuid (behindTurn). resume, finding no run
under a turn's key, takes one whose behindKey is that key, rewinds it to
behindTurn (rewind_conversation, as letGo does), marks it rewound so it
isn't shelved, and tells it only the turn's messages. A run that can't be
rewound is let go and the turn told whole to a new run, as before.
Logging. A turn after a reply that starts a new run logs "claude: no run
waits for this turn: <why>" (whyNoRun): it went on with a turn this one
doesn't follow, waits under another key (model, settings, system prompt
or tools differ), waits at an earlier turn, is busy, ended (how long ago
and why: abortFor's reason, or how Claude Code exited), or no run here
had the conversation. "tool results no run waiting" now adds "the run
that made the calls ended Xs ago: <why>" (whyCallsLost).
Case 1 (499 mid-reply, then "tool results no run waiting" and 17 messages
told) is not fixed. The run that answered had been started anew for that
turn, so letGo has no earlier user message to rewind to, and its results
were already handed to it over MCP. Keeping its cache would mean rewinding
to Claude Code's own tool_result message and telling the results again as
text, or interrupting instead of ending the run; neither can be checked
without the reporter's request shapes, and a fork that took the lead's
calls (claimResume) looks the same from here. The new log line says which
run ended and why, so the next report can tell.
Tests (claude_side_question_test.go), with 2.1.290's request shapes
(billing line with changing cch, 1h cache_control, adaptive thinking,
output_config effort, context_management, system messages, signed
thinking sent back):
- TestClaudeSideQuestionKeepsTheConversationsRun: turn, turn, suggestion,
real turn go to one Claude Code (turn 4), rewound to the suggestion's
uuid, told only the new message; twice. Red with the take-back disabled
("went to another Claude Code: pid ... turn 1").
- TestClaudeSideQuestionNotRewound: a run refusing the rewind is let go,
the turn goes to a new run, 1 run left. Red with the fix disabled (2 runs).
- TestClaudeNoRunSaysWhy (gone / another key) and
TestClaudeToolResultsNoRunSaysWhy: red with the log line, or the
lostCalls record, removed by hand.
Run:
- the new tests -race -count=5: ok
- real e2e: the real 2.1.290 client in -p --prompt-suggestions against
the bridge, whose Claude Code was the real 2.1.290 too, both against a
local mock of Anthropic: one bridge run for the whole session, "taken
back from the side question" logged after each suggestion, 0 runs told
the whole conversation; the real turn's request to the mock went on
from the reply before the suggestion, without it.
- gofmt -l .: clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./...: ok
- set -o pipefail; go test -tags nogui ./... at load average ~45-53:
every package ok but agent, gateway, library, plugin and provider, which
hit go test's 10m default. Rerun with -timeout 40m -p 2: agent, library,
plugin ok; gateway red only in TestOTelWaterfallIncludesUnbilledFallback
and TestOTelWaterfallFailureAndCancellation (#1794, already filed: they
read only the first OTel export; -count=10 alone passes); provider red
only in TestCopilotSecretToolUsername (#1627, already filed; red 1 of 5
alone under load, then 5 of 5 green). Neither touches this change.
- the new tests with the bridge's neighbours (LetGo, TurnGivenUpOn,
ToolResultsGivenUpOn, Idle, EndedRunSaysWhy, ForksAnswering) -race
-count=5: ok
Not tried: the real Claude subscription upstream, the interactive TUI
(the -p flag turns on the same suggestion), other side requests
(extract_memories, away_summary, /btw), case 1's actual requests.
|
||
|
|
c533499446 |
provider, gui, cli: a group can keep its models out of the lists agents see, offered through the group alone (#1783)
cybershape asked for a client's model list to show only a group, not every model behind it. A provider could already be kept for routing groups (Provider.Unlisted), but that hides the whole provider, and the models a group names may come from providers used elsewhere too. Group.Unlists (json "unlists"): the models a group names (a member fixed at an effort counts as its model) and those its patterns match leave Catalog(), so `magpie models`, /v1/models and every agent's list (CatalogFor) show the group without them. They stay in Served(), so a group routes over them and a request naming one as provider/model is still answered, and Unlisted() returns them for the GUI as it does an unlisted provider's. A nested group keeps its own setting; a group switched off or hidden keeps nothing out. With no group unlisting, Catalog() takes a fast path and is unchanged. - Routing view: the group editor's "Model lists" (Its models too / The group alone, segmented, with a hint), saved with Save; the card shows "Its models unlisted". Both group Save paths send unlists. zh, zh-TW, ja, de. - CLI: `magpie group set <id> listed=no|yes`; `magpie group <id>` shows listed: no. - TUI: the group member picker offered Catalog(), so models kept out of the lists (an unlisted provider's, before this too) couldn't be put in a group from the TUI. It offers Served(), as the GUI's picker does. - docs/reference.md, Routing groups: listed=no. Product call: a per-group switch, off by default, rather than hiding members of every group, so existing lists don't change under anyone. Run: - go test ./internal/provider -run 'Group|Catalog|Unlisted|Served', ./internal/gui, root package, ./internal/tui: ok. TestGroupUnlistsItsModels fails with the Catalog filter removed; TestMemberOptionsOfferUnlistedModels fails with the picker on Catalog(); TestApplyGroupPairs covers listed=no/YES/maybe. - GUI group-unlists.test.cjs, Chromium and WebKit, en zh zh-TW ja de, at 1100px and 420px: 20/20. i18n-keys: ok. - gofmt; go vet darwin, windows, linux (-tags nogui): clean. Not tried: with the reporter's own client; a real agent's model file written after toggling (CatalogFor is covered by the test). |
||
|
|
0d58ec8dcb |
davsync: a write a server without conditional PUTs let another go over is merged again at the next sync (#1776)
On an S3 server that refuses If-Match (Aliyun OSS answers 400 NotImplemented), put falls back to HEAD then an unconditional PUT. Two computers writing in the moment between both pass the HEAD, both are told they wrote, and the later file is kept. Worse, the loser's next sync then took the winner's file as having seen its own: its st.Remote was the file it wrote, so its changed parts looked unchanged here and changed there, and the old parts were brought in over its own changes. The edit was lost on the server and on the computer that made it. - version.Blind marks a write the server didn't check (s3.go's fallback). - state.Blind keeps, for such a write, the file's sum and the remote and local part hashes from before it. The next sync that reads another file than that one merges from before the write. What this computer changed counts as changed again and goes back up beside the other's. A 304 or the same file clears it. Restore and Upload clear it. - docs/reference.md says what happens on such a server. No compare-and-swap exists on OSS, so the race itself isn't closed: the other computer's file is kept for up to one sync interval (3 minutes) before this computer's change is merged back. The reporter's AppendObject journal would close it but needs every computer upgraded and OSS-only signing. If the other computer saw this one's write and then changed the same part again, the next sync can't tell that from a write that went over it. It counts the part as changed on both sides: the newer stays, the other is saved, and a notice says so. Nothing is lost. Run: - TestS3BlindWriteGoneOverIsMergedAgain (fake S3 with no conditional writes, two computers): A renames a provider and B sets the theme, B's PUT goes over A's, then A's next sync puts both on the server with no conflict notice, B brings in the rename, and nothing more is written. With the reset taken out (broken by hand), it fails: "A's rename here after its next sync: \"DeepSeek\"". - go test ./internal/davsync whole. Not tried against real Aliyun OSS: the fake answers conditional PUTs the way the reporter quotes OSS (NotImplemented). |
||
|
|
446bffcac7 |
gateway, gui: a Routing row's share used renews with its own window, not the biggest one (#1778)
Vigilans' Factory account showed "32% used · renews in 27 days": the week's 32% beside the month's reset. Allowance.For gives the fullest window's share and the renewals biggest first, and routing.js paired the share with renews[0], so for any account of more than one window the row mixed two windows. - provider.Allowance.Fullest(model, now): the reset of the window For's share is of (the later of two as full; a window whose reset has passed counts as empty, as For does). - The trace's Weighed gains usedRenews (from weighRouted's left.fullest); routing.js's usedRenews(w) uses it in both the story rows and the account rows, and falls back to renews[0] only for an account of one window (a route recorded before this commit). - Smart's order is unchanged on purpose: it goes by the biggest window, and Factory's month holds less than its weeks add up to, so what a week leaves isn't lost at the week's reset. docs/reference.md says so, and gateway-routing.md names Fullest/usedRenews. Run: - go test ./internal/provider ./internal/gateway -run 'Fullest|UsedRenews|Weigh|Routing|Smart' and the packages whole. - TestUsedRenewsWithItsOwnWindow fails with left.fullest set to the biggest window's reset (broken by hand, then restored). - routing-key-windows.test.cjs: 44/44 in Chromium and WebKit, all languages and widths; it fails on HEAD's routing.js. - Every routing-*.test.cjs plus panel-routing in both engines: 594/601. The 7 WebKit failures are clicks waiting for an element to be "stable" under load average ~44, in routing-group-fold (#1612, #1672), routing-sessions (#1307) and routing-days-fit. routing-days-fit passes run alone. The other two fail the same alone with HEAD's routing.js. Not tried against a real Factory account: the windows are those the Factory plugin's limitWindows reports (5h/7d/30d with resetsAt). |
||
|
|
04747d00ad |
provider, gui: a ChatGPT sign-in whose port 1455 can't be opened goes on, says why, and is finished by the pasted address (#1782)
nianlee-official's ChatGPT sign-in stopped at "port 1455, where ChatGPT
sends the sign-in back, is busy" with nothing of ChatGPT's running. That
message was given for every listen error: a Windows port in a range
Hyper-V, WSL or Docker excluded (WSAEACCES, no program holds it) read the
same as one another program held, and either way the sign-in stopped,
though ChatGPT's page puts the code in the address the browser ends on.
What changed:
- begin (signin.go): when listenCodexCallback can't have the port, the
codex sign-in still starts. Its handler serves no port and it waits for
the address, pasted, as a Docker sign-in does (pastedCallback goes
through the same handler). SignInState says why in CallbackBlocked
("reserved" for Windows' WSAEACCES 10013, else "busy") and names the
port in CallbackPort. The redirect stays localhost:1455, the only one
ChatGPT's client takes. listenCodexCallback returns the real error.
- GUI: the sign-in box says which of the two it is, with the port, in
place of the server-or-Docker guess (5 languages). CLI: the same.
- Not changed: Kiro's built-in tries ten ports already; the ChatGPT API
sign-in falls back to any port.
What was run:
- go test ./internal/provider -run
'TestCodexSignInGoesOnWithItsPortTaken|TestCallbackBlocked|TestCodexSignIn|TestPasted|TestLoopback'
-race -count=5: ok. With begin returning the listen error again,
TestCodexSignInGoesOnWithItsPortTaken FAILs: "the sign-in stopped at the
taken port: listen tcp 127.0.0.1:61025: bind: address already in use".
- signin-port-blocked.test.cjs (new), signin-paste-codex,
signin-callback: 45/45 in Chromium and WebKit, en/zh/zh-TW/ja/de, 900
and 420 wide. With app.js from HEAD the new test FAILs (the note never
shows, TimeoutError).
- gofmt -l, go vet (darwin, GOOS=linux -tags nogui, GOOS=windows), full
go test -tags nogui ./... before the push.
Not tried: a real Windows excluded port range (the Windows box was
unreachable over ssh); the reserved case is tested with errno 10013 as
Go's net.Listen wraps it. The reporter's own cause isn't confirmed yet;
the issue asks them.
|
||
|
|
bfaedf1830 |
gui, profile: the profile in use is ticked and named on the panel's Profiles button, not a count read as its name (superhtoooth on X)
superhtoooth (macOS): 保存方案设置了方案名字,但是应用方案没有用这个名字。
menu 里面变成了方案 1,方案 2。而且在应用里面没有显示当前使用的方案.
The bug: the tray panel's Profiles button showed the number of saved
profiles next to its label ("方案" + "2"), which reads as a profile
named 方案 2. Profiles were saved and applied under the typed name all
along; nothing anywhere said which profile was in use.
What changed:
- profile.InUse: a profile is in use while applying it would change
nothing on this computer - every detected agent's saved field is as
the profile has it (compared with the same renamed-ref spelling Apply
writes), its model lists are held (provider.ModelListsHeld, a dry run
of SetModelLists via the extracted putModelLists) and its library
setup is as saved (library.Holds, the mirror of Restore). A profile
that touches no agent here is not in use.
- Why not "last applied": that would stay ticked after the user changes
a model by hand, a tick that lies. With this definition a profile
saved from the current setup is in use at once, a hand change clears
the tick, and applying puts it back. Two identical profiles are both
ticked; the button names the first.
- GUI: /api/state carries inUse. The panel's button names the profile
in use (a pop-up button showing what is picked), else counts them as
before; its chip gets a check mark and aria-current, in panel and
window; the chip's tooltip and its details say "In use" (string
already in every language). CLI `magpie profiles` marks it, the TUI
notes "in use". Docs (reference, start en/zh/ja) say so.
What was run:
- go test ./internal/profile (new TestProfileInUse: save, hand change,
apply, hidden model list, library instructions, absent agents) and
./internal/gui (new TestStateProfileInUse through the HTTP handler),
scratch HOME. Broken by hand: field compare, ModelListsHeld,
library.Holds and state's InUse each turned a test red.
- go test -tags nogui ./... in a scratch HOME (the four slow packages
rerun with -timeout 40m under load ~45).
- GUI: new profile-in-use.test.cjs (reporter's steps in the panel at
360px, every language, plus the window) and panel-profiles,
profile-confirm, profile-details, old-webkit, i18n-keys, gui-zh-tw,
gui-ja, gui-de in chromium and webkit: all pass. Old app.js fails the
new test.
- Real CLI in a sandbox HOME with a codex config: save/use/profiles
show the mark, and it goes after a hand edit.
- gofmt; go vet darwin, linux (nogui), windows.
Not tried: the real tray app with real agents, and Windows/Linux at
runtime.
|
||
|
|
f5dd4d604e |
gui: the Linux app's sidebar button switches the layout at once, no view transition, which WebKitGTK with compositing off crashed in (depravity_wings on X)
Since
|
||
|
|
8f2a314cf9 |
gateway: a ChatGPT account's turn goes zstd-compressed, as Codex's own client sends it (ylorn on X)
ylorn (X, v0.1.1202) sent a text-only gpt-6-luna turn of 1,100,224 bytes
straight to chatgpt.com/backend-api/codex/responses. Sent plain it got 503.
The same turn zstd-compressed (259 B) got 200. magpie decodes Codex's
inbound zstd and sent the backend plain JSON, so the turn got 503 through
magpie too.
What Codex does (openai/codex a9b08151, 2026-10-11):
- codex-rs/core/src/client.rs:1704-1712 responses_request_compression:
Zstd only with the enable_request_compression feature, a sign-in that
uses_codex_backend, and the OpenAI provider.
- client.rs:1780: used for the POST /responses stream only.
/responses/compact and /models go plain.
- codex-rs/features/src/lib.rs:1411-1416: the feature is Stable and on by
default.
- codex-rs/protocol/src/auth.rs:54-63: uses_codex_backend is true for the
ChatGPT sign-ins and false for ApiKey and Bedrock.
- codex-rs/codex-api/src/endpoint/responses.rs:130-147 sets it for
/responses.
- codex-rs/http-client/src/request.rs:196-217 compresses with
zstd encode_all at level 3, sets Content-Encoding: zstd, and never
compresses twice.
What changed:
- provider.CodexCompressed compresses a body sent to CodexBase/responses
with klauspost zstd, already a dependency. It uses SpeedDefault (about
level 3) and no frame checksum, like libzstd's default. It sets
Content-Encoding, Body, GetBody and ContentLength to the compressed
bytes, and returns the wire size.
- It is called once the body is final and signed: in forwardOnce for a
codex account, in codexUpstreamOn (the relay) on every try (so a try
again or a body without an unreadable image is compressed afresh), and
in warmCodex.
- Unchanged: /responses/compact, an sk- key's requests to api.openai.com,
every key provider (even one at the same URL), and a body already
encoded.
- The plain body is still what magpie keeps, masks, traces and shows.
- codexDropped (#1628, a2b96139c/8029d98b7) judges "large request" by the
bytes sent on the wire. A text turn that compresses to a few KB and is
reset is a small request's 503, not a "MiB" hint asked again. A
screenshot's random bytes stay past 1 MiB, and those are still asked
again.
- The gateway and provider TestMains leave turns plain
(CodexZstdForTests), since their fake backends read the body as JSON.
The new tests turn it on.
- TestAsksOwnBackendAgreesWithTheGatewayDispatch read any call whose sixth
letter is upper case (CodexCompressed) as a serveX dispatch. It now
needs the "serve" prefix. Removing "kiro" from asksOwnBackend still
turns it red.
- docs/subsystems/gateway-routing.md: the "sent plain JSON" line now names
this exception.
Tests: internal/gateway/codex_zstd_test.go covers the accounts loop, the
relay (inbound zstd and plain), a try again after a drop, compact and an
API key plain, a key provider at the same URL plain, and a reset judged by
wire bytes. internal/provider/codex_zstd_test.go covers the round trip,
GetBody, Content-Length and the URLs left alone. Broken by hand, each went
red:
- no compression in forwardOnce: Account and AskedAgain
- no compression in the relay: Relayed, AskedAgain and JudgedByBytes
- no account guard: KeyProviderTurnStaysPlain
- compact compressed: CompactAndAPIKeyStayPlain
- the drop judged by len(body): JudgedByTheBytesSent
Real account (the owner's ChatGPT sign-in, gpt-6-luna, 1,100,279 B
text-only body, 391 B zstd):
- Direct to chatgpt.com, twice: plain 200/200, zstd 200/200. ylorn's 503
did NOT reproduce from here (
|
||
|
|
e21ea07e47 |
gui: a client in the Usage page's Agents list can be hidden from it, and shown again from the line under it (ikunbots on X)
ikunbots asked to hide curl, Go-http-client, python-httpx and other clients
from the Agents list beside the agents they actually use.
What changed:
- Each Agents row has a "…" button that shows on hover (always on touch) and
opens the app's row menu (openRowMenu) with "Hide from this list".
Right-clicking the row opens the same menu. No native select.
- The hidden ids are saved by client id in settings.UsageAgentsHidden,
trimmed and deduped. They go through POST /api/usage/arrange
(agentsHidden), which changes only that field, and the Settings save
carries the field over.
- Hiding is display only. The ledger keeps the calls, and the totals, the
chart and every share still count them.
- When anything is hidden, a quiet "3 hidden" / "已隐藏 3 个" line sits under
the list. It opens the hidden rows, dimmed, each with "Unhide" / "取消隐藏".
No click scrolls the page: the scroll guard holds the clicked line in place.
- Where a pointer hovers, the "…" takes no room. Its margins give back its
width and gap, so a row at rest is laid out as on main (mobile-web's
desktop comparison is the same). It shows over the end of the share bar.
On phones (body.web) it has its own grid column.
- Translated into zh, zh-TW, ja and de. docs/subsystems/gui-shell.md
describes it.
What was run, in a worktree off origin/main:
- gofmt -l: clean.
- go build ./... and go vet ./...: pass.
- GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./...: pass.
- HOME=<scratch> go test -tags nogui ./...: 49 packages ok. Includes the new
TestUsageArrangeAgentsHidden, which covers saving, surviving a settings
save, narrowing and emptying.
- New usage-agents-hide.test.cjs: 32/32 in Chromium and WebKit. It covers
en, zh, zh-TW, ja and de at 1200, 560 and 390 (web). It hides by "…" and
by right-click, checks the POST body, unchanged totals and an unmoved
page, then unhides, reloads and checks the hidden rows persist.
- All 48 usage, panel-arrange and click-scroll GUI files: 503/503.
old-webkit and mobile-web: pass.
- Full GUI suite (6489 tests, concurrency 5): the reds outside this change
fail the same when run alone on origin/main
|