a3cd1338454e65bcfe86bf641389871cdba00cac
340
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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.
|
||
|
|
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.
|
||
|
|
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
|
||
|
|
3deb85685f |
gui: Usage's subscription cards in one row are as tall as each other, so their bottoms line up (ikunbots on X)
ikunbots ("magpie 的这个卡片可以对齐吗") and duanjl_china ("有的长有的短"):
Claude Code, Codex and Antigravity sat side by side in one row on the
Usage page, each as tall as what it held, so their bottoms were ragged.
What changed
- packUsage (app.js) still packs the cards into columns as #860 made it
(a short card stacks beside a tall one, never stretched to a row's
height). After placing them, the last card in each column gets a
min-height that takes it down to where the tallest column ends.
- Cards side by side in one row (one card per column) are as tall as
the tallest, bottoms on one line, content at each card's top.
- A stack stays a stack: the upper cards are as tall as themselves and
only the last one reaches down to end with the tall card beside it,
which is what #860 asked for (堆叠和 Codex 对齐).
- One column: each card is as tall as itself, nothing to line up.
- The min-heights are cleared before every measuring, so a re-pack
(resize, a fold opened, cards changed) measures each card as tall as
itself. A min-height rather than a stretch keeps a card that outgrows
it growing, so the ResizeObserver still re-packs.
- docs/subsystems/gui-shell.md says so.
Tests
- usage-pack.test.cjs:
- New: ikunbots' three cards (Claude Code 2 windows, Codex, Antigravity
6 families; content heights 107/169/217px) at 1400 and 1018px are one
row with bottoms within 0.5px; at 480px one column, each card as tall
as itself; widened again, one row lined up again.
- The reporter's #860 stack at 897/1018/1400px still stacks:
Antigravity as tall as itself, DeepSeek under it with the 7px gap,
ending where Codex does.
- sound(): a card is as tall as itself unless it is last in its column,
which ends with the tallest; no card is shorter than its content.
- The fold case: opening Codex's brief account grows what the card
holds; the card already reaching down to the stack's end stays that
tall rather than growing (was "the card grew").
- Broken by hand: no min-height applied -> "1400px: the cards' bottoms
line up" red in all 8 (chromium/webkit x en/zh/ja/de); min-height not
cleared before measuring -> "narrow: antigravity is as tall as itself"
red. Restored: 8/8 pass.
Run
- usage-pack.test.cjs in Chromium and WebKit, en/zh/ja/de: 8/8 pass.
- Every GUI test file touching the Usage page (75 files, those naming
#subscriptionUsage/.subscription-card/view=usage, plus click-scroll),
both engines, concurrency 6: 917/918 pass. panel-usage webkit en failed
once under that load ("asked: period=today&limit=1", a 2.4s poll in its
Requests-window step this change doesn't reach), passes 3/3 alone;
added to #1544 with its cause.
- Screenshots before/after with fixture data looked at: ragged row
before, one line after; 897px stack unchanged but for DeepSeek/Codex
ending together.
- No Go change; gofmt/vet/build not run. Full GUI suite not run.
|
||
|
|
6c1c0a7472 |
gateway, gui: magpie's image recognition is an MCP server of its own, /mcp/magpie/vision, with one analyze_image tool (JonahFu on X)
What: beside /mcp/magpie/web-search, the gateway serves the model that describes images (Settings › Models › Image recognition, else magpie's automatic pick) as a Streamable HTTP MCP server. analyze_image takes an image (absolute file path, http(s) URL or data:image URL) and an optional prompt: without one it is described as a model's image is (same cache and system text), with one the prompt is asked beside it. The JSON-RPC serving, guard and Origin check are shared with the web search server (serveMCP). A file path is read only for a local, unproxied caller, up to 20 MB, and only when its bytes are an image; another computer sends a URL or data URL with a gateway key. Each call holds the key's limit (budget.Reserve) and reads in Routing as the agent's analyze_image call. Settings › Models shows the address under Image generation (#visionMcpRow), in every language. Run: - go test -tags nogui ./... (no failures); gofmt -l clean; GOOS=linux and GOOS=windows go vet ./internal/gateway. - New TestVisionMCPAnalyzesImage / WithNoSeer / Guarded / HeldToKeyLimit. Broke the local() guard by hand: TestVisionMCPGuarded went red on the other computer's file path being read. - GUI (chromium + webkit, en/zh/zh-TW/ja/de, 1100 and 520px): vision-mcp, search-mcp, public-url-default, images-missing, settings-sections, i18n-keys, routing-vision-why: 95 pass. The row was first put between the two pickers and images-missing went red (it finds them by position), so it sits last. - Real use: this build under a sandbox HOME holding only the owner's OpenRouter provider, Image recognition set to openai/gpt-6-luna. initialize, then tools/call with docs/screenshots/font-settings.png as a file path and a prompt: the model listed every settings row and its value correctly. Not tried: a real agent (Claude Code, Cursor) mounting it; its MCP exchange is the same as the web search server's. |
||
|
|
f131117976 |
gui: on niri the tray panel opens under the bar beside the clicked icon, not in the middle of the screen (#1670, Kenoia)
A Wayland window can't place itself. Under niri the panel opened where niri floats a new window, the middle of the output. Hyprland already had an adapter (omarchy/hypr.go); niri now has one too. niri (checked in niri v26.04's source, niri-ipc/src/lib.rs and src/ipc/server.rs) can't add window rules at runtime and doesn't report the pointer over IPC. So omarchy.NiriPanel watches niri's event stream ($NIRI_SOCKET, one line of JSON per message) and moves each window of magpie's pid titled "magpie panel" once as it opens: MoveWindowToFloating if it was tiled, then MoveFloatingWindow with SetFixed x/y, which count from the working area's top-left (below the bar). It goes 6 px under the bar, centred on the x that the tray host passed to the SNI Activate(x, y), kept inside the output. Wails' Linux tray keeps that x in private fields (lastClickX/lastClickY), read the same way trayProps already reads props; TestTrayClickIsWails reads Wails' source to fail if they move. Noctalia passes bar-surface-local coordinates, so the x is taken across the focused output. With no click (`magpie panel`), or with one off the output, it goes to the top right. Wails' HideOnFocusLost closes it when another window takes the focus. What was run: - go test -race ./internal/omarchy/, go test ./internal/gui/ (sandbox HOME, pinned GOMODCACHE/GOCACHE). The IPC fixtures are built from niri-ipc 26.4.0's Window/Output/Event/Reply types, quoted in the test. - Broke it by hand: dropping the placed-once map fails TestWatchWindows (placed [7 7 9 9 9]); dropping the right-edge clamp fails TestPanelSpot. - gofmt -l; go vet (darwin), GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...; linux nogui and windows builds. - A nested niri 26.04 (winit backend on Xvfb, scale 1.5, Fedora 43 container, magpie built with -tags gtk3), with SNI Activate sent via dbus-send. Activate(300, 14) put the panel at [58, 6] (300 - 484/2). A second Activate closed it. `magpie panel` reopened it at the top right (853 - 484 - 6 = 363). Activate(800, 14) clamped it to 363. `magpie gui` taking the focus closed it. Not tried: a real niri desktop, Noctalia or another real tray host (Waybar, ironbar), more than one monitor, a bar at the bottom or the side (not accounted for), focus-follows-mouse. The panel still opens in the middle and slides up; how visible that is on real hardware wasn't seen. Not from this change: omarchy's TestCurrent fails with -count=2 on main (it passes with -count=1). |
||
|
|
206dc085be |
provider: a magpie run from a terminal that only lists accounts no longer writes logins.json, and every change to it is made under a lock the gateway holds too, so a token the gateway just refreshed is never written back over (#1674, FaintGhost)
Every CLI command that reached Logins() (magpie ls, providers, sessions,
usage) ran rememberLogins, whose 30-second throttle (loginsSeenAt) lives
in the process, so in a new process it never held: each run moved Seen on
for the signed-in Codex and Claude accounts and wrote logins.json back.
loginsMu was an in-process mutex, so that read-modify-write could
interleave with the gateway's renewSavedLogin: the CLI reads, the gateway
writes a refreshed sign-in, the CLI writes what it read. Codex/OpenAI
refresh tokens are single use, so the account would be signed out.
- rememberLogins writes nothing when the only change is Seen and the saved
Seen is less than seenEvery (10 minutes) old (onlySeenMoved, comparing
with what was read, IDs and order normalised as writeLogins writes them;
sortLogins is split out of writeLogins for that).
- internal/filelock (new): davsync's TryLock/Unlock (flock; LockFileEx on
Windows) moved here and davsync uses it; Lock(path, wait) and
filelock.Mutex, a sync.Mutex that also holds the OS lock on a lock file.
A lock another magpie holds is waited for up to filelock.Wait (10s),
then gone on without, as before, so a stuck magpie never hangs others.
- loginsMu is a filelock.Mutex on logins.json.lock, so all 107 existing
Lock sites (every writeLogins is under one) are cross-process with no
change at the call sites. Taking it calls filememo.Look (new), so the
read under it isn't a parse filememo.Hold kept from before another
magpie's write. savedTokenMu holds logins.json.renew.lock the same way:
two magpies never refresh one saved account at once.
- Siblings: caller-keys.json (access.mu: magpie keys from the CLI vs the
window; a lost revoke would bring a key back) and mcp-signins.json
(mcpauth.fileMu, plus mcp-signins.json.renew.lock around renew, since
library's MCP check renews from the CLI too) get the same lock.
plugin-auth.json already has one (plugin-auth.json.lock, shared with
host.js). Not covered: providers.json (33 store sites with no
in-process lock either; user-entered keys, nothing refreshed there),
migrations.json/settings.json (no credentials), and the agents' own
files (~/.codex/auth.json etc.: the agent itself writes them without
any lock of ours, so a magpie-only lock can't make them safe).
Tests:
- TestReadOnlyRunLeavesLogins: Codex and Claude signed in, Seen a minute
old, file time set back; three "new processes" of Logins("")/codex/
claude/All() leave logins.json's bytes and mtime as they were. Seen an
hour old is written; Codex's own refresh is written at once.
- TestLoginsKeepAnotherMagpiesWrite: between this process's read and write
(beforeLoginsWrite hook) a second test process (TestLoginsOtherMagpie,
os.Args[0] -test.run) renews the saved work@ account's refresh token;
both the renewed token and this process's change are in the file.
- TestLoginsReadAfreshUnderLock: with filememo.Hold held, a write
filememo never heard of is seen by a read under loginsMu.
- TestLockAcrossProcesses (filelock): a holder subprocess makes Lock wait
and give up after its wait; killed, the lock is free; a Mutex holds it.
Broken by hand: onlySeenMoved bypassed -> TestReadOnlyRunLeavesLogins
FAIL "a run that only listed the accounts wrote logins.json"; the file
lock taken out of filelock.Mutex.Lock -> TestLoginsKeepAnotherMagpiesWrite
FAIL "the other magpie's renewed sign-in was written over"; Locked hook
emptied -> TestLoginsReadAfreshUnderLock FAIL. Each restored, green.
Ran: gofmt -l (nothing); go vet ./..., GOOS=linux go vet -tags nogui
./..., GOOS=windows go vet ./...; go build, GOOS=linux go build -tags
nogui, GOOS=windows go build; go test -tags nogui -count=1 ./... under a
temp HOME with pinned caches: all ok but internal/provider, whose
TestReadOnlyRunLeavesLogins failed at that point from its own fixture
(two rewrites of one size given the same mtime read as unchanged by
filememo); fixed in the test, then internal/provider, access, mcpauth,
filememo, filelock and davsync -count=1 all ok, and the three new provider
tests -race -count=10 ok.
Not tried: the reporter's Linux arm64 box with a real systemd gateway and
real Codex accounts; Windows (LockFileEx path) only vetted and built, not
run on the Windows box.
|
||
|
|
34ce89945b |
gateway: an error that escapes its Chinese as \uXXXX is read as one that doesn't, for why it failed and when it's back (#1669, Natsumeretsu)
Every word list that decides why a reply failed (creditWords, brokeWords, rateWords, plannedWords, usedUpWords, quotaCodes) and af0558e6d's resetsWhen were matched against the raw body. A JSON error whose encoder escapes what isn't ASCII (Python's json.dumps by default) carries 用量 as 用量, so none of the Chinese words matched: WorkBuddy's escaped refusal read as a 1-minute rate limit with no reset time, Zhipu's escaped 1113 "余额不足…请充值" as a rate limit instead of out of credit, a sub2api key's escaped "7天限额已用完" as a rate limit instead of out of quota. wordsOf is the one shared point: a JSON body containing \u has its string values decoded and put after it, one to a line; any other body is matched as it is. failure() matches its words on it, resetsWritten reads the reset from it, the per-model rest's otherModels check uses it, and the two creditWords checks beside failure() (fallback.go's same-one retry, patience.go's busy) use it too. Tests: TestResetsWritten gains the reporter's Chinese refusal escaped (read, 3h16m2s) and escaped-but-cut-short (not read); TestWrittenResetRestsUntilThen rests the escaped refusal's model until then; TestFailureReadsEscapedWords: escaped Zhipu 1113 is credit, escaped sub2api 7天限额已用完 is quota, escaped WorkBuddy is quota. With wordsOf returning the body unchanged, all three fail. internal/gateway passes; go test -tags nogui ./... under a temp HOME; gofmt -l, go vet darwin, GOOS=linux, GOOS=windows on internal/gateway. |
||
|
|
c9fb7c9a1f |
gateway: a Claude run its timer ended mid-reply is no longer kept idle, holding one of 6 places (#1667)
A resumed turn's 30-minute timer calls abort. Fired during a reply, finish closed the run and removeRun took it out of b.idle, where it wasn't yet. The reply's last event, already in the segment, still reached the client whole, so ended was told ok and kept the closed run with keepIdle, then re-armed its timer. That timer found it closed and never took it out, so it held one of idleMost places until pushed out, and the push-out shelved a session removeRun may already have deleted. letGo's keepIdle had the same window. keepIdle now reads r.closed under b.mu and refuses an ended run, returning false; ended and letGo then return without re-arming the timer or rewinding. finish sets closed before removeRun takes b.mu, so a run is either refused here or kept and then taken out by removeRun. Tests: TestClaudeRunEndedMidReplyIsNotKeptIdle fires the run's timer (abort through removeRun) and then calls ended with a whole reply. On the old code it fails: "a run its timer ended mid-reply is kept idle (1 runs), holding a slot of 6"; it passes with the fix. TestClaudeIdle* kept closed runs only so abort did nothing; they now keep live runs, and TestClaudeIdleReplacementKeepsItsKey sets the other run at old's key directly, since keeping it there through keepIdle would end old. Run: go test -race -run 'Claude|Subscription|Idle|LetGo|Rewind' ./internal/gateway (ok); the full suite is in the next commit's body. Not tried with a real Claude Code: the window needs a 30-minute reply. |
||
|
|
af0558e6d0 |
gateway: a 429 that says in words when it's back rests until then, in Chinese as in English (#1669, Natsumeretsu)
WorkBuddy answers a frequency limit with the time it resets, in words:
"将在 2026-10-11 20:16:02 UTC+8重置" and "your usage will reset at
2026-10-11 12:37:53 UTC+8, ...". resetsAt read neither (only Claude
Code's "limit reached|<unix>" and ChatGPT's resets_at), so the Chinese
one rested quotaRest (15 min, matched 用量) and the English one
fallbackCooldown (1 min, no word list matched): the account was asked
again long before it was back, refused, and benched again.
- resetsWritten reads a time beside the reset phrasing (resetsWhen:
"reset(s) at", 将在/将于), in the UTC/GMT offset it is written with.
The offset must be followed by 重置 or punctuation, so a refusal cut
after "UTC" or "UTC+" is never read as UTC; a date that isn't real,
one past, or more than a week off (longestWritten) isn't read; another
vendor's date in passing ("deprecated on ...", "retry after ...") is no
reset. resetsAt falls back to it, so keepRetry notes it too.
- failure reads such a 429 as out of quota in either language.
- One that points to the account's other models ("切换其他模型",
"switch to the other models") rests that model alone (restID), so
the account's other models are still asked during an hours-long rest.
- rateRest: a reset time the refusal names (resetsAt, or as keepRetry
noted it) is believed up to longestQuota, as the quota branch does,
and the trace says "resets"; a Retry-After or rate-limit reset header
stays held to longestWait. Decided: the stated time is the vendor's
statement of when the account is back, and how far it is believed
shouldn't hang on which word list the message happened to match
(8 days as quota vs 1 hour as rate for the same words); a Retry-After
is generic advice and keeps the hour.
The rest is the gateway's, so it holds for moved WorkBuddy users too:
the plugin (packages/workbuddy 0.1.14, explained()) passes a 429 that
isn't "unapproved channel"/14018 on as it came.
TestPluginWrittenResetRests shows a plugin-served 429 with the
reporter's refusal resting the model until the stated time.
Tests: TestResetsWritten (reporter's bytes in both languages, other
offsets, cut-short, garbled, past, >7 days, other vendors' dates),
TestWrittenResetRestsUntilThen (both languages rest the model by
"resets", noted path, cut-short falls back, other vendors' 429s
unchanged), TestRateLimitBelievesItsReset, TestPluginWrittenResetRests.
Broke each piece by hand (reader, classification, rate cap, model
scope, offset, the terminator) and each made one of them fail.
TestRateLimitBacksOffWhenItComesBack now expects "resets" for a noted
reset. go test -tags nogui ./... under a temp HOME, rebased
on
|
||
|
|
2a8a9aecfa |
provider: signing out of ChatGPT and Devin's CLI checks go through the account's own proxy, as its sign-in does (#1663, demystify0137)
What changed: two siblings of
|
||
|
|
498b77fbca |
gui: the sign-in box shows the proxy it goes through, and another can be picked and kept as the account's (#1663, demystify0137)
What changed: while a sign-in waits (or after it failed), the box shows "Proxy: …" beside Open again. It opens the app menu (openProtoMenu, no native select) with Global (only when it could be kept), Direct, the subscription's proxy, each account's proxy and Custom…, which asks for an http://, https:// or socks5:// address. Picking one starts the sign-in again through it and cancels the open one; when it ends, the backend keeps the pick as the account's (keepSignInProxy). Userinfo in a proxy URL is never shown. "Sign in again" on an account now names that account (user), so it goes through the account's own proxy. The user and the pick are carried through the risk, site and plugin-method steps. Strings in zh, zh-TW, ja and de. docs/subsystems/providers-accounts.md describes the sign-in proxy. Why: the reporter asked that a sign-in use the subscription's or the account's proxy and be able to choose one; the default now does, and this lets the user choose and see it. What was run: - signin-proxy.test.cjs (new): Chromium and WebKit, en/zh/zh-TW/ja/de, at 900 and 380 wide, 40/40. It fails against HEAD's app.js (no link). - The sign-in, add-sheet, plugin-signin, click-scroll, i18n-keys and gui-<lang> files: 203/203; signin-close.test.cjs updated (the acts row now also holds the proxy link). - go test -tags nogui ./... ok; gofmt; linux/windows vet. Not tried: a real vendor sign-in through a real proxy from the window. |
||
|
|
ee7a9b24a6 |
agent: Grok App is an agent magpie connects: a magpie provider channel with magpie's models and their efforts (#1625, fjrtdk)
fjrtdk asked for Grok App (RongleCat/grok-app, a desktop GUI over the Grok
Build CLI) as a full agent: MCP, skills, RTK, models and effort.
What was already there, read in the App's source:
- MCP: the App reads ~/.grok/config.toml's [mcp_servers] in both of its
modes and hands them to the CLI it starts, so the Grok Build row's MCP
sync already reaches it.
- Skills: Grok Build's ~/.agents/skills, synced from the Grok Build row.
- RTK: rtk has no installer for Grok Build, so there is nothing to wire.
What was missing is models, and that is what changed:
- internal/agent/grokapp.go: a new agent, "grok-app" (alias grokapp), for
the App's agent-home/config.toml under its data folder: GROK_APP_HOME,
else ~/Library/Application Support/com.grokapp.grok-app or ~/.grok-app
on a Mac, %APPDATA%\grokapp\grok-app\data (and two older places) on
Windows, $XDG_DATA_HOME/grok-app or ~/.grok-app on Linux; the first
that exists.
- Connecting writes a [model.magpie] channel in the App's own format
(its custom routes): model, base_url = the gateway's /v1, name,
api_key (magpie-grok-app, so usage says the App), api_backend =
"chat_completions", app_provider_mode = "generic", app_models and
app_efforts as JSON strings (the App unquotes them with serde_json),
supports_reasoning_effort, app_supports_vision for a model that takes
images, and context_window when magpie knows it. app_models lists
magpie's models with their effort levels ("none" left out), so the
App's model and effort pickers show them.
- It sets [models] default = "magpie"; what was there is stashed, and
Disconnect puts it back and drops the channel: the file is
byte-identical to before (TestGrokApp).
- A sync keeps the model and the default effort the user picked in the
App while magpie still serves them, and writes nothing when nothing
changed.
- Picking one of the App's own routes (the official "grok", or a
channel of the user's with a base_url) takes magpie out.
- The notice says to start a new chat or restart the App, which reads
its providers when it starts an agent; translated in i18n.js (zh-CN,
zh-TW, ja, de) and listed in NOTICES.
- agents.go, agentenv.go (GROK_APP_HOME), docs/reference.md,
docs/subsystems/agent-wiring.md, both READMEs' agent lists.
Picking magpie in the App is a custom route, so the App runs that agent in
its independent mode (its own #557): it clears agent-home's auth.json
rather than syncing the official sign-in. ~/.grok is never written.
What was run:
- go test -tags nogui ./internal/agent ./internal/agentenv ./internal/gui:
ok. Full go test -tags nogui ./... under a temp HOME: ok.
- gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui: ok.
- Broken by hand, each red: context_window written quoted (TestGrokApp);
the user's picked model ignored (TestGrokAppSyncKeepsTheirs); their
default effort dropped (SyncKeepsTheirs); Disconnect not unstashing
(TestGrokApp); a no-op sync writing (SyncKeepsTheirs); "none" listed
as an effort (TestGrokApp).
- Real use in a sandbox HOME: a built magpie on 127.0.0.1:3681 with a
fake upstream; `magpie grok-app magpie/fake/echo-1` wrote the channel;
the real grok 1.0.50, started as the App starts it on a custom route
(GROK_HOME=agent-home, --model magpie), answered through magpie, the
upstream saw echo-1 and usage.jsonl counted agent "grok-app". `magpie
grok-app default` restored the file (the only difference was grok's own
[marketplace] line written while it ran). ~/.grok/config.toml untouched.
Not tried: the real Grok App GUI (it would sign in through the keychain
and ~/.grok), a model with effort levels end to end, Windows and Linux
paths beyond TestGrokAppDir.
|
||
|
|
a0c4dba97d |
gui: the tray icon closes an open panel on the Mac under a window over the whole screen too, not only when the panel can be seen (#1661)
TestTrayCellClickReleasedPanel went red with "initial quota click did not open the panel". The cause: Wails' WebviewWindow.IsVisible on the Mac is the window's occlusion state, not [NSWindow isVisible]. This Mac runs UURemoteServer, whose privacy curtain is an opaque window over the whole screen at layer 2147483631, above every app's. Under it, every window is "occluded", so the panel the click had just opened read as closed. The same check is a product bug too. togglePanelNow went through Wails' SystemTray.ToggleWindow, which chooses hide or show by IsVisible. Under such a cover, a click on the tray icon showed the already open panel again and never closed it. With only the test's check changed, the test failed on "second quota click did not close the panel". Fix: on the Mac, togglePanelNow decides by windowOpen (shown and not miniaturised, the check #1381 brought in for lightweight mode). It hides the panel, or places it and shows it, itself. fitPanel, zoomWindows and trayCellClick use windowOpen in place of IsVisible as well. Linux and Windows still go through ToggleWindow, unchanged. The Hyprland branch's IsVisible checks are left alone, since they are Wayland only. Both AppKit tests (TestTrayCellClickReleasedPanel, TestPanelCloseHidesIt) now read the panel's state through windowOpen. gui-shell.md item 5 says so. Run, on darwin/arm64: - Under an injected cover (scratchpad cover.swift: opaque, max level, sharingType none, the whole screen): - origin/main: TestTrayCellClickReleasedPanel 0/8, and TestPanelCloseHidesIt 0/4 ("timed out waiting until the panel shows"). - Test-only change: 0/8 ("second quota click did not close the panel"). - This commit: TestTrayCellClickReleasedPanel 25/25, and TestPanelCloseHidesIt 20/20. - Under UU's own curtain: - origin/main: 30/30 red. - This commit: 10/10 green. - Before the curtain was up, origin/main passed 75/75. Under an activator load, it was 5/40 red. - go test ./internal/gui (GUI build) passes. go test -tags nogui ./internal/gui passes. gofmt is clean. - go vet with -tags nogui passes for linux and windows; go vet passes on darwin. Not tried: clicking the real status item by hand under a remote session. The test drives trayCellClick and togglePanel's path through the host. |
||
|
|
94fd332c35 |
agent, gui, tui: an agent's own models can be left out of its model picker (#1642, MizuIro-H)
DeepSeek Harness offers its own DeepSeek models beside magpie's in its
model picker, and nothing in magpie could leave them out: `magpie visible`
and the model list only cover magpie's catalog. An agent's model list now
has a switch at the top, "Show {agent}'s own models", for an agent that
has models of its own. Off, its picker offers magpie's alone.
- settings.OwnModelsHidden lists the agents whose own models are left
out. provider.OwnModelsHidden / SetOwnModelsHidden read and write it.
POST /api/settings keeps it: the Settings page doesn't send it.
- agent.Picks(f, cur) is a field's options without the agent's own
(no Ref, a value). It leaves them in when the field has no magpie
option at all, and always keeps the value the agent is set to now, so
the user's own choice isn't dropped or rewritten. The GUI's agent
fields and the TUI picker read it. The CLI still sets an own model by
name.
- GET /api/agent-models/{id} says `own` and `ownHidden`. POST
{ownHidden} sets it. The GUI's switch rolls back if the save fails,
and closing the list filters the picker at once, before the state is
read again. The order view (magpie's models alone) hides the switch.
- Strings in zh, zh-TW, ja, de.
Run: go test ./internal/agent ./internal/provider ./internal/settings
./internal/tui, all green. go test ./internal/gui is green apart from
TestTrayCellClickReleasedPanel, which fails the same alone on
origin/main
|
||
|
|
9ce12eec71 |
gateway: a tool_use turn sent to DeepSeek's Anthropic endpoint carries a thinking block, so DeepSeek no longer refuses the request with 400, or with 422 over Claude's redacted thinking (#1611)
What changed: in thinking mode, DeepSeek's Anthropic endpoint (api.deepseek.com/anthropic) refuses a request when an assistant turn has a tool_use and no thinking block: 400 "The `content[].thinking` in the thinking mode must be passed back to the API". It also refuses redacted_thinking anywhere in the request with 422 "unknown variant `redacted_thinking`". A Claude Code routing group whose Claude turns fall over to DeepSeek met both refusals. This is the Anthropic-endpoint sibling of #1592 (Responses) and #1462 (Chat). - anthropicReplaysThinking(host, model): DeepSeek only, by host or model id. It is never api.anthropic.com or a Claude model. - withThinkingOnToolTurns: a tool_use turn with no thinking gets a {"type":"thinking","thinking":" "} block first. Redacted thinking becomes that block, or is dropped when the turn already has thinking. The body is returned byte for byte when nothing changes. - The passthrough and the translated build (a Chat/Responses client to an Anthropic-only DeepSeek) both use it. The translated build also replays the turn's own reasoning text, where it has one. - docs/subsystems/gateway-routing.md describes it. Checked live on 2026-10-11 against api.deepseek.com/anthropic with deepseek-flash and deepseek-v4-pro: - Thinking on (no field, enabled or adaptive) with a bare tool_use: 400. - Thinking disabled with a bare tool_use: 200. - redacted_thinking, even in a text-only turn: 422. - Thinking " ", thinking "", unsigned thinking and thinking after text: all 200. What was run: - New tests in deepseek_anthropic_thinking_test.go: - direct and through group/cc; - glm-5.2 and claude-sonnet-4-6 on the same upstream are sent unchanged; - the translated path; - the body is returned byte for byte when nothing changes. - Breaking each call site by hand turns its test red. - go test ./internal/gateway passed (410s). gofmt -l is clean, and go vet passes for linux, windows and darwin. - End to end, with a built binary on port 3611 and a sandbox HOME holding the owner's real DeepSeek key: - before this change: 422 with redacted thinking, and 400 with thinking adaptive; - after it: 200 with a complete reply in all 8 cases (direct and group/cc, streamed and whole, adaptive and no thinking field). |