06ff45fed58dddf709f2b9042b8d8d5b3afbe6fc
3229
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
06ff45fed5 |
gui: a request's row on Routing keeps the model that answered readable beside its metrics, and the accounts column gives up its spare room (#1926, hibaliqya-yonma)
What changed: - The request list's columns were time, asked, to (minmax(0, 1fr)) and the metrics (auto). Rows share their columns (subgrid), so the metrics column took the widest row's whole line for every row, and "to" got what was left. Now "to" keeps at least 14em (30% of a narrower list) and the metrics take at most 40%, wrapping inside it (they already wrap); asked is held to 32% (was 36%). The no-subgrid fallback gets the same columns. - "to" said "<account> · <model>" in one box that gave way before the reasoning level, so it read "· hi…". It is now two boxes: the account gives way first (down to 2.5em), the model stays whole when it fits, and the said box keeps at least 9em before the level is cut. The text is the same, so tests and titles that read it see no change. - Side by side (1150px and wider), the accounts column is clamp(260px, 28%, 360px), was clamp(280px, 32%, 400px): in a page kept to 1200px ( |
||
|
|
08b1a60c03 |
gateway, gui: a routing group whose classifier fails says so on its card, and the log says why (#1929, versun)
What changed: the gateway keeps, per classifier model, why it couldn't
say the last time it was asked (an error from the request, or an answer
that was no number of the list) and when, until it answers again
(gateway.ClassifierFailure). The first failure, and each one that says
something new, is written to the log once ("routing: the classifier X
couldn't say: ..."). /api/groups sends it as a group's classifierFailed,
and the group's card on Routing shows a line "Classifier failed 3 min
ago: <why>" with an amber dot (no stripe); its title says that until the
classifier answers, no rule with an intent matches and turns reason as
the agent asked. Strings in en, zh, zh-TW, ja and de.
Why: versun's MLX-Serve answered its Clef decision model, asked as a
chat model, with a 400. The only place that said so was each request's
own details; the group's rules with an intent quietly never matched,
which read as the routing working. The preset itself is fixed in the
commit before this one (versun's, cherry-picked).
Run:
- go test: TestClassifierFailureIsKept (gateway: a 400, kept while
resting, "not a number", cleared by an answer) and
TestGroupsSayAClassifierThatFailed (gui: only the failing group's JSON
has classifierFailed). Each went red with its line removed by hand
(the record in classify(), the fill in groupsState).
- group-classifier-failed.test.cjs: chromium and webkit, en zh zh-TW ja
de, at 1100 and 420: 20/20; with classifierFailed dropped from the
fixture's reading in groupRow, 10/10 of one engine red. i18n-keys
passes.
- go test -tags nogui ./internal/provider ./internal/usage ./internal/cli:
ok. ./internal/gateway hit the 10m default timeout at load ~150-190
(other sessions); rerun with a longer timeout before the push, below.
- go test ./internal/gui: TestDockJoinLeadsCommandTab (Command-Tab order
had kitty in front) and TestMainWindowCorners (measuring killed under
load) failed; both are desktop-window tests this change doesn't touch.
Not verified: a real MLX-Serve; versun ran his own.
|
||
|
|
b2b015c584 |
provider: MLX-Serve's decision models classify routing groups through System One, separated from chat models by capabilities
MLX-Serve (github.com/ddalcu/mlx-serve) serves decision models (Clef, Clef-Flash, Kev, Laya, D1) at POST /v1/systemone (and /v1/decisions). Its /v1/models lists them alongside chat models, marking them with capabilities: ["decisions"]. Setting a routing group classifier to an mlx-serve decision model previously failed because the preset had no decision endpoint and magpie offered it as a chat model, which MLX-Serve rejected with 400. - The mlx-serve preset has a decision base, http://localhost:11234/v1. An existing MLX-Serve provider saved without decide gets its chat base as one, at whatever port it was given (as oMLX does). - mlxServeDecides joins listsDecisions. fetchDecide reads /v1/models and keeps models with the "decisions" capability under <id>.decisions, with the model's context window and input modalities. - DecidesModel takes them out of the agents' chat lists and offers them as deciders. Jev() is the first of them. A server with no decision model lists none, and no Jev alias is made up for it. - Provider test on a decision model asks System One rather than chat. Run: - TestMlxServeDecisionModels: fake MLX-Serve answers with real captured fields. Clef-Flash with capabilities: ["decisions"] is a decider, chat models reach agents, and RouteDecider plus AskSystemOne post to /v1/systemone. TestModels tests clef-flash-4bit via decide. Red without mlxServeDecides in listsDecisions. - TestListedMLXServeDecideTable: real captured response, vision modalities, `models` field fallback with omitted input_modalities, chat-only server, empty list, and invalid JSON. - TestMLXServeWithoutDecisionModels: no decision model means none, not Jev. - Real MLX-Serve on localhost:11234 in sandbox HOME with isolated config: provider add mlx-serve, provider refresh, provider test mlx-serve clef-flash-4bit (543 ms, decide OK), group add with classifier. - go test -tags nogui ./internal/provider/..., gofmt -l, GOOS=linux and GOOS=windows go vet, cross-OS builds. |
||
|
|
5e30d58fe4 |
usage: a request's row says the upstream's own stop reason on the Requests page, in /v1/magpie/usage/requests and in the CSV (#1927, Gluxggg)
What changed: the gateway has recorded why the upstream said each reply ended (Record.Stop: a Responses reply's "completed", Chat's "stop" or "tool_calls", Anthropic's "end_turn") since |
||
|
|
54ba9042d1 |
gui tests: routing-save-keeps-the-row runs in every language and at 420px, and wheels to the group as a reader would (#1093)
The test ran in English and Chinese at one width, with Save's text from a map of its own. It now runs in all five languages, at 1100 and 420px, takes Save's text from the page's t(), and wheels down to the group before opening it. WebKit never scrolls to an element for a click, since magpie scrolls only for the reader. Run: chromium and webkit, 20/20. With routing.js's scroll back to the row removed, 20/20 red. |
||
|
|
f9f1df2e1a |
provider, agent, gui: saving a routing group no longer waits on a Codex usage read, and the saved row comes back into view (#1093)
Saving a group ran agent.SyncCatalog, and Codex's Sync asked whether the signed-in ChatGPT account is used up through LoginUsage, which reads the vendor when its one-minute cache is stale and makes the caller wait (922-1148ms in the reporter's 17 saves, 9-20ms on a cached read). provider.CodexUsedUpKnown() answers from what was already read and never asks; the sync uses it. KeepOnAnAccountWithRoom still reads it every loginSwitchEvery and touches the catalog when the answer changes, so the sync learns of it without asking itself. The group editor stands in for the row, so on Save the page got shorter and the browser clamped the view to the list's foot. routing.js now brings the saved row back with readerScrolls + scrollIntoView, and only when it is out of view, so a click hold isn't released for nothing. Squashed from #1093 by wizzy-yang onto current main. |
||
|
|
c3dc7aefba |
provider, settings: an idle magpie no longer parses settings.json for every account of every model's price (xsw on Discord)
xsw reported v0.1.1222 sitting at ~15% CPU while idle, with no gateway
requests. Since
|
||
|
|
a65f2131dd |
gateway: a provider's model can be marked a video or image model in its editor (#1399, shen-joe)
shen-joe's relay serves a video model (agnes-video-2.5-flash), but its
/models list doesn't say "kind": "video". magpie only took a base-URL
provider's video models from that field, and its image models from that
field or from the model's name. So the model could never be asked at
/videos. They asked to tag video models, either in Settings or when
adding the provider.
What changed:
- settings.ModelKinds holds "image" or "video" by "<provider>/<model>".
RenamePerModel carries it along with the other Model* maps.
- provider/modelkind.go:
- MarksKinds: only a provider with its own base URL can be marked. A
subscription, another magpie and a decision API can't.
- ModelKind, KindModels and SetModelKind. A model can be marked if the
provider serves it, or if its fetched list has it (a video model is
left out of the chat list).
- SetModelPrefs takes a "kind" with the model's other prefs.
- gateway:
- Drawers adds the models marked image and drops the ones marked video.
- customVideomakers adds the models marked video and drops the ones
marked image.
- The 400 for a model that can't make videos now says where to mark it.
- GUI: the model chip's right-click menu gets "Makes: Auto/Image
model/Video model…" (an app menu, not a native select). The pick is
staged until Save, and a marked model shows a small image/video tag.
Strings are in zh, zh-TW, ja and de.
- docs/subsystems/gateway-routing.md describes it.
- settings_keep_test sets ModelKinds, so a Settings-page save is checked
to keep it (that guard test went red until it did).
Why per model, in the provider's editor: the kind belongs to one model
of one provider, like the per-model API pref already set there.
Settings → Image/Video only pick the default model. This also covers
their "tag it on the provider" alternative.
Not done: Agnes's own video API (polling at /agnesapi?video_id=, the
finished video in "url") isn't OpenAI's GET /videos/{id}. Marking the
model gets the request to its /videos, but the poll won't match until
there's a mode for it. I've asked the reporter for real responses.
Run:
- go test ./internal/provider ./internal/settings ./internal/gui
./internal/gateway: ok (gateway 1658s).
- TestCustomProviderVideoTheUserMarks, which goes red with the
KindModels loop in video.go removed.
- GUI model-kind.test.cjs, 16/16 (en/zh/ja/de, 900/420, Chromium and
WebKit). It goes red with the menu item removed.
- Sibling GUI tests: model-api-gemini, model-copy-id, model-api-preset,
model-test-one/as/why, provider-detect-models, provider-typed,
i18n-keys, gui-ja and gui-de.
- gofmt, plus linux and windows go vet -tags nogui.
- Not tried against Agnes's real API (no key).
|
||
|
|
1d74826b9e |
gui: a provider's models say whether it serves the vendor's list or only those picked, and the last pick unpicked serves none (#1831, kchen0x)
kchen0x found the model picking hard to follow: with none picked the
provider served every model (dashed), one picked served that one, and
that one unpicked served every model again, while Select none served
none and looked nearly the same as "none picked".
The editor now says which of two things the provider serves, with a
segmented control above the models: "Vendor's list" (up to 24 of it,
dashed, and models it lists later) or "Picked only" (the picks; none
while none are, its balance and usage still shown, saved as noModels).
A click on a model, Select all, Select none, Free only and Working only
are all Picked only, so unpicking the last pick leaves none instead of
flipping back to the vendor's list; only "Vendor's list" goes back to
it. The hint under the list names the mode. Not shown for a decision
API's provider, whose models no agent sees. Strings in zh, zh-TW, ja, de.
Run: provider-none-picked.test.cjs, now also at 420 wide and checking
the control, the last pick unpicked and both segments, passes 30/30 in
Chromium and WebKit in en, zh, zh-TW, ja, de at 1100 and 420; with the
unpick change taken out it fails ("glm-5.3-free after the last pick
unpicked"). i18n-keys passes. The 25 other GUI tests that touch the
model chips pass in both engines (model-first-pick and model-copy-id
failed in the first run, before the hint kept "Click a model to pick
just it", and pass 14/14 and 4/4 after it).
Screenshots looked at for zh 1100 and de 420.
|
||
|
|
4047d00d60 |
agent: Claude Code's /model names a subscription's provider beside its account when the model names are plain (#1136, cjyrainbow)
cjyrainbow could not tell in Claude Code's /model which provider a
subscription model came from: its row said the model and "account ·
via magpie". Since v0.1.1223 the label follows "Names in agents' lists"
as Codex's does, so with names On it is "GPT-5.5 · Codex". With names
Off, or a name the user gave the model, the label has no provider and
the note was still the account alone.
The note now puts the provider before the account in that case
("Codex · me@example.com · via magpie"), as an API key's note already
names its provider. With the provider in the label the note is
unchanged; routing groups are unchanged.
Run: TestClaudePickerSubscriptionSaysItsProvider (a Codex sign-in in a
sandbox home, On and Off) passes; on the old claude.go it fails with
the Off row "GPT-5.5" / "me@example.com · via magpie". The TestClaude*
tests pass. Real Claude Code 2.1.296 in a sandbox CLAUDE_CONFIG_DIR
showed a picker written this way with the label and the note as its
two columns (before the note change; not run again after). go test
./internal/agent ok (1180s, under heavy machine load). gofmt -l
clean; go vet, GOOS=linux and GOOS=windows go vet -tags nogui
./internal/agent ok.
|
||
|
|
9c922b9f77 |
provider: a subscription's place in the order holds on a computer where its plugin has the other id (#1940, Sun1090)
Sun1090 put two plugin subscriptions first on one computer; the other
computer, synced, kept them where they were. The order is synced (the
providers part of WebDAV sync carries providers.json's order) and no
sign-in reorders it. But a built-in subscription served by its plugin is
"workbuddy-plugin" where the built-in isn't moved onto it and
"workbuddy" where it is (PluginID), and whether it is moved lives in
migrations.json, which isn't synced. The order from one computer named
ids the other doesn't have, and ordered() put those providers last.
ordered() now ranks a provider whose own id the order doesn't name by
its counterpart (id <-> id-plugin), only for the built-in subscription
ids (accountIDs), so a custom provider ending in -plugin is only itself.
An id the order names itself still wins.
Run: TestOrderKeepsAPluginsPlaceByEitherID passes; with the lookup taken
out it fails ("not moved here: [zhipu deepseek workbuddy-plugin
workbuddy-ai-plugin]"). go test ./internal/provider ok; gofmt -l clean;
go vet and GOOS=linux / GOOS=windows go vet -tags nogui
./internal/provider ok. Not tried across two real computers; the
reporter's ids are asked on the issue.
|
||
|
|
38bd14dbfd |
library: a well-known kit brought in before v0.1.1223 groups as one source again (#1862, WardLu)
WardLu's Feishu skills (3) and Fish Audio skills (2) still showed as 3 and 2 groups on v0.1.1223, which grouped well-known kits by their base. The lock now says the kit's base, but each skill's From was recorded when it was brought in from ~/.agents/skills (ImportSkills), and back then that was the skill's own sourceUrl, e.g. "docs.fish.audio/.well-known/agent-skills/fish-audio-api/skill.md". repoOf takes From before the lock, so the stale per-skill key won. fromKey reads a From that carries /.well-known/ as the base before it, so those skills group as the lock now says, without rewriting the user's library. Run: TestWellKnownKitFromBeforeGrouped, built from the reporter's five lock entries with From set to the old form, passes; on the old skill_from.go it fails with five per-skill groups. go test ./internal/library ok; gofmt -l clean; go vet (darwin) and GOOS=linux / GOOS=windows go vet -tags nogui ./internal/library ok. Not tried in the reporter's own GUI. |
||
|
|
41972b25fc |
zcode: magpie's provider reaches a ZCode whose data was moved to another folder in its settings (flower on Discord)
What changed: ZCode 3.14 has a 数据存储路径 (data storage path) setting.
Changing it copies ~/.zcode/v2 to <folder>/.zcode/v2, and from the next
start ZCode reads its providers (provider_config.json, config.json),
credentials.json and runtime/provider from there. The choice stays in the
home folder's .zcode/v2/setting.json as dataBaseDir, which ZCode's main
process reads first (readBootstrapDataBaseDirFromDisk, then setDataBaseDir;
getDataBaseDir is that, else ZCODE_DATA_BASE_DIR, else HOME). magpie always
wrote ~/.zcode/v2, so for such a user it said ZCode was connected while
ZCode's 模型设置 showed only BigModel and Start Plan and no magpie.
appdir.ZCodeDataIn reads dataBaseDir the way ZCode does (trimmed, ignored
when empty or relative); the ZCode agent target, the ZCode subscription's
credentials.json and its zcode-builtin.json glob use it. Skills, AGENTS.md
and the CLI's cli/config.json stay under the home folder: ZCode reads
those from HOME/USERPROFILE (getUserZcodeSkillRoot, the MCP config path),
so internal/library is unchanged. ZCode's session database
(internal/sessions) is not changed here: where ZCode's CLI keeps it under a
moved folder was not checked.
Read from ZCode 3.14.3's app.asar (copied to the scratchpad):
out/main/index.js (bootstrap, setDataBaseDir, buildHostProcessEnv passing
ZCODE_DATA_BASE_DIR), out/host/chunk-*.js (getAppConfigDir =
<base>/.zcode/v2) and out/host/index.js (provider_config.json under it).
flower hasn't said they moved the folder; this is the one way found in
ZCode's code for "magpie says connected, ZCode has no magpie" with a
provider_config.json magpie wrote. That file, and the one this build
writes, decode with ZCode's own decodeProviderConfigFile (run from a copy
of glm/zcode.cjs): providers ["magpie"].
What was run:
- TestZCodeMovedDataFolder (new): with dataBaseDir set, Set("magpie")
writes both files under the moved folder and none in ~/.zcode/v2; an
empty, blank or relative dataBaseDir keeps ~/.zcode. On the old
zcode.go it fails: "no magpie in the moved folder's
provider_config.json".
- Sandbox, built binary: HOME=<sandbox>, setting.json dataBaseDir=<sandbox>/D,
`magpie zcode magpie` wrote D/.zcode/v2/{config,provider_config}.json
and nothing under the home folder's .zcode/v2 but setting.json.
- go test -tags nogui ./internal/agent ./internal/appdir ./internal/provider
under a temp HOME; gofmt -l; GOOS=linux and GOOS=windows go vet -tags
nogui on the three packages.
- Not run: the ZCode app itself with a moved folder (not launched against
any config), and Windows.
|
||
|
|
440d26335f |
gui: Gateway says gateway keys come once Share on local network is on, for other computers and tunnels (DD on Discord)
DD (Discord #feedback, v0.1.1222) wanted a Cloudflare Tunnel that needs an API key and found no gateway keys. They are on Gateway, and only once Settings > Network and sharing > Share on local network is on. Nothing on either page said so. - Gateway: while not shared, a line under Connect says what gateway keys are for (other computers, and a tunnel to this one such as Cloudflare Tunnel) and that they come with sharing; its button opens Settings > Network and sharing. Shared, the line gives way to the keys. - Settings: the Share row names tunnels beside other computers. - zh, zh-TW, ja, de for both strings. Checked first, against a sandbox v0.1.1222 with real cloudflared (quick tunnel, --protocol http2): a request through the tunnel carries Cf-Connecting-Ip/X-Forwarded-For, so lanGuard counts it as remote. Not shared it gets 403; shared it needs an enabled gateway key. No gateway change is needed. A plain TCP forward that adds no headers still reads as local; that is #1655. Tests: - new gateway-keys-off.test.cjs: chromium + webkit x en/zh/zh-TW/ja/de x 1100/420. With the line forced hidden by hand it fails. - gateway-model-info, gateway-systemone: wheel the model rows into view (reach), since the line puts them past the window's foot in WebKit. - sse-body: measures the view after wheeling to the option it clicks, not before; the extra wheel moved it 1px and read as the switch's move. Passes on the old assets and the new. - every GUI test that opens Gateway or Network and sharing (34 files): 328/328. Not run: tunnels on Linux or Windows. |
||
|
|
feb21d7d21 |
gui: an update found before its notes reached the site takes them from the next check (#649, Sun1090)
Sun1090's v0.1.1224 update dialog showed no notes. The release has them now
(GitHub and the live /api/latest both return them). The site's worker has no
GITHUB_TOKEN, so when GitHub rate-limits it, it answers from the releases
feed. That feed can lag a new release by minutes, and its answer then has
the version but empty notes. The app downloaded that version, and every
later check found the same version and kept the empty notes.
Now, when a check finds the same version as the one downloaded and that
one has empty notes, the check's notes are taken, on a copy, because the
install may still be reading the one held. Notes that are already there
are never replaced.
Run:
- TestUpdateRecheckTakesNotesLate (new) passes. It went red with the fix
turned off ("empty notes not taken from the recheck") and with the
empty-notes guard removed ("held notes replaced").
- go test -tags nogui ./internal/gui after rebasing on origin/main.
- gofmt -l; go vet on darwin, GOOS=linux -tags nogui and GOOS=windows.
Not verified: what the worker answered at 07:23-07:29 on 10-13. No worker
logs were read.
|
||
|
|
3ccbe6bc15 |
plugins: a runtime for built-in plugins, and Plugins › Built-in to switch them (P0)
Lxxyx on X (https://x.com/Lxxyx_/status/2109506752656150974): magpie has too much in it. This is P0 of making magpie's parts plugins, as DeepSeek Harness does: a runtime, plugins.yml, and the first five built-in plugins the user can switch off. - internal/pluginrt: a registry (Register from init), a manifest (API caret range, Requires/Provides, Essential, InUse, Apply, Parts, Defaults) and Reconcile: the plugins no longer wanted, with whatever needs a service they provided, are disposed newest first; the wanted ones are applied once their services are there. A plugin that fails or panics is failed and the rest run. TestPluginsImportOnlyCore keeps the boundary: nothing outside plugins/ imports one, none imports another. - plugins.yml (appdir.Config()): default → preset (essentials | all) → the user's rows → in use. A new install is written Essentials, a magpie that ran here before (settings.RanBefore) All, so existing users keep everything. Writes are locked, whole and keep a .bak; a file that doesn't parse is an error, never empty, and is never written over. - plugins/groups, library, otel, sessions, warmups. In P0 a plugin off is the window's alone: its page, sections and rows (data-feature) leave the window; the gateway, TUI and CLI serve the same, nothing is deleted. One in use stays on. - The window: Plugins › Built-in, the first tab, a switch per plugin; GET/POST /api/plugins/builtin; boot.js says which are off before the first paint. CLI: magpie plugin builtin [on|off <id>], plugin preset, plugin dump [--json]. - docs/subsystems/plugin-runtime.md, gui-shell.md. Run: go test ./internal/pluginrt/ ./internal/settings/ ./internal/gui/; gofmt -l; go vet ./...; GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet ./.... GUI: builtins.test.cjs in Chromium and WebKit, 5 languages, 1100/800/420; list-sort, mobile-web, routing-keys-fold, routing-sessions pass. By hand under a sandbox HOME: a new install gets essentials, an existing one all, a broken plugins.yml is refused and kept, dump works. Full suite results after the rebase are in the push notes. |
||
|
|
f2b0780fa2 |
gateway: a held rule fails over within the member it chose, and a fallback outside it isn't kept for the turn (#1946, XcodeFish)
A group of coding-fast and coding-quality, its rule sending turns to coding-quality: when coding-quality's member failed mid-turn the request went to coding-fast's members before coding-quality's other one, and the turn then stayed on coding-fast. Within a turn the rule is held, and when affinity kept a member the rule's order wasn't applied at all (gateway.go and nestedRules skipped `hit.Held && aff.Kept`), so the failover order was the kept one, then the parent's own order. ruleOver (rules.go), used at the group's rule and every nested group's: - the kept one stays first while it is of the rule's member that goes first (the one it names, or a Then's while that is resting); the rule's other members follow it, ahead of the group's others; - one kept outside that member, which took over when it failed, isn't held: once a member of the rule's target is out of its rest, the next request of the turn goes back to it (Affinity.Why "rule"). While all of it rests, the fallback stays. No new option. docs/subsystems/gateway-routing.md says so. Run (before the rebase onto origin/main): go test -tags nogui -count=1 ./internal/gateway/: green but for TestKimiHeldBurstTellsNoSpeed at load average ~139 (passes 3 of 3 alone; filed as #1963, not on this path), gofmt -l, GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gateway/. TestHeldRuleFailsOverWithinItsMember fails on the old code (tried [kq1 kf1], the reporter's order), and with the go-back part disabled by hand (round 3 kept on f1). After the rebase: gofmt, both vets, and go test -run 'Rule|Group|Affin|Nested|Stick|Turn|Classif|Decide|Pause' ./internal/gateway/ green. |
||
|
|
2fd2cb60d4 |
usage: ZCode's calls leave the cache out of input, so the Requests page's hit rate reads 96.9%, not 49% (#1947, XcodeFish)
ZCode stores the AI SDK's counts: input includes cache reads and writes. The session summary already took the cache out, but ocCall passed ZCode's calls to the ledger as they were, so the Requests page, which adds the cache to input for its hit rate, counted it twice (the reporter's 275 calls: 49.2% instead of 96.9%). ocCall subtracts cache read and write from input for agent "zcode"; callCacheVersion goes to calls-v12 so cached calls are parsed again. Test: TestZCodeCallInputLeavesOutCache, with the reporter's rows; it checks each call's tokens, the 96.9% rate, and that the session's input equals its calls'. Fails on the old code. Ran: go test -tags nogui ./internal/sessions/ (ok), go vet darwin/linux/windows, gofmt -l. |
||
|
|
32201c6a06 |
gateway: what GLM leaves between a written tool call and its close is no longer sent on as text (#1945, XcodeFish)
GLM writes calls as text, <tool_call>{json}</tool_call>, and often
leaves stray "]", "}", "}}", `">` or longer runs between the JSON and
the close. hermesCall's json.Decoder stopped at the first whole object
and the tail went to the agent as an answer of its own beside the
call. A heredoc whose quotes the model left unescaped also closed the
object early, and the command went to the agent cut short.
hermesCall now looks at what follows the object: junk (blanks and
}]"'>) and then </tool_call> is taken with the call; other text before
a </tool_call> means the object closed early, so the block is no call
and stays text for the model to write again. A call with no close
followed by prose reads as before. textCallJunk also drops such a tail
after a call's own close.
The same fix for moved users is in the trae plugin 0.2.11
(magpie-community/plugins c3bcb5c).
Tests (textcalls_tail_test.go): TestTextWrittenCallTailDropped (the
issue's tails, and one after the close) and
TestTextWrittenCallCutEarlyNotCalled; both fail on the old code. Ran:
the full gateway package, go vet darwin/linux/windows, gofmt -l.
|
||
|
|
c8f103fac0 |
gateway: a conversation too long for the model reaches the agent at once, not retried as a rate limit (#1944, ASD-max)
The ChatGPT backend answers an overflowing Codex request with a 200 stream whose error event and response.failed say context_length_exceeded. streamStatus read that through quotaWords, whose "exceeded" matched, so it counted as a 429: the group's patience asked the same member again 7-8 times and the account was rested, while the agent never got the error that makes it compact. quotaSaid(msg) is quotaWords minus anything tooLong(400, msg) already calls an overflow. streamStatus checks tooLong first (-> 400), and its 429 case and claude_subscription.go's two quotaWords guesses use quotaSaid. A real rate limit, an overload and a spent quota read as before. Tests (overflow_stream_test.go, from the real backend stream, its safety_identifier redacted): - TestStreamOverflowNotRateLimit: the overflow events are 400; rate limit 429, overload 529, usage limit 429 unchanged. - TestCodexOverflowInGroupNotAskedAgain: the agent gets context_length_exceeded, the member is asked once, no rest. Both fail on the old code. Ran: go test -tags nogui ./internal/gateway/ (full package, ok), go vet on darwin/linux/windows, gofmt -l. |
||
|
|
a894559e23 |
library: a project's skills and MCP servers reach Qoder, CodeBuddy, Droid, Cline and Command Code (eirc on Discord)
eirc could give Qoder and other agents skills and MCP servers only
user-wide; Library's project page didn't offer them. Each agent now gets
the project folder or file its own source or docs say it reads:
- Qoder, Qoder CN: skills in .qoder/skills, servers in
.qoder/settings.json's mcpServers (@qoder-ai/qodercli and
@qodercn-ai/qoderclicn 1.1.69: projectConfigDirName ".qoder",
getProjectSkillsDir = <config>/skills; docs.qoder.com/cli/mcp-reference).
- CodeBuddy Code: skills in .codebuddy/skills, servers in .mcp.json, or
mcp.json when the project has only that (2.164.0 reads the first of
[.mcp.json, mcp.json]).
- Droid: servers in .factory/mcp.json, skills in .agents/skills
(docs.factory.com).
- Cline: skills in .agents/skills (CLI 3.0.70 reads .clinerules, .cline
and .agents /skills).
- Command Code: skills in .commandcode/skills (commandcode.ai/docs/skills).
Left out, unconfirmed: Command Code's project MCP (.mcp.json in its own
transport shape, which would clash with Claude's), Copilot CLI's project
MCP, Zed's .zed/settings.json, WorkBuddy. docs/subsystems/library.md gets
a Projects row.
Run: go test -tags nogui ./internal/library (temp HOME, pinned module
cache); the three new tests in project_targets_test.go fail with the map
entries reverted ("magpie knows of no folder qoder reads a project's
skills from"), and the CodeBuddy mcp.json test fails with that fallback
turned off. gofmt -l clean; go vet -tags nogui on darwin, linux and
windows. No GUI asset changed (the page takes both from sync.go). Not
tried with the real Qoder, CodeBuddy or Droid CLIs.
|
||
|
|
15105161e0 |
provider: the Claude account Claude Code is signed in to is told by its sign-in, so its /usage goes through its own proxy (#1938, kensenzhao)
kensenzhao: two Claude accounts, each with its own proxy (accountProxies, #1807). With B signed in, `magpie quota` read B's usage through A's proxy, while a saved account's read went through its own. The cause: magpie named the account Claude Code is signed in to from ~/.claude.json's profile. After a switch, a Claude Code started on the account before writes that account's profile, so the sign-in was B's while the profile still named A. liveLogin and claudeAccount then called A the signed-in account. Logins flagged A as active, /usage ran with ViaLogin(A), which is A's proxy, using B's credentials, and B's reading was shown on A's card. claudeSignInOfAnother already kept this crossing out of the saved records (netfishx), but not out of the live name. Now liveLogin and claudeAccount correct the profile's name by the sign-in (claudeSignInOwner). When the profile's account doesn't hold Claude Code's credential and exactly one other saved account does, that one is the account signed in. claudeSignInOfAnother and the new owner share claudeHolders. Everything that names the live account follows: Active, /usage and its card, settings.json's proxy env, warm-up, model test and the bridge. Audit of the other usage readers: every per-account read goes through loginQuota's ViaLogin(l.User), and the saved Claude read through ViaLogin at the run. Codex names its live account from auth.json's own tokens, so it can't cross this way. Grok's reading and Kiro's API-key reading still use the provider's proxy (noted in |
||
|
|
110b204313 |
sessions: Pi's and omp's own calls reach Usage, here and in WSL (#1951, Elenoxe)
Pi in WSL on a provider of its own never reached the Usage page: the
call ledger had no reader for Pi's or omp's session files, so only what
went through magpie's gateway was counted, and Sessions showed tokens
that Usage didn't.
calls_pi.go reads them whole, as call_cache's wholeCallReaders does for
Kimi, from piFiles, ompFiles and wslFiles("pi","omp"):
- each assistant message is a call on its own provider and model, with
Pi's durationMs or omp's duration/ttft;
- "usage" / "model_usage" entries on the provider they name, and a
compaction's, branch summary's or tool result's usage on the model in
use, as Sessions counts them;
- a call through magpie's own entry (provider "magpie", "dial" before
the rename) is left to the gateway, which logged it already;
- a failed call (no usage) is none;
- a fork's copies of its parent's entries (written before its header's
time) are the parent's, and a call is keyed by entry id + time.
The fixtures are Pi 1.1.0's and omp 18.9.1's own files, written in a
sandbox HOME against a fake OpenAI-compatible relay (a run, a pi --fork
of it, a session whose calls failed before it went on through magpie);
the magpie lines are the owner's own Pi's, the reply text left out.
Run: go test -tags nogui -count=1 -timeout 45m ./internal/sessions
./internal/usage ./internal/cli ./internal/gui (green); gofmt -l; go vet
-tags nogui on darwin, GOOS=linux and GOOS=windows for internal/sessions.
Broken by hand: with the reader unregistered TestPiCalls finds 0 pi
calls and TestWSLSessionsListed says the distro's pi calls aren't
counted; without the magpie skip TestPiCalls/BesideReplies count the
gateway's calls; without the fork rule reading the fork's file alone
gives its parent's calls too.
Not tried: a real WSL distro (wslFiles is covered by the existing fake
distro), Windows paths at runtime, real "usage"/"model_usage"/
branch_summary entries beyond the fixtures. Grouping the Sessions
agent strip by WSL distro stays open in #1951.
|
||
|
|
a75fa9e54a |
gateway, provider: OpenRouter's image-only models draw on its /images API, not chat (#1116, fixes #1105)
OpenRouter answers a chat request for gpt-image-*, seedream, flux, qwen-image, grok-imagine and the like with 404 "Use the /api/v1/images endpoint instead", and viaFor sent every OpenRouter model to chat. Models catalog.ImagesAPI names now go to OpenRouter's POST /images, with reference images as input_references (image_url parts) and its media_type and prompt/completion token usage read back; a 404 there is returned as is rather than retried on chat. Gemini and gpt-5-image stay on chat. The provider Test probe asks the same endpoint. Run: go test -tags nogui ./internal/gateway/ ./internal/provider/ ./internal/catalog/, go vet (darwin, linux nogui, windows), gofmt. With the /images dispatch removed, both new gateway tests go red. The real case (owner's OpenRouter key, sandbox HOME, a throwaway test not committed): openai/gpt-image-1-mini at quality low drew one image, 200, usage 12/272, and with that image as a reference drew again, 200, usage 1035/272. The request shape matches OpenRouter's openapi.json ImageGenerationRequest. |
||
|
|
dbcf791e4e |
providers: the Providers page keeps asking while an account's list is on its way, as a fetch started behind it is counted before it returns (#1147)
* providers: the Providers page keeps asking while an account's list is on its way, as a fetch started behind it is counted before it returns FetchNewBehind and FetchNewSoon started FetchNew in a goroutine, and newRunning, which FetchingNew reads, was counted only once it ran: providersState read FetchingNew straight after, was told no fetch was on its way, and the page stopped asking with the list still to come. fetchNewGo counts a fetch before it returns, but only one with work: a poll with nothing due starts and counts nothing, or each poll found the last one's no-op still under way and the page asked for ever (#1092 at GOMAXPROCS=1). Which accounts are due is known at once unless a CLI is left to ask who is signed in (never answered, being asked or about to be asked by the next look): then the fetch is counted and lists, waits on the CLI (#1789) and fetches behind the page, which doesn't wait on a CLI (#541). FetchNewSoon lists nothing before it returns, so /api/state?last=1 still answers at once (#1519). FetchingNew also says true while fetchingNew is set, for a page whose FetchNewBehind found another still picking the accounts due (tsuixl). FetchNew keeps main's missing: an account that failed, one waiting out newFetchRetry unless another's fetch listed it meanwhile, or a CLI that didn't answer in time. The accounts are listed again when a CLI answered while they were listed. * providers: a CLI that answers while the accounts are listed has its account's list fetched in that pass, and one forgotten then sends the fetch behind the page fetchNewHeld counts the CLIs answered before it lists the accounts and lists them again if one answered by the time awaitIdentities returns, in place of listForNew; TestFetchNewListsAgainForAnAnswerWhileListing fails without it (and on main). fetchNewGo, which lists only with no CLI left to ask, sends the fetch behind the page when one was forgotten meanwhile (a sign-in finishing); TestFetchingNewForgottenWhileListed fails without it. FetchNewSoon no longer counts itself before FetchNew does: fetchingNew covers that. The CLI cases of TestFetchingNewOnceStarted wait on a 5s look and allow 1s (yetone). |
||
|
|
2362bfced3 |
redact: a placeholder the model rewrites ({{ PHONE_x }}, a dropped brace, another case) comes back as the value (shensmart on Discord)
shensmart, with personal data masked, saw {{PHONE_…}} left in the
model's replies. Every reply path already goes through redact.Writer
(serve, Codex's upstream, count_tokens, embeddings, image and video
prompts; plugin-served providers write into the same wrapped writer),
and an exact placeholder came back on all of them, split across
Anthropic, Chat Completions, Responses and Gemini SSE events alike. What
didn't come back is a placeholder the model wrote differently from how it
was given: Jinja-style {{ PHONE_x }}, {{PHONE_x} or {PHONE_x}, the bare
PHONE_x, or the hash in upper case. Restore matched only the exact form.
Restore now finds a placeholder's body (KIND_ and the 8 of the hash), in
any case, at a word boundary, and puts the value back when it names one
magpie made, taking with it the braces and spaces the model put around
it (both braces of a side, or one of each side; a lone { on one side is
the text's own). The 40-bit keyed hash means no other text matches.
For streams, partialTail also holds a tail like "{{ PH", "{{PHONE_x}"
(the second brace still to come) and a last word that starts like a kind
magpie has masked (PH, PHONE_b5pu), and Writer.event now looks for the
tail before restoring, so a placeholder whose closing brace is in the
next event is not put back with that brace left behind in the text.
Not changed: the values stay in memory only. The placeholder key is kept
in redact.key, so after a restart the same value gets the same
placeholder, and the agent's history holds the real value (it was put
back), so the next request brings it again; checked by masking, clearing
the map and key as a restart does, and masking the history again.
Writing the map to disk would keep every masked secret in one file.
Run: go test ./internal/redact ./internal/gateway (sandbox HOME), gofmt,
go vet and GOOS=linux/windows go vet on internal/redact.
TestRestoreRewrittenPlaceholder, TestWriterStreamRewrittenPlaceholder and
TestWriterStreamToolArgsRewritten fail on the old redact.go/writer.go;
with the old writer.go alone the stream test fails with "13987654321 }}"
(a stray brace); with wordTail turned off it fails with a bare
PHONE_zdx44tzn left in the text.
|
||
|
|
b8e23db45a |
backup, davsync: an import or a sync installs the plugins and names the subscriptions to sign in to (yapechan)
yapechan on Discord (Windows, Synology WebDAV): after an import or a WebDAV
sync no providers showed on the other computer; adding the same provider by
hand made the synced settings and usage apply. No error, a restart didn't
help.
Cause. A backup and a sync carry providers.json as stored. For a
subscription that is its model picks and settings alone (no endpoint, no
key), and sign-ins are never carried by design; allProviders lists such an
entry only once an account is signed in here. plugins.json was not carried
at all, so a provider served by a plugin (every moved subscription, any
plugin provider) had nothing to come from on the other side. The import
said "N added" and "Needs a key: , " (the picks entries have no name and no
key), and the sync said nothing. API-key providers do come over: tried with
a nogui build in two sandbox HOMEs (DeepSeek, a custom relay, Kimi Code all
listed after `magpie restore`). No Windows-only path issue found.
What changed:
- provider.Carried(keys): the plugins added from npm or git, on/off and
their options (without keys, options whose names look like a key are left
out, as secret headers are). Folder plugins and plugin-auth.json stay.
- backup.Bundle.Plugins (nil from an older magpie). Restore installs the
ones not here through provider.AddPlugins (plugin.Add, then Off and
Options, then HandOver once); it never removes or changes one already
here. A failed install is reported, not a failed restore.
- Result.SignIn / provider.NotSignedIn: the subscriptions brought with no
account here. NeedKey no longer lists picks-only entries (provider.OnlyPicks).
- davsync: the providers part's hash covers the plugins (unchanged for a
setup without any), take/bring carry them, bring installs (logged on
failure), and Status().SignIn names what to sign in to.
- CLI restore and `magpie webdav`/`s3` status print both; the GUI's import
result and the sync row show them (en, zh, zh-TW, ja, de).
- docs/reference.md says what a backup carries now.
Run:
- go test -tags nogui ./internal/provider ./internal/backup ./internal/davsync
./internal/cli ./internal/gui in a sandbox HOME.
- New tests fail with the change broken by hand: TestPluginsCarried
(installed-skip and the HandOver guard), TestNotSignedIn,
TestRestorePluginsAndSignIn ("Needs a key: [ Acme]" without OnlyPicks),
TestSyncPluginsAndSignIn (bring not installing, Status not naming),
sync-sign-in.test.cjs (the lines removed).
- sync-sign-in.test.cjs: Chromium and WebKit, en/zh/ja/de, 900 and 440px,
16/16; it also caught subNames throwing while providers was still null.
sync-*.test.cjs, s3-sync, i18n-keys, gui-ja, gui-de pass.
- gofmt -l, go vet, GOOS=linux and GOOS=windows go vet -tags nogui on the
touched packages.
Not tried: a real plugin install from a real sync (the installs are stubbed
in tests); a real Synology server.
|
||
|
|
cb003877f3 |
agent: a renamed provider's models follow it in Pi's, OmO's and Prime Agent's enabledModels (#1828, #1919)
The sibling of the StepCode fix before this, and of omp's (
|
||
|
|
b515538ad6 |
gateway: the model list names each model's service tiers for every client, so Cindy offers Fast where it is offered (#1914, tsuixl)
Cindy reads supportsFastMode from a model's service_tiers in /v1/models (a priority entry), and its import link asks /v1/models with no magpie header. The models handler gave service_tiers (codexTiers, the tiers Codex here is offered on each model, #1234) only to a magpie asking with X-Magpie-Drawers, so Cindy never showed Fast on GPT-6-Astra / GPT-6.1-Sol. Every client now gets them; a model with no tier says nothing, and the remote-magpie path is unchanged. The context ring showing "—" in the same report is not touched: per the reporter's own reading it is Cindy's Codex runtime wanting native metadata, which /v1/models already carries as context_window. Run: - TestModelsListTiersForEveryClient (new): a relay's gpt-6.1-sol lists priority, its glm-5 lists none, on a plain GET /v1/models. Red on the old handler ("" for gpt-6.1-sol), green now. - go test -tags nogui ./internal/gateway on every test in the 39 files that GET /v1/models plus every *Tier* and *Fast* test: ok (110s). - gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows. - Not tried in a real Cindy: whether Cindy's Fast then sends service_tier priority through its Codex runtime is left to the reporter on the next release. |
||
|
|
90ac1f0385 |
agent: a renamed provider's models follow it in StepCode's enabledModels (#1919, ggbdpq)
Renaming a provider moved StepCode's defaultModel to the new id and
appended it to enabledModels, but the list kept magpie/<old>/ entries
(the model it was on, others the user listed, a glob), which name nothing
after the rename. StepCode now has a RenameRefs hook, as omp has
(
|
||
|
|
b790594074 |
plugin: Settle waits for the sign-in hook, so TestPluginModelsSayExpired no longer writes into its removed folder (#1935, Nxir; #1543)
The cause: a host's "signIn" event (a models hook saying an account's sign-in expired) ran provider's OnSignIn hook with a bare go f(...). That hook writes the account's lapse into logins.json (lastgood.Keep, then the file, then Changed) under .config/magpie. TestPluginModelsSayExpired returns as soon as the lapse reads back, and Settle, its cleanup, waited for refreshes and the change hooks (Told) but not this one, so the rest of its write could land while TempDir removed the folder: "unlinkat .config/magpie: directory not empty", seen under load on #1543 and on Nxir's CI run. The fix: the sign-in hook runs through the same counted tell() as the change hooks, so Told, and so Settle, waits for it. Settle then waits for refreshes and restarts once more, since a hook told before the providers were read reads them, which can start a host again. Reproduced by injecting a writer into the hook (300 files in .config/magpie, 1ms apart, after notePluginSaid): on the old code TestPluginModelsSayExpired -count=3 failed with the reported "directory not empty"; with the fix it passed 3 of 3. The injection was removed. New TestSettleWaitsForTheSignInHook (synctest, as its sibling for change hooks) goes red with the bare go f(...) put back. Run: go test -tags nogui ./internal/plugin/ ./internal/provider/ -count=1 in a sandbox HOME (both ok), TestSettle* -race -count=3, gofmt -l, GOOS=linux and windows go vet ./internal/plugin/. |
||
|
|
4921e5e2a6 |
sessions: Kimi Code's sessions are listed on the Sessions page and the Usage page's Sessions tab (#1913, infinitr0us)
Kimi Code's calls reached the usage ledger in #1607, but no session reader was ever written for it: allFiles had no Kimi entry, so its sessions were missing from Sessions and from Usage > Sessions (both read sessions.List). kimi.go reads a session folder, sessions/<workdir slug>/<id>/, as Kimi Code itself does (packages/agent-core-v2, checked at MoonshotAI/kimi-code afd95f6): - state.json: the title, custom or Kimi's own (isCustomTitle, titleKind, an old customTitle, as normalizeSessionTitle decides), cwd or 1.4's workDir, createdAt as epoch ms or an RFC 3339 string. Its size and mtime join the main file's, so a rename reads the session again. - each agent's wire.jsonl: usage.record tokens (a magpie/ model counted under its own name: here it is the session's spend), turn.prompt typed by the user (a subagent's system_trigger and a skill_activation aren't), step.end end_turn as replies, tool.call names. - a fork counts only what follows its last {"type":"forked"} marker (copyAgentWire + appendForkedMarker); one without a marker is cut at its createdAt. - resume: kimi --session <id>. The same files feed the calls reader (kimiCallFiles now shares kimiFilesIn). Siblings: Kimi's ~/.kimi-code in a WSL distro is listed (wslAgents) and its calls are counted (callSources); the Usage page's Sessions tab reads the same List. ggbdpq described a reader on the issue; the patch they mentioned didn't come through as an attachment, so this is written from their notes and Kimi's source. Co-authored for the design. Tests (testdata/kimi-code-sessions: the #1607 reporter's whole real files, 6 sessions, totals equal to their README's): TestKimiCodeSessions, TestKimiCodeSessionCounts, TestKimiCodeSessionFork, TestWSLKimiCode. Broken by hand, each goes red: no kimiFiles in allFiles, no marker cut (the clock-set-back fork), no createdAt cut, no WSL entry, any origin as a prompt, no workDir, no resume case. Run: go test -tags nogui ./internal/sessions/ ./internal/gui/ in a sandbox HOME, gofmt -l, GOOS=linux and windows go vet. Not tried with a live Kimi Code install (the fixtures are real files from one). Co-authored-by: ggbdpq <ggbdpq@gmail.com> |
||
|
|
97751188ea |
library: an unreadable skill copy stays in place during sync (#1102)
An unreadable subfolder in an agent's copy of a skill hid edits from the timestamp scan, which ignored read and stat errors. So switching copy/link mode, refreshing the skill, or removing a duplicate copy could replace the copy and lose those edits. Shared-folder deduplication could remove SKILL.md before failing on the unreadable subtree. changedAt and copyIsFresh now return the scan error. The copy is kept in place for that sync (Library.blockedSkills) and reported as a Problem naming the path. This covers agent copies, shared-folder deduplication, project copies and Claude Desktop copies. Other agents still sync, and a later sync tries again once the copy can be read. Merged onto main. #1449 added two callers of changedAt in skill_changed.go: - libraryHash doesn't remember a hash for a folder it couldn't wholly read. - editState says unknown for an agent's copy it couldn't wholly read, so an update from GitHub keeps the library's version aside. TestEditStateUnknownForAnUnreadableCopy covers editState. docs/subsystems/library.md keeps both new rules. Run: - go test -tags nogui ./internal/library/ and ./... (see the PR), go vet for darwin, linux with nogui, and windows, and gofmt. - With changedAt ignoring walk errors again, the four ScanError and EditState tests go red. - With editState ignoring the error, the new test goes red (edited true, known true). - Checked with Unix permissions on macOS only, not as root and not on Windows. |
||
|
|
24146c0314 |
agentenv: REASONIX_STATE_HOME is cleared in every sandbox, as Library reads Reasonix's REASONIX.md from it
|
||
|
|
3cf39f53d8 |
library: Pi and OmO write instructions into the user's own CLAUDE.md, not a new AGENTS.md that hides it
Pi reads one user-wide instructions file from its agent folder: AGENTS.override.md when it is there, else the first there is of AGENTS.md, AGENTS.MD, CLAUDE.md and CLAUDE.MD (loadContextFileFromDir in dist/core/resource-loader.js, @earendil-works/pi-coding-agent 1.2.0; the older @mariozechner/pi-coding-agent has the same order without the override). OmO's engine, @code-yeongyu/senpi 2026.10.12, has the same candidates (resource-loader.js:260) and loads the global one the same way (:314). The library always wrote ~/.pi/agent/AGENTS.md (and ~/.omo/agent/AGENTS.md), so a user who kept their instructions in CLAUDE.md there lost them to the new file from the next run on. Both targets, and their WSL ones, now pick the file with firstThere, as Prime Agent and StepCode already do, and name AGENTS.override.md as the Override the Instructions page shows when it has text. Not changed: omp (@oh-my-pi/pi-coding-agent 18.10.3) reads only its agent folder's AGENTS.md (src/discovery/builtin.ts:930), so it has no gap. dsh (@deepseek-ai/dsh 0.2.0-rc.2) keeps $DSH_HOME/AGENTS.md; its package has no loader of its own to check the order against, so it is unverified. Run: TestPiInstructionsFirstThere (new: no file -> AGENTS.md and the override path; a user's CLAUDE.md -> it is the target, SaveInstructions appends the block after "# Mine" and writes no AGENTS.md; an AGENTS.md there comes first again). Broken by hand three ways, each red: Pi back to a plain AGENTS.md, OmO back to a plain AGENTS.md, Pi's Override dropped. Full go test -tags nogui ./internal/library, gofmt -l, go vet on darwin, GOOS=linux -tags nogui and GOOS=windows, with pipefail, a private GOCACHE and a sandbox HOME. The WSL cases are not run: their target is only built with a distro running, which this Mac has none of. |
||
|
|
d26c5b14df |
gui tests: github-sync wheels to the first row's Edit and the form's Turn on, which WebKit never scrolls to (#1130)
magpie moves the page only for the reader (scrollOnPurpose), so in WebKit the click on a row scrolled out of the window found it "outside of the viewport" and timed out: 8 of 15 WebKit cases failed on the PR as submitted. The test now wheels back up before Edit and down to the bar before the refusal case's Turn on. Run: github-sync in WebKit 15/15 (8 red before), and with the other sync, i18n and language tests in Chromium and WebKit 72/72. |
||
|
|
f82aba090b |
davsync, gui, cli: GitHub sync refuses a repository that isn't private (#1130)
The sealed setup is committed on every sync, so a public repository would hand anyone every version of it, the whole history, to try passphrases on offline. prepare now reads the repository's "private" field and refuses before writing when it is false or missing, naming the repository and what to do. The form's hint, the CLI usage and docs/reference.md say the repository must be private; sync-backup.md lists the rule and its verification command now points at ./internal/cli. Run: go test -tags nogui ./internal/davsync/ and the cli tests (TestGitHubCmd|TestWebdavCmd|TestS3Cmd|Help) green; TestGitHubPublicRepositoryRefused goes red with the check removed. GUI: github-sync, s3-sync, webdav-settings-refresh, sync-other-kind, sync-not-backup, i18n-keys, gui-zh-tw, gui-ja, gui-de in Chromium and WebKit, 72/72. Not tried against the real GitHub API. |
||
|
|
cdfe7629a5 |
davsync: GitHub sync's "not a magpie backup" advice names the file where it is, not under magpie/magpie/ (#1130)
fileWhere passed folder+"/"+file to g.at, which already puts the file under the configured folder and magpie/, so the recovery advice told the user to look at <folder>/magpie/magpie/sync.json, a file that isn't there. It now passes the file alone. Run: go test -tags nogui ./internal/davsync/ (green). TestGitHubNotBackup's new assertion goes red with the old path put back. |
||
|
|
1af326806f |
sync: magpie's setup syncs to an encrypted file in a GitHub repository, beside WebDAV and S3 (#1130)
A third sync kind: github://owner/repo[/folder] keeps the same sealed backup WebDAV and S3 keep, as <folder>/magpie/magpie.magpie-backup in a repository the user already has, written through GitHub's Contents API with a fine-grained token of its own (Contents read and write), kept in sync.json apart from the library's GitHub token. The token goes only to api.github.com: a redirect anywhere else is refused, and the passphrase may not equal it. Each update is a commit; an empty repository is initialised by the first backup. Settings › Sync gets a GitHub kind with Repository, Branch, Folder and token; magpie github mirrors magpie s3. Inactive servers of every kind are kept in Config.Servers (Other stays for older clients). Squashed from yetone/magpie#1130 at 6b5b1c693e1a3a23e177b4d376f3f7f70f3bc23d onto main. Merge resolutions: the CLI moved to internal/cli since the PR was cut, so github_cli_test.go moved there (package cli) and the github command, its help line and `magpie help github` were wired in internal/cli/main.go and help_cli.go; README's Sync row kept main's links and took the PR's wording; i18n.js zh-TW kept both sides. |
||
|
|
d9a050cc19 |
gui: Check for updates no longer calls every plugin up to date when some couldn't be checked, and names GitHub's rate limit on a plugin from GitHub (#1942, bingqilinweimaotai)
The summary read "Every plugin is up to date · 1 couldn't be checked" (所有插件都是最新的 · N 个无法检查), which contradicts itself: a plugin that couldn't be checked isn't known to be current. When any plugin couldn't be checked and none has an update, it now reads "No updates for the plugins checked · N couldn't be checked: …" (zh, zh-TW, ja, de added). A git plugin's reason now uses the check's new `limited` field (when the limit lifts, and whether a token was sent) through the rate-limit strings the Library already translates, instead of the raw error, so it says to add a GitHub token in Settings → Network and sharing, or that the token's own limit is used up. Run: new plugin-check-github-limit.test.cjs (en, zh, ja, de at 980 and 420, with and without a token) in Chromium and WebKit, 18/18; red with the old summary and with the raw error restored by hand. plugin-check-updates, plugin-git, i18n-keys, gui-ja, gui-de in Chromium and WebKit: green. |
||
|
|
334bb182e9 |
plugin: Bun's release check asks GitHub's API with the GitHub token from Settings too (#1942, bingqilinweimaotai)
What changed: an audit of every request magpie makes to GitHub's API after the git-plugin fix. The library's skill checks, private-repo probes and RTK's release check already carried the token; the Plugins page's git-plugin check and topic search got it in the previous commit. The one left was Bun's newest-release check (bunLatest), asked of api.github.com/repos/oven-sh/bun/releases/latest anonymously through getURL. getURLFrom now has a request to GitHub's API's host carry the token (ghtoken.Authorize), and bunLatest asks githubAPI so tests can move it. Bun's zips (github.com, npmmirror) are other hosts and never get it. With a token set, that one request isn't sent to the MAGPIE_MIRRORS fallback (source.Do sends nothing with Authorization to a mirror), the same as the library's API requests. Left as they are: Copilot's api.github.com requests carry the user's Copilot sign-in, not this token; raw.githubusercontent.com and codeload aren't the rate-limited REST API; site/worker.js is the website's. What was run: - TestBunReleaseCheckCarriesGitHubToken (new): bunLatest is asked with "Bearer github-env", a download from another host with none. With the Authorize call removed it fails: "Bun's release was asked of GitHub's API with Authorization """. - go test -tags nogui -run 'Bun' ./internal/plugin: ok. - gofmt -l clean; go vet -tags nogui darwin, GOOS=linux, GOOS=windows on internal/plugin: clean. |
||
|
|
431707944e |
plugin, library: Check for updates asks GitHub with the GitHub token from Settings, and says when GitHub's rate limit is used up (#1942, bingqilinweimaotai)
What changed: a plugin installed from GitHub (github:owner/repo) is
checked by asking GitHub's API for its branch's commit (githubHead,
through fetchJSON). That request went without a token, so a token saved
in Settings → Network and sharing did nothing for it: the check stayed
at GitHub's 60 requests an hour for the whole address, which a shared
proxy exit uses up, and the row said only "<url>: 403 Forbidden".
- The token lookup, where a token may go and how a rate limit is told
move from internal/library into a new internal/ghtoken, shared by the
library and the plugin package (plugin can't import library).
The order is unchanged: Settings, then GITHUB_TOKEN, then GH_TOKEN.
- plugin's fetchJSON has a request to GitHub's API's host (githubAPI)
carry it, which covers the git plugins' check and the Plugins page's
topic search. Raw files, npm and every other host never get it, and
source.Do already sends nothing with Authorization to a mirror.
- An answer from GitHub's API that is a rate limit (429, or 403 with
X-RateLimit-Remaining 0, Retry-After or a rate-limit message) is a
ghtoken.Limited: the check's row has Why "limited" and Limited {until,
token} for the page, as the library's skill check already had. A 401
to a request with a token names which token was refused, never the
token.
What was run:
- TestGitPluginCheckCarriesGitHubToken (new, internal/plugin): asks with
no token / GH_TOKEN / GITHUB_TOKEN / Settings in that order of
precedence, a 403 rate limit with and without a token, a 429 with
Retry-After, a refused GH_TOKEN, and a raw-file host that must get no
Authorization. Broken by hand twice: with fetchJSON's Authorize removed
it fails "GH_TOKEN: GitHub's API was asked with Authorization "", want
"Bearer gh-env"" (and the other two sources); with the limit check
removed it fails with Why "registry", Limited nil, "403 Forbidden".
- go test -tags nogui -count=1 ./internal/library ./internal/plugin
(temp HOME, pinned caches): ok, the library's TestGitHubToken*,
TestGitHubRateLimitSaid among them.
- gofmt -l clean; go vet -tags nogui on darwin, GOOS=linux and
GOOS=windows for internal/plugin, library, ghtoken, gui: clean.
- Not tried against the real api.github.com (tests stay off the network).
|
||
|
|
1133ca0fe2 |
gui: the window opens on the page you last left, as a Mac app comes back as it was
molvqingtai on Discord asked for Routing to be the first page, and lc for
the sidebar to be reordered by drag. Rather than a setting or a reorder,
the window now reopens on the page the reader last left: show() keeps the
page in localStorage magpie.lastView, and keptView() opens it at start.
- A page asked for in the address (?view=: the tray's links, a reload)
still wins, Agents too.
- A kept name that is no page opens the first page; one gateway mode
leaves out (Agents, Library) opens Providers, through show()'s and
setGatewayMode's existing fallback.
- localStorage is how the window already keeps magpie.navLayout and
magpie.panelTab across restarts; checked on a copy of the installed
app's WebKit store (~/Library/WebKit/com.yetone.magpie), which holds
those keys from earlier runs.
- Opening on the kept page scrolls nothing.
docs/reference.md and docs/subsystems/gui-shell.md say so.
Run:
- internal/gui/tests/last-page.test.cjs (new), Chromium and WebKit, at
1100 (sidebar) and 420 (header tabs): left on Routing, opened again with
no ?view= and reloaded -> Routing, nothing scrolled; Settings kept;
?view=usage and ?view=agents win; an unknown kept name -> Agents;
gateway mode with agents/library kept -> Providers, routing kept ->
Routing. Broken by hand, it goes red: with show() not saving, with the
kept page not restored, with the kept page beating ?view=, and with
both gateway fallbacks removed.
- model-rate.test.cjs opened "/" after Providers and took it for Agents;
it now asks for ?view=agents.
- 171 GUI files that navigate more than once or touch the start page
(gateway-mode, sidebar*, nav-*, click-scroll, view-*, getting-started,
side-toggle, panel-*...) plus 151 that open the bare root URL, both
engines, 5-6 files at once: all green but model-rate (fixed above) and
load flakes that pass alone here and on origin/main
|
||
|
|
419ef30219 |
gateway: Claude Code gets a safety refusal as Anthropic's own, and switches to its fallback model; how many more accounts are asked is a setting (#1925, DD on Discord)
DD on Discord: through magpie, Claude's safety filter refusing a turn never makes Claude Code move to its fallback model, as it does on Anthropic's API. magpie asked every other account and group member (#248), then told Claude Code a 400 "<model> refused this request", which it takes as an API error. Claude Code 2.1.296 switches on stop_reason "refusal" in a 200 reply (the stream's message_delta or a whole message, stop_details giving the category), and only with a fallback model set; a 400, Anthropic's "Output blocked by content filtering policy" or magpie's, is never retried. What changed: - When nobody is left after a refusal, an agent on Anthropic's Messages API gets the held refusal itself, the vendor's 200 with stop_reason and stop_details, streamed or whole (holdWriter.handBack): keyed Anthropic providers, groups, the Claude subscription. Codex and Chat clients keep the 400, since an empty-looking whole reply makes Codex ask again. - Settings' refusalRetries counts how many more candidates (accounts, then group members, another model among them) a refusal is asked of. Unset is every one, #248's behaviour (Koohoko asked for it); 0 hands it straight back. GUI: Settings > Models > Replies > "Ask again after a refusal" (Never ask again, 1, 2, 3, All), en/zh/zh-TW/ja/de. Global, no CLI: magpie has no general settings CLI (as noLoopGuard). Other 400s are still never asked again; refusals still rest nobody. - disabled-models.test.cjs wheels to Enable, which the new row put past the window's foot at webkit de 420. - Docs: reference.md "When the safety filter refuses", gateway-routing.md. Run: - go test -tags nogui ./internal/gateway (full, -timeout 40m: a first run hit the 10m default at load ~70 from other sessions), ./internal/gui, ./internal/settings; gofmt -l clean; GOOS=linux and windows go vet. - GUI: refusal-retries-setting (en, zh, zh-TW, ja, de at 1100 and 420) with gui-zh-tw, gui-ja, gui-de, i18n-keys and every tab=models suite (disabled-models, images-*, loop-guard-setting, member-model-setting, search-*, searcher-pick, vision-mcp), chromium and webkit: 176 pass. - refusal-retries-setting under load (8 runs at once, load ~200): first 4 of 8 failed at en/ja 420, a press landing on the first save's "Saved" note over the row, then WebKit's wheel still moving the view as the press was measured. It now reaches each button clear of anything drawn over it (reader.cjs reach) and waits for the scroll to rest: 16 of 16. Broken by hand: - handBack off: TestRefusalRetriesNoneHandsClaudeCodeTheRefusal, ...CountsTheTries, ...Group, ...ClaudeSubscription and TestRefusalWithNobodyLeftIsAnError fail (400 "refused this request"). - count ignored: those plus ...CodexStillTold400 fail (the next key answers). - GUI keep-on-omit dropped: TestSettingsRefusalRetries fails; the GUI test fails with All sent as undefined, and with the row not appended. Not tried: a real Claude account's refusal, or Claude Code's fallback switch end to end; the refusal shapes are from Claude Code's source and Anthropic's docs. |
||
|
|
43d8a5633f |
library: Library → Instructions lists Qoder, Command Code, CodeBuddy Code and Reasonix, each at the file its source reads
The rest of the audit after wongxy's Qwen Code report (
|
||
|
|
3d92b61d89 |
library: Library → Instructions lists Kimi Code, fx, Prime Agent, StepCode and jcode, each at the file its source reads
wongxy's report that Qwen Code was missing (
|
||
|
|
2810a7154d |
provider: a moved Cursor gets plugin 0.2.11, whose collected usage of earlier steps no longer inflates the step's prompt (#1053, plugins #101)
The Cursor plugin collects a tool step's late usage event with the
conversation's next step. Before 0.2.11 it added it to that step's
prompt_tokens, so pi read its context as 366,940 tokens on a 300k window
with 185,670 in use, and compacted early (geoqiao, #1053). 0.2.11 sends
the collected part as usage.magpie_deferred, which the gateway bills
with the step but never tells as its prompt (
|
||
|
|
04ff9a775c |
library: the sync at start lets go after each agent's part, for the page's reads and changes to go first (#1624, Hipple)
magpie writes the library into the agents again at every start
(app.go's library.Sync). That ran as change(): one hold of the library's
lock through every agent's instructions, servers, hooks and skills. Every
read of the Library page (Read, Glance, ReadInstructions) and every change
waits on the same lock, so the first one or two operations after opening
magpie waited for the whole sync, and later ones didn't: Hipple's "the
slow ones are the first one or two after opening, then under 1s" on
0.1.1223, 11 agents and 88 skills on Windows.
Sync now runs the same steps change's sync does (syncSteps, shared by
both, so the order stays one), each under the lock on a fresh load and
saved after it. A read or change that comes meanwhile waits for one
agent's part, not the rest. What a step learnt of the skills (hashes,
copies found untouched) goes on to the next only while nothing else took
the lock between; the lock counts its holders for that. A change by the
page still syncs as before, in one hold.
Measured: with the library's sync made slow (looks slowed), a Read
started during it came in with 0 of 6 agents' skills given back; on the
old Sync it came in after all 6, every time.
Run:
- TestReadDuringSyncWaitsForOnePart: -race -count=5 green; with Sync put
back to change(nil) it fails 2 of 2 ("the read went after the whole
sync").
- go test ./internal/library/ green; ./internal/cli/ green after
rebasing onto
|
||
|
|
4794de398e |
library: a skill installs from a repository too big to download whole, by fetching only its skills' folders (#1941, Goalonez)
What changed: fetch still downloads a repository as one codeload
tarball first. When its files pass the 200 MB limit (untar's errTooBig),
it now falls back to fetchSkillFiles: one request to GitHub's API for
the repository's file list (git/trees?recursive=1), then every file in
a folder with a SKILL.md, from raw.githubusercontent.com, each checked
against the git hash the list gives. The repository's folders are made
empty, so candidates, origin, a probe of a subfolder and an update check
read the result as they read a whole download. The 200 MB limit now
applies to what is actually fetched: skills that are themselves over it
still say so. A private repository's files come from the API's
git/blobs with the Settings token (it never goes to raw). A repository
found too big is remembered for the run, so the install after its probe,
and update checks, don't download 150 MB again before falling back.
gitTree's entries gained mode, sha and size (named gitEntry).
Why: vectorize-io/hindsight keeps its skills (a few hundred KB) beside
an app; its tarball is 188 MB gzipped, 253 MB unpacked, so any skill
in it failed with "the repository is too big to install skills from".
What was run:
- Real repo, sandbox HOME, no token: on the old code ProbeSkills
("https://github.com/vectorize-io/hindsight") fails with "too big"
after 34s. With the fix it lists all 15 skills (skills/*, the
integrations' skills; .claude/skills hidden as before) in 32s, and
installing skills/hindsight-docs writes its 160 files, the same count
GitHub's tree lists.
- New TestSkillsFromATooBigRepository and
TestTooBigRepositoryChecksWhatArrives (httptest stand-ins for codeload,
the API and raw, laid out as hindsight is, paths and tree entries
from its real listing). With the fallback taken out both fail with
"the repository is too big to install skills from (over 200 MB)".
They check raw is never asked for a file outside a skill, codeload
is asked once across two probes, a file that doesn't match its hash
is refused, and skills over the limit themselves still error.
- go test -tags nogui ./internal/library (ok, 141s); -race -count=10
-run TooBig (ok); gofmt -l clean; go vet, GOOS=linux and
GOOS=windows go vet -tags nogui ./internal/library clean.
Not tried: a private repository over the limit against real GitHub
(covered only by reading: raw 404 -> git/blobs with the token).
|
||
|
|
3a9d73c5c6 |
gateway: a plugin's deferred usage is billed with its step, never told as the prompt
The Cursor plugin collects a tool step's late usage event with the conversation's next step. It used to add it to that step's prompt_tokens, which agents read as how full their context is: pi saw 366940 tokens (181270 + 185670) on a 300k window where 185670 were in use, and compacted. The plugin now reports it apart, as usage.magpie_deferred (yetone/magpie#1053). The gateway parses the field into Usage.Deferred and adds it only where it bills: the usage records (6 sites in serve), the OTel attempt span and route pricing, as a tier before the request's own, so promptCounted still reads the request's own prompt. What a client is told (Usage.chat, the Anthropic encoding) stays the request's own. A reply without the field is handled as before. docs/subsystems/provider-plugins.md describes the field. Verified: go test -tags nogui ./... (50 packages ok, sandbox HOME, caches pinned); gofmt; go vet on darwin, linux (nogui) and windows; go build on the same three. The new tests were broken by hand and each went red: billed() ignoring Deferred, cUsage dropping the field, routeUsage without the tier, Usage.add forgetting it, the decoder ignoring a usage with only a deferred part, the usage records and the OTel span not using billed(). Not tried: a real Cursor account on this checkout; the plugin side was run against real Cursor (composer-2.5, forced late events), where the deferred totals matched the dashboard's events token for token. Picked from geoqiao/magpie cursor-deferred-usage (595d6384c), as PRs here are collaborators-only. Rebased over the service-tier logging (#1784), keeping its TierAsked/TierSent/TierServed beside billed() at the three usage.Record sites, and Usage's Tier beside Deferred. Run on this tree: go test -tags nogui -timeout 40m ./internal/gateway and ./internal/provider (sandbox HOME); gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows. billed() forced to ignore Deferred: 3 tests and 5 subtests of deferred_usage_test.go go red. |