e4e9eb0928becfa4e48484dde85ef5032671d582
20
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
667ac8bd6f |
settings: a look at one setting takes the shared settings, not a copy
settings.Load() copies the whole Settings (clone + deepCopy of every map and slice) for each caller. 133 places read one field of it and threw the rest away: the proxy for every outgoing request (netproxy), the GitHub token, the China mirror switch, a model's output cap, wire or price on a gateway request. With a real account in the tray, Load's clone was 26.6 MB of the 318 MB the process allocated in its first seven minutes, most of it through netproxy.For on each request. Each of them now reads settings.Shared(), the read-only settings every caller is given for the same settings.json. Only reads were changed: a scalar field (string, bool, int, float) or a map field's index read. A caller that keeps a whole map or slice, or calls a method on the settings, still takes Load's copy. |
||
|
|
51b98b1a85 |
model efforts: a relay listing no levels says where magpie's come from, and a set that changes nothing says so
@czhhcz on X (magpie 0.1.4016, Claude Code, a third-party relay): the relay's /v1/models gives a Claude model `reasoning_levels: []`, yet `magpie model efforts` lists five levels for it, and setting every level was "silently dropped"; only hand-editing modelEfforts worked. What happens: a custom relay that names no levels for a model gets the model's own levels from models.dev (borrowedEfforts), and the gateway fits requests to them, so Claude Code's max and xhigh already reach the relay as asked (TestRelayListingNoLevelsStillGetsTheAgentsEffort). A set of every level is the default, so nothing is saved, but the CLI printed "✓ … offers every level it has" as if it had changed something; the hand edit changed nothing either. An empty list stays "unknown", not "none": magpie writes [] itself for levels it doesn't know. - provider.KnownBorrowed(model) says when a model's levels are borrowed. - `magpie model efforts` prints, for such a model, that the provider's list names none and these are the model's own from models.dev, and that `off` sends no reasoning field. - ChangeModelEfforts / ChangeModelSpec report whether anything changed. A set that changes nothing prints "· nothing changed" with what it already offers, and no ✓. - Sibling: `magpie model spec --reasoning` printed "✓ saved" over the same no-op; it now says nothing changed. - GUI: its level chips show the current state, and ticking every level is the default, so nothing is sent; no silent-drop path, unchanged. Run on mote: go test ./internal/cli ./internal/provider (whole packages); go test ./internal/gateway -run 'Effort|Reasoning|Relay|Adaptive|Spec'; go vet, GOOS=linux -tags nogui and GOOS=windows go vet of the three packages; gofmt -l. New tests: TestModelEffortsOfARelayThatListsNone (a httptest relay with reasoning_levels: [] in a sandbox HOME) and TestRelayListingNoLevelsStillGetsTheAgentsEffort. Broken by hand, each red: the no-change check skipped (✓ printed again), the borrowed line left out of the listing, and spec's "saved" forced. Not tried: a real relay; the GUI suite (no GUI file changed). |
||
|
|
e18aca1038 |
agents: an agent's own context window, and a routing group's own Compact at (ul3140773077392, NovaStudiosss on X)
ul3140773077392 on X: dsh compacts earlier than other harnesses at the same
window, so one global size per model fits none. An agent's sheet (Agents,
the agent's Settings line) now holds "Context window": a size for every
model, or model=size pairs (provider/model, group/<id>, provider/*, a bare
model id, *). Empty follows each model's own window. It is applied in
provider.CatalogFor, the choke point every agent's model list goes through,
so dsh's contextWindow, Codex's catalog and Claude Code's window all read
it, and a window set this way makes Codex/Claude compact at that window
(Entry.WindowSet). Stored in settings.AgentContexts, kept by a general
save (settingsapi); POST /api/settings/agent-contexts and
`magpie model window <agent> [model=size...|off]`.
NovaStudiosss on X: Routing, a group's Edit, Advanced already had "Context"
(the window agents are told). It now has "Compact at" beside it
(Group.Compact; compactSet reads it before the members' smallest), also
`magpie group ... compact=`.
GUI: agentwindow.js, loaded on demand through agentcompact.js so app.js
stays inside its budget (TestCoreScriptBudget passes; the "Context window
in {agent}" label reuses the existing "Context window" key). Every agent
with fields now has a sheet; agent-prefs' Pi expectation says so.
Run at the pushed head, on mote: go vet (darwin; linux -tags nogui;
windows) on provider, agent, cli, gui, settings, settingsapi; gofmt clean;
go test provider, cli, settings, settingsapi, gui (TestCoreScriptBudget
and cli's route table fixed here), agent -run Dsh; node --test agent-window
and group-compact (chromium and webkit, en zh zh-TW ja de, 900 and 420px),
agent-compact, agent-prefs, compact-at. Reds seen identically on a
detached origin/main
|
||
|
|
a5e805f574 |
Codex: Ultrafast beside Fast in a group member, and a Fast/Ultrafast setting per model (kdajenks on X)
kdajenks (magpie 0.1.3739, Codex on ChatGPT Pro) could set Fast only from a
routing group's member row and had no Ultrafast there, and no way to set the
speed in the model's own settings. Ultrafast exists: Codex's catalog lists
the `ultrafast` service tier, the code already sent it for agent picks and
Codex's service-tier row, and the live account's service_tiers hold it.
- Group member: the button steps Standard speed, Fast, Ultrafast (where an
account offers it, `ultraOK`), back to Standard. `Group.Ultra` is a subset of
`Fast`, kept through rename, fold, share, gone-filter and the CLI
(`magpie group ... ultra=`). The gateway marks the candidate `ultra`.
- Per model: `settings.ModelTiers` ("<provider>/<model>" to priority or
ultrafast), `provider.SetModelTier` (refused where CanFast/CanUltra say no),
`ModelPref.Tier` in Model settings (Standard speed / Fast / Ultrafast, in
modellimits.js), and `magpie model tier <provider/model> [fast|ultrafast|usual]`.
The gateway sends it on a direct pick for an agent with no fast pick of its
own, through fastPick, so an account without Ultrafast gets priority. A group
member goes as the group says.
- Docs: gateway-routing, providers-accounts, reference.
Run (mica, at the rebased head over
|
||
|
|
4999cef657 |
cli, gui tests: context-cap's usage line lines up, and ContextCapAll is kept (#6103, #6104)
|
||
|
|
f5e1b10913 |
settings: longest context can hold a model's own window too (WJaunita45604 on X)
v0.1.3681's Longest context left a window the user set for a model, or "*"
on its provider, alone even when longer. Settings > Models > Routing now has
a menu beside the field: "Models without their own" (the default, as before)
or "Every model". In both modes the shorter of the cap and the user's own
window is told; they differ only when the user's own is longer (own keeps it,
every model brings it down). Settings.ContextCapAll, Settings.CappedOwn,
POST /api/settings/context-cap-mode {all}, magpie model context-cap all|own.
Applied in provider.windowIn (so /v1/models, catalogs, compaction), Codex's
CodexNativeWindow/CodexWindow (the list's ETag tag carries the mode) and the
gateway fallback window. i18n in zh, zh-TW, ja, de.
Run (wsl-run, mote's disk was full): provider (full), settings, settingsapi,
codexcat packages; cli -run ContextCap; gateway -run ContextCap|ModelsList;
GUI context-cap, i18n-keys, model-load, settings-places, settings-general in
chromium and webkit; TestCoreScriptBudget; gofmt; go vet nogui and
GOOS=windows vet. Broken by hand: windowIn's CappedOwn removed turns
TestContextCapAllHoldsTheUsersOwnWindowsToo red.
Not tried: the whole Go and GUI suites, a real Codex reading the list, macOS
or Windows runs, GUI in zh-TW/ja/de beyond the i18n-keys check.
|
||
|
|
7476328901 |
settings: one longest context for every model (WJaunita45604 on X)
Settings > Models > Routing has a Longest context field (magpie model context-cap [<size>|off], POST /api/settings/context-cap). It lowers every model's window to it, so a user need not set each model. A window the user set on a model, or on its provider with "*", wins and is not capped; a model whose window is unknown stays unknown. It is applied where the window is derived, provider.windowIn, so /v1/models, every agent's catalog, group windows and the compaction thresholds that follow the window all agree. Codex's own models take it through CodexNativeWindow, CodexWindow and codexcat.Cap on the list the gateway serves; the list's ETag carries the cap so Codex asks again. The provider editor's Listed value stays the vendor's. Run (mote): provider, codexcat, cli, settings, settingsapi, gateway tests; GUI context-cap, model-load, settings-places, i18n-keys, settings-general in chromium and webkit (en, zh); TestCoreScriptBudget; gofmt; vet on darwin, linux nogui and windows. Broken by hand: windowIn without the cap turns TestContextCapHoldsEveryModelButTheOnesTheUserSet and TestModelsListContextCap red. Not tried: the whole GUI suite (one row added to an existing list, no new API read on page load), a real Codex reading the capped list, Windows run. Not covered: Claude Code's own [1m] choice (claudeRunName) and agent/claude.go's fallback when a ref has no window. |
||
|
|
99b080e2ee |
agents: an agent can have its own Provider in model names (KillTry27355 on X)
"希望 可以在不同的 agent中选择是否显示供应商名字,现在只能统一开关":
Provider in model names was one switch for every agent. An agent's
Details on the Agents page now has a Provider in model names row: As in
Settings · <mode> (the default, kept for everyone), On, Not on names I
set, or Off, for that agent alone. The CLI has the same thing:
`magpie model suffix <agent> [on|own|off|every]`.
- settings.AgentSuffix keeps the agent's own mode by the id its lists are
kept by (Agent.ListsFor, lower-cased, without @wsl: or #profile). An
agent with none follows PlainNames/PlainOwnNames as before, so nothing
a user already set changes.
- provider.LabelsFor(agent, es) reads that agent's mode. Every place
that named models with Labels for an agent now passes the agent: Codex's
catalog, the agents' written lists (route.go, Pi's extension), the
gateway's /v1/models (by agentOf(r)), Muse, Antigravity, Ollama, Claude
Desktop's catalog and descriptions, Claude Science. Labels is
LabelsFor("").
- POST /api/settings/agent-suffix sets it and rewrites the agents'
configs (catalog.Touched), as Settings' switch does.
- docs/subsystems/agent-wiring.md says where the mode is kept and read.
- The picker is in agentsuffix.js, imported when an agent's Details open,
so the core grows by the one line that loads it (1,529,335 of its
1,533,802 budget, after the previous commit's move). An agent whose
list takes no names of magpie's (noNames) has no row.
Tests, each red on the old code: TestAgentSuffix (provider: modes, keys
with @wsl and #profile, reset, bad input), TestAgentSuffixReachesItsFileAlone
(agent: Pi's file follows its own mode while Codex's follows Settings'),
TestModelsListFollowsAgentSuffix (gateway /v1/models per agent),
TestModelSuffixAgentCmd (cli), settings_keep (AgentSuffix survives a
Settings save), agent-suffix.test.cjs (5 languages x 1180/390 x chromium
and webkit, and a noNames agent has no row).
Broken by hand (a copy with LabelsFor ignoring the agent and the picker
reading no own mode): TestAgentSuffix, TestAgentSuffixReachesItsFileAlone,
TestModelsListFollowsAgentSuffix and every agent-suffix GUI case went red.
TestModelSuffixAgentCmd stayed green; it checks what is saved, not the
names.
Run on mote at this change on top of
|
||
|
|
234903cb23 |
cli: magpie model api sets the API a model is asked on, as the editor's picker does (yew_fence_931206)
A relay with many models behind one key can now have each model's API
set from a script, not only in the provider editor's Names, prices &
levels ("API this model is asked on"):
magpie model api <provider/model>... chat|responses|anthropic|gemini|auto
magpie model api <provider/model>... --reset (auto)
magpie model api <provider/model> what it is asked on
magpie model apis [<provider>] the settings; with a
provider, every model
It saves through provider.SetModelPrefs, the editor's Save, into
settings' modelAPIs, so a running gateway reads it on the next request
and the agents' model lists are told once. Choices are those the editor
offers (modelAPIs in app.js): the APIs the provider has a URL for, when
it has two or more; Vertex AI none. --help anywhere prints the usage. A
flag in place of a model, an unknown API, a model the provider doesn't
list, or an API it has no URL for is refused; several models are all
checked before any is written. A saved setting for a model the vendor
no longer lists can still be reset. Documented in docs/reference.md
("The API a model is asked on") and the gateway-routing page.
Run (mote, via mote-run, at this tree on
|
||
|
|
6b47bce670 |
cli: magpie model compact <agent> sets an agent's own Long conversations
|
||
|
|
7b09d2c951 |
provider: a model can be listed by an id of the user's at its provider, asked for by its own
zeewell on X (tweet 2116404121930432888): relays serve one model under
ids of their own (deepseek-v4.1-flash-1017, grok-4.6@500k). They want to
give each one their own id at the provider layer. magpie then lists,
routes, groups and finds groups by that id, and the upstream request
still carries the vendor's id.
Choice: a new per-model map, settings' ModelIDs
("<pid>/<local>": "<own id>"), served through the wire names that
already exist. ModelSameAs was not widened. It means "same as another
vendor's model": it lends specs and joins found groups. Making it rename
models everywhere would change every existing user's ids and refs.
ModelWires was not reinterpreted either, for the same reason. ModelIDs is
ModelWires turned round: a wire keeps magpie's id and changes the one
sent, and this keeps the one sent and changes magpie's. Settings.Wires()
merges each entry in as a wire name (wrapped by a "<pid>/*" wire). Every
place that sent a ModelWires name (gateway, usage ledger, request page,
UpstreamName, UpstreamNameAs) reads Wires(), so the upstream id needs no
new path. An explicit ModelWires entry for the same id wins.
- Listed by the local id: Available, liveIDs/liveByID, Serving and
ListPrice translate through OwnModelID. /v1/models, agents' lists,
Resolve, routing groups and found groups (auto/<local>, merged with
every other provider serving that id) all see the local id.
- Only a provider of the user's own (Account == nil) takes one. An
account's or a plugin's request is built from its list's id, which no
wire reaches.
- Two variants of one provider given one id: the latest given it wins,
and the earlier one is listed by its own id again. The CLI names it.
The editor refuses two rows given one id in one save. A model of the
provider's own id that a variant is listed by (plain grok-4.6 beside
grok-4.6@500k) is not listed while the variant has it.
- The user's values are never overridden. SetModelID moves picks,
contexts, fallbacks, groups' members/rules/fast/placed/off/weights/
classifier/pick, the pickers' lists, every per-model setting
(Settings.MoveModel) and gateway keys' models (provider.ModelMoved,
set by access) to the new id, but only where nothing is under the new
id yet. Agents' own files are not rewritten: an old provider/<own id>
still resolves and is sent as it is. Group match patterns and key
patterns stay as written.
- Key limits: a key held to either id passes for both (modelAllowed:
the ref, OwnModelID, ListedModelID). Group members use the same check.
- Usage: model = the listed id, served = the vendor's id from its reply.
The price is the own id's first.
CLI: magpie model id <provider/model> [<id>|--reset], magpie model ids.
GUI: Providers > a provider's editor > Names & levels > "Listed as",
beside Same as. It is staged with the editor's Save and taken back by
Restore default, in zh, zh-TW, ja and de. Accounts have no box.
Docs: providers-accounts.md, gateway-routing.md, and site start.html in
en, zh and ja.
Run (mote-run, at this tree rebased on
|
||
|
|
a0ba8e1f2e |
grok: each model's context_window follows Long conversations, and one set by hand stays through a sync (uk.jent)
uk.jent (Discord #feedback) reported that magpie writes every Grok Build model's context_window as the model's whole window. They wanted about 300K without editing dozens of models, and they lost hand edits on each sync, because SetTOMLTables replaces the [model."magpie/..."] tables whole. Grok Build now uses Long conversations, the mechanism Codex and Claude Code already use. grokWindow gives: - min(window, Compact) when the model or provider has its own threshold; - otherwise settings.Working(window): 272K by default on longer windows, the typed size, or the whole window with Full context. What magpie wrote is stashed under grok:<path>:windows, and grokOwnWindow uses it to tell a hand edit apart: - A value that differs from what magpie last wrote is the user's, and it stays. - In a config written before the record, a value other than the model's whole window is the user's. - Disconnect forgets the record. The agent sheet's Long conversations row now shows for Grok Build (AGENT_PREFS). Its texts, the provider editor's hint, the Context tab's note and `magpie model compact` now name Grok Build, in en/zh/zh-TW/ja/de. setCompact and setAsync now share prefWrite. That dedupe keeps app.js under its budget, which is not raised. Behaviour change: a Grok Build model whose window is over 272K now gets 272K by default, as Codex does, unless Full context is on. Run on mote, at this head (c893c2229, rebased on |
||
|
|
00d44d6928 |
routing: Codex's composer predictions story says their model is picked in Codex's row on the Agents page (#3425, chiperman)
Routing's Kind description for composer_predictions still sent users to Settings › General › Codex composer predictions. That setting moved to Codex's row on the Agents page. chiperman's commit (5e372e168) fixed the Routing text in five languages. It is ported here with their zh, zh-TW and ja; the de wording is mine. Grepping for other texts that still name the old Settings place for a setting that moved into an agent's row found four more, now fixed: - app.js compactField, the provider editor's "Compact at": empty follows Long conversations, now "in their settings on the Agents page (else in Settings)". The field's text is one string now, and the header comment no longer repeats it, so app.js stays inside its budget (unchanged). - gateway sealedWayOut: "Codex subagents on any model" is in Codex's settings on magpie's Agents page, not "magpie's Settings". - gateway codex_titles: "Codex composer predictions are off" and "Codex titles are off" answers name the same place. - cli `magpie model` help text. Each gateway message has a test that fails on the old wording, and the GUI files assert the new place and the absence of the old one. Run 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 ( |
||
|
|
ea9454d2d8 |
usage: count two ids of one model as one, magpie model alias (SlouchyQuill507 on Discord)
A vendor names one model two ways (deepseek-v4.1-flash and deepseek-flash),
and Usage, Usage > Sessions and `magpie usage` showed two rows. Now:
magpie model alias deepseek-v4.1-flash deepseek-flash
magpie model alias deepseek-v4.1-flash (what it is counted as)
magpie model alias deepseek-v4.1-flash --reset
magpie model aliases
kept as settings.json "usageAliases" {from: to}. Off until one is written.
Ids match as routing groups match them (provider.sameModel: vendor/ prefix,
case, "_", snapshot date), at every provider; a chain is followed to its
end; an alias to itself, a loop, or a flag as an id is refused. A loop
written into the file by hand counts each model under its own id.
Display only: requests, agents' model lists, /v1/models, routing groups,
Same as and prices never read it. Each call is priced by the id it was
made under and only then counted under the alias; the alias's own price
is never put on the other id's calls, and a merged row is priced only
when every id in it is. Applied in usage summarize/direct (Models
groups), the gateway sessions projection (alias read before
gatewayCache's lock; the cache key hashes usageAliases), and
sessions.List/Get/Find/Stats (read before storeMu/mu, merged into new
slices so the memo is untouched; ModelEffort rows merged too). A failed
settings.json read keeps the last aliases read, and SetUsageAlias refuses
to write over an unreadable file (EditUsageAliases under fileMu). The GUI
settings save carries usageAliases. No GUI control.
Not aliased: the Requests ledger's per-request model and its model
filter, which show each call's own id.
Run (worktree at
|
||
|
|
357ffac7be |
usage: a model's Same as prices its calls when no list does (#2344, liuweifeng)
A model a provider serves under its own id (a WorkBuddy kimi-k3-1, a relay's renamed gpt) had no price unless the user typed one, even when the user had already told magpie in the editor's "Same as" box which model it is. Its calls showed no API-price cost in Usage, window holds had no price to weigh, and `magpie model price` said unpriced. Now, when neither the user's prices, the provider's list nor models.dev's maker price covers a model, provider.SamePriceIn takes the maker's list price of the model it is the same as (settings.ModelSameAs), and the provider's price rate still applies. A price the user set, or a list that prices the model, always wins; nothing is inferred without a Same as. The same fallback is used by priceOf (Usage costs, re-priced when the ledger is read, so past calls pick it up), usage's apiPricer (window holds), the model editor's greyed list price, and `magpie model price`, which names where the price came from. The "Same as" tooltip says so in en, zh, zh-TW, ja and de. Run: - go test -p 1 -tags nogui ./internal/provider ./internal/usage ./internal/cli ./internal/gui (focused: TestSameAsPricesAnUnlistedModel, TestHoldsPriceTheModelItIsTheSameAs, TestModelEditorShowsTheSameAsPrice, TestModelPriceCmdSaysWhereThePriceCameFrom, plus the packages): ok - GUI (chromium + webkit): provider-same-as, i18n-keys, model-price-edit, 11/11 pass - gofmt -l clean; go vet -tags nogui for darwin, linux, windows: clean Broken by hand, each went red: - SamePriceIn dropped from priceOf: "kimi-k3-1 ... false; want $0.3" - usage's apiPricer fallback removed: "wasn't its API price: <nil>" - the GUI editor branch removed: "list <nil>" - the CLI source line disabled: TestModelPriceCmd... FAIL - the zh tooltip left untranslated: provider-same-as.test.cjs 0/2 A prefix-stripping branch passed when removed (MakerPrice already resolves vendor-prefixed ids like moonshotai/kimi-k3), so it was dropped. Not tried: a real WorkBuddy account's usage after the change. Full suite: SUITE_LINE |
||
|
|
f074996d93 |
provider, gateway, gui: a model with none of its levels ticked is sent no reasoning field, on every route and in a routing group (yuexian7)
yuexian7 on Discord: models.dev lists their model as reasoning, and the
vendor answers any reasoning parameter with 422 while the same request
without it works. In a routing group they couldn't set an effort per
model, and the model editor refused to untick the last level ("Keep at
least one level"). The learned refusals (
|
||
|
|
f71155591e |
provider: a provider at a vendor's own endpoint is priced from that endpoint's models.dev catalog (#2052, mengyianx)
A custom provider added by its address alone, with no catalog named, was priced only by the model's maker. Qwen3.8-27B, whose maker (Alibaba) sells no such model on any of its seven models.dev catalogs, read "no price is known for it" even at AMD's own endpoint, where models.dev's amd lists it at $0, a price. - catalog: models.dev's provider "api" is read; AtEndpoint names the catalogs at a base URL (trailing slash and case ignored). - provider: EndpointCatalog is the one catalog models.dev lists at one of a key's provider's endpoints (an Anthropic base, kept as its root, also with /v1), used by ListPrice when the provider has no catalog of its own. Never for a subscription's account, never when two catalogs share the address (minimax / minimax-coding-plan), never a plan's catalog (an id with -plan, or membershipCatalogs), whose $0 is the membership's. A user's price and a named catalog still come first; a relay's endpoint matches nothing and its model stays unpriced (no reseller guess). - cli: `magpie model price p/m` with no price gives the two commands that set one (p/m and */m); a price from an endpoint's catalog names it. - gui: the Catalog field's hint says it also sets list prices (en, zh, zh-TW, ja, de). - docs: reference.md's "What a model costs", providers-accounts.md row. What was run: - Reporter's exact case, built binary (go build -tags nogui), sandbox HOME with a copy of this machine's models.dev cache (2026-10-14, same amd entry as the report), providers 001 (relay), 002 and amd at https://developer.amd.com.cn/radeon/api/v1: 001/gpt-5.5 $5/$30, tiers, as before 001/Qwen3.8-27B no price, now with the two commands to set one 002/Qwen3.8-27B $0/$0, "what models.dev's amd lists at its endpoint" amd/Qwen3.8-27B $0/$0 The two suggested commands were run and took effect. - TestEndpointCatalogPrices / TestEndpointCatalogOnlyItsOwn, fixture testdata/endpoint_catalog.json trimmed from the real models.dev cache. Break checks, each FAILs with the case named: ListPrice not using EndpointCatalog -> 002/amd/001 at AMD unpriced, EffectivePrice(002, Qwen3.8-27B) unpriced plan exclusion removed -> "a plan's endpoint: EndpointCatalog() = alibaba-coding-plan", qwen3.5-plus at $0 instead of $0.4/$2.4 single-match rule removed -> "an endpoint two catalogs share: EndpointCatalog() = minimax" Account check removed -> "a subscription's account ... = amd" Anthropic /v1 match removed -> thinkingmachines unmatched - GUI: internal/gui/tests/catalog-hint.test.cjs, chromium and webkit, en zh zh-TW ja de, widths 1100 and 420: 20/20 pass, plus i18n-keys; with the old app.js/i18n.js it fails "one hint names list prices". - go test -tags nogui -timeout 45m ./internal/catalog ./internal/provider ./internal/cli: ok (provider 244s, cli 125s, catalog 3s). gofmt -l clean; go vet (darwin), GOOS=linux go vet -tags nogui and GOOS=windows go vet -tags nogui on those packages: clean. |
||
|
|
841af36bfc |
gateway: models the user disabled are refused on every route, and leave every list (#1867)
oxsean asked for one place to turn a model (claude-fable-5) off for good:
not reached by a direct request, an old session, a routing group member,
a fallback, a sub-agent, count_tokens or a decision model.
What changed:
- settings.DisabledModels: patterns, an exact id or a glob (* any run, /
included; ? one), matched ignoring case against provider/model, the
bare id and its last segment (provider/disabled.go). Empty by default,
so nothing changes for anyone who doesn't set it.
- Lists: buildEntries (entriesOff) leaves a disabled model out of the
catalog, so /v1/models, agents' model files and pickers, Codex's list
and every group go without it; membersIn skips it as a member, Deciders
as a decision model; codexModels drops Codex's own disabled slugs and
codexListTag changes so Codex refetches.
- Requests (gateway/disabled.go): 403 "model <id> is disabled in magpie"
in each API's error shape, at #882's choke points: serve (idOff),
perKeyBarred (no candidate: group next member, provider Fallback),
count_tokens and Gemini :countTokens, serveSystemOne,
serveDecisionGroup and postDecide, draw/video/embeddings, and
codexBackend for Codex's own bare models. A group with a member left
goes on without it; one with none left is refused naming them. A bare
id the catalog no longer has is refused as disabled, not 404. A Codex
sub-agent pick onto a disabled model stays on its lead's model.
- An unreadable settings.json is never "none disabled": the list read
last stays; with none read, every request is refused; nothing is
written over the file.
- CLI: magpie model disable <model|glob>..., enable ..., disabled
(list-disabled).
- GUI: Settings > Models > Disabled models: each pattern with the models
it matches now and Enable; Disable... opens the model picker, which
also takes a typed glob. Says only requests through magpie are covered.
POST /api/settings/disabled-models; POST /api/settings keeps the list.
Strings in zh, zh-TW, ja, de.
- docs/subsystems/gateway-routing.md: Disabled models section.
What was run (worktree at origin/main
|
||
|
|
23e764d0e0 |
cli: magpie's commands move from the root into internal/cli; the root keeps only main.go
The root held 89 .go files (30 commands, 59 tests). They move as they are to internal/cli (package cli), with git mv so history follows them. The only code change is main() becoming cli.Main(version): the root's new main.go keeps `var version` in package main, so -ldflags "-X main.version=…" in the Makefile, the Dockerfile and magpie-releases, and every workflow, work unchanged. go-winres's rsrc_windows_*.syso still land next to package main in the root. Tests that read testdata by a root-relative path now go up one level (../plugin/testdata/fake, ../sessions/testdata). Five subsystem doc links point at internal/cli/. Run: - go build ./..., gofmt -l, go vet on darwin, linux and windows (nogui) - builds with tags production, dev, "production nogui"; windows -H windowsgui; linux CGO_ENABLED=0 - make release-cli TARGETS="darwin/arm64 linux/amd64 windows/amd64 android/arm64" VERSION=9.9.9-tidy: all four built, binary prints "magpie 9.9.9-tidy" - docker build --build-arg VERSION=7.7.7-tidy: container prints "magpie 7.7.7-tidy" - go test ./internal/cli (default and nogui): 152 tests, the same count as the root on main - go test ./...: all packages pass (agent, gateway, library, provider timed out at 10m under other sessions' load and passed rerun alone with -timeout 40m; none of them changed) - the built binary in a sandbox HOME: version, help, ls, providers, claude, and an unknown command's error |