5daba8337be1c5d64cade5bbbe4f3391c451bf8e
1620
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
b0174e7615 |
usage: a ChatGPT card says why its allowance can't be read, and a ChatGPT API account says where it shows
hmy on Discord: five ChatGPT accounts each said only "暂时无法获取额度"
(Allowance unavailable). danzi002 on Discord: accounts added through the
API never show usage, ones added as ChatGPT do.
What changed:
- Codex's usage read (codexWindows) now words its failure
(codex_usage_words.go): a Cloudflare challenge names the proxy/VPN
address as the usual cause; any other HTTP answer names its status and
what ChatGPT said; a network error says chatgpt.com couldn't be
reached; a reply magpie can't decode says so. The error still unwraps
to accountStatusError, so expiry and passing logic is unchanged.
- A ChatGPT API account (chatgpt-api) was read as a Codex account: a
saved one said "chatgpt-api accounts can't be used side by side", the
one in use read Codex's own sign-in ("Codex is signed out", or another
account's allowance under its name). OpenAI's API tells no plan usage,
so its row now says so, names chatgpt.com/settings/usage (SeeAt) and
says the same account added as ChatGPT shows it here.
- GUI quotaError translates each of these (en, zh, zh-TW, ja, de), and
"not read yet" (errNotAsked) gets its own words. The generic fallback
now reads "Allowance unavailable — hover for why"; the row's tooltip
has always been the raw error. Comments in app.js were shortened to
stay under TestCoreScriptBudget, which is not raised.
- docs/subsystems/providers-accounts.md describes the words.
Endpoint: the real wham/usage read of the owner's accounts in a sandbox
HOME copy (read-only, ~/.codex untouched) answered 200 and parsed, so
the endpoint itself is not broken; the "error decoding response body"
work is another session's and is not touched here.
Run (on mote; provider and gui again at the pushed head, rebased on
18c69aa46;
|
||
|
|
18c69aa467 |
gui: Windows reads the screens with one callback, not one per display change (1111_13879)
1111_13879 on Discord: on Windows the app died after a few hours with
"fatal error: too many callback functions", taking the gateway with it
(clients got connection refused). Five dumps all ended in
w32.GetAllScreens -> syscall.NewCallback -> runtime.compileCallback,
from Wails' WM_DISPLAYCHANGE handling.
Wails (v3.0.0-beta.24 here; v3.1.0 and v3.2.0-nightly.20261101 are the
same) reads the screens again on every WM_DISPLAYCHANGE, and on
WM_SETTINGCHANGE for SPI_SETWORKAREA, through w32.GetAllScreens, which
passes a fresh closure to syscall.NewCallback each call. Go never frees
a callback and throws past about 2000, unrecoverably.
magpie now sets WndProcInterceptor (screensWndProc): on Wails' hidden
main-thread window ("__wails_hidden_mainthread") it takes those two
messages before Wails does, enumerates the monitors with one callback
made once at package level (allScreens), builds the screens exactly as
Wails' processAndCacheScreens does (wailsScreen) and hands them to
Screen.LayoutScreens, then answers as Wails would (DefWindowProc for
WM_DISPLAYCHANGE, 0 for WM_SETTINGCHANGE). Other windows and messages go
on to Wails. Wails' one read at start-up is the only per-call callback
left. No go.mod change: no newer Wails fixes it, and magpie has no fork.
Other per-call NewCallbacks in Wails' Windows code: w32.EnumChildWindows
and w32.SetWindowsHookEx, neither called by Wails or magpie. WndProc
classes are registered once; the WebView2 COM vtables are package-level.
magpie's own (internal/agent apprestart) is already made once.
Run at this tree (base e156fdd03; origin/main since adds only
|
||
|
|
2251ca1ce9 |
providers: a ChatGPT account's row says when its paid plan ends (danzi002)
danzi002 on Discord (#general, 11-02): 「codex 账号什么是可以加一个 plus 账号到期时间」. The Usage page, the tray panel, the TUI and `magpie quota` have shown "Until …" for the signed-in Codex account since |
||
|
|
5f0a84a003 |
agent: Air in JetBrains IDEs gets magpie's Magpie agent in ~/.jetbrains/acp.json (Jumy on Discord)
Jumy asked for the "air-plugin" new in IntelliJ IDEA 2026.3 (Settings ›
AI › Air). magpie's air agent wrote the Air app's acp.json, in
~/Library/Application Support/JetBrains/Air, which the IDE plugin never
reads: the plugin (com.intellij.air, air-plugin-262.8665.521-mac-arm64
from JetBrains Marketplace) loads its custom ACP agents in
AcpConfigurationLoader (intellij.air.backend.acp.runtime) from
user.home/.jetbrains/acp.json on every system, the file AI Assistant's
custom agents use too; AgentServerConfig takes command, args, env,
use_idea_mcp and use_custom_mcp. The standalone app (Air-262.1037.14,
Fleet-based) reads acp.json from its own configs folder
(genericAcpConfigPath), so the two are separate files.
Air's own agents have no base URL: JetBrains AI, the agent's own login,
or an Anthropic, OpenAI, Gemini or OpenRouter key under AI › Air ›
Accounts. So the IDE gets the same route as the app: a new air-ide agent
("Air (JetBrains IDEs)", aliases air-plugin, air-in-ides) writes a
Magpie entry (opencode acp, OPENCODE_CONFIG naming magpie-opencode.json
beside acp.json) and nothing else; the user's agents and
default_mcp_settings stay, and disconnecting takes out that entry and
that file. air and air-ide share airAt. air-ide shows for an IDE config
folder of 2026.2 or later (the plugin is bundled from 2026.3), or with
its entry already in acp.json. Notice in en, zh, zh-TW, ja, de; README,
reference and agent-wiring rows.
Run at this head (rebased on
|
||
|
|
ed978e560f |
gui: the Quit question's Don't ask again, and Settings › General › Ask before quitting (zhujiu on Discord)
zhujiu (Discord #feedback) asked for a 不再提示 on the question a tray Quit asks while agents go through magpie ( |
||
|
|
b58669eb09 |
gateway: an overload told in Codex's stream says server_is_overloaded (wjh66)
wjh66 on Discord (Windows, v0.1.2710, Codex on the ChatGPT sign-in, gpt-6.1-sol): every turn showed "reconnecting 5/5", and app.log had the backend's "Our servers are currently overloaded" again and again. With one ChatGPT account, magpie asks an overloaded turn again (lastRetries) and keeps Codex alive past keepHeldAfter with the stream's 200 and comments. When the retries ran out, the backend's busy status (529, or a 503 saying overloaded) went to Codex in that stream as response.failed with code server_error. Codex reads server_error as Retryable (codex-rs codex-api sse/responses_error.rs) and sent the turn five more times, each one asked three times by magpie: 18 asks of an overloaded model, then the last error alone. The backend itself says an overload in a stream as server_is_overloaded (#1418), which Codex reads as ServerOverloaded: "Selected model is at capacity. Please try a different model.", without the reconnects. streamError now gives a Responses client server_is_overloaded when the status is 529, or a 5xx whose words say overloaded (saidOverloaded). Other failures keep server_error, which Codex retries. A routing group or the codex subscription's fallbacks still take an overload before any of this, as before. This does not explain the earlier "error decoding response body". Codex says that only when the body of a 2xx fails to read. magpie's streams read clean over real TCP in every overload shape tried (see |
||
|
|
58a833f254 |
mcp router: initialize says what each server behind it is and does
packinggoodsllc_07668 (Discord) runs magpies that only share MCP servers,
and an agent given several routers knew each by its name alone. A
router's initialize instructions now describe what it holds, built from
what the servers themselves say; no model writes any of it.
- After the "Tools of …" first line (and the router's name sentence when
it has one), a line per server: "- name (its serverInfo.title): what it
is for. Tools: tool (first clause of its description), …". The tools
the Library turned off are left out; another router's "[name] " prefix
is dropped. A line too long for its share says tools by name, then as
many as fit and "and N more". The whole is at most 2000 characters
(hubSayMax), the closing text kept whole.
- What a server is for: the market's words as before, else its
serverInfo.description, else its instructions' first line (saysOf).
Another magpie's "Tools of a (…), b." is said with "Tools of" once.
- What a server said and listed is kept in settings.Dir()/
mcp-hub-servers.json (not the synced library folder), keyed by name and
a hash of hubKey, written via temp+rename only on change, pruned of
servers gone. A router started again describes its servers without
starting any; one added or edited since is listed by initialize, which
waits up to 5s for it.
- Pi's hub description (hubAbouts) uses the server's own words too.
Agents, from their installed source (research, not run): Claude Code
shows instructions (4096 chars), Codex as the namespace description,
OpenCode, Gemini CLI (trusted folders only), Qwen Code, Pi (first line in
the prompt); Kimi CLI ignores them. None shows serverInfo.title.
Run at this tree (mote):
- go test -tags nogui ./internal/library: ok (116s)
- go test ./internal/gateway -run 'Hub|MCP|Roots|OversizedBody|
ReadOnlyKeyEveryRoute|FileURI|ImageModel': ok
- GOOS=linux and GOOS=windows go vet internal/gateway internal/library;
go vet internal/gui internal/cli; go build ./...; gofmt -l: clean
- New: TestHubInstructionsDescribeServers, TestHubDescriptionsOutlive
ARestart (library); TestHubAboutBounded, TestHubServerLine,
TestHubClauseBrackets, TestHubLineOfARouter (gateway).
- Red on the old code: TestHubInstructionsDescribeServers at
|
||
|
|
a00b53f7b1 |
gateway: a plugin's fetch is told the session the agent named and its Claude Code subagent (plugins#620)
magpie builds each plugin's request itself, so the agent's own headers (x-claude-code-session-id, x-claude-code-agent-id, x-opencode-session) never reached a plugin. Devin's cache keepalive therefore keyed Claude Code Auto's permission check by its text alone, and on the translated path magpie merges consecutive same-role messages, so a check whose history grew changed its first message in the middle and got a new key: its older pings kept running beside the new ones (zelong77, plugins#620, still seen on devin 0.1.33). forwardOnce now sets X-Magpie-Session (sessionOf: the caller's own X-Magpie-Session, else the agent's session header) and X-Magpie-Subagent (Claude Code's agent id) on a plugin's request, after deleting any the caller sent, and host.js's MAGPIE_ONLY list strips both from what the plugin sends on, so the vendor never gets them. A request naming no session has neither. devin 0.1.34 keys its pings by them. docs/subsystems/provider-plugins.md says so. Run at origin/main |
||
|
|
9f641daeab |
codex: a turn stuck on a used-up account no longer holds the Codex app's Send grey after a switch by hand or magpie's takeover (xiaoq6285)
xiaoq6285 on Discord (v0.1.2700): Codex on an official ChatGPT account ran out of quota, and after switching to another account or provider in magpie, the Codex app's Send button stayed grey. magpie has no chat composer of its own; the button is the Codex app's, which greys Send for every model while the app-server it runs is on a ChatGPT account the app holds. magpie lifts that by restarting the app's app-server (codexAppStep), but never while a Codex turn is open in its sessions, for up to codexTurnWindow (30m). When quota runs out mid-turn the turn is left open, so the restart, and the grey, waited. |
||
|
|
52195b6b07 |
backup: the setup is backed up into a folder by itself, and any version put back (jwaitq)
jwaitq (Discord) nearly lost their setup on Windows and got it back only
from a Downloads\data folder they happened to have. They asked for
backups made on a schedule into a folder, with a version to go back to.
What changed
- internal/backup/auto.go: Settings › Sync › "Back up by itself". On by
default: once every 24 hours, the last 7 kept, into
<config dir>/auto-backups. Interval (1 hour, 6 hours, 1 day, 1 week, or Off), keep (3,
7, 14, 30) and the folder are the user's to change. autobackup.json holds
only what the user set; a field they never touched follows the default,
so a later default never overrides their own value. An unreadable
autobackup.json makes no backup and says so, never "off" or a default.
- What goes in is the export without API keys (backup.Collect(false)),
the same bundle and the same handling of secrets as the manual no-keys
export, with the proxy URL blanked as well (it can carry a password).
Not sealed, so it opens without a passphrase. Files are 0600 in a 0700
folder, written to a temp file, fsynced and renamed, and listed only
when they parse and their sha256 matches, so a half-written file is
never a version. A temp file over an hour old is removed.
- A backup is made only when the setup changed since the newest one, so
a quiet week keeps a week of versions, not seven copies of one day.
The loop runs inside the gateway (WhileServing), first 2 minutes after
launch, then every 10 minutes it checks whether one is due by the
newest file's time, so a restart doesn't make an extra one.
- Restore puts a version back the way Import does (additive), after
first writing the current setup as a "-restore" backup. If that
backup can't be written, nothing is put back. The row says when the
undo copy was made, and restoring it undoes the restore. "-restore"
backups are pruned past Keep like the rest.
- internal/gui/backup.go: GET /api/autobackup and POST
/api/autobackup/{set,choose,now,reveal,restore}. internal/cli
settings_parity_test names the two routes in notYet (S2).
- GUI: autobackup.js, imported lazily when Sync is drawn, so app.js and
the core budget are not raised. The app's own segmented controls and
menus (no <select>), the folder row with Change…/Show/Default, Back up
now, and the versions list with Restore behind a confirm. Strings in
en, zh, zh-TW, ja, de (22 keys each).
- docs/subsystems/sync-backup.md: "Backups by themselves".
- Tests touched beside it: sync-sign-in's "last row" is now the last of
Sync's own rows (the new rows come after Import); usage-computers
scrolls its tick to the middle, since in WebKit the sticky Settings
tabs covered it at the page's end; agent-prefs waits for Settings'
first draw instead of reading the static index.html's rows.
Tests
- internal/backup/auto_test.go: TestAutoBackupOnSchedule (injected
clock, no sleeps), TestAutoBackupAfterRestartWaits,
TestAutoBackupOffOrUnreadable, TestAutoBackupPrunes,
TestAutoBackupHoldsNoSecrets, TestAutoRestoreRoundTripAndUndo,
TestAutoRestoreNeedsTheBackupFirst, TestAutoHalfWrittenNeverListed.
- internal/gui/backup_test.go: TestAutoBackupRoutes.
- internal/gui/tests/auto-backup.test.cjs: chromium and webkit, 1100px
and 420px, en/zh/zh-TW/ja/de; plus "Sync redrawn while the backups are
being read still shows them", which found a real bug (the rows were
dropped when Sync redrew during the first read) and is red on the old
code.
Broken by hand, each test red, then put back: dedup off (OnSchedule),
interval check off (OnSchedule, AfterRestartWaits), keep+1
(Prunes), proxy left in (HoldsNoSecrets), no backup before a restore
(RoundTripAndUndo), restore going on after a failed backup
(NeedsTheBackupFirst), unreadable config read as default
(OffOrUnreadable), checksum not checked (HalfWrittenNeverListed),
os.Rename without the temp step (HalfWrittenNeverListed). And the
redraw fix, reverted: the redraw GUI test red in both engines.
Run on mote (macOS 27) at this change on c9af34446; rebased then onto
|
||
|
|
70b96126ef |
gui: a provider's editor grows with a large window (5046312 on Discord)
5046312 on Discord: in a large, wide window the provider editor (Codex's, with its accounts, meters, cap pill, switches and many option rows) stayed a 600px box in the middle, cramped, and asked for a better layout or a resizable sheet. drawEditor's editor now carries `roomy`, and openModal copies it onto #modal's dialog as it already did `wide`. `.modal .dialog.roomy` is min(max(600px, 56vw), 880px, 100%): 600 up to a 1071px window, then 56% of it, at most 880, as a Mac sheet takes the room its content needs. Its height already follows the content up to the window, so no new height rule. A question that takes the editor's place in the same dialog (Sign out's forget-ask, Disconnect, ...) drops the class and stays 600. No drag handle. The rows themselves are unchanged. Every provider editor (subscriptions, keys, new providers, presets) goes through drawEditor. The core-script budget is not raised (7 bytes under). Sizes (chromium, en; width x height of the dialog): window before after 2560x1440 600 x 1228 880 x 1038.5 1440x900 600 x 810 806.4 x 810 1100x800 600 616 1024x768 600 600 560x420 512 512 390 web 374 374 Run at the pushed tree (this commit on 019b308f1; the whole-suite runs below at earlier bases, editor-roomy, i18n-keys and the budget tests again at |
||
|
|
1829cd52ff |
sessions: a poll while a session grows makes only the rows it shows
VeryBTC on X (tweet 2117104179454091396) reported RSS that rises and
stays up while the window is open and a long-context session is active.
In that case every Sessions poll sees a changed file and rebuilds the
list. That rebuild copied every gateway-only session three times
(GatewaySessions, listedGateway, gatewayListed) and made each one a
Session row before EachMerged stopped at its 5000-row limit. It also
made every Claude Code file's path and key again.
- usage.EachGatewaySession walks the projection without copying it.
gui's listedExternal stops at the list's limit and skips hidden
sessions and sessions without an agent or id, as listedGateway did.
- sessions.EachMerged sorts indexes and makes a row only when the merge
reaches it. The order is unchanged: newest first, stable on ties.
- listCCFiles reuses the last listing's path and key strings while a
folder lists the same names. One file new or gone is stepped over.
This holds ~32 B per file (~480 KB at 15k files), and the strings are
shared with the listing it already held.
- page_memory.go's ~330 MB comment now has current numbers.
gateway-sessions.md describes the lazy rows.
Per poll, on mote (go test probe through the real /api/sessions
handler, TotalAlloc):
15k sessions x 10 turns, 400k ledger rows
after a session file grows 150.6 MB, 201 ms -> 109.9 MB, 170 ms
unchanged (warm) 17.2 MB -> 12.0 MB
3k sessions x 40 turns, 150k rows (no gateway-only rows past the cap)
after a session file grows 31.3 MB -> 29.6 MB
unchanged (warm) 4.5 MB -> 3.4 MB
/api/usage is unchanged at 0.4 MB.
Tests:
- TestSessionsListMakesOnlyTheGatewayRowsItShows (gui) uses 3 natives,
6000 gateway sessions in tied pairs, one hidden and one carrying a
native's id. At limits 5, 40 and 6010, and with no limit, the rows
equal the old pipeline's (listedGateway + gatewayListed +
MergeExternal) after the JSON round trip. A grown native comes first
with its new Last. The poll's allocation stays under 6000 rows' size.
- TestEachMergedMakesOnlyTheRowsItReaches (sessions): 15000 externals
and 20 rows give MergeExternal's first 20, with allocation under a
tenth of the rows.
- TestCCListingKeepsItsNames (sessions): a second listing of 3000 files
is equal to the first, in at most 3n mallocs. A file added, files
removed, and a folder gone with another new each list as a fresh
listing does. Another agent's keys keep their own prefix.
Broken by hand, each red:
- EachMerged building every row first: 8.8 MB, the sessions test fails.
- The GUI handler back on the listedGateway(GatewaySessions) loop, with
the lazy merge kept: 13.7 MB, the gui test fails.
- The gui test on origin/main's code: 23 MB, fails.
- The ccNames reuse turned off: 12197 mallocs, the listing test fails.
Run on mote (mote-run) at 73a1b8769, rebased on origin/main
|
||
|
|
07f4d46c52 |
gateway: a Codex reply that ends early, and any failed call, is written to app.log
wjh66 (Discord, Windows, v0.1.2696) saw Codex on a ChatGPT sign-in with
gpt-6.1-sol show "reconnecting 5/5" and then `error decoding response
body`, and app.log around 15:27 held nothing about it. That text is
reqwest's for any read error in a body (a reset, a chunk cut short, a
timeout), so it says the connection broke mid-reply, not which side broke
it. The cause is not found; this change only makes the next report carry
evidence.
- record logs a failed call (status >= 400 or an error) when debug is off,
once a minute per agent/provider/model/status/error, counting repeats.
- codexUpstream logs a reply that ended before its last event (or a
non-SSE body cut by a read or write error): bytes passed on, whether
OpenAI's stream failed or ended, and whether Codex went away, a write
to it failed, or it was told response.failed.
- Shutdown with requests in flight says they are cut (Windows has no
handover, so a quit or update cuts streams after shortDrain).
Run at this head (rebased on 4bd0d6f38; the new and stream-cut tests and vet run again after the rebase on mote and Windows, the full gateway run on Linux was at
|
||
|
|
02727188a4 |
gateway: a Zen free model asked on OpenCode Go is asked at Zen's free tier, else the refusal says where it is served (51bit.eth)
51bit.eth (Discord #general) ran Claude Code through magpie with OpenCode's free models on a provider named OpenCode Go (opencode.ai/zen/go). Every request failed "400 OpenCode Go: Upstream request failed: Model is unavailable.", and a header of their own (x-opencode-session) didn't help. The same models worked in OpenCode. Cause: OpenCode's two gateways serve different free models. Zen's free tier (/zen, the public key) serves the -free models and big-pickle; Go (/zen/go, a Go key) serves only beam-free and iceman-contributor-free (its /models on 2026-11-02). Go answers any model it doesn't serve 400 "Model is unavailable." before it reads the key. A user ends up with a Zen free model under Go by typing it, or because a Go key /models refuses makes the provider list models.dev's opencode-go catalog, which names free models Go doesn't serve (#4900, not changed here). What changed: - provider.RetryOpenCodeFreeOnZen, called in forwardOnce for OpenCode URLs beside RetryZhipuCoding: a 400 "Model is unavailable" from Go for a model OpenCodeFree calls free is asked once more at Zen's free tier on the same API (openCodeGoToZenFree: /zen/go/v1/... and /inference/go/... to OpenCodeFreeURL's /inference/openai|anthropic), with the public key in Authorization (and x-api-key on Anthropic), never the user's Go key. Zen's 2xx is returned as is. - Refused at Zen too, Go's 400 keeps its words and adds what Zen said and where the model is served: under the OpenCode Zen provider, which needs no key. A model that isn't free isn't asked at Zen; its 400 says to pick one the OpenCode Go provider lists. - docs/subsystems/providers-accounts.md: a row beside the GLM Coding Plan one. Run (mote, through mote-run): - go test ./internal/provider -run 'OpenCode|Zen' and ./internal/gateway -run 'OpenCodeGo|ZenFree': ok, at the pushed head after the rebase too. - gofmt -l: clean. GOOS=linux and GOOS=windows go vet ./internal/provider ./internal/gateway: ok. - go test ./internal/provider -count=1 -timeout 45m: ok (113.9s). go test ./internal/gateway -count=1 -timeout 45m: one red, TestCodexPoolSaysTheClientsVersion, which is #4807 (open, red in full runs on mote; this change touches no Codex path). Output added there. - Real: a built magpie serve on mote, sandbox HOME, port 3591, an opencode-go provider with a made-up key, Claude Code-shaped /v1/messages: - deepseek-v4.1-flash-free (Zen's): Go 400, then asked at /inference/openai/v1/chat/completions with the public key; Zen answered 429 FreeUsageLimitError (#3491), and the message names both and the OpenCode Zen provider. - cat-jam-free (in the catalog, served by neither): Go 400, Zen 400, message says where. - glm-5.3 (Go's, paid): "Invalid credential" as before, Zen not asked. Broken by hand: - Retry call removed from forwardOnce: TestOpenCodeGoFreeModelAskedAtZen and TestOpenCodeGoUnavailableSaysWhere red (old message, one request). - Key swap removed: TestOpenCodeGoFreeModelAskedAtZen red, Zen asked with "Bearer sk-go-users-own". Not tried: - A working Go key (the owner's is expired), so beam-free on Go end to end is only the fake. - A Zen free reply end to end: from mote Zen's free tier answers 429 FreeUsageLimitError to magpie with the built-in OpenCode Zen provider too (#3491). - Gemini protocol: not asked at Zen (OpenCode has no Gemini free URL). |
||
|
|
4bd0d6f389 |
gateway: a provider whose model asks for a tool turn's thinking back, under a name that doesn't say DeepSeek, is asked again with it and sent it from then on (qisishiqi)
qisishiqi (Discord #help): a routing group fell from a rate-limited Codex subscription to "My Claude", an Anthropic-format endpoint, and the request failed 400 "My Claude: The `content[].thinking` in the thinking mode must be passed back to the API." That is DeepSeek's model refusing a tool loop continued without the thinking of its tool turn. magpie fills those turns (a space, or the turn's readable reasoning) only when the host or the model names DeepSeek (anthropicReplaysThinking, chatReplaysReasoning, #1462/#1611). A relay serving DeepSeek under another name, or a model the user named otherwise, got nothing, and Codex's sealed reasoning has no text to give. Now forward reads a 400 on Messages or Chat whose words are DeepSeek's (thinkingBackRefusal: `content[].thinking` / `reasoning_content` ... in the thinking mode must be passed back), and when filling the tool turns (withThinkingOnToolTurns / withReasoningOnToolTurns) changes the body, remembers the provider's model (unfit, thinkingBackNeeded) and asks once more; forwardOnce fills them for it from then on, every route alike. A provider that never asked is sent the conversation as before. Scoped to the vendor's refusal, not to every Anthropic endpoint. Checked against api.deepseek.com with the owner's key, 2026-11-02 (deepseek-flash, Messages and Chat): a tool turn of the loop being continued with no thinking is refused with exactly these words (the test fixtures are those bytes); a space thinking block or reasoning_content " " is taken; readable unsigned thinking is taken; finished tool turns and plain replies without thinking are taken, with or without tools; thinking disabled takes it all. So DeepSeek's docs' "even for turns without a tool call" is not enforced today, and the existing tool-turn rule stands. Sibling: the Chat side had the same name-only gate, and gets the same learned fill (TestReasoningBackLearnedBehindAnotherName). Responses (reasoning_text) is filled by model name on any host already. Run at this head on mote: - go test ./internal/gateway -count=1 -timeout 45m: every test ok but TestCodexPoolSaysTheClientsVersion, #4807 (red in a full run, passes alone; passed 5 of 5 alone here). Not touched by this change. - GOOS=linux and GOOS=windows go vet ./internal/gateway: ok. gofmt -l: clean. - New: TestThinkingBackRefusalRead (the live bytes and qisishiqi's literal error read; Responses' reasoning_text and a bound-signature refusal not), TestThinkingBackLearnedBehindAnotherName (Codex request mid loop, group: 429 on the Responses member, then "My Claude" with claude-sonnet-4-6 and relay-model: 200 on the second ask with a space thinking block first, next turn 200 on the first ask, another provider sent no thinking), TestReasoningBackLearnedBehindAnotherName. Broken by hand: with the retry in forward off, all three cases go red with qisishiqi's error ("400 after 1 calls ... My Claude: The `content[].thinking` ..."); with the learned fill in forwardOnce off, the second turn is refused again ("400 after 2 calls"). Not tried: qisishiqi's own provider (its host and model are unknown); a real relay in front of DeepSeek; a plugin provider's fetch path. |
||
|
|
f9595e7684 |
gateway: System One requests are kept in the request archive, and Routing says when the archive is on (wangb on Discord)
wangb on Discord: 「请求存档开启, 但是 systemone 的请求没有记录下来」. The Routing page then said "magpie 只保留最近 40 个请求的请求体和响应体… 要保留 每个请求的,请在「用量 › 请求」顶部打开「请求存档」", as if the archive were off. Why: only serve() made an archive wire (archiving). The two System One paths never reached it: - /v1/systemone, which an app sends (serveDecideTries, also used for a decision group), opened a Route but recorded no Call. It was in neither Recent calls nor the archive, so the Routing page could never open its bodies. - the question a routing group's Jev classifier asks for a turn (askJev / jevLevelled -> systemOne -> postDecide) only appended a usage row. What changed: - serveDecideTries captures its reply, makes the wire as serve does, names it on the Route from the start (Route.Archive), and records a Call (Route, status, error, fallbacks, usage, bodies) when it ends. So the call is in Recent calls and, with the archive on, in the archive. Its usage row carries Archive. - systemOne keeps the call magpie made itself through a new archiveOwn. It keeps the request as it went (method, path, the headers magpie signed it with, the body in the provider's shape) and the answer, with secrets scrubbed as for any call. Its "routing" usage row names the archive entry. postDecide became postDecideSent, which also returns the request it sent. archive's queueing moved into queueArchive, which both share. archiveID makes the name. - Routing's "Request and response" for a request in neither the ring nor the archive: with the archive on (gateway.archive.on in /api/providers) it says the archive is on and this request isn't in it (made while it was off, or not saved). It no longer says to turn the archive on. New string in zh, zh-TW, ja and de. - docs/subsystems/gui-shell.md says which calls are archived and which still aren't. Still not archived (unchanged): Codex's own backend (codexUpstreamOn), draw, embeddings and video side routes, and replies magpie writes itself (answeredHere). Masking makes no outgoing call. Chat classifiers and Codex titles to a model already go through serve and are archived. Run on mote at base |
||
|
|
a8d6a861a4 |
agent: Pi's codemode gets magpie's decision and image models (extensions/magpie.ts)
wangbinyq on Discord (#feedback) asked for magpie's System One and image
models in Pi's config, since Pi's codemode can call classifier and image
models (models.classify, models.generateImages; Pi docs/models.md "Use
classifier models").
Pi's models.json can't hold them: its model entries have no type, so
every one is a chat model (ModelDefinitionSchema, modelFromJson in
provider-composer.ts, Pi 1.4.0 / c9f4c7b9f). A custom provider's
classifier and image models come from an extension alone
(docs/custom-provider.md, "Register mixed-operation models"). So while
models.json has providers.magpie, magpie now writes
extensions/magpie.ts in Pi's agent folder, which Pi loads by itself:
- provider magpie-systemone: provider.OfferedDeciders, labelled as
/v1/models labels them, on Pi's own typesafe-system-one client
(builtinProviders' typesafe .classify), which posts the TypeSafe
System One body to the gateway's /v1/systemone. Text input only.
- provider magpie-images: gateway.ImageModels (new; mediaModels with
labels, the Settings > Images default first, none while it is off),
drawn by POST /v1/images/generations with the input's images as data
URLs, b64_json back as image blocks.
Separate ids because an extension's models replace those models.json
gives the same provider id: registered as "magpie", Pi 1.4.0 listed no
chat models at all ("No models available").
The file is rewritten at each Sync and on a pick, and removed with
providers.magpie (pick of none, Disconnect, a Sync that finds it gone).
A magpie.ts whose first line isn't magpie's mark is the user's and is
never written over or removed. Pi only, not OmO or Prime Agent. On a Pi
older than its classifier models the extension returns without
registering anything. Codemode itself is not turned on: that is the
user's defaultTools.
Run at the pushed head (on mote):
- At
|
||
|
|
1aca55909f |
gateway keys: a key given a model is not given a routing group of it the user never handed out (kautism)
kautism on Discord: a gateway key held to gemini 3.8 alone was shown, and could use, a routing group the user made of gemini 3.8 alone, though the user never gave the key that group. groupAllowed let a key use any group whose every member it may use (the #882 rule), so the group leaked into /v1/models and every route that asks it. - key_models.go groupAllowed, the one check every route asks (the model lists' entryAllowed, serve on every API, countHeld, embeddings, images, videos, decision groups, a subagent's and masking's route): a group of the user's own is a key's only when the key names it (group/<id> or group/*). A group magpie found (auto/<model>, one model several providers serve; foundGroup) still passes when the key may use every member, as it is that model. A key that names accounts and no model (Linka, access.HeldModels gives it "<provider>/*") still may use a group of those providers' models alone, as it may every such model: access.Identity.AccountModels says so, for an issued key too. - keyGroupFor: a bare name that is both a group of the user's the key may not use and a model it may use is that model for the key (a group the user called "Gemini 3.8", id gemini-3-8, would otherwise have turned the key's bare gemini-3.8 into a 403). serve's grouped and countHeld use it. - Decision models (v0.1.2681) unchanged: a group the key names still asks its own Jev; TestGatewayKeyHeldToAGroupKeepsItsDecider passes. - A group named inside one the key doesn't name no longer makes the outer one the key's (TestGatewayKeyModelsNameAGroup updated); the key names the outer group to use it. - docs/reference.md and gateway-routing.md say so. TestGatewayKeyGivenAModelIsNotGivenItsGroup is the reporter's case: a key given google/gemini-3.8 alone, a group "Only 3.8" and one "Gemini 3.8" of that model alone. Neither is listed in /v1/models nor found at /v1/models/{id}; each is refused on chat completions, messages and count_tokens, by id and by name; the model is served by id and bare; a found group of two providers' gemini-3.8 is still listed and served to a key given both; a key naming group/only-38 is given it. TestGatewayKeyModelsHoldAKey, TestKeyListSeesChangesNextRequest updated from the old rule. Broken by hand: groupAllowed back to the old rule: the new test, TestGatewayKeyModelsHoldAKey and TestGatewayKeyModelsNameAGroup red. The bare-name fallback off: the new test red (chat gemini-3.8 403). The accounts-only exception off: TestGatewayKeyAccountsOnlyHoldTheModels red. Run on mote at this commit (rebased on origin/main |
||
|
|
1747559d02 |
plugin pages: name the scheme in a browser's policy, and the service's 'self' (#4198)
In `magpie web`, iOS Safari (18.7) loaded none of a plugin page's scripts: pagePolicy named the page's folder as a scheme-less host-source (host/_magpie/plugin/<tok>/), a sandboxed frame's origin is opaque, and that WebKit took the missing scheme from it, so the bridge never said hello and the page was broken at 10s (orinsid; YangHonghang on v0.1.2681, young02036 on Discord). - pagePolicy: a browser's policy now names the folder under both https:// and http:// (ownSources). Behind nginx or Cloudflare TLS ends before magpie and nothing magpie trusts says which scheme the page came over, so X-Forwarded-Proto is not read; both name the same host, port and folder, and an https page can't load http:// files anyway. The desktop window keeps its own transport alone (wails://, http:// on Windows, #2501). - The second layer (YangHonghang): a page's local service sends its own policy, `connect-src 'self'`, and what it sends runs under magpie's `sandbox allow-scripts`. In WebKit, 'self' there didn't match the service page's own fetch of api/x. servePageService now names the service's root (/_magpie/plugin/<tok>/_magpie/service/) under both schemes after each 'self' in a CSP header the service sends, plus ws:// and wss:// in connect-src and default-src (serviceSelf). 'self' stays, so nothing allowed before is taken away. A <meta> policy isn't rewritten; the plugin docs (en, zh, ja) say to write whole sources. Run at f0a723d4c's tree (rebased on |
||
|
|
b4a9cd8db5 |
codex: a tool name the ChatGPT backend refuses goes as one it takes, and comes back as the agent's
wing3556 on Discord (11-02): a compaction through a Codex account failed 400 "Codex: Invalid response.create payload: Invalid 'input[83].name': string does not match pattern. Expected a string that matches the pattern '^[a-zA-Z0-9_.-]+\z'." The ChatGPT backend checks every tool name in a request, a call's in input as well as a tool's in tools, and refuses the whole request when one fails. A conversation can hold a call by such a name: a model another provider served wrote one with a space, a colon or non-ASCII in it, and the agent kept it beside its "no such tool" answer. Every request that replayed it, the compaction above all, then failed on Codex. Nothing on the way checked: buildResponses copies a call's name as it is, and redaction keeps names as written. What changed: - provider.CodexToolName: a valid name stays as it is. Otherwise each refused byte becomes "_", the result is cut to 55 and gets "_" plus 8 hex of its sha256, so it is the same on every request and two names never meet. CodexToolNames applies it to tools (namespace children too), function_call/custom_tool_call items, additional_tools and tool_search_output items, and tool_choice. A body with no bad name goes byte for byte. - It runs where every request to the ChatGPT backend passes: codexBody (an account's, translated or relayed) and codexUpstreamOn (Codex's own sign-in, /responses and /responses/compact), beside DeclareSearch. - A tool the agent declared under such a name is called back by its own name: translated replies through decoderFor (now given the request's tools; codexNamesBack), relayed Responses replies through nsTidy's new back map (codexRenamedIn). - docs/subsystems/gateway-routing.md says so beside #1270's paragraph. Not covered: namespaces, the OpenAI API (whose pattern has no "." and a 64 limit), Azure and Copilot Responses, filed as #4875. Run on mote at this head: - TestCodexToolNamesTheBackendTakes and TestCodexToolNamesKeepValid pass. The fake backend refuses a bad name with the reporter's 400 word for word; the test covers Claude Code's compaction on /v1/messages with four bad history names (sent twice, byte-equal), Chat with a declared "search:web" called back by that name, Responses relayed the same, and Codex's own /backend-api/codex/responses. - go test ./internal/provider ./internal/gateway (-timeout 45m): provider ok; gateway ok but TestCodexPoolSaysTheClientsVersion, the red already filed as #4807 (full package run only, another test's Codex identity reaches it); it passes alone at this head. - go vet ./... (darwin) and GOOS=linux/windows CGO_ENABLED=0 go vet -tags nogui ./...: ok. gofmt -l: clean. Broken by hand: - codexBody hook off: compaction red with the reporter's 400. - codexUpstreamOn hook off, decoder restore off, passthrough restore off (together): the codex, chat and responses cases each red. Not tried: wing3556's real conversation (we don't have its bytes, and the agent is unknown; Claude Code is likely). No real ChatGPT account was asked with a bad name, so whether the real backend also limits length is unknown. |
||
|
|
e7185daebe |
claude: a failed interactive read says why in app.log, and names the trust question (#4830)
mydosu (#4830) found nothing in app.log to say why every /usage read and
test of a saved account failed, and the card's reason, "showed no
prompt", said nothing of the trust question Claude Code was waiting on.
- claudetui: when the helper's deadline comes while Claude Code shows
"trust this folder", the reason is "Claude Code asked whether to trust
<folder>, not answered in the 16.8s its caller waits for it: <screen>".
Any other screen keeps "showed no prompt".
- gateway: askClaudeTUI and claudeUsageTUI log a failure to app.log
(logOneOff): "claude: a /usage read of saved account <dir> failed: ...",
with the helper's whole reason on one line, which the card clips to 300
bytes. The home folder and any /Users/<name>, /home/<name> or
C:\Users\<name> become ~, secrets go through redact.Scrub, and past
800 bytes the line keeps the first 300 and the last 500, so the end of
the last screen stays.
- docs/subsystems/claude-subscription-bridge.md says both.
Run at this head (mote, rebased on origin/main; the gateway set re-run
with Upstream|Unsent|Routing added after the rebase): gofmt -l clean; go vet for claudetui and
gateway, and GOOS=linux and GOOS=windows go vet for claudetui, gateway
and provider: ok. go test -count=1 -timeout 45m ./internal/claudetui
./internal/provider: ok. ./internal/gateway -run
'Claude|TUI|Usage|Warm|Ask|Trust|Subscription|Bridge|OneOff': ok.
Windows (win-run): ./internal/claudetui ran with the new trust_unanswered
case passing through ConPTY; TestShimFirstMessageWaitsForTools and
TestShimReadsUsage are red there, the same at origin/main
|
||
|
|
aab48dea94 |
claude: a saved account's .claude.json says magpie's work folder is trusted (#4830)
mydosu (#4830, Windows, v0.1.2679, Claude Code 2.1.316): since
|
||
|
|
4dfdd0cd63 |
provider: a provider switched off is asked for nothing, its plugin's model list included
ChangQiu on Discord switched a provider off long ago, and magpie still reached it. Routing, fallback, usage and balance reads, warmups, check-ins and keepalive were already held back (On(), leftAlone, KeepListsFresh). These were not: - The plugin host's providers listing ran every plugin's models hook, which asks the vendor, and its sign-in renewal (fresh), for every plugin provider, on or off. Go now passes the ids switched off (plugin.ListingOff, provider.pluginsOff: the provider's id and the plugin's own id, read from providers.json alone). host.js lists such an id without running a hook (info(..., quiet)), so its row stays and keepListed keeps the last list. - Sync (POST /api/sync, `magpie sync`) fetched every ready provider's list. Both now go through provider.RefreshLists, which skips one switched off. - Saving or switching on in the GUI fetched the list even for one left off; PrefillNewKeys asked one switched off too. What still asks one switched off, by the user's own click: the TUI's refetch, the provider Test button and `magpie provider models <id>` refetch. Tests: TestOffPluginProviderAskedNoModels (the fake plugin's models endpoint counts its hits: 0 while off, the list kept, asked again once switched on), TestPrefillAsksNoProviderSwitchedOff, TestPluginsOffNamesThePluginsOwnIDs and TestRefreshListsAsksNoProviderSwitchedOff. Run on mote at this head (first at |
||
|
|
ce2e81da11 |
routing: a group's member its provider counts free says free on its card and in its editor (jiabubu)
jiabubu on Discord: v0.1.2274's Free for me and a group's Free first,
but a routing group never showed which of its members are free.
groupsState's memberInfo now carries free (provider.FreeModel: the
provider is Free for me, or its vendor serves the model free). The
Routing page says a muted "free" for such a member, whatever the
group's routing, so it shows before Free first is picked (and Cheapest
first reads the same word): on the group's card line, beside the
provider in the group editor (a small like "by pattern", with a hover
saying what Free first and Cheapest first do with it), and in a manual
group's pick row and menu. A paid member says nothing. Routing plugin
files only; the core's scripts are unchanged. No new colours.
Run at 67dedea38 (rebased on origin/main
|
||
|
|
a4916aec10 |
gateway: a Codex websocket turn sent to a Responses relay leaves Lite's client_metadata marker behind (#4853)
A Codex title request through a Responses relay (CPA) failed with "X-OpenAI-Internal-Codex-Responses-Lite requires reasoning.context to be all_turns". fromLite took Lite's shape off for a backend that isn't OpenAI's: it lifted additional_tools, left reasoning.context out and didn't send the Lite header on. But over a websocket Codex says it is Lite a second way, in client_metadata (ws_request_header_x_openai_internal_codex_responses_lite: "true", codex-rs client.rs build_ws_client_metadata). magpie left that marker in, so the relay still read the request as Lite and passed it to the ChatGPT backend without the context it had been told to expect. fromLite now also drops that one client_metadata key (withoutLiteMetadata). Every other client_metadata entry, the instructions and the identity line go as Codex sent them. Reported by ChangQiu on Discord and filed as #4853 by ZyphrZero. The withoutLiteMetadata patch and its two tests are ported from ZyphrZero's fork commit 7f67c732. TestCodexSocketLiteTurnLeavesLiteForARelay is new: it sends #4853's title request through passthrough to a fake relay and checks that the marker, the context and the header are all gone. Run on mote at this head: - the three new tests plus TestLiteSubagentLeavesLite and the additional_tools tests: ok - go test -timeout 45m ./internal/gateway: one red, TestCodexPoolSaysTheClientsVersion (#4807). It passes 3/3 alone here and on origin/main. - go vet ./internal/gateway with GOOS=linux, windows and darwin: clean. gofmt -l: clean. Broken by hand: with withoutLiteMetadata stubbed to return its input, all three new tests went red. Not tried: a real CPA, or a real Codex websocket session through magpie. |
||
|
|
225d521cde |
minimax: Desktop keeps its own model pick, so magpie says to pick once in its menu
教父 on Discord (MiniMax Code 3.1.10, magpie v0.1.2629 and v0.1.2679):
MiniMax Code turned on in magpie's Agents page with a model picked, and
MiniMax Code went on with the user's own MiniMax-M3.1-Flash; Sessions
showed nothing.
3.1.10 is MiniMax Code Desktop (Electron, MiniMax Code.app). It runs the
mcode runtime on the same ~/.minimax/config.yaml magpie writes, and that
write is right: defaultModel is custom_provider:magpie/<model>. But
Desktop's window keeps the global model last picked in it in Chromium
localStorage ("mavis:model-selection", read from 3.1.10's renderer chunk
56321) and, when the model list loads, marks that one selected while it
is still in the runtime's list, ignoring the runtime's own default.
Only a session.model_updated from the runtime's own select API moves it,
and the runtime reads config.yaml at start-up and doesn't watch it. A
release build has no local HTTP API (local-runtime's server listens only
with the diagnostic sidecar env set), so magpie can't move the pick, and
writing the app's leveldb would risk the user's app data. Nothing changed
here between v0.1.2629 and main (only 35c47f762's dsh YAML speed-up).
What changed:
- desktopApps knows MiniMax Code Desktop: MiniMax Code.app with bundle id
com.minimax.agent.cn (filecdn.minimax.chat) or com.minimax.agent
(file.cdn.minimax.io), and on Windows electron-builder's per-user
default %LOCALAPPDATA%\Programs\MiniMax Code\MiniMax Code.exe. So its
version shows beside the CLI's, and ~/.minimax isn't a leftover there.
- With the app installed, MiniMax Code's notice says to restart the app
and pick a magpie model once in its model menu (under magpie); mcode
sessions still need a restart. Translated in zh, zh-TW, ja and de.
- agent-wiring.md says why.
Run (on mote) at the first base
|
||
|
|
a1f56720cd |
gateway: Claude Desktop's catalog-named rows say their provider in the description (4 v5)
4 v5 on Discord: with Provider in model names on, Claude Desktop's picker listed four relays' Opus 5.5 (老林夕, 新林夕, 百德, chatflowsai) all as "Opus 5.5 (…7922287072.anthropic.claude-opus-5-5)", told apart only by the id's tail. Cause: a Claude model with reasoning levels is listed as magpie-<n>.anthropic.<model> so Desktop gives it the effort picker (claudeLooking). Desktop 4.4212 labels a picker row by labelOverride, then its signed catalog's name, then display_name (ngn in index.chunk-m4oMImJ-.js), so our display_name "Opus 5.5 · 老林夕" is never shown for those ids; Qhn then appends the differing id tail to rows of one name. labelOverride comes only from an admin inferenceModels list in Desktop's profile (static, read at start, sealed at rest in 4.4212, and it can't say DesktopLongest's "[1m] only"), so magpie doesn't write it. Turning the catalog off would lose the effort picker for opus/sonnet 5.5 (Kfn lacks them). Change: Desktop shows the gateway's description under the name, before the catalog's (which has none for these models). desktopModels now puts the provider there for a catalog-named row (DesktopNumber != "") when the Provider in model names setting puts it after the name (desktopSaidBy): on, every one; own, every vendor-named one; off, only two of one name. A DesktopLongest 1M row says "1M context window · <provider>". Ids are unchanged, so saved sessions and picks still resolve. Rows Desktop names by display_name are unchanged. agent-wiring.md updated. Run on mote. At base |
||
|
|
2b938b170d |
gateway keys: the key editor offers decision models (Jev, Clef) beside the groups
Kautism on Discord: a gateway key held to a few routing groups couldn't use Clef or Jev, and they showed nowhere for it. A decision model is a model: /v1/systemone and the decision list another magpie asks for (DecidersHeader) hold a key to it as to any model, which stays so (the restriction covers both routes). But GET /api/caller-keys/models listed only provider.Catalog, which has no decision models, so the only way to let a held key ask one was All models. - caller_keys.go: the picker's list now has OfferedDeciders, each after its provider's chat models, marked decides. - keys.js: such a model's note says it is a decision model that a routing group asks whatever the key may use, and that picking it lets the key ask it itself; en, zh, zh-TW, ja, de. - A group the key names still asks its own Jev for every turn with no key check (askJev); TestGatewayKeyHeldToAGroupKeepsItsDecider holds that, and that the key is refused Jev at /v1/systemone and not listed it until it names it, then allowed and listed. - docs/reference.md and gateway-routing.md say so. Run on mote at the pre-rebase head; at the pushed head (rebased on |
||
|
|
066ece93bb |
provider: LongCat is a vendor preset, Meituan's LongCat API platform with chat completions, Responses and Anthropic messages (hoobnn on Discord)
LongCat makes its own models (LongCat-2.5, launched 11-02) and serves them
at api.longcat.chat. magpie had LongCat's icon but no preset for it.
The new preset is longcat ("LongCat", KindVendor, icon longcat, catalog
models.dev's longcat). It uses:
- chat completions and Responses at https://api.longcat.chat/openai/v1;
- Anthropic messages at https://api.longcat.chat/anthropic;
- docs at longcat.chat/platform/docs/zh/api-docs, keys at
longcat.chat/platform/api_keys.
The key goes as a Bearer. magpie sends both headers, and the docs ask for
Bearer on both endpoints; x-api-key alone gets "missing_api_key". The model
list is /openai/v1/models. longcat.chat's and longcat.ai's accounts use the
same API host (both sites' api-docs pages name api.longcat.chat).
An entry at those endpoints imports as the preset, for example CC Switch's
Claude Code and Codex entries from LongCat's cc-switch page. OpenCode's
auth.json "longcat" (models.dev's id) maps to the preset too. The README
(en, zh), docs/reference.md and the site's import pages (en, zh, ja, and
import.html, with the icon) list it.
Sources, read 11-02: api-docs, api/models, api/model, api/model-params,
api/chat, api/messages, image-video-understanding, cc-switch, pricing/
longcat-2.5, change-log, faq.
Probed without a key, from this machine: /openai/v1/models and
/anthropic/v1/models answer 401 authentication_error "missing_api_key".
/openai/v1/chat/completions, /openai/v1/responses and
/anthropic/v1/messages with a bad Bearer answer 401 "incorrect api key".
Run at this head (base
|
||
|
|
d24be3c251 |
gateway: a request over a provider's byte cap is asked again with its oldest images left out (EDwinpzy)
EDwinpzy on Discord (v0.1.2605, Windows, Codex Desktop, compaction on auto/deepseek-v4.1-flash through Command Code): a long session full of screenshots could not compact. Command Code refused the summary request with 400 "Request body is 40.1 MB, over the 32 MB limit for one request (33554432 bytes)". That is not a 413, so summaryTooLarge never sent it to the text-only ask, and Codex's compaction failed three times. The compaction guard then held it for five minutes, and after that the same 40 MB body was sent again. Agent turns of the same session hit the cap the same way. What changed (internal/gateway/body_cap.go, wired in forward and forwardOnce): - byteCapRefusal: a 413, or a refusal of any other status whose words say the body is over a size limit. A 401, 403, 429 or a context overflow (tooLong) never counts. - refitOverCap (forward): the cap is taken from the refusal (the smallest size it names below what was sent, else 3/4 of what was sent) and kept per provider id. The request is then asked again, fitted to 3/4 of the cap, at most three times. - To fit a request, the oldest history images are replaced one by one, each with a text part: "[An earlier image was left out here to keep this request under its size limit.]" (it names neither magpie nor the vendor). The latest user message's images, and every text including tool output, are kept. Every other byte of the body stays as it was. Covers Responses, Chat, Anthropic and Gemini. - withinCap (forwardOnce): once a cap is known, a later request near it is fitted before it goes, so each turn doesn't pay a refusal first. - When leaving out every earlier image still doesn't fit, or every size is refused, the agent gets a 413 request_too_large naming the size, the cap and what was kept. Codex reads that as context_length_exceeded, and its compaction goes on to plainCompact and localSummary instead of sending the same body into the guard's hold. Every route that calls serve goes through forward, including magpie's own: compaction, titles, the classifier, search, vision and the Codex fallback turn. So all of them are fitted. Not changed: magpie's own requests still run no gateway hooks, so a plugin's onRequest doesn't see compaction (EDwinpzy's other ask). Running them there changes the plugin contract: a recall plugin's context would land in summaries and titles, and onResponse would see calls the user never sent. Filed as #4847, and written in gateway-request-hooks.md. gateway-routing.md describes the byte-cap fitting. Tests (body_cap_test.go), built from the reporter's shape: a ~40 MB Codex session of 20 ~2 MB screenshots, from view_image tool outputs and pasted user images, and a latest user message with its own screenshot. The fake upstream refuses anything over 32 MiB with the reporter's literal 400 body. No network. - TestCompactionOverByteCapLeavesOutOldImages (Responses and Chat upstreams): Codex gets the model's SUMMARY. The second ask is under 24 MiB, the oldest screenshot is replaced by the marker, SHOT19 (the latest user message's image) is kept, and every user text and tool output text is kept. - TestTurnOverByteCapLeavesOutOldImages: a turn is fitted the same way, and the next turn goes fitted with one upstream call. - TestOverByteCapNothingToLeaveOut: every image is in the latest message. The body is sent once, and Codex gets context_length_exceeded with "over the 32.0 MB 1017dp takes in one request ... no earlier image". - TestCompactionOverByteCapEveryTime: refused at every size. Asks get smaller, there are at most 6 calls, and it ends in a local summary with no image in it. - TestByteCapRefusal and TestWithoutOldImagesEachProtocol: the classifier (TPM 429, context overflow, 401 and an invalid-schema 400 are not caps), statedCap, and the Chat, Anthropic and Gemini splices. Run on mote (Go 1.26.8, macOS) at this change on |
||
|
|
f5c956b848 |
plugin: a 401 on an access token its refresh token renews makes it due, not the sign-in gone (plugins#618)
jinpy666 (magpie-community/plugins#618): with Copilot plugin 0.1.0, the two Copilot slots that carried no traffic said "sign-in has expired — sign in again" within a day or two, while their GitHub OAuth token still traded at /copilot_internal/v2/token. A plugin's bare 401 (no X-Magpie-Sign-In) marked the account whatever the cause, and a mark is cleared only by a success or a usage read that says so, which an idle slot never gets. The host now judges such a 401 against the sign-in as the request found it (staleAccess in host.js). For an OAuth sign-in with a refresh token whose access token is still the stored one and not due yet, it makes the token due (expires 1, under the auth lock, only while the access token is unchanged), drops the account's loader and says "kept": the gateway fails the request over as before, and the next request renews the token through the plugin's loader (or magpie's auth.refresh) and goes through. Still marked: an access token renewed for this request and turned away, one that was due already and not renewed, an account with no refresh token, and a plugin saying "expired" (a refused refresh). A sign-in that can't be read when the 401 comes is unknown: kept, not marked. A marked account stays routable (pluginAlsoOn doesn't filter marks), so a slot marked before this is renewed on its next request and the success clears it. Copilot isn't a mover; its plugin 0.1.1 (plugins 53d4813, on the dist branch; never on npm) says "expired" for the exchange's own 401 and "renewed" for a quota read GitHub answers, which clears old marks. TestPluginStaleAccessRenewsNotLapses (new, fake plugin + local vendor, no network): idle account kept and due after the 401, renewed and 200 on the next request; a renewed token refused is marked; a refused refresh (signIn "expired") is marked; plugin-auth.json unreadable at the 401 marks nothing; a marked account is still routed. TestPluginFailover's "gone" case asserted one 401 marks; it now asserts no mark after that 401 and the mark once the account's renewed token is refused too. docs/subsystems/provider-plugins.md has the rule. Run at this commit's tree (mote, rebased on |
||
|
|
b3eb26400c |
library: a ${NAME} only the login shell exports reaches the MCP server magpie starts or calls
Cyrus on Discord: once a Library MCP server's token was written as
${NAME}, the Library listed no tools for it. magpie expanded the
reference from its own environment only, and a magpie opened from the
Finder or the Dock has none of the profile's variables, so a token
exported in .zshrc was "not set" for the tool-list check, and the
router (dialHub) and Codex's run through the gateway (specOf) didn't
start the server either.
expandAll, the one place all three expand a reference, now takes a
variable magpie's environment hasn't from proc.LoginVars: what the
login shell (and fish or nushell, as shellEnv asks them) exports, read
through /bin/sh as the existing PATH probe is, each answer kept a
minute. On Windows it reads the registry's user then machine variables
(one set with setx after magpie started). The value is only in memory
at call time: never set in magpie's environment, never written to
library.json or an agent's file, never logged. A variable set nowhere
is still novar, naming it ("NAME not set" on the page, unchanged). The
library only documents ${NAME} (no ${NAME:-default}), so nothing else
is parsed.
Run at this head (90d554db1 rebased on
|
||
|
|
1a864f156e |
usage: a hidden card a menu bar cell showed offers Show in Overview, not Hide again
Found while fixing yuu003348's report ( |
||
|
|
dee1afa400 |
usage: what is hidden from the Overview can be found again (yuu003348 on Discord)
yuu003348 on Discord: "观测/用量/概览 从概览中隐藏 后 无法取消隐藏". The way
back was there: a "{n} hidden" line under the cards (#quotaHid), each row with
Unhide, Show all from two. But it was drawn in --faint (#b9b9c2 on #f4f4f6,
1.77:1, 11.5px), so it couldn't be found; the Agents list's line (ikunbots on
X) is the same class.
- app.css: .us-hid .us-hidline is --muted (3:1 or more in light; ~5:1 in
dark by the tokens), for both lines.
- plugins/usage/page.js: while any are hidden, a card's menu and an Agents
row's menu end with "Show {n} Hidden". It opens the line under its list,
puts the keyboard on it and brings it into sight on the menu's click
(openHidden, scrollOnPurpose). hiddenQuotas() is the one count both the
line and the menu read.
- i18n: "Show {n} Hidden" in zh, zh-TW, ja, de.
- docs/subsystems/gui-shell.md says both.
- usage-cards-hide / usage-agents-hide now expect the new item when
something is hidden already.
Run (mote, node --test):
- usage-hidden-way-back.test.cjs (new): chromium and webkit, en/zh/zh-TW/ja/
de, 1200, 560 and 390 (touch long-press): 2 of 2 ok (32 cases).
- 130 Usage/menu/tray GUI files: the only reds the change made were
usage-cards-hide and usage-agents-hide's exact menu lists, now updated.
Every other red there is red at origin/main
|
||
|
|
d39358f1bb |
claude: /usage and "hi" reads run in magpie's work folder and say why they ended (#4830)
mydosu's Claude Code quota reads on Windows failed for both accounts
with "exit status 1" alone. Two things were behind it:
- Each one-off interactive run (claudeUsageTUI, askClaudeTUI) started in
a new magpie-claude-<n> temp folder, which the helper trusted, so each
read wrote one more trusted projects entry into the config's state file.
The reporter had 67 in ~/.claude.json.
- The caller's budget (subscriptionTimeout, 20s) is shorter than the
helper's own waits (45s for the prompt, 20s for a panel). The context's
kill came first, and that is TerminateProcess on Windows, so Wait said
"exit status 1" with an empty stderr. On Unix the same kill says
"signal: killed".
What changed:
- One-off TUI runs work in claudeWorkDir (oneOffDir). That is the
owner-checked folder the bridge's own runs already use, so each config
directory holds one trusted entry instead of one per read. A temp
folder is made only when that folder can't be.
- The run's session file there is removed by the session_id the helper's
init line names (dropOneOff). It is not removed under WSL.
- The helper is told its caller's deadline (claudetui.DeadlineEnv, the
context's deadline less min(3s, a quarter of what is left)). At that
time it ends on its own, saying what Claude Code hadn't done and its
last screen, e.g. "Claude Code hadn't drawn /usage's panel in the
2.9s its caller waits for it: ...".
- A run that still says nothing reads "Claude Code's interactive mode
said nothing before magpie stopped waiting for it (...)" (oneOffErr),
not an exit code.
- quotaError says these reasons on the card as "Allowance unavailable:
{why}" (an existing key in every language). The full text stays in
the tooltip. Nearby comments were cut so the core script budget holds
without a raise.
- No -p fallback was added. The -p asks keep their own temp folder,
since -p asks nothing about trust.
- The entries older magpies left in ~/.claude.json are left alone:
magpie never writes that file.
Run at this head (after the rebase on
|
||
|
|
c875e66c24 |
gateway: reasoning a Chat, Messages or Gemini client's calls carry, refused by another Responses upstream, is asked again without (#4798)
Since |
||
|
|
18c3976234 |
gateway: DSML calls Alma relays from a group's DeepSeek are guarded on the Responses route
wishSeikouudoku on X (tweet 2117056042001719807, 11-02 08:47 +0800): Alma, through a magpie group to DeepSeek, got <||DSML|| calls>, invoke name="…" and parameter as its reply's text, and no tool ran. Cause, already fixed on main: Alma's magpie provider is of type openai, which the AI SDK sends to /v1/responses (the owner's usage log: 4365 Alma rows with ep /v1/responses). DeepSeek's preset speaks Responses too, so the reply was relayed as it came, and before |
||
|
|
ca1fc43fc9 |
provider: quota history draws no line for a plugin's aside window that says no share (#4825)
ggbdpq's patch (gua2100 on Discord), reviewed and landed with an
end-to-end test and a doc line.
What changed
- quotaOfPlugin marks an aside window that leaves `used` out, with no
count to reckon one from, as noShare. pointOf refuses such a window,
so the history no longer draws a flat 100%-left line for it. The card
still shows the row as before.
- noShare is unexported and so lost on JSON. Cards restored from the
cache have AsOf set, and noteQuotaHistory skips them, so this never
matters.
- Review changes: TestAsideWindowWithoutUsedDrawsNoLine now also runs
the windows through noteQuotaHistory and QuotaHistories in a sandbox
HOME, and wants lines [Bonus Weekly] only.
docs/subsystems/providers-accounts.md says such a window isn't kept.
Run at the pushed head (on mote, base
|
||
|
|
679bc412cb |
library: Magpie Browser's row asks which agents may use it, once connected
Magpie Browser is added with no agents (opt-in), so the router offers it to none until one is ticked, and an agent asked to use the browser reached for AppleScript instead. While its extension is connected (GET /api/library/browser, read again every 3s while the row is shown, so connecting it needs no reload) and no agent has it, its row asks "Which agents may use it? They act in your tabs, signed in as you are.", a button per agent that clicks that agent's chip (servers/agents, as a chip's click). Once one has it, the row asks nothing more. Not connected, or given to an agent already, it asks nothing. Run on mote at this head ( |
||
|
|
e44ad72cfd |
gui: a failed status dot is an x, not a red dot alone
coolmantou on Discord (#feedback), who is red-green colour-weak, could barely tell the green status dot from the red one. Under a deuteranopia or protanopia simulation the two are one olive colour, in light and dark. Making the green lighter would not help a greyscale or protan reader, so the failed state now says it by shape (Apple HIG: never colour alone). What changed - app.css: a --x-mark token (an SVG x, used as a mask). Each failed dot keeps its red and its 6-7px box, is drawn through the mask and scaled 1.5 so it reads as heavy as the round dot. Layout is unchanged. Dots: Test models (.tdot.bad), an agent's status (.ag-st.bad .ag-dot), the check-in (.ci-dot.bad), the request ledger (.led tr.bad .st .dot). - routing.css: a try or probe (.rt-req/.rt-probe.bad .to i), a step (.rt-steps li.bad::before), the preview (.ps-dst.bad > i). - library.css: a server that failed (.lib-health.err::before). A ring was not used because "not checked" is already a ring there (#2308). - Not changed: green-only dots with no red pair (gateway, keys, tiles, live), chart markers, routing's animated packets, redact's categorical facet dots. The tray has no status dots of its own. - docs/subsystems/gui-shell.md says it beside "State is shown with a dot". Tests - status-dot-shape.test.cjs (new): for all 9 pairs with the real stylesheets, in chromium and webkit, light and dark, 980 and 420 wide: the good dot has no mask, the failed one has the x mask and the good one's box, and its pixels have ink on the arms and centre and none above the centre. - library-mcp-health.test.cjs: its "a dot, not a stripe" check now expects the x for a failed server and a round dot for the rest. Run at the pushed head (mote, via mote-run) - status-dot-shape + library-mcp-health: 16 pass, 0 fail (chromium and webkit). - go test -run 'Asset|CSS|Budget|Compress|Revalidate' ./internal/gui: ok. - At |
||
|
|
ad53a23dc8 |
gateway: X-Magpie-Account takes a percent-encoded name (plugins#615)
StockRabbit (magpie-community/plugins#615, Magpie 0.1.2587, Windows): pinning the Fingerprint page to the WorkBuddy account 北冥 failed every sample with "Header 'X-Magpie-Account' has invalid value". A header value is ASCII on the wire and fetch refuses any other, and the gateway matched the header only against the account's user (北冥) or its trace id (workbuddy@北冥/…), so no ASCII form could name that account. pinTo now matches the value as written or percent-decoded (pinnedName: url.PathUnescape, kept only when it decodes to valid UTF-8). The trace's Pinned, the call's error and the 404's "no account %q" name it decoded. gateway.go:2701 is the one place that reads the value; codex_backend.go, codex_relay.go and gateway.go:2523 test only that it is present, so they need nothing. docs/reference.md and the gateway-routing page say how to send such a name. Run at this head (rebased on |
||
|
|
49c99e18d1 |
provider: quota history draws measured windows set aside for routing (#4612)
chowyuan1314: the Cursor plugin marks its Weekly window aside when on-demand or free credit can pay, and Grok Bot always — using them up doesn't stop the account, so routing sets them behind — and both carry a real percentage. pointOf refused every window set aside that wasn't a pool's, so quota-history.json took no point for them and the card had no curve, while the same account's Codex windows drew theirs. The aside check predates the pools' (#651); the pools' own exception ( |
||
|
|
611ce90d15 |
agent: OpenBot, magpie's models in its model picker (jiezhengj)
OpenBot (nightly-labs/openbot, openbot.run, v0.58.0) is a new row on the
Agents page. jiezhengj on Discord asked for it: today they type magpie's
address into OpenBot by hand and add each model one at a time.
OpenBot lists the user's own OpenAI-compatible endpoints from
openbot-custom-providers-v1.json in its userData folder:
~/Library/Application Support/OpenBot, %APPDATA%\OpenBot, or
~/.config/OpenBot. Connecting adds an entry with id "magpie" pointing at
the gateway's /v1 and holding the models picked for OpenBot, with
secret null. OpenBot seals an entry's key in safeStorage, which magpie
doesn't open, so the entry has no key. OpenBot hands it to OpenCode
keyless, and the gateway accepts it as a request from this computer.
What the entry keeps to:
- OpenBot's decoders drop the whole list over one bad entry. So the entry
has at most 64 models, only ids OpenBot accepts as magpie/<id>, and a
context window only inside 1,024 to 100,000,000.
- The user's other entries stay. The name, harness and secret they give
magpie's entry in OpenBot stay too.
- A sync with nothing to change doesn't write.
- A file whose version isn't the number 1, or whose providers isn't a
list, is one OpenBot refuses itself, so magpie leaves it alone.
- Disconnect takes out magpie's entry, and the file too when only the
version and an empty list are left.
OpenBot reads the file at start, so while it runs, a notice says to
restart it. The notice is in every language.
OpenBot is detected by its userData folder, OpenBot.app
(app.openbot.desktop), or OpenBot.exe under %LOCALAPPDATA%\Programs or
%ProgramFiles%. Docs updated: agent-wiring.md, reference.md, and both
READMEs.
Run at the pushed head, on mote:
- gofmt -l: clean.
- go vet -tags nogui for internal/agent and internal/gui, and for ./...
with GOOS=linux and GOOS=windows: ok.
- go test -tags nogui -count=1 -timeout 45m on internal/agent and every
package that imports it (., backup, cli, davsync, gui, library,
profile, stats, tui, uninstall, plugins/...): ok.
- GUI: agent-notice-lang, i18n-keys, header-relang and about-notices in
Chromium and WebKit: 58 of 58 pass.
After rebasing on
|
||
|
|
e87140242b |
settings: Check in now for one account, its switch left as it is (xiaowu_95660)
xiaowu_95660 (Discord #general) asked for a way to check in one account
right now where its daily check-in switch is, without turning the switch.
- provider: a checkiner can be held to one account (`only`), and
CheckInAccount(ctx, by, key) runs the same claim path once for it, for
WorkBuddy, Trae, MiniMax, Qoder and every plugin with a check-in.
CheckinOff is not read or written.
- gui: POST /api/usage/checkin-account {By, Key}. Settings' daily check-in
group (built-ins and plugins) gets a "Check in now" row under its
accounts. One account checks in at once; several open the app menu to
pick one. The line says done, already checked in, not eligible,
inactive, captcha, own-app or the failure. Only quotas reload, so
Settings isn't redrawn under the button.
- The row and press live in the lazy checkinnow.js (core budget unchanged,
three check-in comments cut). Once loaded it draws at once, so a redraw
by the switch doesn't shorten the page for a moment.
- Strings in zh, zh-TW, ja, de. provider-plugins.md says how it works.
Run at befdfa72b (on origin/main d89f03aa9;
|
||
|
|
3f393a4fae |
redact: a user name is not masked where code has the same word as a name (Tomyu_2034 on X)
Tomyu_2034 on X: "magpie 里面的 masking 很容易把参数变量名当成 user name
给 mask 掉". No sample was given, so the class was measured: with "User
name in home folders" and "User and computer names" on, two finders took
names in code for the user's.
- Known values (known.go). A user name the home rule found once
(/Users/developer/…) is known from then on when it is 8 bytes or more,
and standsAlone's default bound is a letter or a digit only, so it was
masked wherever the word stood between anything else: def
run(developer, developer_dir), developer_mode = True, const developer
= 1, {"developer": true}, - developer_count := 0 in a diff, a tool
call's old_string. A user name such as developer or workspace1 is a
word code has too.
- The "User:" line rule (more.go). Its unquoted value was any
login-shaped word, so user = current_user, user: UserInfo, login =
loginName, username = target_name, a Go struct's "\tUser UserProfile"
and a TS interface's "user: CurrentUser" went as made-up names.
nameAlone now decides a known USERNAME: it is the user's name as a word
of its own in text (a path's part, name@host, --author=name, ls -l's
owner, uid=501(name), prose, a quoted string, chown name:staff), and
code's where it is joined to another part (_ $ a letter or digit beside
it, or a . or - with one past it), declared (const/let/var/def/func/
class/return/import…), assigned or called (name =, name(, name[,
name :=, x = name), a JSON key ("name":), or a parameter ((name, ,name)
name: str, name string), but for id's 501(name)). Nothing is exempted
by a key's name: a tool call's arguments are read by the same rule as
any text, and a quoted value in them is masked as before. The "User:"
rule leaves an unquoted value made of two or more words (split at _ .
and camel humps) one of which says it holds a user (identParts: user,
name, login, current, target, info, obj, id…); a quoted one, and a
login of words of its own (deploy_bot, john_doe), are masked still.
The boundary costs this: prose that puts the name alone in a list
"(developer, alice)" or before "=" now goes as written; such text reads
as code to this rule. A name under 8 bytes was never matched as known,
so for those only the "User:" half changes anything.
Tests (identname_test.go), with "developer" (a common word) and
"rinakato" (a handle), known from a working directory first:
- TestUserNameInCodeIsNoUserName: a Python and a JS file read, a JSON
file, Go code, a diff and an edit tool call's arguments go as written;
a home path, --author=, ls -l, uid=501(), prose, a quoted string, a
JSON value, chown and a bash tool call's ~name go as the made-up name.
- TestUserLineInCodeIsNoUserName: seven code lines unmasked; User:
deploy_bot, USER=rinak, user: "current_user", ssh config's User and
user = john_doe masked.
Broken by hand: with more.go and known.go as on main both tests are red
(12 and 7 failures); with standsAlone's USERNAME case returning true,
TestUserNameInCodeIsNoUserName alone is red.
Run at this head (on origin/main 89ffc58f5; nothing since touches
internal/redact or the doc), on mote:
- gofmt -l clean; go vet ./internal/redact ./internal/masking, and
GOOS=linux -tags nogui and GOOS=windows go vet ./internal/redact: clean.
- go test ./internal/redact ./internal/masking ./internal/otlp
./internal/pii ./internal/sessions ./internal/settings: ok.
- go test ./internal/gateway -run '(?i)mask|redact|privacy|personal|
standin|restore': ok.
- go test ./internal/gui: TestMainWindowCorners/macOS_26_SDK red, the
AppKit title bar on mote's macOS 27 (#3949, open); nothing else.
Not tried: the full internal/gateway package and go test ./... (the
gateway takes ~45 min; pushed at once per the owner's ship rule); the
local model's PERSON finds, which already leave snake_case and
lower-case words (modelTakes, programWords); the home rule's
"/home/<segment>" in a web route ('/home/dashboard'), which reads as a
home folder and is unchanged; a real request with the reporter's code.
|
||
|
|
a8e98e1abb |
gateway: a Claude Code run that exits mid-reply is a failure, not a 200 (#4822)
A Claude subscription run whose Claude Code exited after its reply began, with no message_stop nor a result (only the message_start, or part of the text), closed its segment as if the reply had ended. The client was answered 200 with nothing or the words so far, and the agent took it as a finished turn. - readOutput: at the end of Claude Code's output, a reply begun on the open segment (KStart, tracked in emit as unended until a KStop or KError) ends with a KError, 502, "Claude Code exited before it ended its reply" and the end of its stderr. -p and the interactive mode share this path. - relay, not streamed: any error is a status, words said before it too (was: a 200 with the partial reply), as a translated reply cut short is (errEndedShort). The try's usage is kept as before ( |
||
|
|
89ffc58f5b |
gui: a card's Refresh says the read's failure, and Claude Code's first-run screens say what to do (#4817, uiuing)
From uiuing's branch (1eeb8928b, 66818dbf6), adapted. A usage card's
Refresh showed nothing when the read came back as a card with an
error: only a thrown request reached status. quotaRefresh now says the
refreshed card's error through quotaError, for a single account and
for a provider whose cards were replaced (the one kept in quotas).
quotaError reads the helper's new "stays on its first-run screens" and
an older magpie's "shows its first-run notes" as "Finish Claude Code's
first-run setup, then refresh", in en, zh, zh-TW, ja and de. Comments in
quotaError and quotaRefresh were cut so the core scripts stay in their
budget (1,533,732 of 1,533,802; main was at 1,533,780), with no raise.
Run at the pushed head, on mote: node --test of claude-quota-onboarding,
quota-refresh-order, usage-card-refresh, usage-refresh,
usage-refresh-flight, account-refresh, editor-quota-quiet,
usage-no-reading, usage-remote-cards, tray-usages, glm-quota-error,
claude-usage-asked, allowance-open-read, api-key-usage,
key-balance-card, copilot-signed-out-account, signin-again, plugin-git
and i18n-keys (chromium and webkit, every language each file runs, 440px
where it sets it): 287 of 287.
go test -run 'Budget|I18n|Lang' ./internal/gui ok.
go test -run "Claude|TUI" ./internal/gateway ok. The full
./internal/gateway (-timeout 45m, before the rebase onto
|
||
|
|
af4ff747bc |
claudetui: Claude Code's first-run screens are gone through as a person would, not the run's end (#4817, steven_4422 on Discord)
With "runs as" Interactive, a Claude Code whose onboarding was never finished (no hasCompletedOnboarding in the state file: steven_4422's every request 502'd, uiuing's /usage read in #4817) stopped on the "Security notes" screen, and |
||
|
|
62ffc40169 |
gateway: a waiting request goes to an account back from rest (01huadalang)
01huadalang on Discord (11-01): three ZCode accounts, three requests at once each. The first two got a 405 and rested, so every request went to the third, and those over its three waited in its lane. Once the first two were back, the waiting ones stayed on the third, behind its long turns, until its requests were cut by hand. Same under Smart, In turn and Stays off. Cause: a request that queued in a lane (lanes.take) waited only for that lane's turn. Nothing looked again when another lane gave a slot back or a rest ended. With ZCode's maxAccounts 2, the third took a seat while the first two rested and was a reserve again once they were back, but the requests already waiting for it stayed. laneMate also gave way to a mate resting, because ready() checks only lane and RPM room. Change: - lanes.take takes a move func. While waiting (lanes.await), it looks again when any lane gives a slot back, when a rest is lifted (Unrest, UnrestAll signal lanes.freed), when the soonest rest among the others ends, and at least every 5s (laneRecheck). waitMate finds the first candidate after it in the planned order (then those probeOne left out for resting) of the same provider, or any member of a group, that has a free slot with no queue (tryTake), minute room, isn't resting, didn't give way, and isn't a reserve as keepAtOnce stands now. The request then leaves its queue (errMoved) and serve runs that candidate with the slot already taken for it. A fallback provider is never one. Strict stays leave no other candidate, so nothing changes there. - laneMate skips resting mates. - docs/subsystems/gateway-routing.md Limits row says so. Tests: - TestWaitingRequestGoesToAccountBackFromRest: 3 keys, cap 3, MaxAccounts 2, k1 and k2 resting (405), 9 requests. 3 go to k3, 6 wait for it, and none reach the resting two. Then the rests are lifted (Unrest) or run out (300ms), and the six go to k1 and k2 while k3's three are still out (9 at once). Run under Smart and Rotate, with Stays default and off. - TestWaitingRequestTakesSlotGivenBackElsewhere: 2 keys, cap 1. A third request waiting for one key goes to the other when that one's request ends, under default, order, rotate and usage routing. - TestFullMemberGivesWay updated. c, waiting for first, now goes to second once second's b ends. d (first's fallback is second) still waits for first. Run on mote (mote-run), rebased on |
||
|
|
6b3a6d42c0 |
agent: VS Code's Agents window (vscode_agent_host) counts as VS Code, its turns as Codex's
justruman on Discord (#general, 11-01): VS Code's Agents window showed
in Usage as a raw "vscode_agent_host" row, 23 calls, 7 failed, beside
the "VS Code" row.
Why: VS Code's agent host runs `codex app-server` with clientInfo
{name: "vscode_agent_host"} (microsoft/vscode main at 8fb6054,
src/vs/platform/agentHost/node/codex/codexAgent.ts CLIENT_INFO; it
bundles @openai/codex 0.163.0). Codex sends that name as its
originator and at the head of its User-Agent, and it reads the user's
~/.codex config, so with Codex connected to magpie its turns come here
under VS Code's name. No agent's UA list had it.
- Usage: vscode_agent_host is in VS Code's UA list
(vscodeAgentHostUA), so those calls are VS Code's. Records are named
again at read time (ReportedAs -> AgentOf), so calls already logged
under the raw name fold into VS Code too. Insiders' and VSCodium's
agent host send the same name and are counted as VS Code (Stable):
nothing in the request tells them apart.
- Routing: fromCodex also takes vscode_agent_host (hostedCodex), so
every Codex rule holds for those turns. The one that fails without
it: one of Codex's own models asked there, which no account in
magpie serves, was answered 404 "magpie knows no model" instead of
going on Codex's sign-in (codexOwnOffMagpie). Also now applied:
spawn_agent's model list, compaction told in the stream on a byte
cap/overflow, Codex's headers to a keyed Codex-only relay.
- A test asked as Codex keeps only Codex's own names (codexNamed) as
Codex's shape: the agent host's headers never become it.
- VS Code's Copilot-proxied names (vscode_codex, vscode_claude_code) go
to GitHub, not magpie, and are not matched.
- docs/subsystems/gateway-routing.md says so.
Run on mote at this change rebased on origin/main 16ce5ed23; the
one commit since,
|