c5f15cae7ccc8a67ea944f4b8d2c2fdf801611a8
3791
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
c5f15cae7c |
provider: Amazon Bedrock's Mantle endpoint (@marktoown on X)
"添加 AmazonBedrock 的时候,API 还是旧的 Bedrock-runtime 节点,不支持最新的
Bedrock-mantle 节点". The reporter wanted to add Amazon Bedrock at its
Mantle endpoint, but magpie only offered bedrock-runtime.
What it does:
- A new vendor preset, bedrock-mantle ("Amazon Bedrock (Mantle)"), takes
the same Bedrock API key as the runtime.
- It has 17 regions of its own (mantleRegions): the
bedrock-mantle.{region}.api.aws hosts that answered on 2026-10-16.
The runtime's eu-west-3 has no Mantle host.
- Chat completions and Responses go to /v1, and Messages to
/anthropic.
- Unlike the runtime, its models are listed from GET /v1/models.
NoList stays on the runtime preset only.
- Mantle serves each OpenAI-style model under one prefix.
- OpenAI's closed GPTs and xAI's Grok are under /openai/v1. Every
other model is under /v1. Asking at the wrong prefix gets "model `x`
isn't supported on this route".
- provider.MantleBase picks the prefix from the model id. The
gateway's forwardOnce and the provider test's tinyBody both use it.
- For a model whose maker the rule doesn't know, the gateway asks
again once at the other prefix when Mantle refuses it for its route
(internal/gateway/mantle.go).
- When the second prefix takes it, the gateway remembers that prefix
in unfit. When both refuse, the client gets the first refusal and
nothing is remembered.
- IsBedrockMantle is true for the preset and for any provider added at a
Mantle host. IsBedrock includes it, so the shared Bedrock rules apply
to Mantle too:
- Claude goes on Messages only.
- The key is sent as x-api-key alone, which is what Mantle's own
examples send.
- max_completion_tokens is used, and metadata is stripped.
- Beta renames and refusals apply.
- There is no Priority.
- GPTs go to Responses first.
- I checked every other IsBedrock caller. None is runtime-only except
the legacy /openai/v1 -> Responses migration in normalize, which is
harmless for Mantle.
- A provider added by its Mantle address gets the APIs it wasn't given
(mantleEndpoints, in normalize). A chat or Responses URL given at
/openai/v1 is moved to /v1, because /openai/v1/models is a 404 and the
list lives at /v1/models.
- GUI: the editor's Key header row is hidden for a Mantle Anthropic
address, as it already was for the runtime's.
- Docs: README (en, zh) preset lists, docs/reference.md,
providers-accounts.md (a new row) and gateway-routing.md (a new row,
plus a test command).
What was run, in the worktree at
|
||
|
|
b2764f7f9e |
provider: a check-in sent through a plugin's fetch that got no reply retries in a minute, not half an hour (plugins #149)
A moved WorkBuddy account's check-in goes through the plugin's fetch.
Bun's failure comes back as text, not as a *url.Error, so
wbCheckinFailed took "ECONNRESET: The socket connection was closed
unexpectedly" for a refusal and waited the full 30 minutes. It now also
treats Bun's and Node's words for a request that got no reply as
offline: ECONNRESET, ECONNREFUSED, ETIMEDOUT, ENOTFOUND, EAI_AGAIN,
EHOSTUNREACH, ENETUNREACH, ConnectionRefused, ConnectionClosed,
FailedToOpenSocket, "Unable to connect" and "socket connection was
closed unexpectedly". Offline retries after 1m, doubling, up to 30m.
wbCheckinFailed is the one place the workbuddy, minimax, qoder, trae and
plugin check-ins all go through.
TestWorkBuddyCheckinPluginResetRetriesSoon feeds the reporter's literal
error through the account's plugin fetch. The first tick is Failed and
Offline; a minute later the fetch answers and the tick is Claimed.
"plugin fetch: HTTP 500", "WorkBuddy refused: code 11140" and "Unable to
parse the reply" stay not offline. With the fix stashed the test is red
("reset: … Offline:false").
Run (sandbox HOME, GOMODCACHE, GOCACHE; set -o pipefail), base
|
||
|
|
e243937ca3 |
gateway: a fast pick can be sent as Ultrafast where the account offers it (#1954)
zhenghaowen0967 asked for an agent's fast pick of a ChatGPT model to go as
Codex's Ultrafast without the client asking for it. settings.UltraPicks
holds the agent's fast picks that are set to Ultrafast; each one is in
FastPicks too.
- The gateway marks those candidates `ultra` in fastPick.
- On Chat and Responses, a try sends service_tier "ultrafast".
- From Messages, a try carries withUltra to forwardTranslated, which
sets Request.Ultrafast for the ChatGPT backend.
- In every case, the #1784 check decides the account. One whose list
doesn't offer Ultrafast goes after a mate that does (tierMate). With
no mate left, it is sent priority.
- That check now covers Chat as well as Responses.
- Sibling fix: chat.go dropped a Chat client's own service_tier
"ultrafast" (Fast was false, Ultrafast unset). It now parses as
Responses does.
- provider: SetFastTier (""/priority/ultrafast) behind SetFastPick.
CanUltra and UltraModels say whether one of Codex's accounts lists
Ultrafast on the model. UltraPicks follow a provider rename
(renameModelPrefs) and survive a GUI settings save.
- GUI: an option gets ultraOk/ultra. Where ultraOk is set, the bolt in
the picker steps usual -> Fast -> Ultrafast -> usual, as a camera's
flash button steps its modes. Ultrafast shows two overlapped bolts, in
the row and after the field's model. Tooltips and the status line are
in en, zh, zh-TW, ja and de. POST /api/agent-fast takes `ultra`.
- No `:ultrafast` suffix for routing groups yet.
Tests, each broken by hand and seen red:
- TestUltraPickSentUltrafast covers omp/Responses with no tier asked
(acct-pro:ultrafast), the Pro account out (then acct-plus:priority),
another agent unchanged, opencode/Chat and claude/Messages picks, a
Chat client's own ultrafast, and switching back to Fast or off.
- Red with ultra forced false (4 cases).
- Red without withUltra (claude went priority).
- Red without the chat.go parse (2 cases).
- TestSetFastPick: red without UltraPicks in renameModelPrefs.
- TestSettingsSaveKeepsWhatItDoesNotSend: red without the api.go carry.
- fast-ultra.test.cjs (en zh ja de, window and 440px panel): red (9/9)
without the Ultrafast step.
Run (vet, gofmt, GUI and full suite at base 8b84dc902; the reruns
below at a rebase onto
|
||
|
|
ef6d5ca400 |
provider: a model's listed APIs, Cline/Kilo free mark and remote price are looked up, not the whole list copied for each, so 2,500 models' /v1/models is 0.8s again (K.Liu on Discord)
K.Liu: /v1/models with 2,000+ models took 2.8s on 127.0.0.1, where it took 1.6s before, so third-party apps couldn't show the whole list. Cause: |
||
|
|
19e9fc47f0 |
provider: moved Cursor users get opencode-cursor-auth 0.2.17: a multi-step turn's last step reports its own prompt, a step of many long calls isn't failed as an incomplete batch, and a continuation in a Run's last minute rebuilds instead of a 502 (magpie-community/plugins#156, #155, #157)
Raises the cursor mover's min to 0.2.17. npm view --prefer-online
@magpie-community/opencode-cursor-auth@0.2.16 and @0.2.17 answer
their versions.
plugins c7c6498 (0.2.16 in 2dd4328):
- #156 (erzay): Codex read the final step's prompt_tokens, the whole
turn's 1,105,934 over ~21 calls, as its context (~61K) and compacted
at once. The last step now reports its own share, by its own prompt
estimate and output, and the rest of the turn goes as
usage.magpie_deferred, billed but never told as the prompt. Test
with erzay's numbers: prompt < total/2, prompt+deferred, cache and
completion add up.
- #155: the native batch wait ran once from the first call, so a step
of 13 calls with long arguments, each sent after the model wrote
it, was failed past 30s in total. The wait restarts from the latest
call or text. Tests: calls 150ms apart under a 300ms wait seal; a
stalled step still fails no earlier than the wait.
- All three new tests fail on 4e64f26's source.
plugins 0b82190 (#157, nicegui; 0.2.17 in 3dbaa0b): a tool-result
continuation with <= min(60s, lifetime/10) of the Run's 15 minutes
left rebuilds from the supplied history before writing results. Merged
at reviewed head 75e481a, which resolved the conflict with a7614aa's
expireIn (it now sets expiresAt too). Injected with an offset clock:
62s left kept the Run (1 Run, 1 result written); 59s and 0.5s left
rebuilt (2 Runs, 0 results); removing the check turns those red. bun
test 267 pass x3, check.mjs ok.
gofmt -l clean; go vet ./internal/library ./internal/provider
GOOS=darwin/linux/windows ok.
Full suite: set -o pipefail; go test -timeout 45m ./... at
|
||
|
|
ea3babac89 |
library: TestSkillRelinkKeepsUnreadableCopy holds under load, where the library skill's hash is remembered past its chmod
Red in a full run at |
||
|
|
e733b0722e |
plugins: a provider plugin says which service tiers a model serves, and Codex offers them (#2514)
Lovest on Discord (#general, v0.1.1267): a provider plugin had no way to
say a model is served at Fast or Ultrafast, so Codex never offered them for
plugin models, and the host dropped the field anyway.
- host.js keeps m.serviceTiers (tiersOf: string ids or {id} objects,
trimmed, de-duplicated, anything else dropped) as plugin.Model.ServiceTiers.
- pluginCatalog puts them on catalog.Model.Tiers; CodexTiers offers a
plugin's tiers when it declares any, so codexcat writes service_tiers
(priority named Fast) into Codex's catalog and /v1/models.
- forwardTranslated keeps service_tier (OwnTier) for a plugin provider only
when the request is translated to its Chat or Responses and the tier is
one the model declares (provider.PluginTiers). A request relayed in its
own protocol was already sent as the client wrote it; unchanged. Cursor's
fast flag and #1954's ChatGPT tiers are untouched (#1954 not on main yet).
- Docs: serviceTiers in site/public/docs plugins (en, zh, ja) and a
"service tiers" section in docs/subsystems/provider-plugins.md.
Tests (internal/gateway/plugin_tiers_test.go, fake plugin FAKE_TIERS):
TestPluginModelServiceTiersListed (fake-1 priority=Fast + ultrafast,
fake-resp ultrafast, fake-claude none) and TestPluginServiceTierReachesFetch
(Responses→plugin Chat and Chat→plugin Responses send a declared tier,
drop an undeclared one; same-protocol relays as before).
Broken by hand: OwnTier branch forced false → 3 translated cases red;
CodexTiers without IsPlugin → listed test red; host.js serviceTiers: [] →
listed test red. Restored → green.
gofmt -l clean; go vet -tags nogui with GOOS=darwin, linux, windows clean.
Not tried with a real vendor plugin that serves ultrafast.
Full suite: go test -timeout 45m ./... at af9e0d6b2 (sandbox HOME, load
average ~408 from other sessions): every package ok except agent and
gateway, which timed out at 45m with no failed test (rerun whole: timed
out again, 0 failures), gui (TestMainWindowCorners killed, #1936),
TestVendorThatStopsMidAnswerIsSaid (filed #2535) and
TestSetAnswersWhileDevinAndProvidersHang (#1375). The reds and the tests
running at each timeout (TestCodexKeptOnChatGPT, TestReplyNamesMember)
pass rerun alone, except TestMainWindowCorners (#1936). CI is the gate.
|
||
|
|
63be47717a |
gui: TestPanelJoinsFullScreenSpaces checks key status only where the session gives it (#2450)
The test was wrong, not the panel. It required the quick panel to be key
after Focus, but on this Mac (macOS 26.2 25C56, no input for ~30 min,
frontmost app kitty) macOS makes no non-activating panel key for an app
that isn't active when nothing the user did is behind it. That held at
|
||
|
|
6b3ee5a03b |
library: a repository that keeps its skills again under a plugin's folder lists each once (碳碳双键 on Discord)
tw93/waza keeps its eight skills in skills/ and again in plugins/waza/skills/. Some of the plugin copies lag the top ones. Typing "tw93/waza" in Library → Skills listed "16 skills", each one twice. unhiddenFirst only folded a copy in a hidden folder (.claude/ skills, #1964) into the unhidden one; two unhidden copies both stayed. It now keeps one copy of each skill. It prefers the copy outside hidden folders, then the one fewest folders deep, then the first. That covers both candidates (the probe and install) and skillDirsIn (the new-skill check). Run: - TestRepoWithAPluginCopyListsEachSkillOnce uses waza's real paths. Against the old skills.go it is red (9 lines: 16 candidates, the plugin's descriptions, 16 tree dirs); with the fix it is green. TestMarketInstallsASkillKeptInClaudesFolder (#1964) is green too. - Real use: ProbeSkills("tw93/waza") against GitHub in a sandbox HOME lists skills/check … skills/write, 8 in all, each once. - gofmt -l clean; go vet -tags nogui ./... clean for darwin, linux and windows. - Full suite: go test -timeout 45m ./... at load average ~115 (other sessions' suites). 63 packages ok. internal/agent and internal/gateway timed out at 45m with no test hung (TestOpenCodeAndCrushKeep… and TestStrictAffinity… had each run 0s), and go list -deps shows that neither imports internal/library. internal/gui's TestPanelJoinsFullScreenSpaces is #2450, red on main already. |
||
|
|
e72b6a3327 |
gateway: preserve cache splits and known 1h writes across updates (#1717)
Keep reported Anthropic cache_creation splits, including pure-5m replies,
through API and subscription parsing and client output. Only positive
counters replace known usage. Completed sums retain all counters and
split presence.
Across continuation tries, search rounds and internal bridge messages,
partial updates add earlier total writes only with a positive total. A
split with counts and zero 1h keeps the current message's known 1h before
adding earlier messages' usage. A zero-filled or absent split keeps the
per-counter rule. Omit a zero-filled partial split with a positive total
from output; retain a reported zero-total split. Split presence and the
parsed update's own count evidence remain separate.
Yetone's zero-filled bridge probe and matching continuation/search probes
failed at 0c9298d with 10 instead of 15 1h writes. Fable's partial-5m and
pure-5m cases failed at e1de9bc7 in bridge, continuation and both search
modes with the same loss. All pass after the repair. The 12-case matrix
matches main's client totals and 1h counts and continuation/search ledger
counts. A renderer test rejects a fabricated 50/0 split on a sparse delta.
Verified under sandbox HOME, pinned Go caches and nogui: focused race,
Darwin vet ./..., Linux/Windows gateway vet, gofmt and diff checks. Archive
mutations removing current-message carry, bypassing each of three callers,
and restoring the fabricated split each fail behavior assertions. Restored
archive passes. Earlier zero-total, unreported-split and pure-5m cases stay
green. No live-provider check in this repair.
Review (yetone's session, landed from the PR's head c4cf224 and 90cdb2f):
the partial-cache probes go red when carryUpdate is reverted by hand,
and the 12-case matrix gives the same client totals and 1h counts as
main
|
||
|
|
d9e87eb328 |
gateway: clients opt into Claude subscription cache marks and TTLs (#1717)
Problem: Messages clients need control of cache boundaries and TTLs when a Claude subscription answers. Ordinary clients must retain their run identity, prompt and environment. A routing group's API-key member keeps its marks and must not report the subscription bridge's drops. Change: Select client-owned marks only with X-Magpie-Cache-Marks: client. Map system and fresh-history boundaries and the request tail, default missing TTLs to 5m, validate slot and TTL order, and separate opted-in run identities. Retain prefix constraints across live and saved runs. Report unmappable marks only for the Claude subscription try. Bound its selection hold to two seconds and clear the report and hold for a non-Claude fallback. Check ordinary identity bytes without a version-specific hash golden. What was run: Sandbox HOME, nogui: go vet ./... on darwin; gateway vet with GOOS=linux and GOOS=windows; full gateway tests; focused cache and usage tests with -race. gofmt and git diff --check passed. The group probe failed before the fix with tools:1 on the API-key reply in both routing orders and both stream modes. Hand-broken candidate scoping, stale report clearing, keepalive holds and ordinary identity bytes each failed behavior tests. Live, Claude Code on a Claude subscription and an Anthropic API key, through a recording proxy: in a group whose API-key member answers, in either order and both stream modes, the reply has no dropped-mark header and upstream receives the tool mark; a Claude answer reports tools:1; a failed Claude try followed by an API-key answer leaves no report. With a delayed API-key reply, the group's first keepalive came 0.85 s after a direct request's. Without the header, the outgoing request equals one from a gateway built at the same base. No GUI or real Linux/Windows execution. |
||
|
|
8b84dc902b |
gateway: a gateway key held to some models is told of those image and video models alone in /v1/models (塔哥 on Discord)
A key limited to some models (#882) saw only those in /v1/models' chat list, but the image and video entries (kind image/video) were listed for every provider. Requests with them were already refused (draw.go, video.go), so this was a listing leak only. A remote magpie signed in with such a key showed the owner's whole image and video catalog. drawerObjects and videomakerObjects now take the request and drop what the key doesn't allow, as the chat list does. Test: TestGatewayKeyModelsHoldTheImageAndVideoLists (key_models_test.go): this computer and an unrestricted key see grok-imagine-image/-video, a key held to elsewhere/* sees neither, a key held to grok/grok-imagine-video sees that alone. Red on the old code (the restricted keys saw both), green now. Run at |
||
|
|
107fbbc36d |
provider: moved Factory users get opencode-factory-auth 0.1.31, whose OpenAI models' requests go without temperature and top_p, not 400 (sweanng424 on Discord; magpie-community/plugins#154)
Raises the factory mover's min to 0.1.31 (npm view --prefer-online
@magpie-community/opencode-factory-auth@0.1.31 answers 0.1.31; published
by plugins 4e64f26's publish run 38857895455). The magpie side of the
class, plugin models' temperature: false not read, is #2492.
Run at
|
||
|
|
a15e576564 |
agent: OpenPencil uses magpie's models (@JC_be_better on X)
OpenPencil (ZSeven-W/openpencil, the openpencil-desktop app) keeps the builtin agents its chat runs on in settings.json under Rust's dirs::config_dir()/openpencil (read from its settings_io.rs and settings_payload.rs). magpie adds one builtin_agents entry, id "magpie", kind openai-compat at the gateway's /v1 with the magpie-openpencil key, preset custom, the picked models as OpenPencil writes a list: the first as `model`, `models` only for two or more, at most 64. The user's other entries and settings stay, and so do the display_name and enabled they give magpie's entry; a sync with nothing to change doesn't write. A file magpie makes gets "version": 1 (OpenPencil sets a file without it aside as corrupt); a file with another version, or none, is left alone. Disconnect takes the entry out, and the file when nothing else is left. OpenPencil reads the file once at start and writes it all back when it quits, so a change is refused while openpencil-desktop runs (Windows can't be asked, so the notice says to quit it first). Notice translated in zh-CN, zh-TW, ja and de. README (en, zh-CN), docs/reference.md and docs/subsystems/agent-wiring.md list it. open-pencil/open-pencil, the other app of the name, keeps its providers in its webview's localStorage, so it gets no row. Run, under a scratchpad HOME with GOCACHE/GOMODCACHE pinned: - go test -p 2 -tags nogui -count=1 -timeout 45m ./...: ok, 66 packages ok, 18 with no test files - gofmt -l: clean; GOOS=linux and GOOS=windows go vet -tags nogui ./...: clean - go test ./internal/agent -run '^TestOpenPencil': ok - node --test agent-notice-lang, i18n-keys, header-relang (Chromium and WebKit, every language, wide and narrow): 37/37 pass Broken by hand, each went red: the running check, the 64 cap, the version check, keeping the user's display_name, the no-op sync, and writing the version into a new file. Real use: OpenPencil v0.8.4 (latest release, arm64, sha256 checked against its SHA256SUMS) under a sandbox HOME, started on a settings.json magpie wrote with the user's own Anthropic entry beside it. It started and ran 15s with the file intact and no .corrupt copy. v0.8.4 has no `models` field, so it lists only the first magpie model; main lists them all. Not tried: a chat request through OpenPencil's UI; its exit save (it didn't quit on an AppleEvent and was stopped with TERM, so the write-back wasn't seen); Linux and Windows; a build of OpenPencil's main. |
||
|
|
7597c13237 |
gui: a curl example pasted into a provider's editor fills it in (@mark_li21 on X)
@mark_li21 asked: 能支持通过curl例子直接导入provider不? A curl example
from a vendor's docs, pasted into a custom provider's Base URL or API key,
now fills in the editor instead of being pasted as text.
curlOf (app.js) is one pure function. It reads the paste the way a shell
would: lines joined by \, cmd's ^ or PowerShell's backtick; curl.exe;
quotes and escapes. From that it takes:
- the API that the URL's endpoint names: /chat/completions is Chat,
/messages is Anthropic and /responses is Responses;
- the base URL before that endpoint, spelled by respellURL the way the
editor already wants it;
- the key from Authorization: Bearer, x-api-key or api-key;
- the model in the JSON body.
A key that is only a placeholder ($X, ${X}, %X%, <token>, YOUR_API_KEY)
is not taken. The key box is left empty and focused instead. A new
provider adds the model to its models. A saved provider's picks are left
alone, because adding to an empty list would narrow what it serves. A
preset's editor only takes the key.
A note in the editor says what was filled in. It also points out a
placeholder left in the URL, such as {WorkspaceId}, and a URL with no
known endpoint. Its four strings are translated into zh, zh-TW, ja and
de. Text that isn't curl pastes as before, including several keys at
once.
Found along the way: url.onpaste = fromCurl cancelled every plain paste
into the Base URL, because an on-handler that returns false cancels the
event. The handler is now wrapped. The test fails on the unwrapped one.
Fixtures, in internal/gui/tests/fixtures/curl, are the docs' own bytes:
- OpenAI chat (API reference) and Responses (quickstart);
- Anthropic Messages;
- DeepSeek, Zhipu, Moonshot and OpenRouter quick starts;
- Alibaba Bailian's Windows cmd example (^ and \"-escaped JSON);
- SAP AI Core's PowerShell one-liner (curl.exe, <Deployment_url>);
- Unsloth Studio's PowerShell example, with backtick continuations, as
its usage panel renders the template. This one is not copied from a
static doc page.
The doc row is "A pasted curl command" in
docs/subsystems/providers-accounts.md.
Run at
|
||
|
|
674b6ca288 |
gui: a provider's per-key proxy lines fold past eight keys (@NetRozee on X)
@NetRozee on X: a custom endpoint given a thousand keys froze magpie.
Cause. The editor's Advanced > Proxy drew a line for every key, each
with a Provider's proxy | Direct | Custom control. Each control, once in
the page, looked up its place among every .segs in the editor and slid
its thumb (segsPlace, slide): quadratic, with a layout read each. The
Accounts list above it already folded (keyFold); this list didn't.
Fix. proxyLines folds a provider's keys as keyFold does: past KEYS_FOLD,
the first KEYS_FIRST and those with a proxy of their own, then All N
keys; opened, a filter (keyMatches, as the Accounts list's) over
KEYS_PAGE lines and how many more, and Show fewer. Typing draws the
lines again under the filter, which stays in the page (#1055). A key not
drawn keeps its proxy: Save posts every key's own, drawn or not.
Subscription accounts' lines are unchanged. No new strings.
Measured (Playwright, the editor opened on a provider of N keys):
1000 keys 5000 keys
Chromium 1067ms -> 100ms 55.6s -> 93ms
WebKit 4809ms -> 68ms 203s -> 81ms
DOM 9388 -> 434 nodes 45388 -> 434 nodes
Tests: provider-many-keys-proxy.test.cjs (new, en and zh, Chromium and
WebKit): fails in all four on the old app.js (no All 300 keys). With
account-proxy, provider-many-keys, filter-ime, usage-keys-fold,
i18n-keys, click-scroll, provider-proxy, proxy-own-wording,
routing-proxy, plugin-proxy-page, signin-proxy and proxy-test: 221 of
221 pass in both engines.
Run: gofmt -l (clean); GOOS=linux and GOOS=windows go vet -tags nogui
./... (clean); go test -tags nogui -count=1 -timeout 45m ./... in a sandbox HOME (GOCACHE, GOMODCACHE pinned) on
|
||
|
|
0bbb2f3ca4 |
provider, gui, gateway: a thousand keys are listed once and read eight at a time (@NetRozee on X)
@NetRozee on X: "when I add a thousand keys for a custom endpoint magpie
just froze or crash by itself".
Cause. The Providers page asked, for each key, what it rests by
(RestKey), and RestKey listed every key on again (KeysOn), which itself
looked along the list for each key: cubic in the keys. /api/providers
and every /api/keys/* answer, an import too, are drawn through it. The
gateway asked, for each key of every request, whether it serves the
model (Serves), and each asking read the provider's lists again (a
filememo stat, and a read while the file is new) and looked along each
model's key ids. fetchPerKey looked along the lists for each key and
model the same way.
Fix.
- KeysOn drops repeats by a set.
- RestKeys finds once whether several keys are on; providerInfo uses it.
- Serving(model) reads the lists once and answers for each key from sets
(keyLists, made again when the lists are read anew); perKeyBarred and
the test pick use it. Serves is Serving for one key.
- fetchPerKey keeps each model's keys as a set and indexes the old list
by key once; a model kept for a failed key is kept once, as before.
- KeysListed and ListsRead count listings and list reads for the tests.
Behaviour is otherwise the same.
Measured (go test in a sandbox HOME, a custom provider, 50 models):
1000 keys 5000 keys
providerInfo 1.54s -> 7.5ms 2m42.9s -> 18.3ms
providersState 1.65s -> 110ms 2m40.3s -> 146ms
POST /api/keys/import 1.64s -> 82ms 2m44.7s -> 288ms
of one more key
gateway perKey 100.9ms -> 8.2ms (old not run) -> 40ms
(each request)
Tests (counts, not time), each red on the old code by hand:
- TestProviderInfoListsKeysOnce: old 1001 listings for 1000 keys, 11 for
10; new 0 and 0.
- TestPerKeyReadsListsOnce: old 1001 list reads for 1000 keys, 11 for
10; new 1 and 1.
- TestServingReadsListsOnce, TestRestKeysIsRestKey,
TestKeysOnDropsRepeats: same answers as before.
And the vendor reads. KeyBalances, PlanQuotas and remoteKeyCards started a goroutine
for each key and asked the vendor with all of them at once: a thousand
keys were a thousand requests to one relay together, each holding a
connection and its body.
Fix. keySlots holds each provider's reads to keyReadsAtOnce (8); other
providers' keys are read beside them. A read whose context is done goes
on without a slot and fails at once, as before.
Tests:
- TestKeyReadsEightAtOnce: a Command Code provider of 31 keys and a
remote magpie of 31 keys behind a server that holds every request.
Old code (the slots taken out by hand): 31 at once for balances, plans
and remote limits; new: 8, every card still there.
- TestKeySlots: a done context takes no slot; another provider's keys
have their own.
Run: gofmt -l (clean); GOOS=linux and GOOS=windows go vet -tags nogui
./... (clean); go test -tags nogui -count=1 -timeout 45m ./... in a sandbox HOME (GOCACHE, GOMODCACHE pinned) on
|
||
|
|
af601541ef |
routing: a request opens to its request and response (Fate on Discord)
Fate asked on Discord to see what a single request on the Routing page sent
and got back, such as a Codex prediction. The bodies were captured already,
in the Gateway page's 40 recent calls and the opt-in request archive, but
nothing led there from a Routing request.
- gateway: a Call carries the Routing request it was (Call.Route = the
trace's Route.ID), set where serve, the Codex backend and a refused title
record it. Server.RouteCall finds it in the ring. A route id is not a
call id. A route names its archive copy (Route.Archive =
call.archiveName()), set only when the archive was on, so it reaches the
saved history too.
- gui: GET /api/gateway/call takes ?route= besides ?id=. It is the same
handler, the same no-store, the same key guard and the same 404 once the
ring has let the call go.
- Routing page: the story's head has "Request and response". It fetches
only when pressed, and shows the masked bodies through callBodyPanel (an
SSE reply reads as its events). A request the ring no longer has shows
the archive's copy through archivePanel when the route names one.
Otherwise it says the last 40 are kept until magpie quits and how to turn
the archive on. Nothing more is captured or kept than before.
- The head now wraps. At narrow widths its buttons ran past the story
("Back to live" was cut off at 440px).
- The two button words live in i18n.js: i18n-keys' "a plugin's words are
its own" found them inside core strings.
- docs/subsystems/gui-shell.md says how a route reaches its bodies.
Tests:
- TestRoutingRequestOpensItsBodies (new): each of two routes gets its own
bodies; route 0 and an unknown route get 404. Red without
`call.Route = tr.ID` ("route …: 404").
- TestArchiveWholeBodies now checks that the route names the archive. Red
without the t.Archive line (`route names archive ""`).
- routing-bodies.test.cjs (new), chromium and webkit at 440px, en, zh,
zh-TW, ja and de, 10/10. It covers the ring's copy read only when asked,
hiding, another request closing it, the archive's copy, the
how-to-keep note, nothing past the story and no left border.
- Red with the client asking ?id= and with the head's wrap removed.
- routing-request-metrics.test.cjs: with the head wrapped, its 480px
picker clicks in WebKit landed on the footer. Playwright's WebKit places
elements in the scrolled view hundreds of px lower than
getBoundingClientRect, which elementFromPoint agrees with. The test now
clicks where the page shows them. 5 runs of both engines, 20/20.
Run in a sandbox HOME at
|
||
|
|
1d227a7eb9 |
tui: a group's page keeps the row picked and its header in view (#2452)
What changed - viewGroup drew every member and every rule and left the rest to the terminal. A group with more of them than the terminal has rows (a whole provider's thirty models at 80x24) scrolled the header and the highlight off the top, and j/k moved a pick no one could see. The library page (#2220) and the agents page (#2428, |
||
|
|
ba17c4f90d |
provider: a Command Code plan key's card shows the month's credits as a meter (#2451)
tianxia3111 runs Command Code on the keyed preset with a plan's key. Its
card showed the 5-hour and weekly windows as meters, but the month's
credits only as dollars left ($5.27), with no share of the month. The
cause: billing/credits leaves out the planId, so the key's card couldn't
know the plan's monthly pool. The signed-in subscription's card gets
that pool from billing/subscriptions.
The key's card (planKeyWindows -> cmdKeyWindows) now asks
billing/subscriptions with the same key for the plan. It then makes the
month a "Credits" window beside the other two, through the same
cmdQuotaOf the subscription's card uses ("$4.78 / $10.00" on a Go plan).
- The plan id is kept per key for ten minutes, since
billing/subscriptions takes 15-20 s at times.
- The id read before still counts while the plan can't be read.
- A key whose plan was never read keeps its two windows alone.
- A pay-as-you-go key, with no windows, still gets no card.
planWindows' request and status handling move into planBody, so that
cmdKeyWindows can decode the reply itself; other vendors are unchanged.
Run:
- New TestCommandCodeKeyCardHasCredits uses the reporter's own
billing/credits reply. Its billing/subscriptions reply has the shape
the other Command Code tests use (individual-go-monthly), because the
reporter's plan id isn't known.
- With the new branch disabled by hand, the test went red: two windows,
no plan. With it, green.
- TestKeyQuotasKeepLast now answers billing/subscriptions with 503 and
still sees its two windows.
- gofmt; go vet -tags nogui for darwin, linux and windows.
- Not tried against Command Code's real API: there is no plan key here.
- Full suite (go test -timeout 45m ./..., at
|
||
|
|
f1c91a99c0 |
gui: a redraw mid-move keeps the move running and its failure said
The redraw comes from renderProviders, for example when an account's allowance read lands (loginUsageOf). It drew a subscription's "Move to the plugin" field again from the provider alone. Midway through a move, the button then said "Move to the plugin" again and took presses: a second move could start while the first ran. A failure that came after the redraw was said into the old field, which was gone, so the user saw nothing. renderMove now keeps the running move's label, and a failure's reason, per provider in moveSaid. A redraw draws both again. A failure that lands after a redraw redraws the providers, so the reason shows in the field on screen. Found while chasing #2431 (plugin-move's editor scrolls 23px in WebKit). That shift was not reproduced: 16 loaded WebKit runs were green, and so were injected late usage, late icons, a busy main thread and a forced chain. The findings are on the issue. This doesn't close #2431. plugin-move.test.cjs now redraws mid-move and after a failure. - Broken by hand: without moveSaid it is red 4 of 4, both engines. The errors are "a redraw mid-move forgot the move" and "a redraw forgot why the move failed". - With the fix: 8 of 8 green, 3 runs. Review: a failure said is kept only while the move's state is the one it failed from, so a move that lands another way (the hourly hand-over) doesn't keep showing it. plugin-move*, fonts: 56/56 in both engines after. Full suite: node --test --test-concurrency=4 internal/gui/tests/*.test.cjs (chromium and webkit) on |
||
|
|
96e9c0a080 |
gui: a usage card's reset line wraps its parts, never runs off the card (#2443)
At 560px, German's "Zurückgesetzt 19. Okt. 02:37 ·" was wider than the room left beside the other parts of the reset line. The span is white-space: nowrap, so it ran 10px past the card. key-balance-card's view-usage test caught it only in weeks when the date fell on a long German month and weekday, so it was red on main some days and not others. Each part of .quota-reset (and .quota-holds) is now white-space: normal and min-width: 0. A part goes whole onto its own line when it doesn't fit, and only a part wider than the card breaks between its words. The test now pins its weekly reset to the next 28 Sept 02:37 that is more than eight days ahead. That is the widest German date, so the test no longer depends on today's date. - Broken by hand: with the old CSS, the pinned test is red in chromium de (10px past the card). - With the fix: green in both engines, every language. Full suite: node --test --test-concurrency=4 internal/gui/tests/*.test.cjs (chromium and webkit) on |
||
|
|
ecb28abf2e |
gui: a menu redrawn under a still pointer leaves the typing in its search (#2439)
The font menu, session combo and row menus focus whichever item the pointer moves onto. When the search narrowed the list under a pointer that hadn't moved, the redrawn item under it got a mouseenter too, took the focus out of the search, and the next letters went nowhere. fonts.test.cjs went red whenever the list landed while the pointer sat over the menu. hoverFocus now remembers where the last mousemove was. A mouseenter there is a redraw's (UI Events fires mouseenter before its mousemove), so it leaves the focus where it is. A real move still focuses the item. The new fonts test hovers an item, then types "HarmonyOS" into the search. The focus has to stay in the field, and Enter has to pick HarmonyOS Sans SC. - Broken by hand: with the old `b.onmouseenter = () => b.focus()`, the test is red in chromium and webkit (the focus is on the item, and the typed text is cut short). - With the fix: green in both engines, 3 runs. Full suite: node --test --test-concurrency=4 internal/gui/tests/*.test.cjs (chromium and webkit) on |
||
|
|
97f264c7fb |
gateway: a 413 on the OpenAI routes says request_too_large, so pi compacts (@wilsonxuuuu on X)
@wilsonxuuuu's pi, on gpt-6.1 through magpie, stopped on
"magpie API error (413): {...,"type":"api_error"}" at 114k of a 1M
window and never auto-compacted. The vendor's 413 was a body byte cap.
pi's overflow table (pi-ai utils/overflow.ts) knows a byte cap only as
request_too_large, Anthropic's type, which magpie already gave on the
Anthropic route but not on chat/responses. writeErrorSaid now types
every 413 request_too_large (Gemini keeps its own status shape). The
status stays 413 and the byte-limit hint stays; it is not turned into
context_length_exceeded, so Codex and Claude Code read it as before
(Codex reads code, not type). pi compacts once and retries once
(_overflowRecoveryAttempted), so a body that is still too big after
compacting stops instead of looping.
Run:
- pi 1.1.0's own isContextOverflow on the reporter's body: api_error
false, request_too_large true.
- TestPayloadTooLargeSaysRequestTooLargeToPi (an nginx 413 page from a
chat upstream) and the new Chat/Responses rows of
TestBodyRejectionErrorShapes fail with the gateway.go change reverted
by hand, pass with it.
- go test -tags nogui -count=1 -timeout 45m ./... under a sandbox HOME:
every package ok. gofmt clean; GOOS=linux and windows go vet of
internal/gateway clean.
Not tried: a real pi session hitting a real vendor 413.
|
||
|
|
008571462b |
plugin: Settle starts no refresh while it settles (#2449)
Settle's own Restart tells the OnChange hooks, and one that calls
Cached() started refreshProvidersInBackground after Settle's last
refreshing.Wait. callWithTimeout starts the host under WithoutCancel, so
it went on once Settle returned and spawned a host in the test's removed
HOME ("Module not found host-....js", uv_cwd) or in the next test's,
while that one signed in. provSettling keeps Cached and the loop's
continue branch from starting one while Settle runs.
TestSettleStartsNoRefresh: red without the fix ("Settle started 3
refreshes"), green with it, also -race -count=20. In go test -v
./internal/cli the stray host lines went from 7 to 0.
Run: internal/cli, internal/plugin, internal/provider whole ok; gofmt -l
clean; go vet -tags nogui for darwin, linux, windows ok.
Full suite: go test -tags nogui -timeout 45m ./... at
|
||
|
|
6641e1b0ac |
provider: a plugin sign-in drops what a request holds at once (#2449)
TestPluginLoginInstallsItsCLIFirst went red on macOS CI (run
38798393584) with "not signed in after the install: []". cli's run()
sets catalog.Changed = agent.SyncCatalog, and a sync left going from an
earlier step holds the catalog (provider.Hold), plugins and their
sign-ins among it, for up to a second. The host's "auth" event dropped
that only through catalog.Touched, told in the background, so on a busy
runner provider.Logins right after the sign-in read the snapshot taken
before it.
plugin.OnChangeNow registers hooks run before changed() or listed()
returns, i.e. before the host's reply after the event is read; provider
registers dropHeld there. Changed() is filememo.Forget + dropHeld.
Reproduced by injecting a pause where SyncCatalog holds (patch kept
outside the tree): without the fix red 3/3 with the CI message; with it
ok -count=5. TestHeldGoesWithAPluginChange: red without the fix ("held
from before the change: built 1 times, want 2"), green with it, also
-race -count=20.
Run: -count=20 -run TestPluginLoginInstallsItsCLIFirst ./internal/cli
ok; internal/cli, internal/plugin, internal/provider whole ok; gofmt -l
clean; go vet -tags nogui for darwin, linux, windows on the three ok.
Full suite: go test -tags nogui -timeout 45m ./... at
|
||
|
|
bbf901570e |
provider: a WorkBuddy account's spent credits leave its free models counted out, as the plugin does (plugins#138)
hheei (magpie-community/plugins#138): an account at 560 / 560 credits
was ranked spent for deepseek-v4.1-flash too, which WorkBuddy serves at
x0.00 and which draws no credits. The plugin was fixed in 0.1.23
(notModels) and the mover min is 0.1.24 already; the built-in, which
users who haven't moved still run, had the same fault. wbQuota's
personal Credits window and the enterprise window now pass through
wbSpareFree, which scopes them (QuotaWindow.matches) to the models not
marked Free in the provider's last fetched list (catalog.Live). With no
list read, every model counts, as before. The 14018 "Credits exhausted"
rest already rests only the paid model (PaidBesideFree).
Run:
- TestWorkBuddyCreditsSpareFreeModels (new): with no live list the free
model reads 100%; with one, deepseek-v4.1-flash (either case) reads 0
while -sg (x0.03) and gpt-5.5 read 100. Broken by hand (wbSpareFree
returning early): red, "deepseek-v4.1-flash: 100% used, want 0".
- gofmt -l clean; go vet -tags nogui ./... for darwin, linux, windows: 0.
- Full suite: go test -timeout 45m ./... in a sandbox HOME, twice: every
package ok except internal/gui's TestPanelJoinsFullScreenSpaces ("the
panel shown doesn't take the keyboard"), which is red the same way
alone on a fresh origin/main
|
||
|
|
be1030ece3 |
agents: a row magpie can't connect says why, whole
"Only Cursor's own models" beside "Can't connect" read as two things.
Each of the four native-only rows now says it uses only its vendor's
models, so magpie can't connect it, in every language, and the line
wraps instead of being cut short.
Run at this head before the rebase onto
|
||
|
|
72ff0f5eea |
agents: Cursor CLI's row shows cursor-agent --version
Cursor CLI updates itself and isn't on npm or Homebrew, so magpie shows
its version only (@G_Z_Y on X saw none).
Run at this head before the rebase onto
|
||
|
|
a80bc30092 |
agents: the Cursor editor's ~/.cursor is no Cursor CLI
The editor makes ~/.cursor on its own, so the folder alone says nothing
of cursor-agent (dirShared): cli-config.json or the command finds Cursor
CLI. The Library still writes the MCP servers and skills the editor reads
there when only the editor is here (SharedHere).
Run at this head before the rebase onto
|
||
|
|
486ea82378 |
agents: cursor-agent's row is Cursor CLI (@G_Z_Y on X)
@G_Z_Y looked for Cursor CLI on the Agents page and took the "Cursor" row
for the editor. The row is cursor-agent, so it is named Cursor CLI. What
it keeps in ~/.cursor is the Cursor editor's too (MCP servers, skills,
chats), so the Library and Sessions name it Cursor there (SharedName).
Run at this head before the rebase onto
|
||
|
|
7fefbc614e |
gateway: a relay's cap on one request's input fails over in a group (#2445)
B.ai answered a 380K request, under the model's 1M window, with 400
"Input token exceed the limit (request id: …)". No pattern in tooLongRe
matched it, and quotaWords wants "exceeded", so retryable() was false and
group/top's other three members were never asked (worksyang).
tooLongRe now also matches "input token(s) (count) exceed(s|ed) (the)
(max|maximum) limit". The refusal is taken as an overflow, so the chat
loop's existing #700 path asks the next member that may hold the request
(withRoom, failOverflow). Nobody rests, another account of the same model
isn't asked, and with no member left the agent is told it overflowed, to
compact. paceWords still keeps rate limits worded with input tokens out,
and a plain bad request still isn't asked of anyone else. System One's
decision groups (decide_group.go, which the report cites) are unchanged:
their requests are short decision text.
Test: TestRelayInputCapGoesToTheNextMember uses the reporter's message
verbatim. The JSON around it is not the reporter's; the issue shows only
the message. Docs: gateway-routing.md failure paragraph + verification.
Run:
- Broken by hand, the new test went red each time:
- pattern removed: group answered 400, member 2 never asked;
- paceWords check removed: two rate phrasings taken as overflow;
- retryable true for every 400: the plain bad request reached member 2.
- TestRelayInputCap, TestEveryVendorsOverflow, TestOverflow*,
TestContextOverflow*, TestOutOfBudget*: ok.
- gofmt -l: clean. go vet -tags nogui ./... on darwin, linux, windows: ok.
Full suite: go test -tags nogui -timeout 45m ./... at
|
||
|
|
7e4336e719 |
gateway: an event magpie appends to a cut stream begins after a blank line (#2446)
A passthrough stream cut mid-line got its error event written onto the half-written line, so the client read "event: error" as more of that line's data and never saw the error as an event. ggbdpq's patch (#2446) tracks whether the last write ended a line (passthrough's write, and holdWriter.atLine for cutLoop) and puts a blank line, two newlines when mid-line, before the appended event. The same join could happen to the other event passthrough appends: the finish_reason filled in for a Gemini OpenAI-compatible reply that ended done ( |
||
|
|
0f391a7a71 |
gui: a panel row's name keeps its width beside a long model summary (#2447)
EdwinDigital: in the tray panel, WorkBuddy's row said its models in words
("gpt-6.1-sol · Microsoft Foundry, claude-opus-5-5 · Microsoft Foundry +1"),
and the words took the row: the name was squeezed to 10px at 550px and to
nothing at 440px and below, or at any width once the pointer came onto the
row and the model's logo eased in. The row's columns were 20px, a name in
minmax(0, 1fr) and the words in auto, so the words claimed their whole
width and the name gave way.
Now the name's column is fit-content(60%): it keeps its own width, up to
60% of the row, and the words take what is left and cut first (.vt already
ellipsizes). The words sit at the row's end (justify-self: end), so their
effort bars and chevrons stay in one column down the list. It holds for
every panel row with a summary (a model list, one model's label, import,
launch, CLI not found), not WorkBuddy alone.
Name width, WorkBuddy / Claude Desktop, before -> after, chromium and webkit
the same: 550px 10.05 / 8.09 -> 76.05 / 103.92; 440px and 360px 0 / 0 ->
76.05 / 103.92; hovered the same after.
Run at
|
||
|
|
0cad76cd99 |
gui: the provider editor folds rarely used fields under Advanced
The owner: "Provider表单太复杂了…有一些可以折叠在高级里面". Headers,
proxy, concurrency and RPM limits, prices, context and output windows,
native compaction and fallback now sit in an "Advanced" fold beside the
key and models. It opens on its own when any of them is set, keeps the
state it was left in across the editor's redraws (keyed by the provider
being edited), and a Save refused on a field inside it opens it and
focuses that field. A signed-in account's editor folds the same.
Strings in zh, zh-TW, ja and de.
Motion ("整个弹窗高度的改变也应该是丝滑的动画"): the fold grows and
shrinks on one spring-like curve, its rows fading in, its arrow turning,
and the dialog's height follows on the same curve both ways; clicked
again mid-way it turns back from where it is. Reduce motion: at once.
Every dialog holds its place: the element last pressed or focused stays
where it was while the dialog grows or shrinks (a relative top plus a
max-height cap), so the button under the pointer doesn't run away. Where
there is no room above, only a pressed button below the fields shortens
them through the cap; nothing a click does scrolls the fields
(models-fold, names-fold). An element mid-scale (a Copy button's pop) is
measured by its parent (key-copy). The names list holds its height while
drawNames rebuilds it, so WebKit doesn't clamp the editor's scroll mid
rebuild (provider-detect, "Ask on one API moved" 64→190).
Tests: provider-advanced-fold (new, 5 languages × 2 engines, 420px);
about 21 editor tests open Advanced before reaching a folded field;
balance-method and plugin-move find the fold by its class; detect-draft
allows 0.5px. appScriptBudget 1,250,000 and coreScriptBudget 1,426,000
(1,232,466 and 1,405,937 with this).
Run: go test ./internal/gui/ ok. Every GUI file (771) in a full run,
4 at a time; its reds, rerun alone at this head, both engines:
key-copy 8/0, models-fold 4/0, names-fold 8/0, balance-method 42/0,
provider-detect 4/0, plus provider-remove 16/0, plugin-move 8/0,
provider-detect-draft 20/0, provider-advanced-fold 50/0,
provider-add-models 4/0. Red on origin/main as well, filed: #2435
(agent-connect-no-models, fixed in
|
||
|
|
fbabe861e2 |
lessons: three GUI changes left other GUI files red on main, and a Windows rule left two Mac tests red on Windows CI
Added under 10-15's criteria still missed: |
||
|
|
d3ca90afcc |
gui tests: text-size scrolls its control to below the Settings tabs held at the top
|
||
|
|
056cfe3323 |
provider: Codex's keychain read waits for the user, tells a refusal from no answer, and is kept while the item is unchanged (#2367)
Dony2050 (#2367) runs Codex with cli_auth_credentials_store = "auto" and no auth.json, so magpie reads "Codex Auth" through /usr/bin/security. Four faults: - One 10s timeout covered both of macOS's prompts and the user typing their password. A read they approved after 11-16s still failed. - A timeout and a refusal gave the same error. - A read was kept for 10s only. With "Allow" (once), background polls prompted again about every 30s. - Only a restart cleared the 10-minute failure cache. What changed: - Reading the secret is one ask per item at a time (askCodexKeychain). It runs in its own goroutine for up to 2 minutes (keychainAsk), outside codexKeychainMu, so no `security` run happens under a lock a reader needs. A reader waits at most 5s from when the ask started (keychainHold), then gets errKeychainWaiting. A request or a page never waits out the prompt. The ask's answer is kept when it lands, unless magpie kept a newer one after it started. - Each failure says what happened: - exit 44: no item. - exit 51 (errSecAuthFailed) or 128 (errSecUserCanceled): denied or cancelled (errKeychainRefused). Checked against SecBase.h. Exit 44 was also checked on a throwaway keychain in the scratchpad. - the 2 minutes ran out: no answer (errKeychainNoAnswer). - anything else: errKeychainUnread. None of them counts as signed out. - A successful read is kept while the item is unchanged. After 10s a reader runs Stat (find-generic-password without -w), which shows no prompt and returns only the item's mdat. The secret is read again only when the mdat changed. - Every write of the credential re-derives the cache: - codexStore.write keeps the date of what it wrote (keepCodexKeychain). - Switch, sign-out (deleteCodexLogin) and refresh forget a read (forgetCodexKeychain), so the next read checks the date. - forget keeps a refusal for its 10 minutes (#2408). - resetCodexKeychain clears everything. Only tests use it. - The saved accounts' line in the GUI has a "Try again" link beside Remove when a read was refused, got no answer or is waiting (Exclusion.Retry). It posts /api/provider/keychain-retry, and RetryCodexKeychain reads once past the refusal. - The reason now says "Always Allow" lets /usr/bin/security read the item, so macOS stops asking each time Codex changes it. - Two new strings in zh, zh-TW, ja and de. - docs/subsystems/providers-accounts.md: the "Codex's credential store" row describes the above. Tests: - TestCodexKeychainAskedSeldom (rewritten) covers: - an unchanged item over aged and forgotten rounds asks once; - a changed item asks again; - a gone item is not found without asking; - a refusal is kept through forget. - TestCodexKeychainPromptWaitedFor: a held prompt gives "waiting" to the first and to 8 concurrent readers without blocking. Once answered, the read succeeds with one ask. - TestCodexKeychainRetry: Retry and Why for refused, no answer and no item, and RetryCodexKeychain. - TestSecurityKeychainExits (codex_keychain_ask_unix_test.go): a fake `security` built with testenv.Program covers: - a 2s answer with keychainWait = 1s succeeds; - Stat parses the mdat; - exits 44, 51, 128 and 1 map as above; - a hang gives no answer. - signedout_test: Retry is set only for an unread item. - GUI keychain-retry.test.cjs runs in chromium and webkit, in en and zh: - order Try again, Remove; - the POST body; - the line leaves after a click; - no link without retry. Broken by hand (each restored after): - Find bounded by keychainWait again: TestSecurityKeychainExits red ("a read the user answered late ... no answer in time"). - exit 51 not classed as refused: TestSecurityKeychainExits red ("Find, denied"). - Readers wait on the ask (no hold): TestCodexKeychainPromptWaitedFor hangs; the package timed out. - forget clears every read: TestCodexKeychainAskedSeldom red (4 asks). - mdat match ignored: AskedSeldom red (7 asks). - Cache never re-checked: AskedSeldom red (the changed item wasn't seen). - RetryCodexKeychain also deleting the failure cache: still green, because a fresh read asks past a refusal. That loop was removed as redundant. Not tried: - A real macOS prompt, or an item Codex itself wrote. Every test uses a fake `security`; the real keychain and ~/.codex were not touched. - Put and Remove are still bounded at 10s. Run at this head, rebased on origin/main |
||
|
|
a6f908ba58 |
gateway: a Gemini OpenAI-compatible stream that lost its finish_reason is ended by usage, or cut
Linka (Discord #feedback): Gemini's OpenAI-compatible API sends a whole
function call (its thought signature, the usage) in one chunk and the
finish_reason in the next. When the upstream hung up between the two,
magpie relayed a stream that ended with neither, and Pi threw the
complete call away ("Stream ended without finish_reason") and asked the
whole 160k turn again. On a Chat upstream only a failed read was a cut,
so a clean EOF there went on as a stream with no end.
That API counts the usage only on the generation's last chunk(s): the
Vertex fixture (testdata/vertex_openai_thoughts.sse) has it only beside
finish_reason, Linka's frames have it on the call chunk and the finish
chunk, and Google's forum and third-party docs say the same; no Google
doc states it. So for a Chat upstream that is Gemini's (geminiCompat,
saysItsEnd) and ended without a finish_reason:
- its last chunk carried usage: the generation was done and only the
finish_reason was lost. It is filled in (chatTail), "tool_calls" after
a call and "stop" otherwise: relayed, as one chunk before [DONE]
(written only if [DONE] hadn't gone); translated, as the reply's normal
end (tool_use for Claude Code), streamed and unstreamed. Recorded ok.
- no usage at its end: the reply was cut, and the client gets "the reply
ended before it was complete" (errEndedShort), as a Gemini stream's
finishReason is told (#1643, #1644): the relay's error chunk, the
translated stream's error, an unstreamed 502.
A failed read keeps its own "connection lost mid-reply". Other vendors'
Chat streams are unchanged.
Tests (gemini_compat_cut_test.go, Linka's frames): relayed, the call
with usage ends with finish_reason tool_calls then [DONE], text with
usage with stop, the call without usage with the error and no
finish_reason; a whole reply with or without [DONE] goes as it came
with one finish_reason; kimi-k3 with and without usage unchanged.
Translated: with usage one message_stop with stop_reason tool_use and
no error, streamed, and a 200 tool_use unstreamed; without usage one
error and no message_stop, and a 502 unstreamed.
Broken by hand, each red: the relay fill off (relay test: no
finish_reason), the streamed fill off (0 stops, 1 error), the
unstreamed fill off (502), usage ignored in chatTail.finish (every
no-usage case ended as whole, unstreamed 200).
Run: gofmt -l clean; GOOS=darwin/linux/windows go vet -tags nogui ./...
ok; go test -run 'TestGeminiCompat|EndedShort|TestStreamCut|
TestWellFormed|Sniff' ./internal/gateway ok.
Docs: gateway-routing.md says when the finish_reason is filled in.
Full suite: go test -tags nogui -timeout 45m ./... at base
|
||
|
|
db8b791797 |
plugin: tools-, page- and agent- packages take their short name without the prefix
@magpie-community/tools-calc served its tools as tools-calc_eval and its
page under "tools-calc" because ShortName only dropped middleware- and
opencode-. It now drops tools-, page- and agent- too, so the calc example
serves calc_eval/calc_convert/calc_date as its README and the docs say.
`magpie plugin options` / SetOptions find a plugin by its short name or by
its bare package name (plugin.Called), so "agent-aider" keeps working
beside "aider".
Run at
|
||
|
|
167df70550 |
provider tests: TestSecurityKeychainAnswers's fake security is a program macOS has let run
The full suite at |
||
|
|
641f00e4c5 |
claudebridge: the MCP helper calls magpie back past the agent's proxy (#2440)
ump45nose's TestClaudeToolCallbackOnANonLoopbackAddress was red on their
macOS with "curl: (56) Recv failure: Connection reset by peer". The run
hands Claude Code the proxy magpie gives it for Anthropic (by default the
system's: netproxy.EnvWith), with NO_PROXY of localhost, 127.0.0.1, ::1
and the system's exceptions. A gateway on a LAN or Tailscale address
(MAGPIE_ADDR, #1546) isn't in it, so the helper Claude Code starts, which
inherits that environment, sent its tool callback to the proxy. A proxy
that resets it or can't reach back left the call short of the run, and the
turn with the tool's results found no run waiting. The same path is real,
not only the test's: Go's http client takes *_PROXY for every host but
loopback, and the helper serves Claude, Cursor and Grok runs alike.
The helper's callback is always magpie on this computer, so its client
now uses no proxy at all. The test stand-ins of the helper (the takeback
and fork scripts' curl) call back with --noproxy '*' as it does.
Run:
- Reproduced the report: settings.Proxy on a local listener that resets
every connection, TestClaudeToolCallbackOnANonLoopbackAddress red with
the reporter's exact curl (56) reset; green after (temporary edit, not
kept).
- New TestCallbackGoesPastTheAgentsProxy runs the helper as its own
process with every *_PROXY on a resetting proxy, calling back to this
computer's non-loopback address. Red on the old helper ("read: connection
reset by peer"), green now.
- gofmt -l clean; go vet -tags nogui for darwin, linux and windows on
internal/claudebridge and internal/gateway.
- Full suite: go test -timeout 45m ./... at
|
||
|
|
1a16fc0b5b |
gui: Settings' scroll hairline holds its head instead of finding it on each scroll
|
||
|
|
55d6ea4ffc |
gateway: a translated model's messages say their phase, so Codex folds them (#2437)
Codex Desktop folds a finished turn's commentary and calls under "Worked
for …" by each assistant message's `phase`, which OpenAI's own models
write ("commentary" / "final_answer"). A message with none is read as an
answer, so every progress line of a model magpie translates (the
reporter's Qoder plugin, a chat upstream) stayed unfolded.
The Responses encoder now holds a message's output_item.done until the
next item that isn't reasoning opens (commentary) or the reply completes
(final_answer); the completed output carries the same phases.
renderResponses does the same for a whole reply. A Responses upstream
relayed as it is (passthrough) gets the same rule through a new phase
tidy, streamed or whole. A phase the upstream wrote is kept; a reply cut
short (incomplete, failed, error, a stream with no end) guesses no final
answer, since Codex reads a missing phase as the answer. Keepalives go
out at once; sequence numbers are given in write order. At most 512
events wait behind a message, then it goes without a phase. Codex's
base_instructions are not touched.
Run (worktree at origin/main
|
||
|
|
a61a6f9546 |
gui tests: menu-scroll's fixture answers /api/plugin-pages
menu-scroll has been failing 24 of 24 on main since |
||
|
|
a0a4d55ef7 |
gateway: a passed-through reply whose reasoning loops before it says anything is asked again once, and its tries counted (#2436)
lqisgod's five looped replies (pi → WorkBuddy, Chat in and out) each
ended at once with empty tries and status 200. The once-only re-ask of a
reasoning loop (loopReasks) lived only in streamTranslated's onLoop, so a
same-protocol passthrough had holdWriter.reask nil and cutLoop ran on the
first trip. A re-ask that did happen in place wasn't counted in the usage
record's tries either (tries came from route.Tries alone).
Now holdWriter lets such a try go (mayReloop/letGoLoop) when its
reasoning looped, nothing has spoken (loopGuard.spoke: no text or call),
the request has its re-ask left and its context is alive, and either
nothing of the try reached the agent (held bytes dropped, any protocol)
or the agent speaks Chat (bytes written up to the end of the tripping
event, the next try's chunks follow). The fallback loop records the try
as failLoop with reloopedError and asks the same provider again after
retryPause. In-place re-asks add to tries too. An Anthropic or Responses
stream whose reasoning already reached the agent still ends with the
loop error: a second message_start/response.created can't follow. The
plugin host's fetch goes through the same holdWriter
(TestLoopEndsWorkBuddysReply's plugin subtests).
Tests: loop_guard_test.go's chat case now expects 2 asks and an answer;
every passed-through `data:` line is valid JSON; the usage record has
Tries == asks and no error. docs/subsystems/gateway-routing.md updated.
Broken by hand, each red:
- hw.reloop = false (old behaviour): TestLoopEndsTheReplyOnEveryProtocol,
TestLoopEndsWorkBuddysReply, TestReasoningLoopIsAskedAgain fail.
- reasked not added to tries: the same three fail with "usage record's
tries 0, the vendor asked 2 times".
- spoke never set: TestLoopAfterTextIsNotAskedAgain fails.
Run: gofmt -l clean; go vet -tags nogui ./internal/gateway ./internal/usage
with GOOS=darwin, linux, windows ok; go test -run Loop ./internal/gateway ok.
Not tried: a real WorkBuddy account looping (the loop can't be forced).
Full suite: go test -tags nogui -count=1 -timeout 45m ./... on base
|
||
|
|
6f92815335 |
routing: each try says where its time went: magpie, the network, the vendor (Discord, Magic_zero)
A user read a slow turn as the gateway being slow. The try loop's
httptrace now also records DNS, connect, TLS, GotConn (reused or not)
and the first response byte. Each Try keeps a TryNet ("net"): magpie's
own time, requests made before it, the wait for a pooled connection,
DNS, connect, TLS, sending, the vendor's wait for its first byte, and
Head (from the try's start to that byte). A Route also carries the usage
record's Sent/Own/Retried/Queued split. Usage records are unchanged.
The Routing page's story shows "Where the time went" under each finished
try. It is one stacked bar plus named values, in three groups (magpie,
network, vendor): Waiting for a slot (tr.queued, which was never shown
before), In magpie, DNS, Connecting, TLS, Sending, Vendor (first byte),
First token, Streaming. Parts that took no time are left out. The
strings are in every language. "Waiting for a slot" moves from the
Usage plugin's i18n into i18n.js, since Routing uses it too.
Not covered: plugin providers (and any other request sent by something
other than Go's client). Their request goes out through the Bun host's
fetch, so no httptrace fires. Such a try has no net and shows no
breakdown, only the time it took, as before (and so does a trace from
before this change).
Run (worktree at origin/main
|
||
|
|
b6533893a7 |
plugins: Discover lists tools and page plugins, and the intro links to the plugin docs
Every kind of plugin magpie runs now has its place on the Plugins page, so
someone looking to extend magpie finds what exists and how to write one:
- Discover has "Tools for agents" (market kind "tools") and "Pages" (kind
"page") sections beside Subscriptions, Gateway middleware and Agents,
each card with its own chip (a new Tools chip, the Page chip). Before,
both kinds fell under Subscriptions as Providers.
- A GitHub repository tagged magpie-plugin whose package.json has
magpie.page.file is a Page, and that file must be committed, as a
provider's entry must (TaggedRepos).
- An installed plugin that only gives tools wears the Tools chip.
- The intro says what a plugin can be (provider, gateway middleware,
routing strategy, tools, an agent, a page) and its "Write a plugin" link
opens usemagpie.ai/docs/plugins in the window's language (zh and zh-TW
to zh/, ja to ja/), outside the window.
- The docs' Publishing section lists the "tools", "page" and "agent"
registry kinds and the community package names for each, in en, zh, ja.
Run at the reviewed head (on origin/main
|
||
|
|
cf21b71ff3 |
gui tests: agent-connect-no-models takes all_hidden's new words and gives its list to open (#2435)
|
||
|
|
a7e1e8ed83 |
agent: Air starts the OpenCode an IDE installed from the ACP registry (#2423)
whiteS18 installed OpenCode from IDEA's ACP registry. The IDE unpacks it into ~/Library/Caches/JetBrains/IntelliJIdea2026.2/acp-agents/opencode/ 1.19.0/opencode, on no PATH, so Air's Magpie agent said "OpenCode not installed". airOpenCode now also looks where JetBrains IDEs and Zed put registry installs (Caches/JetBrains/*/acp-agents/opencode/*, Zed's external_agents/registry/opencode/*; ~/.cache and ~/.local/share on Linux, %LOCALAPPDATA% on Windows), the newest by mtime. Run: - TestAirFindsACPRegistryOpenCode: darwin, linux and windows layouts (the reporter's literal macOS paths), none installed gives "", the newer of two wins. - XDG_CACHE_HOME listed in agentenv_test's notAnAgent (TestFolderVarsAreListed was red without it). - go test -tags nogui -count=1 ./internal/agent ok; gofmt clean; go vet -tags nogui darwin, linux, windows ok on agent. - Not tried: a real IDE registry install (none on this machine). Full suite: agent only here; the release head runs ./... before its tag. |