ac4af582301a4e8a29245dbba767eba31334ddf9
29
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
7a6211d047 |
providers: a model's own headers, in Model settings
axelburks on Discord: a vendor routes one model by a header of its own. A key's provider (built-in or custom) can give each model headers (settings.ModelHeaders["pid/model"]). They go on that provider's requests for that model alone, after the provider's headers and after auth: a name both have is sent once, as the model's, so a user's value is never overridden by the provider's or magpie's key header. The gateway names the model (provider.WithModel) on every route that asks one: chat on each API, translated and streamed, count_tokens, System One's decision, embeddings, images, videos and the model test. A fallback provider serving the same model id gets its own headers only. Accounts and plugins carry their sign-in's headers and take none. The editor's "Name, price and reasoning level" panel is now "Model settings" (every language), with + Add header per model, staged and made with the Save; Restore default takes them away. The rows being typed are kept out of the draft's compare, so an untouched editor still closes without asking. Broken by hand: dropping WithModel from gateway.go turns TestModelHeadersReachTheirModelOnEveryRoute red; dropping the provider id check in modelOf turns TestModelHeadersStayWithTheirProvider red. Run, on this stack over origin/main |
||
|
|
df7c94bdf5 |
gateway: inline image descriptions survive a restart (#5121)
The vision description cache (Server.sights) was in memory only, so a restart, update or handover described every image of a long conversation again (62 calls in 2.5 minutes in the report). Completed descriptions of inline images are now appended to vision-cache.jsonl (0600) in the config dir before their waiters are released, and New restores them under the same 2048-entry LRU. URL images stay in memory (their bytes can change); failures are never written. Appends and compaction go through a file lock, a corrupt or truncated line is skipped (and backed up before compaction), and shutdown waits for pending saves within the drain window. Patch by MYCF711, applied clean on main. One change: the Unix permission test now makes the config folder before it pre-creates the file (it failed on a fresh sandbox, where the folder doesn't exist yet). Run (mote, at this tree): go test ./internal/gateway filtered to the vision/sight/cache tests, ok; gofmt -l clean; go vet ./internal/gateway for linux and windows, clean. Broken by hand: saveSight call removed from see(), TestDescriptionSurvivesGatewayRestart red (2 descriptions, want 1), green again with it back. Windows: the same filtered tests on xiaomi-gpu via win-run. Not tried: full go test ./..., go vet ./... for linux (wails cgo doesn't build off-platform on mote), a real process kill or a real handover, a real gateway with a real vision model. Co-authored-by: MYCF711 <323101370+MYCF711@users.noreply.github.com> |
||
|
|
d10f377657 |
providers: Names & levels is Names, prices & levels, where a model's own price at one provider is set (ferock4669)
ferock4669 asked on Discord whether magpie has a screen to price each model, since one model can cost differently on each provider. It has: each row in a provider's per-model list has a price box (input, output, cache read, cache write, 1h cache write, long-context tier, $ / 1M tokens), saved in settings' ModelPrices under pid/model. It wins over the list price in Usage (usage.Pricer through provider.BasePriceIn) and in a key's spend cap (usage.KeySpent through NewCoster). Nothing has to be built; the button opening it said only "Names & levels", so nobody finds a price there. What changed: - The button, its panel's heading and fold, and every note that sends the user there say "Names, prices & levels" (zh 名称、价格与推理档位, zh-TW 名稱、價格與推理檔位, ja 名前・価格・推論レベル, de "Namen, Preise & Stufen"); the gateway's vision and compaction notes, the provider package's text, the subsystem pages and the site's start docs (en, zh, ja) follow. - The button's tooltip says it sets what each model costs at this provider; Usage's "estimated" tooltip says where a provider's own price is set and that it counts over the list price. Both in en, zh, zh-TW, ja and de. - Not changed: the Codex model description text in internal/codexcat (it goes to Codex, so a vendor sees it) and core_budget_test's history comment. - app.js: a comment above the price box is shortened so the core script stays under its budget, not raised (app.js 116 bytes under origin/main). Run at the pushed head (rebased on origin/main |
||
|
|
6d23a4282f |
provider: whether a model sees images doesn't wait for usage readings; start ~9 s → <3 s
magpie's gateway listened ~9 s after start. A goroutine dump 3 s in had
main in provider.Allowances' first-ask wait: the start's migrations
(agent.RenameLegacy) read Pi's effort field, which builds Pi's model list,
which asks provider.Described (does any model see images), which ranks
the vision models by spent accounts, which asks each agent's allowances.
Each agent's first ask waits firstWait (3 s) for its accounts' usage over
the network. Every agent's model list asks Described, so the GUI's first
lists waited the same way.
Described only asks whether a model is there, not which account a request
goes to, so it now runs under provider.Unwaited: Allowances answers from
what is last known (the readings kept on disk) and starts the reading
behind it, as after firstWait. A request routed by the gateway still waits
as before.
Real history in a sandbox HOME (17,140 session files, every account
copied from this Mac's), the network blocked by a dead proxy, `magpie web`
started twice each:
- before (v0.1.2528 tree): gateway up at 9.8 s and 8.8 s.
- this change: 2.8 s and 0.6 s; first /api/sessions answered at 4.5 s and
2.1 s, against 12.2 s and 10.7 s.
Tests, on mote: TestUnwaitedAllowancesDontWait is new. Broken by hand
(Allowances waiting under Unwaited too) it fails: "took 20.0s".
go test ./internal/provider/ ./internal/gateway/ ./internal/agent/ ok
(gateway 740 s). gofmt -l clean; go vet (darwin), GOOS=windows go vet,
GOOS=linux go vet -tags nogui of provider and gateway ok.
Not run: the full suite; a start with the network up (the wait there
was the vendor's answer time, up to 3 s an agent); Windows and Linux.
Picked onto
|
||
|
|
f435aadbf3 |
gateway: an image is described once, whatever model describes it, and a canceled request stops its descriptions
Pkh on Discord (0.1.2509, Linux, QwenPaw, Auto routing): with images in the conversation, the Routing view filled with "Image description" rows, one request asking for 63 in ~60ms, and the request they were for had no row of its own. Causes, each red on origin/main |
||
|
|
2570efb5f7 |
gateway: an image the picked model can't describe is described by the next model that sees (kelvinjason11 on X)
kelvinjason11 on X: "图片识别好像只支持一个模型识别 没有fallback". When
the describer (Settings' Image recognition model, or AutoVision's pick)
failed, the turn failed with it, though other models that see were there.
Now describeWith asks the pick first, always. When it fails for any reason
but the client's own cancel, magpie asks the next model that sees: the
first ready one of seersRanked, AutoVision's own order (ready, then
Claude account, Codex, API key, other, then cost), leaving out each model
already tried and each one that turned an image away (sightRefused). At
most 3 models (visionTries), and all of them within visionWaitMost
together: each try gets what is left of it, not a fresh visionTimeout.
- The text header names the model that described the image
("as other/bigeye describes it"), not the pick.
- The Routing row of the stand-in carries Instead, Why and Picked
(describingInstead, the same fields web search's searchingInstead
sets), and the Routing page says in every language that the pick
couldn't describe it, why, and which model did instead.
- When none answers, the error is the first failure as before, then
"nor could X, asked in its place: why" for each other model tried.
- Spent/allowance: each try goes through serve as before, so autoSpent
and spentModel judge every stand-in the same as they judged the pick.
- vision_mcp's describe_image tool gets the same fallback.
Cache (s.sights): a description is kept under the pick and the image,
whichever model described it, with the describer's name beside it. The
same image sent again asks no one, the stand-in's text is reused, and
its header still names the stand-in. A new image asks the pick first
again, so a pick that comes back is used at once. Failures are not kept.
Settings' text ("When the model in use can't see images, this one
describes them to it") is left as it is: the pick is still asked first
for every image.
Tests (internal/gateway/vision_fallback_test.go):
- TestPickedDescriberThatFailsGivesWayToTheNextThatSees
- TestAutoDescriberThatFailsGivesWayToTheNext
- TestNoDescriberAnswersNamesEach
- TestPickedDescriberThatAnswersIsTheOnlyOneAsked
- TestCanceledDescriptionAsksNoOther
TestDescriberThatCantSeeIsntAskedToDescribe now expects the next model
that sees to describe in place of a text-only pick, not a 502.
GUI: internal/gui/tests/vision-instead.test.cjs (every language, 1100
and 520 wide).
Run on mote at 45739f15b (this tree, on origin/main
|
||
|
|
b64ec9d64f |
gateway: a picked model that turns an image away gets it described, not another provider (xyenon)
xyenon (Discord #feedback) picked provider-1/DeepSeek-V4.1-Flash in pi with an Image recognition model set. An image they sent wasn't described; the request was answered by provider-2/DeepSeek-V4.1-Flash. Cause: provider-1's list says nothing of images, so magpie took models.dev's word for the model (catalog.SeesImages: text+image) and sent the raw image. The relay answered DeepSeek's 400 "Failed to deserialize the JSON body ... unknown variant `image_url`, expected `text`". That matches shapeWords, so the try failed as a shape refusal and went on to the next candidate: provider-1's fallback (or the next group member), the same model at provider-2, which sees. The describer was never asked. Fix: a 400/415/422 whose words say images aren't taken (imageRefused: unknown variant image_url/input_image/image, OpenAI's "only supported by certain models", OpenRouter's "no endpoints found that support image", vLLM's "not a multimodal model", 不支持图片 and the like) marks the model blind for this server's run (refuseSight; blindTo checks it first). With a describer, the same candidate is asked again at once with the images described (seenBody, or seenGroup for a group), before any fallback or other member; the try reads failSight, which the Routing page tells as its own story (en/zh/zh-TW/ja/de); the row then reads answered, as for floor's and foreign's re-asks. Later requests are described up front, for a direct pick and a group (user or auto) alike, on Chat, Responses and Messages. Kept on purpose: with no describer (Image recognition off, or no model that sees), going on to a candidate whose copy sees is the only way to answer, so it still does (TestRefusedImageWithNoDescriberGoesToOneThatSees). Documented in docs/subsystems/gateway-routing.md, "A model that turns an image away". Run (on mote, through mote-run): - TestPickedModelThatRefusesAnImageIsGivenItDescribed (9 subtests: direct pick with a fallback, user group, group/auto-…; each API), TestRefusedImageWithNoDescriberGoesToOneThatSees, TestImageRefused: ok. - Broken by hand: with gateway.go/vision.go/routing.go reverted to origin/main ( |
||
|
|
29185e3bbc |
gateway: a request held too long before routing leaves a report its user can copy
Jason on Discord (#general, v0.1.1995, AirbuildEnvironment over Codex's
/backend-api/codex/responses) got the 2m 504: "magpie held this request
for 2m0s without routing it to any provider ... report it with magpie's
log". The desktop app runs the gateway in-process and logs only to
stderr, so there is no log for him to send.
giveUp now writes a report of the held request to a small file in
magpie's cache (held/, folder 0700, temp file renamed into place, the
newest 5 kept). It holds the time, version, OS, the method and path, the
model and agent, how long it was held, each named wait with its time and
whether it was still under way (noteWait now takes a kind: body, body
room, decision model, image description, plugin hooks, JS middleware,
Codex reset, masking), the body room's state, the requests in flight,
and a goroutine profile (function names and lines only, cut at 128KB).
It holds no body and no headers. Route.Held names the file. On the
Routing page, the request's story then says a report was saved, with
Copy Report and Open Folder (Open Folder is left out in magpie web).
GET /api/gateway/held/{name} reads only a report's own name. The 504's
text no longer points to a log: it names Copy Report on the Routing page
and the folder. The log line names the waits too. i18n is in zh, zh-TW,
ja and de, and docs/subsystems/gateway-routing.md has the section.
What held Jason's request is not known from what he sent. The waits that
count before routing are: the body arriving (idle deadline only), body
room (up to 100s, then 503), the decision model (see the next commit),
plugin hooks (11s), JS middleware (250ms a hook), image description
(bounded by the request) and the Codex reset (20s). Slots, RPM and
upstream come after the route begins. A WebSocket upgrade gets a 426.
The report names the wait, so the next one says which.
Run:
- mote, at 57b21abd9 before the rebase: go test ./internal/gateway
-run 'Unrouted|Held|...' passed. The full go test ./... -timeout 45m
was cut off when mote dropped off the network (2 packages ok). The
full suite then went to the Windows box (see the next commit).
- xiaomi-gpu (Windows), node --test: routing-held-report 50/50 in
chromium and webkit, 5 languages, 1100/420px, app and web.
routing-held-request and i18n-keys pass. All routing-* and i18n*:
1742 tests, 94 reds, none in i18n*. The same files are red alone at
origin/main
|
||
|
|
430e3050d8 |
gateway: magpie's own searches and image descriptions go without the agent's middleware (#3695)
aiirobyte (#3695): the gateway exited five times on 2026-10-26, and every client was refused until it was started again. The one exit with a stack died of "fatal error: concurrent map read and map write": two of seenBody's goroutines in middleware.(*Run).Tried at once, one of them in moejs's InternGoString. A request's middleware runs in runtimes of the request's own (serveAgent). Only one goroutine may use a runtime at a time (moejs), and Run has no lock to hold callers to it. serve runs each try's onProvider on them (triedOn) through the Tried the request's context carries. For a model that can't see, magpie has each image of the request described (seenBody), up to four at a time, and each description is a request it makes of its own gateway on a context made from the agent's (magpieChose(ctx)). So the descriptions carried the agent's Tried and ran onProvider on one runtime from as many goroutines. A model that can't search has its searches made the same way (searchWith): a search is asked beside the agent's own stream, which goes through the middleware's onEvent, and beside the round's other searches, so one search is enough to share the runtime when the middleware has onEvent. The runtime's maps were read and written from two goroutines and the gateway died. When it didn't, the calls' values crossed. In the runs below, hooks threw on values that weren't there ("Cannot read properties of undefined (reading 'push')", and "(reading 'messages')"), and a description went out as {"0":0,"messages":[0,{"content":[0,{"image_url":0}],...}],...}, its max_tokens, system prompt, text and image each turned into 0. An earlier run of the same break (tree e1c90a00, this code with older comments) had one image asked about twice and another never. ownAsk takes the request's Tried off the context of those two asks, so they go without the agent's middleware, as serveAgent's comment already said of them ("search and vision stand-ins") and as magpie's other own requests (titles, the classifier) go. The agent's own tries are as before: each runs onProvider once, on its runtime. The subsystem page now says why, and the user docs (en, zh, ja) name searches and image descriptions among magpie's own requests. Going without also keeps what the docs tell a hook. Its ctx.protocol, ctx.model and ctx.stream are the agent's request's, while a description's body is a Chat request and a search's an Anthropic one, whatever the agent speaks. A description is also kept for later requests (sights), so one asked through a request's middleware was handed to later requests, other agents' too. The one community middleware with onProvider, antigravity-cloak, rewrites Claude Code's and Codex's lines in the system prompt, which a description's or a search's prompt, magpie's own, doesn't have. Not changed: the report's other fixes, a lock over the runtime, one ask at a time, or a Run per ask. Each keeps the gateway up but still runs the agent's middleware on asks that are magpie's own, which the docs say go without it, and with the first two onProvider still gets bodies its ctx doesn't describe. With ownAsk nothing else uses a request's Run from two goroutines (holdWriter's keepalive writes under the h.mu the handler's writes hold). magpieChose is left as it is: it says whose pick a call is, and its other callers, Codex's thread titles, descriptions and predictions (codex_titles.go), run before serveAgent with no Tried to take off. What was run (tree 4f97ac18, on origin/main |
||
|
|
5a94eec3ae |
gateway: a request held 30s before routing in no known wait is answered then
sharwowwow on X: "转圈两分钟才报 504,这个超时阈值本身就很折磨人。网关要是能 早点失败、早点给明确错误,排查能省不少时间。" A request held before any route was answered 504 only after unroutedMost (2m), whatever held it. Now the time a request spends in a wait magpie knows of is added up as it happens (noteWait/waited, the union of overlapping waits), and a request held unroutedUnknown (30s) outside them gets the same 504 and message then. unroutedMost (2m) stays the cap for one in known waits. Known waits, each read from the code between counted and noteRoute: - the request's body arriving: r.Body is wrapped (waitedBody), so every read of it (keyLimited, requestBody, readRequestBody) counts; - masking (noteMasking); - System One's or the decision model's classifier (askWaited); - an image's description (seenBody); - Codex's auto reset before the route (autoReset); - plugins' gateway hooks / plugin host start (GatewayBegin) and JS gateway middleware (Begin, Request); - every notePhase (slot, rpm, upstream); these come after the route for watched requests today, so it only guards a future change. What is left is magpie's own work (catalog build, parsing, planning, affine, reading the usage log), ~8.5s at its slowest (a cold catalog sync); 30s is about three times that, with room for a loaded machine. The log says "30s of it in no wait magpie knows of". Run at this tree (rebased on origin/main |
||
|
|
4a3e07f1cf |
model: magpie model spec sets a model's window, output, vision and levels at once
Dani Ariyanto on Discord (#feedback, 10-24): a custom provider's models (kenari/*:free) had no window, reply limit, vision or reasoning known, and there was no one place to say them. magpie model spec <provider/model> what it has, and whose each value is magpie model spec <provider/model> [--context <n>] [--output <n>] [--vision on|off|auto] [--reasoning <levels>|off|auto] magpie model spec '<provider>/*' --context <n> --output <n> magpie model spec <provider/model> --reset magpie model specs It writes the stores magpie model context/output/images/efforts write (providers.json contexts; settings.json modelOutputs, modelImages, modelEfforts, modelReasonless), so every reader that went by those goes by a spec: entryFor/EntryOf/Served, /v1/models, max_tokens, the GUI's /api/providers badges and chips, and the agents' model lists. Every part is checked before anything is written; a refused command writes nothing. Agents are told once. Readers that bypassed the stores and now honour them: - provider.Efforts returns the kept levels, so the gateway fits a request to them (fitEffort): xhigh asked of a model kept to low-high goes as high. This reverses #92 ( |
||
|
|
243aa709b2 |
gateway: AutoVision and the searcher's pick keep each provider's ranked models until a list, a provider or a setting changes
Why: a live heap profile of the app (yg6888 on X, ~1 GB held) had
36 GB allocated, and 5.3 GB of it was under seer -> autoVision ->
smallModelWhere. 4.8 GB of that came through agent.magpieModels
(provider.Described, asked for every agent's model list: dsh every 30s,
and the window's state). Each AutoVision did three things for every
provider that was on:
- built its Exposed list twice: once in smallReady, then again only to
read the picked model's price;
- asked spentModel (perKeyBarred, 1.4 GB) about every candidate model,
before picking one;
- copied the list three times in pickSmall.
The searcher's pick (searcherReady, Searchers, chosenSearcher) goes
through the same smallReady. For a Remote magpie it asked
p.Available() once per model (remoteSearch).
What changed:
- rankSmall puts the candidates in pickSmall's order once. pickSmall of
any subset is the first of that subset in this order, and
TestRankSmallIsPickSmall checks that against the old pickSmall over
2000 random lists and subsets. smallReadyOf then asks spentModel in
rank order and stops at the first model with allowance. The model it
picks, and whether it is ready, are the same as before. Usually only
one model is asked.
- The candidate carries its cost, so smallModelWhere no longer builds
Exposed a second time.
- keptSmallCands keeps each provider's ranked candidates in
stamped[smallKey, []smallCand]. The key is the provider id, the
signed-in account (agent, user, plan, home) and which filter ("sees",
"search"). Entries are dropped when provider.StampNow moves, or
after stampedFor (1 minute).
- provider.StampNow (hold.go, added with dsh's round) is made of:
- held.gen, which Changed moves: a provider saved, an account,
catalog.SaveLive/Touched/Reset, a plugin's change;
- filememo.Gen (settings.Save and every other write this process
makes);
- environSum;
- the time and size of the providers' file, the settings file and the
catalog's cache file, so a write by another magpie (the CLI) counts
too.
The one-minute backstop covers what nothing signals: a list another
magpie fetched, or another program changing an existing account's
model list. A new account is a new key, so it is seen at once (within
provider.Accounts' own 30s).
- Whether a model is out of its allowance (spentModel) is still asked
on every call, never kept. Two callers building one key at the same
time each build it. Nothing waits on another, and nothing is built
under the lock.
Measured on the real path: a sandbox HOME with the live
~/.cache/magpie/models.json (5.8 MB, 231 providers) copied in, 12 API
key providers (openrouter, anthropic, openai, google, deepseek,
nano-gpt, vercel, kilo, requesty, aihubmix, zenmux, poe), and the
catalog.Provider fix 4f044c24c applied to both sides. The benchmark is
go test -bench, -benchtime 2s, not committed. The pick is
requesty/mimo-v2.6-flash before and after.
| Benchmark | Before | After |
| --- | --- | --- |
| AutoVision | 769.7 ms, 22,075,218 B, 73,732 allocs/op | 7.3 ms, 238,201 B, 1,134 allocs/op |
| AutoVision under provider.Hold | 347.8 ms, 21,532,432 B, 69,061 allocs/op | 2.1 ms, 85,207 B, 244 allocs/op |
What is left is mostly provider.All, which reads the accounts.
Tests:
- TestAutoVisionDoesNotBuildListsAgain: AllocsPerRun of AutoVision and
searcherModel with 4 and with 400 listed models. It allows 50
allocations of difference: 521 against 527.
- Broken by hand (stamped.get always builds), it went red at 611
against 1055.
- TestAutoVisionSeesEachChange checks that each change is picked up:
- picks changed through provider.Save;
- a vendor's list re-fetched with new prices (catalog.SaveLive);
- providers.json rewritten directly, as another magpie would;
- settings.Save moving the stamp;
- a Codex sign-in written into the same HOME.
Broken by hand (the stamp ignored, only the minute kept), it went red
at "AutoVision = "" after Haiku and Gemini were enabled". Run with the
other AutoVision tests, TestAutoVisionPassesOverOneOut went red too.
- TestAutoVisionKeptListsAskAllowanceEachTime checks that a used-up
Codex account is seen on the very next call.
Run:
- gofmt -l internal/: clean.
- GOOS=linux and GOOS=windows go vet -tags nogui ./...: clean.
- set -o pipefail; go test -count=1 -timeout 45m ./internal/gateway/
./internal/provider/ ./internal/catalog/ ./internal/gui/, at load
~400 (other sessions' suites), with 4f044c24c applied:
- gateway ok 2259.7s, provider ok 821.8s, catalog ok 16.5s.
- gui FAIL in two tests that fail the same way without this change.
Each was run alone, with these files reverted, on 28bcd4f7e:
- TestMainWindowCorners: the real AppKit window was killed at its
40s deadline, alone too (#1936, #2645).
- TestSetAnswersWhileDevinAndProvidersHang: setting slow/slow-1
took 10.9s against its 10s bound. Alone it took 3.3 to 5.4s with
this change and 4.6 to 5.9s without it, passing 3 of 3 (#1375).
- The new tests were run again after the split into two commits:
go test -run 'TestInfoCounts|TestAutoVision|TestRankSmall|Searcher'
./internal/gateway/: ok.
|
||
|
|
11173c8a20 |
gateway: a long Computer Use turn fits each screenshot once, not every turn (fflake33 on Discord)
fflake33 (magpie 0.1.1279, macOS) sent Codex Computer Use turns of
570K-680K tokens with hundreds of screenshots through the Responses
route to codex/gpt-6.1-sol: 26.5s and 52.7s of the 41.7s and 71s to the
first token were magpie's own work, sampled in image resize, JPEG
decode/encode and JSON.
The causes, from a pprof CPU and alloc profile of a synthetic turn (160
distinct 2940x1912 JPEG screenshots, 112 MB body):
- codexImagesFit's cache of fitted images was a map cleared at 64
entries, so past 64 screenshots every image of every turn was decoded,
resized and JPEG-encoded again: ~19s CPU a turn (triangleResize 42 GB
allocated over 3 turns).
- It looked each part up by path from the top of the body
(gjson "input.%d.content.%d"), reading the 112 MB body again for every
image: ~9s CPU a turn.
What changed:
- codexImagesFit walks the body once (ForEach over items and parts, at
their offsets) and splices only the changed image strings; the rest of
the body goes byte for byte as before.
- The cache (fitted) is an LRU keyed by sha256 of the limits and data
URL, bounded at 256 MB of fitted bytes and 8192 entries, letting go of
what goes unsent for an hour. It holds the encoded bytes, not the
base64. A request looks all its images up before keeping any it made,
so a conversation larger than the budget still finds what was kept
since its last turn.
- Images not kept are made side by side, at most min(4, GOMAXPROCS) at
once (each holds ~100 MB for a Retina screenshot); the same image twice
in one request is made once.
- Sibling: the describer's cache (vision.go sights) was FIFO at 256, so a
text-only model sent 300 screenshots described every one again each
turn. It is now LRU at 2048 (a description is a few KB).
Numbers, codex_images_timing_test.go (MAGPIE_TURN_TIMING=1), magpie's
time before the fake upstream had the request, 160-163 screenshots, run
back to back at load ~15-60 on this M-series mac:
- before (
|
||
|
|
6f950653fc |
gateway, codex: a model turned away for an image says why magpie takes it for text-only and where Accepts images is (KimYx0207 on X)
mark_li21 pasted an image in Codex through magpie and was told the model
doesn't take images, with no hint of why or where that is changed;
KimYx0207 asked that the refusal say the model's list has no image input
and point to Providers → Names & levels, so nobody switches models or
reinstalls Codex first.
Codex turns the image away itself ("… does not support image inputs.
Remove images or switch models."), and magpie can't word that. What it
can:
- Codex's /model: a model magpie hands Codex without "image" now reads
"<name> (text only: Accepts images is in its provider's Names & levels
in magpie) via magpie". It still ends " via magpie", which is how
catalog.MagpieAdded tells magpie's entries from Codex's own. A model
that sees and a routing group read as before.
- The gateway's own 400 (every other agent): after "does not support
image input" it says why — Accepts images turned off by the user for
it, or the provider's model list marking it as not taking images, or no
model in the group marked as taking images — and names
Providers → <provider> → Names & levels, before the note on image
recognition it already gave.
Tests: TestCodexCatalogSaysTextOnly; TestTextOnlyRefusalSaysWhyAndWhere
(the user's own answer, a group); TestKnownTextOnlyModelRejectsImagesBeforeUpstream
now checks the why and the where on all four APIs. With codexcat.go and
gateway.go put back, all three are red.
Real use: a catalog from codexcat.Catalog handed to Codex 0.162.1 under a
sandbox CODEX_HOME (model_catalog_json, a dead provider URL); /model
lists "Text Model (text only: Accepts images is in its provider's Names
& levels in magpie) via magpie" and "Sees Model via magpie". Pasting an
image there wasn't tried.
Run at origin/main
|
||
|
|
ad312dfee9 |
zhipu: a 1308 or 1310's reset time, written with no zone, is read as Beijing's, and a held refusal says its time with the offset (Player on Discord)
Player reached a Remote magpie with a GLM Coding Plan key: "Z.ai:
[1308][Usage limit reached for 5 hour. Your limit will reset at 2026-10-15
20:12 (out of its allowance: not asked again before 17:12)". Z.ai's 1308
and 1310 ("Usage limit reached for N hour. Your limit will reset at
YYYY-MM-DD HH:MM:SS", bigmodel.cn "您的限额将在 … 重置") write the time
with no zone. It is UTC+8: code-yeongyu/senpi#3348 has a 1308 received at
2026-09-21T17:17:32Z saying 01:18:11, 39s later as UTC+8 and 8h later as
UTC; kodustech/kodus-ai#2104 and openclaw/openclaw#97764 show the same
zone-less form for 1310. resetsWhen reads only a time with its offset, so
nothing read it: the key rested quotaRest (15 min), the held refusal said
"not asked again before" a quarter-hour on (17:12, this magpie's local
time with no zone), and after it Z.ai was asked and refused again until
20:12 Beijing time.
- routing.go: zhipuResets/resetsZhipu read Zhipu's own words ("Your limit
will reset at", "您的限额将在") then a whole date and a time to the
minute at least, in UTC+8; not when a digit, colon or zone follows
(cut in its seconds, or a zone of its own, which resetsWritten reads).
resetsAt tries it after resetsWritten, so restAfter and keepRetry both
see it, for the built-in key, a relay passing it on, and a Remote
magpie's held refusal.
- heldClock: a held time is given as "20:12 UTC+8" (today) or
"Oct 16 09:00 UTC+8", since its reader may be a Remote magpie's user on
another clock. Siblings: the quota-held 429 (gateway.go), the capped
window error (fallback.go), the spent searcher (search.go) and describer
(vision.go), all of which wrote Local() with no zone.
- docs/subsystems/gateway-routing.md says both.
The "manual weekly reset" was Z.ai's weekly reset card, spent on Z.ai's
site (magpie only counts them,
|
||
|
|
4594d66d2d |
gateway: an image description's time limit is the describer's, not its wait in the queue, and the usage log no longer calls it the agent canceling (#2318, davisjiahao)
askVisionWith put a 2-minute context.WithTimeout around the whole description, which goes through the gateway itself (s.serve): its wait for a slot (MaxConcurrency, QueueWait), for room in the minute, and the pauses between tries all spent it. A reasoning seer (gpt-6.1-sol on a Codex account) queued or retried had little or nothing left to describe in, and the image's turn failed. The usage log said 499 "the agent canceled the request" for magpie's own limit. sideDeadline (side_deadline.go) now bounds a request magpie asks of itself: the vendor has its limit from when the request last went out to it (httptrace WroteRequest, each try's own), and the whole of it, waits included, a larger one. Image descriptions get 3 minutes per try (a dense screenshot at a high reasoning level can take over two) and 10 in all; a model's search (modelSearch, the same 2-minute limit, the #1522 message) keeps 2 minutes per try and 5 in all. The context's cause says which limit ended it, and the 499 sites in serve record "magpie stopped waiting: its image description had no answer in 3m0s" instead of the agent canceling. Still 499, no fault of the vendor's. Not done: the issue's setting for the limit (none needed once the wait isn't counted) and sending the raw image to a model that can't see it. A pause between two tries still runs on the first try's limit. Tests (vision_wait_test.go): TestVisionWaitIsntTheDescribersTime queues the description behind a held request for twice the limit; TestVisionLimitEndsASlowDescriber has a describer slower than the limit and checks the 502 and the usage row. Broken by hand (WithTimeout back, the old 499 text) both fail: "no answer in 300ms" and "vision usage: 499 the agent canceled the request". modelSearch has no test of its own; it uses the same sideDeadline. Run: go test -tags nogui ./internal/gateway -run 'Vision|Search|Image|Seer|Describ|Concurren|Queue|Cancel|Usage|Lane|RPM' ok (58s); gofmt clean; go vet -tags nogui ./internal/gateway on darwin, linux, windows clean. Not tried with a real queued seer. Full suite: SUITE_LINE |
||
|
|
dc2f0da820 |
gateway, gui: Image recognition and Web search pick how hard their model thinks (MOMO on Discord)
MOMO asked on Discord, "外置模型能不能提供思考深度选项": the model that describes images (Image recognition, analyze_image) and the searcher's model (e.g. Antigravity's Gemini 3 Flash) had no reasoning level of their own to pick. Settings › Models now has a chip beside each of those two pickers. It opens the app's menu (openProtoMenu, no native select) and offers Default plus only the levels that model has (Efforts, weakest first; none shown when the model's levels aren't known, or the row is Off). The pick is saved as settings.visionEffort / searcherEffort, one of catalog.EffortRank or empty, and is checked on save. prefsKeep carries both, so saving another setting keeps them. Default keeps what magpie did before. Image recognition is still asked at the least level the model has (classifyEffort), and the searcher still gets no level. A picked level is fitted to the model's levels at call time (fitEffort), and only these two calls carry it (side_effort.go): - askVisionWith sends reasoning_effort. The image cache key includes the level, so changing the level reads the image again. - searchBody puts thinking (disabled for none, else enabled with budgetOf's budget) and output_config.effort (except for pre-adaptive Claude) on the searcher's Anthropic body. The gateway's translation turns that into each vendor's own form: adaptive or between_tools for new Claude, reasoning.effort for Responses, and thinkingLevel for Gemini 3 on Code Assist / Antigravity. - A picked level raises max_tokens by its budget (replyRoom), so the thinking doesn't eat the reply. - ownSearch and Kimi's search service are sent no level. A fallback searcher is sent the level fitted to its own model. docs/subsystems/gateway-routing.md: new "How hard a side model thinks". Tests: - TestVisionEffortPicked and TestVisionEffortOnAnthropic check the vision body. - TestSearcherEffortPicked checks the searcher body on new Claude, old Claude and Responses. - TestSearcherEffortOnGemini checks the searcher body through buildCodeAssist for antigravity. - TestSideEffortChecked covers settings validation. - side-effort.test.cjs covers the chips: levels shown, a pick saved, Default clears it, toggle and Escape, no scroll, fit in the row and the menu inside the window. It runs in Chromium and WebKit at 1100 and 420, in en/zh/zh-TW/ja/de. Run: - go test -tags nogui ./internal/gateway/ (full, -timeout 30m) on origin/main |
||
|
|
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.
|
||
|
|
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. |
||
|
|
d5cae267a7 |
gateway: image recognition and web search pick only models the user enabled (JonahFu on X)
On a provider with a long list, AutoVision and the searcher picked their
small model from everything the vendor lists (Available), not from what
the user enabled. A Trae CN user's text-only model had its image sent to
OpenRouter's anthropic/claude-haiku-5.5, which they never enabled and
which OpenRouter refused for their region (403).
smallModel, and so AutoVision, searcherModel and the searcher's
first-model fallback, now chooses from Exposed: the user's picks, else
what agents are offered. With no enabled model that sees, a request
turned away says so ("none of the models enabled in magpie can see
images ... enable one that can, or pick one in Settings → Models → Image
recognition"); Vision off says it is off; a describer magpie picked
itself that fails is named as magpie's pick.
Not done: no fallback to another describer on a refusal. With the pick
limited to enabled models, a refusal is of a model the user chose, and
the error now names it and where to change it. Image generation's
AutoDrawer still picks from image models a provider lists: image models
aren't in the chat pickers, so limiting it to picks would turn drawing
off for nearly everyone.
Run: the two new tests fail on the old code (AutoVision =
router/google/gemini-3-flash, searcherModel = google/gemini-3-flash) and
pass now; go test ./... green except internal/gui's
TestDockJoinLeadsCommandTab, which reads the live desktop's Command-Tab
order and passes run alone; gofmt; GOOS=linux and windows go vet
./internal/gateway.
|
||
|
|
d5f434f308 |
gateway, gui: an Image recognition or Image generation model picked in Settings that magpie can't find any more is no longer replaced in silence: Settings › Models marks it missing and says what describes or draws in its place, and the description's row in Routing names it beside the automatic model that described instead (found on #1287)
Before, if the picked model didn't resolve (its provider removed or turned off, or the model gone), seer() and drawer() quietly fell back to AutoVision/AutoDrawer. Settings still showed the gone id as the pick, and Routing showed only the automatic model. The turn still goes ahead with the automatic model, so nothing the user sends breaks. What changed is that magpie now says so:
- VisionMissing and DrawerMissing (pickedMissing) name the pick that doesn't resolve. /api/settings carries them as visionMissing and imageGenMissing.
- CallFor.Missing is set on every description (withDescribeFor). This covers the single-model and group paths and every protocol. routing.js tells that story first.
- With no automatic describer either, the 400 and 502 a turn is refused with name the missing pick and where to change it. So does a draw request that names no model.
- renderImages and renderImageGen show "<id> · missing" in the picker and a red line under the row. The line names what stands in, or says nothing does, and asks the user to pick another model.
- zh, zh-TW, ja and de are translated.
Verified:
- New internal/gateway/vision_missing_test.go. I took out the behaviour (Missing on the row, the notes, the draw message) but kept the helpers so it compiles. Both tests then FAIL:
vision_missing_test.go:80: probe/text anthropic: the description's row is for {Agent:other Model:probe/text Unknown:false Missing:}, want it to name the missing gone/bigeye
(the same on responses, codex and chat, and for group/mixed)
vision_missing_test.go:116: probe/text with no describer: 400 ... "model \"probe/text\" does not support image input"
vision_missing_test.go:135: no drawer: 400 ... "no model to draw with: pick one in magpie's Settings → Images → Image generation, or name one"
- New internal/gui/tests/images-missing.test.cjs checks Settings › Models in en and zh at 1000px and 360px: the picker text, the line inside its row, and no page overflow. A pick that is found shows as before. routing-vision-why.test.cjs gains the missing row. With app.js and routing.js from before this change (Chromium): pass 2, fail 7.
- node --test images-missing, routing-vision-why, routing-side-calls, settings-sections, gui-ja, gui-de, gui-zh-tw and i18n-keys in Chromium and WebKit: 42 pass, 0 fail.
- go vet -tags nogui ./internal/gateway ./internal/gui passes on darwin, GOOS=linux and GOOS=windows. go build -tags nogui ./... passes.
- HOME=<tmp> go test -tags nogui ./internal/gateway ./internal/gui: ok (208.5s, 36.9s).
Not verified: no real magpie instance with a provider actually removed. The gateway was exercised through Handler with fake upstreams, and the GUI with a faked /api/settings. Drawing's own Routing row still doesn't say its model fell back: drawing calls have no story in kindWhy. Only the Settings row and the refusal say it.
|
||
|
|
e7de897f93 |
gateway, gui: Routing now says why an image was described for a model. Either nothing magpie knows says the model sees images, so it is counted as text only, or its provider's list or the user's own setting says text only. It names the fix for each: tick "Accepts images" in the provider's models, or pick the describing model in Settings › Models › Image recognition (#1287, Admin123456-check)
The reporter set Codex to deepseek-v4.1-flash and saw a row "codex/gpt-6.1-sol · 图片描述" in Routing. The model was counted as unable to see images. With no Image recognition model set, magpie had a Codex account's model describe the image (AutoVision). The row said only "which can't see images", so it gave no reason and no way to change it.
CallFor gains Unknown. It is set when blindTo counted the model as text-only only because nothing says it sees (the request has no imageInput of its own). This holds on both the single-model path and the group candidate path. routing.js's kindWhy gives each case its own story. zh, zh-TW, ja and de are translated.
Verified:
- New TestDescriptionSaysWhyTheModelCantSee sends an image on the responses, codex, chat and anthropic routes. It covers an unknown model, a model whose list says text only, and a group of each. Without the gateway change it FAILs, e.g.
vision_unknown_test.go:182: probe/text responses: the description's row is for {Agent:other Model:probe/text Unknown:false}, want unknown true
with the same failure on codex, chat, anthropic and group/unknown.
- internal/gui/tests/routing-vision-why.test.cjs checks the vision row's tag and story in en and zh, in Chromium and WebKit. With routing.js from before this change it gives pass 0, fail 2.
- node --test routing-vision-why, routing-side-calls, gui-ja, gui-de, gui-zh-tw and i18n-keys: 18 pass, 0 fail.
- go vet -tags nogui ./internal/gateway ./internal/gui passes on darwin, GOOS=linux and GOOS=windows.
- HOME=<tmp> go test -tags nogui ./...: all ok except the root package and internal/plugin (TestHostRunsAsMagpieBun context deadline). Those fail only in the full run under load. Run alone, both pass (34.9s, 122.7s).
Not verified: the reporter's real provider. A throwaway test against the real models.dev data found no preset where deepseek-v4.1-flash counts as unable to see. So their case is one of: their provider's list says text only, a model setting, a stale models.dev cache, or a plugin. That is asked on the issue.
|
||
|
|
46f03154ff |
gateway: a gateway key can be held to some models (#882, LCorleone) — a key could reach every model magpie serves. A key now keeps an optional list of models (caller-keys.json "models", none = every model, so older files read as before): <provider>/<model> or <provider>/*, matched against the provider that serves the call, so a bare model name is resolved first and OpenRouter's "anthropic/x" is not Anthropic's. Such a key sees only its models in /v1/models, /v1/models/{id} and the Anthropic (Claude Desktop) and Gemini lists, a routing group only when every member is its; asking for another, by id, bare name or through a group with a member it may not use, is refused before any provider is asked with a 403 in the API's own error shape (permission_error) that names the key and its models, logged as a rejected call like an over-limit key's 429; a fallback it may not use is skipped; embeddings, images and videos it names are held too. magpie's own calls for it (a web search, a picture described, Codex titles with the model Settings name) are marked in their context, not by a User-Agent a client could send, and go on. Set it with the new badge on the key's row in the Gateway page (the app's menu: All models, every model of a provider, each model; sent when the menu closes) or magpie gateway-key models <id> openai/gpt-5 anthropic/* (all takes it off); gateway-key list has a MODELS column. The app's menu, fitting neither below nor above its button, now goes on the roomier side and scrolls instead of running off the window. en/zh/ja/de. TestGatewayKeyModelsHoldAKey (lists, 403s by id, bare name and group, Anthropic shape, fallback skipped, magpie's own call, a free key) fails without the change; TestModelPatterns, TestKeyModelsKept, TestGatewayKeyModelsCLI, TestCallerKeyModelsRoutes pass; gateway-key-models.test.cjs (Chromium and WebKit, en and zh: no native select, menu inside a 420px window, picks sent on close, All models, no scroll, no left border, 560px fits) passes with gateway-connect-keys, gateway-key-limit, gateway-caller-keys and click-scroll. go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass.
|
||
|
|
2a4042a94d | perf: magpie opens and shows the Agents page in a fraction of the time it took (Junjie Zhou on Discord: 8 个 agent 30 个 provider … 每次我打开的时候都会很慢,要好几秒。setting 页面秒进后 我切换到 agent 就有问题) — at start, writing the agents' model lists (agent.SyncCatalog) built every provider's catalog thousands of times with nothing held, each build reading migrations.json, settings and groups again: 6000+ file reads and ~8.5s of CPU in the first 8s with the owner's 30-odd providers, all competing with the first /api/state and the Agents page. Now SyncCatalog, magpieModels and main's start-up moves run under provider.Hold, migrations, groups, settings and a provider's fetched models are held for a second like the rest, and filememo.Hold lets a GET /api/* not stat a file it confirmed unchanged within the last second (any magpie write, Changed() or a recent mtime still reads it again). A big ~/.codex/config.toml parsed in quadratic time (the TOML parser's Shape counts newlines from the start for every key): a 3 MB one took 5.4s, now 0.04s (tomlShaper). theInstalled reads through edit.Read's memo. Measured with a copy of the owner's magpie config and agent configs under a sandbox HOME, the real server in WebKit: CPU in the first 8s 8.59s → 0.39s, page up 475 → 75ms, Agents rows drawn 775 → 325ms after start; the agents' written model files are unchanged (pi byte for byte, opencode the same models). TestTOMLShaperMatchesParser, TestTOMLBigFileParsesInLinearTime (fails on the old code), TestHold (filememo), TestHoldReadsMigrationsOnce. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass. | ||
|
|
6cab11673e |
vision: a model whose list says nothing of images is given the image described, and the description is in Routing as its own call (Discord, Fate: since v0.1.725 images reach a text-only model in Codex, but it reads them badly and Routing shows no call to the Vision model) — 19e239c7 tells agents every model takes images while a describer is set, but the gateway described an image only for a model whose list says explicitly it takes none (ImageInput false); a model the vendor's /models says nothing of (ImageInput nil — most API keys' models, which magpie counts text-only and agents were told so before) had the image sent on as it came, so the text-only upstream got the raw image (dropped, or read by whatever it does with it) and the Vision model was never asked. Now, while a describer is set, a model that isn't known to see (its catalog entry's Images: the list's answer, the user's override, else models.dev) is given the description, on every API (Responses and Codex's /backend-api/codex, Chat, Anthropic, Gemini), for its current turn, older turns and tool results (function_call_output's input_image), and as a routing group's member (blindTo). Without a describer an unknown model is passed images as before. The description was already a call through the gateway (agent magpie-vision) but untied to anything; it now has kind "vision" ("Image description" in Routing, zh 图片描述), For naming the agent and model it described for, and the request's session, so it shows in that conversation's Routing beside the turn. The describer's prompt (every text transcribed, layout, values) and the image (sent whole, never downscaled) were already right. TestModelNotKnownToSeeIsGivenTheDescription (data: and https input_image on /v1/responses and the Codex backend path, Chat), TestModelNotKnownToSeeToolAndGroupImages and TestDescriptionIsInRouting fail on the old code and pass. go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass but TestUserPath, TestCodexVersion, TestClaudeRunEndsWhenTheClientLeaves and davsync, timing tests under load that pass alone and in their packages rerun. Not tried in the Codex App with a real account.
|
||
|
|
19e239c7bf | vision: while a model that sees describes images, agents are told every model takes them (Discord, Fate: with Settings › Vision set, a text-only model in Codex still said it "does not support image input") — the gateway already described an image for a text-only model on every wire format, but the agents were told the model was text-only (Codex input_modalities ["text"], opencode modalities, dsh/omp input, droid NoImageSupport, cline/zed/qoder/workbuddy flags…), so they turned the image away before magpie was asked. provider.Described, set by the gateway to whether seer() finds a describer (Vision names one, or Automatic finds a model that sees; not with Vision off), makes magpieModels (every agent's model file) and codexListed (the ChatGPT backend's /models list and its ETag) say images for every model; Vision changed in Settings rewrites the agents' lists (catalog.Touched). TestDescribedModelsTakeImagesInAgentsLists (Codex list, input_modalities, tag) and TestDescribedModelTakesImages (agent files) fail on the old code and pass; TestDshModelLimits and TestMiniMaxCode turn Vision off to keep testing a text-only model as such. go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. Not tried in the Codex App with a real account. | ||
|
|
564f8782c7 |
provider: keep conversation models on mixed decision providers (#609)
Distinguish decision-only providers from gateways that also serve conversations. Only Jev models use the decision API; ordinary models remain in the catalog, automatic groups and conversation routes. Keep the full model cache when probing a mixed provider’s decision endpoint, and allow conversation model tests in its editor. Verified with go vet -tags gtk3 ./..., go test -tags gtk3 ./..., node --check internal/gui/assets/app.js, and an isolated browser fixture. Amp-Thread-ID: https://ampcode.com/threads/T-01a0fe05-afd7-70df-97cf-fdb69c4f4680 Co-authored-by: Amp <amp@ampcode.com> |
||
|
|
efed707066 |
providers: a provider can be switched off, kept with its keys but out of every agent's list (希望服务商可以有一个开关按钮,关闭后不再写入模型) — a provider whose quota ran out could only be removed, losing its key and settings, or left in, its models still written into the agents and requests still sent to it. Now each provider (a signed-in account too) has a switch on its row in Providers and in its editor's header; off, the row is dimmed and says Switched off (已关闭), its models leave the catalog, so the model lists magpie writes into agents' files are rewritten without them as after any provider edit, and it is left out of routing groups, fallbacks, the Automatic image, vision and search picks, the routing pools and balance and usage polling. A request naming one of its models is answered 404 saying the provider is switched off in Magpie, not that the model is unknown. Switched on, all of it comes back. Saving the provider from its editor keeps it off; magpie provider off|on <id> and the TUI's o do the same. Tested: an off provider's models are not in the catalog or served, a group with it routes to the member left, a fallback to it is not tried, a request for it is refused as switched off, and turned on it is listed and answers again; an account's off is kept. Checked the Providers page in a sandbox HOME in light and dark: switching a row off and on, the editor's switch and its note
|
||
|
|
d00d9ffe6f | gateway: a model that can't see images is given what a model that can says of them (让Magpie支持配置图像识别模型) — until now an image sent to a model the catalog knows takes text only was turned away in the latest turn and left out of older turns and tool results, so an agent on DeepSeek, GLM or any text-only model couldn't be shown a screenshot at all. Now each image in such a request is described once by the vision model and the description goes in its place, in every protocol (Chat, Responses, Anthropic, Gemini), current turn, older turns and tool results alike: "[Image, as <model> describes it for this model, which can't see images:] … [End of the image's description]". The describer is asked through the gateway itself (User-Agent magpie-vision/1, recorded as agent magpie), with a system prompt to transcribe text, code, errors and UI state exactly and not to answer or guess; images are described four at a time, and a description is kept (256, by model+image) since an agent sends a conversation's images again every turn, a failure not kept. An image of the latest turn that can't be described is a 502 saying why; one in an older turn is left out as before. Settings → Images → Image recognition picks the model: Automatic (a small model that sees — a Claude account's, a Codex account's, the cheapest of an API key's, another account's), Off (images turned away as before), or any model or group that sees; an id that doesn't resolve is refused. In a routing group the description is made only when a text-only member is actually tried, so a rule that routes images to a member that sees costs nothing; a member whose image can't be described is skipped for the next, the last one answers 502. The describer's own request is never described again, so a Vision set to a text-only model is turned away, not looped. Checked in a sandbox HOME against a local vendor: an image sent over Chat and over Anthropic to a text-only model reached it as the description, the describer was asked once per image, and the Settings row and its picker in light and dark. |