ac4af582301a4e8a29245dbba767eba31334ddf9
7089
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
1576ccdbbc |
davsync: the sync setup is read once a request, not on every Providers poll
/api/providers asks archiveState, which asks davsync.S3Bucket and so
Load, on every poll, and Load opened sync.json each time, most often a
file that isn't there. In a profile of 200 lists against a copy of the
owner's real config it was 0.19s of 4.07s.
Load now reads the file's bytes through filememo (once until it
changes, remembered missing while a request holds it) and unmarshals a
Config of its own for each caller. Configure and Restore write through
edit.WriteAtomic, which forgets already; Off removes the file and now
calls filememo.Forget too, so sync turned off in a request is off for
the next Load in it.
Run (on mote unless named):
- go test -count=1 ./internal/davsync ok (36.9s); ./internal/gui red on
TestMainWindowCorners only (macOS 27 on mote, #3949); GOOS=linux and
windows go vet ./internal/davsync ok; gofmt clean (here).
- New TestLoadReadOnceARequest, -count=3 ok: 20 loads in one held
request read once, a caller's change stays its own, and Off is seen
at once. Broken by hand: Load reading the file each time -> "read 20
times, want 1"; no Forget in Off -> "still on after Off".
- Here, 200 GET /api/providers on the sandbox with the real config
copy (offline, proxy :9): davsync.Load 0.19s -> gone from the
profile; total CPU within this machine's noise (4.53s -> 4.62s).
- Then rebased onto
|
||
|
|
8d8df06399 |
plugin, gateway: a plugin reports its models' load, and busy models can go last (axelburks on Discord)
axelburks (Discord #feedback): an in-house vendor queues requests to
its busy models, and the plugin could only put the load in the model's
name, which changed only when magpie re-read the list.
- A provider plugin calls input.magpie.load(provider, {"<model id>":
0-100 | null}) whenever it likes, from its own timer. host.js
(reportLoad) clamps each number to 0-100, null clears a model, every
other value is dropped, at most 1000 a call, and it returns the count
taken. A provider that isn't a string or loads that isn't an object
throws a TypeError. It goes to Go as an unasked {event:"load"}.
- internal/plugin/load.go keeps each by provider and lowercased model
id. ModelLoad answers unknown once a load is older than LoadFresh
(5 minutes), never idle. model@size falls back to its model.
- The provider editor shows it by the model as a grey ctx badge
("87%", titled "87% busy now, as its plugin says").
- Settings > Network and sharing > Busy models last (settings.BusyLoad,
POST /api/settings/busy-load, Off by default, over 50/70/80/90% or
1-99 by hand): restLast puts a model reported over it behind the
ready candidates, ahead of the resting. The trace row has busy:<load>.
At a new turn affine moves a conversation off it (Why "busy",
busyBehind); within a turn it stays. after, readyForNew and leastHeld
skip it. Unknown load, a lone candidate, or all busy: nothing moves.
- Docs: site plugins page (en, zh, ja) "Model load" section and input
table; docs/subsystems provider-plugins.md and gateway-routing.md.
Run, all on mote via mote-run at a42736807's tree rebased on
origin/main
|
||
|
|
b683f1c0e1 |
gateway: a search on Volcengine Ark asks for no include value Ark refuses
axelburks on Discord #feedback (1566310723922042991): every web search on an Ark model (ark.cn-beijing.volces.com) failed with 400 "The parameter `include` specified in the request are not valid: unknown type: web_search_call.action.sources". buildResponses adds that value to every Responses request offering web_search on any host but api.x.ai (#315, |
||
|
|
6874b892bb |
providers: a StepFun sign-in is read once a request, not once a row
/api/providers asks StepFunSignedIn for each StepFun provider on every poll, and each ask opened stepfun-auth.json under stepfunMu, most often a file that isn't there. In a profile of 200 lists against a copy of the owner's real config (2 StepFun providers) it was 0.28s of 4.07s. StepFunSignedIn now reads the file through filememo, which parses it once until it changes and remembers it missing while a request holds it. A file with a site's session from before #2384 ("ai", "com") still goes through loadStepFun under the lock, which moves it. saveStepFun calls filememo.Forget, so a sign-in saved during a request is seen by the next ask in it. Run (on mote unless named): - go test -count=1 -timeout 45m ./internal/provider ok (115s); -run TestStepFun -count=3 ok; GOOS=linux and windows go vet ./internal/provider ok; gofmt clean (here). - New TestStepFunSignedInReadOnce: 40 asks in one held request parse once, and a save inside it is seen. Broken by hand: each ask reading the file -> "parsed 0 times, want 1"; no Forget in saveStepFun -> "a sign-in saved in the request wasn't seen". - Here, 200 GET /api/providers on the sandbox with the real config copy (offline, proxy :9): StepFunSignedIn 0.28s -> gone from the profile, syscalls 1.54s -> 1.08s; total CPU 4.49s -> 4.53s, within this machine's noise. Not run: the full ./... suite; GUI tests (no page change); a real StepFun sign-in (the save path is unchanged apart from Forget). |
||
|
|
3ee6c2d948 |
providers: a provider list looks at the stamps, plugin logins, client shapes and accounts once a request
/api/providers took ~25ms of CPU a call with the owner's real config (25 providers, plugins signed in), polled by every open window. Its profile had file system calls at about half, each repeated for every provider the list shows: - StampNow stat'ed providers.json, settings.json and the catalog for every provider (KeptListing); under a request's Hold it is looked at once. - plugin.ListedAt was asked for every plugin provider's Listed(); once a request (heldOf "plugin-listed"). - pluginLogins took logins.json's lock, a file opened across magpies, for every plugin even with nothing to change. It now settles the list as read first, and takes the lock and settles again from a fresh read only when something changes. - clientShape read and parsed client-shapes.json for every relay a list shows (TestsAs); parsed once until the file changes (filememo), a copy given out. - Logins(agent) took the same lock for every provider, twice with its account models; listed once an agent a request, a copy each, listed anew after a write (writePrivate's filememo.Forget). Run (on mote unless named): - go test ./internal/provider ./internal/gui -timeout 45m: provider ok (102s) with the new tests; gui red on TestMainWindowCorners (macOS 27, #3949) and on TestSettingsSaveKeepsWhatItDoesNotSend, red on main since |
||
|
|
9fdef3ea22 |
gui: keep SearchAll through a save of the Settings page (#4514)
TestSettingsSaveKeepsWhatItDoesNotSend is red since SearchAll came in
with
|
||
|
|
3defaf6622 |
dsh: a new desktop profile gets magpie's routes when the start is the user's (zyh6036 on X)
DeepSeek Harness Desktop 0.2.1-rc.5's picker listed only "DeepSeek 账号". The app reads $DSH_HOME/profiles/desktop (apps/desktop/src/paths.ts) and makes it from an empty template on its first start. dshFillNewProfiles gave such a profile magpie's routes only when a wired profile started on one of magpie's models; with the web profile wired but started on one of dsh's own, it returned early and the desktop profile stayed bare. Now a bare profile gets the routes alone in that case (no start written, the user's pick stays theirs), and nothing is filled when no profile is wired. Run: - go test ./internal/agent -run TestDshFillNewProfiles on mote at |
||
|
|
e84870f173 |
plugins: an option's words in the window's language, and a filtered model list says so (plugins#590)
anewuser6937 (Discord, plugins#590) saw one model in WorkBuddy's editor
and took the plugin for broken. They had turned on "Free models only"
themselves, but its label and description read in English in the Chinese
window, and nothing by the models said the list was filtered.
A plugin option (auth.options, magpie's own field; OpenCode's AuthHook is
provider/loader/methods and never reads it) may now give `labels`,
`descriptions` and `confirms`, each keyed by the window's language
("zh", "zh-TW", "ja", "de"), beside the plain strings, as a page's
`titles` do. The host keeps only non-empty strings under language names
of 16 or less, 16 languages at most, each capped as the plain one is
(60/300/300). The editor shows the exact language, then its first part
(zh-TW reads zh), else the plain words, in the row, the hint, and the
confirm dialog and its title. `filtersModels: true` says the plugin's
model list leaves models out while the switch is on; while one is on, as
saved, the Models field says under the chips "Only some models are
listed: the plugin option “…” is on." (zh 只列出部分模型:插件选项「…」已开启。,
zh-TW, ja, de too). An older plugin shows what it showed before, and an
older magpie shows a new plugin's plain words with no note.
WorkBuddy 0.2.10 gives "Free models only" in all four languages with
filtersModels (magpie-community/plugins aec58ae, on npm: `npm view
@magpie-community/opencode-workbuddy-auth@0.2.10 --prefer-online` on mote
says 0.2.10, latest), and the mover's min is raised to it so every moved
user gets it. The CLI's `magpie plugin options` stays English, as the CLI is.
The core scripts would have gone 608 bytes over their budget; three of the
provider editor's comments in app.js are cut down instead, no raise
(1,532,865 of 1,533,105).
Run, on mote (mote-run), at this tree:
- node --test plugin-option-words.test.cjs (new): Chromium and WebKit,
1100 and 420 wide, en/zh/zh-TW/ja/de, switch on and off: each
language's label and description, zh-TW falling back to zh and ja/de to
the plain words for a zh-only option, the note exactly once under the
chips in a .hint inside the editor with no sideways scroll, none while
off, the confirm in the language. With app.js put back: 19 of 21 red
in Chromium (only "en off" passes, both widths).
- With plugin-options.test.cjs and i18n-keys.test.cjs, both engines:
68 pass, 0 fail.
- go test ./internal/plugin ./internal/provider ./internal/cli: ok.
TestPluginOptions with host.js put back: red (empty maps, FiltersModels
false). The real WorkBuddy 0.2.10 index.mjs loaded into this host
(a temporary test, not kept): plugin.Providers lists free_only for
workbuddy and workbuddy-ai with all four languages and filtersModels true.
- go test ./internal/gui: TestCoreScriptBudget ok after the cut. Red,
and red the same at origin/main
|
||
|
|
ed5872d186 |
gateway: a kept previous response holds its input, not the body it came in
previousResponse kept each turn's input items as views into the request body, so every response kept for previous_response_id held its whole body: tools, instructions and anything else the client sent. own counted only the items, so prevCap's 256 MB bounded far less than was held. The input is now copied out (ownItems, as the Codex socket does since |
||
|
|
ef8bd98fba |
gui: a scroll down to a view's end with a wheel the page never hears stands
On macOS 13's WebKit the page never hears the wheel, so a scroll at rest waits for a second one the same way before it counts as the reader's, and is put back after 120ms if none comes. A view with less room than one wheel step reaches its end on the first step, and no second scroll can follow, so the reader's step was put back. A scroll down that stops at the end, with the content still the same height, is now the reader's. Code's put-backs this guards against come from a redraw: up, or with the height changed. Found by view-open-wheel at 420px in zh and zh-TW, Chromium: the phone head left Usage's skeleton 23px of room, less than the test's 30px step, and it was red 3 of 3 on this branch. Broken by hand: without this change the case is red 3 of 3 alone (MAGPIE_OPEN_WHEEL_HEARD=unheard, Chromium); with it, green in the run below, and main at |
||
|
|
febef9741f |
gui: a thumb is put under its option on the window's resize, before the ResizeObserver
A phone draws its options at 13px with 11px padding (the first commit of this branch), and desktop at 12px and 10px. When the window crossed the phone width, a thumb kept its old size until thumbFit ran. In Routing at 560 to 1100 in WebKit, the group-names strip's thumb ran 4px past the view, and the view got a sideways scrollbar 10px tall. thumbFit then moved the thumb back, which changed the view's height inside its own callback, and WebKit reported a ResizeObserver loop (routing-held-dot, routing-rule-columns). Found by tagging each ResizeObserver with its creation stack. Then, on the first frame after the resize, I hid the view's descendants one at a time to see which one widened it. Broken by hand: without this change routing-held-dot is red 5 of 5 in WebKit at 560px, and with the phone's option size back at 44px it passes. Run: routing-held-dot, routing-rule-columns and the 14 GUI files that mention the thumb, on mote, both engines: 189 of 189 pass. Budget: the code and its comment were made shorter so the core scripts stay under TestCoreScriptBudget's 1,533,105, which isn't raised. After the rebase, in the 116-file run below: routing-held-dot, routing-rule-columns and segs-glide pass in both engines. |
||
|
|
32bedd44f7 |
gui tests: usage-range picks its days from the phone's menu, where the strip is hidden
At 390px the head hides #period behind #usageRangeMenu (the phone head commit before this). The test opens the menu and picks the range opt (its last item) or a preset (its first), and checks the menu names the days picked. Run: usage-range on mote, both engines, en and zh: 4 of 4 pass. |
||
|
|
4c46141dfe |
gui: a phone's choice of options in Settings shares its row's middle, as in Usage's filters
The 32px strip (the first commit of this branch) sat at the top of a .prefs .val row of 44px fields, 6px above their middle (redact-rule-edit, redact-rule-row). The sess-tools rule now covers .prefs .val too. Run: redact-rule-edit and redact-rule-row on mote, both engines, every language: pass. |
||
|
|
b791973354 |
gui tests: credit-days reads Today from the phone's days menu, where the strip is hidden
The phone head commit (usage: a phone's head is the tabs over one line of days, sum and refresh) put a phone's days behind a menu over a hidden #period, so the 360px test's click on Today waited 5s on a hidden button in every engine and language (10 of 10 red in the whole suite). It now checks that the menu says Today there; a wide window still clicks the strip. On mote: 10 of 10 green. |
||
|
|
6c29beba1e |
gui: on a phone a picker is drawn as tall as the choice beside it, and search shares a line with Export CSV
Requests' "All models" picker was 44px beside a 26px status strip, aligned at the top, and Export CSV sat alone on its own line. A .sess-pick on a phone is now drawn 32px and taken at 44 by its own ::after, like .segs; the strip in the sess-tools row is 32px (28px options) and centred, and the search field and Export CSV share the last line. Run (mote, at this branch's head after the rebase onto |
||
|
|
457cfd7c63 |
usage: a phone's head is the tabs over one line of days, sum and refresh
The owner's pick of three phone designs (B): Usage's tabs run across the
head, and under them one line holds the days as a menu ("7 days ⌄", the
app's own menu, never a <select>), the sum, and the refresh as a dot and
its figure ("● 5s", green while live). The days strips (#period,
#sessRange, #ctxRange) are hidden behind the menu. It follows whichever
the open tab shows, and a pick clicks that strip's option, so each choice
keeps its one handler; Custom opens the range menu from the head. Each
control is drawn about 30px and tapped at 44. A desktop window keeps its
strips. The refresh keeps its own menu and
its reload icon, unlike the mock-up, which had neither.
usage-phone-head.test.cjs checks the layout, the menu and the taps in
every language and both engines at 390 and 320px, and a desktop
window at 1100px.
Run (mote, at this branch's head after the rebase onto
|
||
|
|
f00a849019 |
gui: a phone draws a choice of options 32px tall and takes it at 44
On a phone (body.web at 760px or less, or a coarse pointer to 1024px) a .segs strip was 44px of fat buttons. Its options are now drawn 28px tall in a 32px strip, 13px text with 11px padding, and each takes a tap 44px tall through a transparent ::after, so what is drawn is small and what a finger hits is not. Run (mote, at this branch's head after the rebase onto |
||
|
|
8f5f2a2941 |
provider: Qoder's mover min is 0.2.52, which renews a job token whose model list is only the free models
star21321321124_93024 (Discord #general, 2026-11-01): a Qoder CN account
with all its credits left listed one model, the free Flash ("Qoder CN: 1
model"), and its agents saw only that one. Qoder CN's model list answers
a caller it doesn't take for the account with every paid model
enable:false and the free one on (captured from gateway.qoder.com.cn,
kept in the plugin's testdata). Up to 0.2.51 the plugin renewed the job
token for such a miss on a chat (plugins#484) but read the list magpie
shows as it came. 0.2.52 renews once from the list too, and doesn't
renew again for a renewed token that still lists only the free models.
keepMovedCurrent brings every moved user up to it.
TestQoderMoverHasTheFreeViewRenewal checks both the qoder and qoder-cn
movers; it fails at 0.2.51 (run).
npm: `npm view @magpie-community/opencode-qoder-auth version
--prefer-online` = 0.2.52 at this commit (registry.npmjs.org, from mote;
this machine's npmmirror still said 0.2.51).
Run at this tree (origin/main
|
||
|
|
b1fc435407 |
library: Magpie Web Search, magpie's search MCP server in Library › MCP (lutra_fs)
lutra_fs on Discord: magpie's search MCP shows in Settings › Models but not in Library › MCP servers. They were right. The gateway's web search MCP (/mcp/magpie/web-search) was only an address to copy in Settings › Models › Web search. It was never a Library server, so no agent could be given it from the Library, and the Library didn't list it. Change: - `magpie mcp search`: a stdio relay to the gateway's search MCP, made by widening browsermcp's Magpie Browser relay into a bridge with its own path, title and an optional session (search sends none, and has a 5 minute client). It takes no arguments. When magpie isn't running, it says "Magpie Web Search can't be reached: start magpie". - library: Magpie Web Search (magpie-web-search) is a featured, opt-in server beside Magpie Image and Magpie Browser. It is installed with no agents, so the user picks them in its sheet, and it switches per agent like any other row. Its command is the full binary path, and serverKey treats any binary's `mcp search` as the same server. Each agent's tool timeout is at least 120s. - Settings › Models › Web search › MCP server: under the address there is a "Give agents Magpie Web Search…" link that opens its Library sheet, or "Turn on the Library" while the Library is off, as Images does for Magpie Image. Gateway mode has no link. - The sheet's hint says where each search goes and what it costs. All strings are in en, zh, zh-TW, ja and de. - docs/subsystems/library.md names magpie's own servers and the new one. - An agent in WSL gets it through the MCP router, as Magpie Browser does. The image-only WSL side() is unchanged. - The sibling, Image recognition's MCP server, is still in Settings only. That is filed as #4653. Run, at this head (rebased on origin/main |
||
|
|
a6217e83d3 |
plugins: a plugin npm said nothing of offers Install, not Coming soon (zhudabao8433 on Discord)
zhudabao8433 on Discord (#general, 11-01): PowerContext (@magpie-community/gateway-powercontext) could be installed yesterday and today reads 即将上线 again. Cause: PowerContext was never pulled. It is in registry.json since plugins 1e4c8a2 (10-29) and on the dist branch (0.2.0, every dist commit since), and not on npm (E404), so magpie learns its version from the dist branch's ~1.7MB index.json. Coming soon is drawn whenever a listing has an npm answer with no version, and three paths gave one without anything confirming the package is missing: - builds before v0.1.2413 kept a dist read cut off at npmEach (6s) as "not on npm" in plugin-npm.json (ferock, |
||
|
|
ec0a11d47f |
gateway: a Codex socket's held reply keeps its input, not the frame it came in
A held turn's fresh input items were views into the response.create frame they were decoded from, so each held reply kept that whole frame alive: Codex's tools and instructions with it, for as long as the socket held the reply (~39 MB of a long session's live heap). keep now copies the fresh items into one buffer of their own; the conversation held before is already owned, and the reply's items were already copied. Run on mote: go vet ./internal/gateway; go test -run 'TestHeldTurnOwnsItsInput|TestResponsesSocket|TestCodexSocket' ./internal/gateway ok. Broken by hand (keep appends fresh as views): TestHeldTurnOwnsItsInput fails, held items read back as the overwritten frame. Not run: the full gateway package before the push, and a real Codex session over the socket. |
||
|
|
36af588e2c |
gateway: "Context window is full" is a conversation too long for the model
ergou0954_54426 on Discord (#feedback, 11-01) routes by intent across several models, one a "kiro opus" of an API-key relay (not magpie's Kiro plugin). On long conversations the relay answered 400 "Context window is full. Reduce conversation history, system prompt, or tools. (request id: …)". That is the wording kiro.rs (src/anthropic/handlers.rs) and kiro2claude (error-mapper.ts) give Kiro's CONTENT_LENGTH_EXCEEDS_THRESHOLD, always as a 400 invalid_request_error, with new-api's request id after it. tooLongRe had no words for it, so the 400 was an ordinary request error: the group never asked the next member, and the agent got the relay's 400 as a plain error, with no context_length_exceeded to compact on. In a stream's error event it stood for a 502 (streamStatus), a passing vendor fault that rests the account and is asked again. tooLongRe now takes "context (window )?(is )?full", so overflowed, failure, retryable, streamStatus, lateRests and writeErrorSaid all read it the same way: on 400, 413 or 422, or in a stream's error event, the member is passed for one with room (failOverflow, no rest), and alone the agent is told context_length_exceeded. Not changed: a 5xx carrying the words is still the vendor's fault (tooLong is 4xx only, as TestContextOverflowSaidTheClientsWay holds for a 502), and tooLongUnsaid still covers a 5xx only where the window is known. Routing could not have skipped the member up front: a custom relay's model has a window only from its own /v1/models list, models.dev by id (catalog.ContextOf, with its spellings), or the user's Context setting. A relay id such as "kiro-opus" matches none, so the window is unknown (0), roomy keeps it and withRoom counts it as having room. A probe in a fresh HOME gave windowOf 0 for claude-opus-4-6, kiro-claude-opus-4.6 and kiro-opus on a custom provider. TestContextWindowFullIsAnOverflow and TestContextWindowFullGoesToAMemberWithRoom are built from the literal text, with and without the request id, Anthropic- and OpenAI-shaped, plus kiro.rs's sibling "Input is too long. Reduce the size of your messages."; ordinary 400s (invalid model, model not found, messages required) stay non-overflows. Found and filed, not fixed: the last candidate's stream error event that says too long reaches the agent as the vendor wrote it (#4675). Run on mote, on this change at base |
||
|
|
445891cf74 |
gui: Insights › Masking keeps to the window's page width, centred, like every other page
refeccd on Discord (#feedback, 11-01): with the window maximised every
page sits in the middle at a fixed width, but Masking (脱敏) runs edge to
edge. The width cap is one rule in app.css that lists the pages by id
(body.window :is(#view-agents, …) { padding: max(16px, 50% - 600px) }).
Masking became a page of the redact plugin (#view-masking, kernel.js)
after that list was written and never joined it. Now it does. The cap
itself is unchanged.
Siblings: every page the sidebar opens (agents, sessions, library,
providers, routing, gateway, usage, masking, plugins) and Settings was
checked against the list; Masking was the only one missing. A community
plugin's page (.view.plugin-page) is a frame the plugin draws and is
left as it is.
The test: page-width.test.cjs no longer keeps its own list of pages. It
reads every page from the sidebar (#nav button[data-view], not a
community plugin's), plus Settings, and requires Masking among them, so
a page added later is held to the same width without the test knowing
it. It now also runs every language at 420px besides en/zh-TW/de at
1920, zh/ja at 2560 and en at 900.
Run (mote, macOS 27, Playwright 1.62.0, Chromium and WebKit):
- page-width.test.cjs on origin/main 6f3dfc282's CSS: red, "masking:
1676 wide at 1920" and "masking: 2316 wide at 2560" in every language,
both engines (12 pass, 12 fail). With the fix: 24 of 24 pass.
- Together, with the fix: page-width, page-width-steady, i18n-keys,
click-scroll and every mask*/masking*/redact*/window-mask/
routing-masking/provider-mask/provider-unmasked/account-mask/
plugin-name-unmasked file: 602 tests, 591 pass, 11 fail. The 11 are
page-width-steady's "opening an agent's details past the window moves
nothing sideways", which fail the same 11 with the file run alone on a
clean origin/main
|
||
|
|
0cabaaf243 |
agent: a portable VS Code on a Mac is wired in its code-portable-data folder (#4151)
faketrader runs VS Code portable on a Mac: /usr/local/bin/code links into /Applications/Code/Visual Studio Code.app, and the build reads /Applications/Code/code-portable-data/user-data/User. magpie detected it but wrote ~/Library/Application Support/Code/User, which that build never reads. Their patch on #4151 is the base; this takes its rule and makes it VS Code's own (configurePortable in src/bootstrap-node.ts), on every OS: - A build is portable when its product.json has no `target` (an installer's build has one) and its data folder exists: on a Mac product.json's `portable`, else `<applicationName>-portable-data`, beside the .app; on Windows and Linux `data` beside the install, also for a build that updates into `<install>/<version>/resources/app`. - The build is the one the launcher on PATH is, through a Scoop shim and every symlink. A launcher whose product.json names another editor (a fork's `code`) isn't the build's. With no launcher of its own, a Mac reads the app folders and Spotlight and takes a portable bundle only when every bundle found is that one; beside an installed bundle, which one runs is unknown and nothing moves. - VS Code, Insiders and VSCodium each go by their own bundle and launcher. - User and extensions come from one place (vscodeDirs): connect, Sync, profiles and Disconnect use the portable User folder, and Zoo Code is found by its extension in <data>/extensions and writes its import file there. Windows' Zoo Code under Scoop looked in ~/.vscode/extensions. - Disconnect's preview is refused for a file in a portable data folder: the preview's child keeps PATH, and its launcher would reach the build's real files, not the copy. That also covers Scoop under home on Windows, which main previewed. - An installed build with no portable folder keeps the OS's folder and ~/.vscode/extensions, unchanged. #3260 and #4009 (Windows): |
||
|
|
6d23a4282f |
provider: whether a model sees images doesn't wait for usage readings; start ~9 s → <3 s
magpie's gateway listened ~9 s after start. A goroutine dump 3 s in had
main in provider.Allowances' first-ask wait: the start's migrations
(agent.RenameLegacy) read Pi's effort field, which builds Pi's model list,
which asks provider.Described (does any model see images), which ranks
the vision models by spent accounts, which asks each agent's allowances.
Each agent's first ask waits firstWait (3 s) for its accounts' usage over
the network. Every agent's model list asks Described, so the GUI's first
lists waited the same way.
Described only asks whether a model is there, not which account a request
goes to, so it now runs under provider.Unwaited: Allowances answers from
what is last known (the readings kept on disk) and starts the reading
behind it, as after firstWait. A request routed by the gateway still waits
as before.
Real history in a sandbox HOME (17,140 session files, every account
copied from this Mac's), the network blocked by a dead proxy, `magpie web`
started twice each:
- before (v0.1.2528 tree): gateway up at 9.8 s and 8.8 s.
- this change: 2.8 s and 0.6 s; first /api/sessions answered at 4.5 s and
2.1 s, against 12.2 s and 10.7 s.
Tests, on mote: TestUnwaitedAllowancesDontWait is new. Broken by hand
(Allowances waiting under Unwaited too) it fails: "took 20.0s".
go test ./internal/provider/ ./internal/gateway/ ./internal/agent/ ok
(gateway 740 s). gofmt -l clean; go vet (darwin), GOOS=windows go vet,
GOOS=linux go vet -tags nogui of provider and gateway ok.
Not run: the full suite; a start with the network up (the wait there
was the vendor's answer time, up to 3 s an agent); Windows and Linux.
Picked onto
|
||
|
|
2be5d206e1 |
gateway: a Codex summary request too large for the vendor is asked again as text, then compacted locally (celestial_eagle_99230 on Discord)
celestial_eagle_99230 (Discord #general, v0.1.2403) runs Codex on official DeepSeek (DeepSeek-V4.1-Flash, 1M window) and gets "413 Request Entity Too Large: Failed to buffer the request body: length limit exceeded". The turn path was fixed by |
||
|
|
90c02326bb |
gui: an app takes the gateway over from its older copy once idle, and says any other version serving it (matrix0487)
matrix0487 on Discord: after an update, pi said 404 'magpie knows no model "kimi/k3.1-pro" ... add a provider in magpie first'. The app had written pi a model its older gateway didn't know, and updating the gateway fixed it. A magpie that finds another one serving the gateway used to log it and wait for that one to quit (watchGateway took the port only once nothing answered). Only the Gateway page said so. Now (otherServes, gateway_older.go): - An older released copy of the app (it says serves app or tray, and a pid) is this app's predecessor. Once its /v1/magpie/concurrency says nothing is in flight (gateway.ServedBusy; unknown is never idle), the app quits it the way the Gateway page's button does (quitMagpieOnPort: a magpie only, by its program) and serves the gateway. A stream through it runs to its end first. watchGateway looks again every 15s while another serves. At most three times a run; a quit that fails is left to the button. - Any other one (magpie serve or the service, magpie web, a TUI, a newer magpie, a build of its own) is left running. /api/state carries it as gatewayOther, and the Agents page says it above the list with what to do, plus the take-over button for an older one (gatewaySkewLine, in plugins/gateway/client.js so app.js stays under its budget). A dev build of this magpie says nothing. New strings in zh, zh-TW, ja and de. How the reporter's older gateway outlived the update isn't known: they never said whether one ran separately. A failed handover leaves the old app serving for up to 15m, and a magpie serve left running is another source. Both are covered now: the first is replaced, and the second is said. Known gap: a request that starts between the idle read and the quit gets the older app's short drain. A socket handover between two running apps (no gap) is not built. Run on mote at 0f8ea30bb (this change on |
||
|
|
6f3dfc282f |
sessions: a scan's index is written at its end and on SIGTERM, not a minute later
A refresh's saves waited out saveGap (1 min) after the last one written,
the scan's checkpoints and its end too: the first checkpoint was written,
the rest waited. A magpie ended in that minute (quit, updated, `web` or
`serve` stopped by SIGTERM, whose handler died without sessions.Saved())
kept a few hundred of the files it read, and the next start read every
rollout again.
- A refresh that reads scanFiles (32) files or more is a scan: its
checkpoints wait scanSaveGap (15 s) and its last save waits for nothing.
A poll's few changed files still wait out saveGap. Saves folded into one
take the shortest gap asked, and a shorter one wakes a waiting save.
- The signal handler writes the index before dying, bounded by
saveOnSignal (5 s).
Real history in a sandbox HOME (11,994 Codex rollouts, 52.5 GB, plus
Claude projects; 17,140 files), index removed, `magpie web` killed by
SIGTERM ~44 s in (right after the first /api/sessions answered):
- v0.1.2521 tree: 1,200 entries kept (1,415 on a second try). Restart:
/api/sessions 23.63 s, 1:38 of CPU.
- this change: 17,140 kept. Restart: /api/sessions 1.30 s, 3.4 s of CPU.
Tests, on mote: TestScanSavedWithoutTheGap and
TestSignalSavesTheSessionIndex are new. Broken by hand: with the scan's
gaps left at saveGap the first fails ("a scan's last save waited out
saveGap"); with the save call taken out of the handler the second fails
("died without the session index saved"). go test ./internal/sessions/
./internal/cli/ ok. gofmt -l clean; go vet (darwin), GOOS=windows go vet,
GOOS=linux go vet -tags nogui of both packages ok.
Not run: the full suite; the GUI app's own quit and update paths (they
return to main, which already called Saved); Windows and Linux runs.
Picked onto
|
||
|
|
0c31638045 |
kiro: the mover installs 0.1.24, which says a too-long conversation as one
ergou0954_54426 on Discord routes by intent across Kiro's Claude and GPT models and DeepSeek, and sometimes a turn failed with Kiro saying the context was exceeded. Kiro says a conversation is past the model's window in three ways, and the plugin up to 0.1.23 turned only the HTTP 400 into the "input is too long for the model's context" that the gateway reads as an overflow (tooLong). The same ValidationException as an exception in Kiro's event stream came out as a 502, so the gateway took it for a passing vendor fault: it rested the account, asked Kiro again (15 asks for a lone provider in a probe), and never told the agent context_length_exceeded, so the agent never compacted. A reply Kiro stopped with MODEL_CONTEXT_WINDOW_EXCEEDED came out as finished. plugins e8050e8 (kiro 0.1.24, on npm) answers both as the 400 that says too long. Routing was already right: roomy skips a member whose known window the request is past, and withRoom moves an overflow to a member with room. The min goes to 0.1.24 so keepMovedCurrent updates every moved user. TestKiroMoverHasTheTooLongFix holds it there. TestKiroPluginOverflowGoesToAMemberWithRoom pins what the gateway does with 0.1.24's two wordings: in a group the other member answers, the try is failOverflow with no rest, and alone the agent gets context_length_exceeded after a single ask. Run on mote: go vet ./internal/provider ./internal/gateway; go test -timeout 45m -count=1 ./internal/provider (ok 150s) ./internal/gateway (ok 712s). gofmt -l clean. Broken by hand: at origin/main's min 0.1.23, TestKiroMoverHasTheTooLongFix fails. A probe with 0.1.23's 502 body showed Fail other, a rest, and a vendor 502 for the lone provider. Not run: the full ./... suite (another session's full suite held mote), and a real Kiro account pushed past its window. |
||
|
|
4794767846 |
routing: back on Routing from another page, the page isn't laid out and drawn again whole (#4652)
xisdumpling (dumplings04605 on Discord), Windows, 0.1.2507: with a
history day of 180 to 298 requests picked, coming back to Routing
stalls the page and the sidebar's highlight. Measured first, with
routing-return-cost.test.cjs (250 rows, a picked day, a request's story
open), which counts what the return does, not how long it takes.
Causes found, each fixed and each red by hand when put back:
- The request list was windowed only from 300 rows, so a day of 180 to
298 had every row in the page. Now from 100 (WIN_MIN); the live list
keeps 60, so it is never windowed.
- Out of sight a view is 0 wide. The ResizeObservers in the routing
client (byWidth, the meta width) and context.js's card sizes took that
as narrow, flipped the narrow layouts while away and flipped them back
on return. A 0 width now keeps the layout it had.
- A hidden list re-windowed itself for a 0-high view, so the return
placed rows and ran metaFit again. It keeps its window while hidden.
- resume rebuilt the whole stage on return. sync("back") rebuilds only
when what the stage was built from (route, pin, day, purpose, lang,
the requests and their accounts) changed, and records it after the
rebuild.
- The visibility observer's group reload was not quiet and redrew the
groups. It is quiet now.
- A providers refresh while on Routing redrew the hidden Providers page.
It is read and drawn when Providers opens (providersBehind).
Not a cause: the nav highlight's rAF reading offsetTop only waited on
the busy main thread; it is one small layout now.
Before and after, the "back on Routing" step (Chromium layout metrics
from CDP; class flips and redraws from MutationObservers, both engines):
- mote, macOS: 25 layouts / 34.9ms of layout, 24 class flips, Providers
redrawn 13 nodes, groups 4, stage kept 0 of 3, 250 rows, 7818 nodes
-> 9 layouts / 3.2ms, 0 flips, 0, 0, 3 of 3, 11 rows, 1367 nodes.
- Windows (xiaomi-gpu, win-run): 25 layouts / 146.4ms, 24 flips
-> 9 layouts / 7.1ms, every check passes. WebKit's counts match.
The test asserts no flips, no redraws, the stage kept, under half the
rows in the page and at most 12 layouts; wall time is logged, not
judged. The page looks the same: no CSS or markup change.
Run:
- routing-return-cost: red on origin/main
|
||
|
|
2b067434d7 |
provider: a Kimi Code membership's k3.1-pro and k3.1-pro-highspeed are priced at the Kimi API's (#4635)
hlyx1's fix (#4635, branch hlyx1/magpie kimi-code-k31-pro-price), asked to be expedited by matrix0487 on Discord. Kimi Code's plans serve k3.1-pro and k3.1-pro-highspeed, which models.dev's kimi-code-plan-* catalogs list at the membership's $0. Neither id was in kimiCodeAPI, so a membership's call on either was unpriced on Usage. They now map to kimi-k3.1-pro and kimi-k3.1-pro-highspeed, like k3 to kimi-k3, and the Requests list names that model (PricedNameFor). Checked: Kimi Code's own /models answer (internal/catalog/testdata/ kimi-code-cn-models-2026-10-31.json) lists k3.1-pro "K3.1 Pro" and k3.1-pro-highspeed "K3.1 Pro Highspeed". Kimi's pricing page (platform.kimi.ai/docs/pricing/chat, read 2026-11-01) and models.dev's live moonshotai entry both give kimi-k3.1-pro $2 in / $10 out / $0.20 cached / $2 5m write, and kimi-k3.1-pro-highspeed $4 / $20 / $0.20 / $4. The fixture's new entries match models.dev's api.json in id, name, cost and canonical_model_id. The alias stays Kimi Code's (kimiCodePlans): the test's relay catalog now lists a k3.1-pro of its own at $0.50/$1, which keeps that price, and PricedNameFor(relay, k3.1-pro) stays k3.1-pro. Docs: docs/reference.md, docs/subsystems/providers-accounts.md. Run on mote (Go 1.26.8), at this change rebased on |
||
|
|
784b66366f |
gui: Settings opens after Codex's row on the Agents page was opened and shut (ysm119)
ysm119 on Discord (v0.1.2519, macOS): opening Settings showed "null is not an object (evaluating '$(row + ".who").title = t(en)')". Cause: an opened agent row borrows its settings rows (AGENT_PREFS, |
||
|
|
fb3942ee67 |
windows: the app's icon fills its square in the taskbar, the tray and Start (dzxx0496)
On Windows 10 magpie's icon looked a size smaller than its neighbours in the taskbar, the tray overflow and Start's "Recently added" (dzxx0496 on Discord, #general). Every Windows icon was the Mac's tile: build/windows/icon-*.png ( |
||
|
|
733fac48fb |
qwenpaw: each model says how its thinking is set, and the editor sets the level (Pkh)
Pkh (Discord, 0.1.2509 on Linux, QwenPaw 2.2.2.post1): QwenPaw's
thinking strength did nothing on magpie's models.
Cause, from QwenPaw 2.2.2.post1's own source:
- providers/provider.py thinking_control() takes a model's
thinking_control, else its thinking_param_style; with neither it is
ThinkingControl() of kind "unknown".
- providers/thinking.py resolve_thinking drops an unknown control to
inherit, so agent.json's thinking_level was never sent.
- magpie wrote neither key in magpie.json's models, so every magpie
model was "unknown".
Change:
- qwenpawModelJSON writes thinking_param_style "effort" and
reasoning_effort_options for a model whose catalog efforts include
levels QwenPaw names (minimal, low, medium, high, xhigh, max), in
QwenPaw's order. "none" is left out: QwenPaw's off sends
enable_thinking / thinking extra_body, which the gateway strips for
some upstreams.
- Both keys are magpie-owned. A model whose efforts go away has them
taken back. A null magpie writes where it never wrote is dropped,
so a user's own config_overrides are kept.
- The QwenPaw agent editor gets an effort field over agent.json's
thinking_level. "" writes inherit. Setting a level drops
thinking_budget, which QwenPaw's validator requires. A budget or
off level the user set is shown and kept.
- Docs: agent-wiring.md and reference.md.
Run:
- gofmt -l: clean.
- go vet darwin, windows, and linux (-tags nogui): clean (mote).
- go test -timeout 45m ./internal/agent/...: ok (mote).
- go test ./internal/gui: 3 reds, also red on origin/main
|
||
|
|
f435aadbf3 |
gateway: an image is described once, whatever model describes it, and a canceled request stops its descriptions
Pkh on Discord (0.1.2509, Linux, QwenPaw, Auto routing): with images in the conversation, the Routing view filled with "Image description" rows, one request asking for 63 in ~60ms, and the request they were for had no row of its own. Causes, each red on origin/main |
||
|
|
da0005df81 |
agent: /api/state lists running agents once in 3s, not with a pgrep each call
/api/state asks StaleCopies for every wired agent, and each pattern
started `pgrep -lf`, which walks every process's arguments. On a Mac
with ~1000 processes that was most of a state call: 45ms each, on every
page switch, save and GUI poll, with a pgrep child seen in 25 of 40
samples.
StaleCopies now reads runningLately: a pattern's listing is kept for
3s, with each process's start (not its age), so an age read later is
still right. A fresh listing (a restart waiting for its app to end)
replaces what was kept, so the look that finds the app gone is what the
next poll sees. A test that fakes running is asked each time. The
waits in apprestart still list now.
Run (mote, this tree):
- go vet ./internal/agent ./internal/gui; GOOS=linux and GOOS=windows
go vet ./internal/agent: ok.
- TestRunningListedOnceInAWhile, TestRunningNeedsNoPs: ok.
Broken by hand (every call lists): red, "listed 6 times in a row,
want 1".
- go test ./internal/agent ./internal/provider: ok. ./internal/gui:
only TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
TestMainWindowCorners/macOS_26_SDK (#3949), both red on main too.
Real accounts (sandbox HOME from a copy of the live accounts, on this
Mac with its real Codex app, daemons and CLI running):
- /api/state, 10 calls after 200: v0.1.2519 43-60ms, this 8.4-21ms
(twice each, alternating). pgrep children in 40 samples: 26 and 24
before, 1 and 1 after.
- Each wired agent's stale copies (Codex: app, two daemons, cli, each
with its start) are the same from both binaries, read twice 4s apart.
Not run: the full ./... suite; Linux and Windows runs of the agent
package (vet only).
Picked onto
|
||
|
|
9be72c9480 |
zcode: a level's thinking carries its budget, and the user's own level options stay (#3852)
Review of d7e1e284f, two things it changed beyond its case:
- Every level that thinks was written as {"thinking":{"type":"enabled"}}
with no budget_tokens. ZCode puts a level's options in the request, so
a Claude before 4.6 (Sonnet 4.5, Haiku 4.5, a relay's) asked through
magpie at any level would be sent "enabled" without the budget
Anthropic's Messages API requires with it, a 400 it didn't get before.
Each level now carries the budget the gateway reads that effort as
(gateway.ThinkingBudget, budgetOf: low 4096 ... max 32000). The
gateway already makes it adaptive for Claude 4.6 and later
(adaptiveThinking; ZCode's output_config.effort wins over the budget)
and fits it under max_tokens (maxoutput.go).
- providerOptionsByLevel was written over on every sync. A user who put
their own there (the workaround for this very bug) lost it. A level's
options already in config.json now stay; no magpie before #3852
wrote any, so whatever is there is the user's.
Tests: TestZCodeOutputAndReasoning expects the budgets;
TestZCodeKeepsTheUsersLevelOptions keeps a hand-written high level and
fills the others.
Run on mote: go test -run TestZCode ./internal/agent, ok. Broken by
hand: the kept options ignored and the budget left out, and those two
tests fail.
Not tried: a real ZCode 3.x (this Mac has Z Code 0.9.1, a different
app; mote has none), so ZCode putting the options in the body is the
reporter's and the author's reading of zcode.cjs, not seen here.
Batch record (gua's #2833 #3052 #3205 #3867 #4107 #4247 #4245 #4113
#3852 and the three review follow-ups; #4106 left out, its test isn't
red without its fix, see the issue):
- Full run on mote before the rebase (base
|
||
|
|
15ffd3b681 |
gateway: a compaction rule sees Alma's first compaction too (#2833)
Review of e72e97ef9: it knew Alma's compaction only by the ask of a later one, "Merge the previous summary with the new conversation.". Alma 0.4.335 (its app.asar, read on this Mac) has two: the first compaction asks "Here is the full conversation to compact." under the system prompt "You are compacting a long conversation so it can continue WITHOUT losing context.", and a merge sends "You are UPDATING an existing conversation summary ..." as its system prompt. The ask and both system prompts are now known. TestRuleCompactAlma also posts the first ask, and each system prompt with an unrelated user message. Run on mote: go test -run TestRuleCompactAlma ./internal/gateway, ok. Broken by hand: the three new entries taken out, and the three new cases go to the other rule (b/big). Not tried: a real Alma compaction through magpie. |
||
|
|
73528a9a03 |
gateway: x-bili- headers go only to a /bili/ URL of the user's own provider (#3052)
Review of 5d5a148ab: it sent every x-bili- header the agent sent to every provider, Claude and Codex accounts and every vendor included. They are the billion-context proxy's own headers, so they now go on only when the request's URL is in bili's prefix form (http://host:8787/bili/<upstream>, the form its README gives for putting it in front of a gateway and the one the report uses), and never for a signed-in account. TestForwardOnceKeepsBiliHeadersFromOthers: a plain URL, a URL with /bili/ deeper in its path, and an account on a /bili/ URL get none. TestForwardOnceCarriesBiliHeaders now posts to a /bili/ URL. Run on mote: go test -run 'TestForwardOnce(Carries|Keeps)BiliHeaders' ./internal/gateway, ok. Broken by hand: the condition set to true, and the new test fails for all three requests. Not tried: a real bili proxy. |
||
|
|
bc7d833916 |
zcode: the reasoning keys ZCode reads, not OpenCode's (#3852)
magpie's ZCode takeover wrote a model's reasoning as
{"enabled":true,"variants":[…],"defaultVariant":…} — OpenCode's
shape, which ZCode's config.json provider entry is loosely modeled
on. ZCode's own schema for it is
{enabled?, levels?, defaultLevel?, providerOptionsByLevel?}
(resources/glm/zcode.cjs, same in the 3.12.3 the issue reports and
in the 3.16.3 checked on this machine; "defaultVariant" has no
occurrence in the 3.16.3 runtime at all). Its .passthrough() keeps
the unknown keys and ignores them, so ZCode picked a level, sent
output_config.effort and never a thinking field — and an
always-thinking upstream model (Kimi Code's kimi/k3.1-pro, for one)
refused every request with 400.
magpie now writes the keys ZCode reads: levels and defaultLevel it
had all along, plus providerOptionsByLevel with thinking on for
every level and off for the one named "disabled". The kept default
a sync reads back now looks for defaultLevel, falling back to the
defaultVariant an older magpie wrote (a key ZCode never read, only
magpie) so a user's choice survives the first sync after the
upgrade. The provider_config.json rule side is untouched: its
optionSpecs.reasoningLevel.values is already a key ZCode reads.
The OpenCode family keeps variants/defaultVariant: there those are
the keys the app reads.
Fixes #3852
Generated-by: GLM-5.3-Flash (ZCode)
|
||
|
|
9a951eb038 |
gateway: end the cgroup memory walk at "/" on every host (#4113)
What: the cgroup v2 walk read the path from /proc/self/cgroup with
filepath, whose separators and root are the host's. On Windows the
root is "\", so filepath.Clean("/"+dir) was
"\system.slice\magpie.service" and filepath.Dir stops at "\", which
is never "/": the loop read \memory.max and \memory.high until the
suite's timeout, holding internal/gateway with no result on Windows
(TestClaudeMemRunsFromTheCgroup, 45m). The cgroup path is a "/" path
whatever the host reads it on, so the walk is path's now (Clean, Dir,
and the label's Join); filepath.Join stays only for the limit file
under the cgroup root, which is a host path. On Linux and darwin,
where filepath's file is path's own code, nothing changes: the walk
reads the same files and the limits, and the "cgroup ..." label, are
byte for byte what they were.
Run: TestClaudeMemWalkEndsAtRoot is new: it runs memLimit("linux", a
fixture whose cgroup path is /system.slice/magpie.service) under a
one-minute watch and fails if the walk never ends at "/". On this
macOS machine it is green before the change too — filepath is path's
code there, so old and new cannot disagree on unix; on Windows it is
red before the change by construction (filepath.Dir of "\" is "\"),
and Windows is the reported host: the reporter's 45m stack at main is
the red this test gives there. With the change it passes, and
go test -count=1 -timeout 45m ./internal/gateway is green (461s),
-tags nogui green (464s); gofmt -l clean; go vet ./... on darwin,
GOOS=linux -tags nogui and GOOS=windows clean (the internal/gui cgo
warnings are main's); go build on the three.
Generated-by: GLM-5.3-Flash (ZCode)
|
||
|
|
0d76d16ec6 |
test(gateway): let only the gateway's deadline end a stall's fake answer
What changed: the fake relays in TestStalledAnswerSaysUrlOrB64 and TestVendorThatStopsMidAnswerIsSaid waited on r.Context().Done() with a time.After(5 * time.Second) fallback of their own. Under load the fake's 5s could end its answer before the gateway's 500ms stall deadline (drawUnit = 100ms) was acted on, so the gateway read a cut body and said 502 "isn't an images API's: unexpected end of JSON input" instead of the stall's 504 (#4245). The fakes now wait on the context alone: the deadline's cancel is what ends them, so the order can't flip. No product behavior changes; both tests still assert the same 504 wording. Run: go test ./internal/gateway -run 'TestStalledAnswerSaysUrlOrB64|TestVendorThatStopsMidAnswerIsSaid' -count=5 - ok. go test -tags nogui -timeout 45m ./internal/gateway/... - ok (500s). go vet ./... and GOOS=windows go vet ./... - ok; GOOS=linux go vet ./... fails in wails (undefined: pointer) at the base commit too. CGO_ENABLED=0 GOOS=linux|windows|darwin go build -tags nogui . - ok. Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
71f26a600f |
library: a save drops an empty applied entry (#4247)
What changed: a sync that only looked at an agent — its hooks, its
subagents, its MCP file, with nothing of the library's to give it —
still took an empty applied entry into library.json, one per agent,
growing at every start ({"claude":{}}, then {"claude":{},"codex":{}}).
The syncs make the entry the moment they look (l.applied(id)), and the
step's save wrote it out. A save now drops an entry with nothing in it,
and keeps every entry that holds something. A file otherwise unchanged
is left alone by the write under it (edit.WriteAtomic), so a sync with
nothing to give anyone no longer writes library.json at all — the
single write a field-showing command of the CLI's was seen to bring
into the HOME a test held, red once on Linux (TestEveryAgentFieldName
WritesNothing).
Run:
- go test -tags nogui ./internal/library -run 'TestSaveDropsEmptyApplied|TestSyncAloneLeavesNoEmptyApplied' -count=1
- go test -tags nogui -count=1 -timeout 45m ./internal/cli ./internal/agent ./internal/library
- go vet ./... and GOOS=linux/windows go vet -tags nogui ./...; builds for the three
systems (linux and windows with -tags nogui)
Generated-by: GLM-5.3-Flash (ZCode)
|
||
|
|
c313a906f4 |
handoff: Give no longer leaves the handed socket's listener blocking (#4107)
A restart that hands the gateway over reads the copy of its listening socket (ListenerFile) to send it along (Give). The copy shares the listener's open file description (TCPListener.File dups the fd), and os.File.Fd puts such a description in blocking mode: a socket's File hands out expecting its Fd to be read, and SetBlocking then takes the O_NONBLOCK flag off the description the copy and the listener share. The gateway's own listener went blocking with it: its accept slept in the syscall once nothing came queued, where Close cannot reach it — the pollDesc evict wakes I/O waiting in the netpoller, not a syscall, and the listener's own FD still counted as non-blocking, so Close waited on its condition variable for that accept to return. stopAccepting waited there, ListenAndServe never returned, and the ending magpie hung: under a full-suite load TestRestartHandsTheGatewayOver sat 43 minutes with the handover goroutine in semacquire inside gateway.(*Server).stopAccepting (the 2701s timeout, #4107). Alone it passed, as the accept only sleeps there when it comes around with no connection queued, which a quiet machine rarely gives. Give now takes the number to send from SyscallConn, which reads it without the blocking switch. Red before, green after: TestGiveKeepsTheListenerNonblocking — a listener handed over with Give keeps its O_NONBLOCK (sub-second, deterministic; on the old Give it fails "Give left the listener in blocking mode (os.File.Fd on the copy)"). Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
837ea5f565 |
gateway: a Kimi tool schema with items is an array, not its enum's string, as Gemini's is now (#3867)
yetone, #3867: kimiSchemaType and collectUntypedEnums read an untyped schema's enum or const before its keywords, so a tool's {"items":{"type":"string"},"enum":["a","b"]} reached Kimi typed "string" with items beside it — the shape its Gemini sibling went out in until |
||
|
|
7bdf08f18d |
gateway: no type beside the $ref a Kimi schema's target is
kimiToolRefTypes wrote a type into each schema a tool's $refs reach that
has none. When the target was itself a $ref — zod writes one beside what
it changed of a reused schema, a format and a description among them, as
Codex's automation_update's targetThreadId reaches {"format":"uuid",
"description":"tt","$ref":"#/$defs/__schema1"} — the type went beside
that inner $ref, and Moonshot refuses one there, 400 "At path
'$defs.__schema14': when using $ref, type should be defined in the
referenced schema instead of the parent schema" (#3205), so every turn
failed though the tool is never called. The plugin side had the same bug
and fixed it in kimi-work 0.1.5.
The chain a $ref names is now followed to the schema it ends at, and it
is there the type goes, or nowhere when the chain ends at a ref to
nowhere or never ends: schemaTypes already resolved chains to say what
the type is, so only the place it is written moves. Codex's own
automation_update schema (the fixture its tests and magpie's root-union
tests share) goes as it was sent: its defs are notes beside a $ref to a
typed target, which Kimi takes.
Fixes #3205
Generated-by: GLM-5.3-Flash (ZCode)
|
||
|
|
ee031e9539 |
gateway: a billion-context proxy in front of the provider gets the client's x-bili- headers (#3052)
What changed: forwardOnce copies the client's x-bili-* headers on to the request it builds for the provider, by a biliHeader predicate beside claudeCodeHeader and codexClientHeader — an x-bili- prefix, in the shape of the anthropic-, x-stainless-, x-claude-code-, x-openai- and x-codex- families already on the allowlist. The headers carry the cooperative plugin's name, conversation and context window, never a key; a header no family allowlists, and the client's own key, still stay off. Why: forwardOnce builds the upstream request from nothing and copies only allowlisted headers, so a client talking to a billion-context (bili) proxy put in front of its provider lost the x-bili- ones that name its cooperative session — bili then saw an anonymous session and injected a duplicate set of compression tools beside the plugin's own (#3052). Whether to generalize this into a per-provider "pass-through client headers" setting, beside PassUserAgent (#1851) and a provider's own Headers, is the maintainer's call; this change only admits the family the issue reports. Run: go test -run TestForwardOnceCarriesBiliHeaders ./internal/gateway fails on the baseline with the three headers empty and passes with the change (httptest, no network); ablation (product file back at baseline, test kept) fails again. gofmt -l clean; go vet ./..., GOOS=linux and GOOS=windows go vet -tags nogui ./... clean; native, GOOS=linux -tags nogui and GOOS=windows builds clean; go test -tags nogui ./internal/gateway green. Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
f0ff905167 |
gateway: a compaction rule sees Alma's compaction ask (#2833)
What changed: compactAsks in internal/gateway/compacting.go gains Alma's compaction ask, "Merge the previous summary with the new conversation.", which opens the last user message of Alma's compaction request. A group's compact rule now matches it. No compactSystems entry was added: neither the repository nor the report carries the opening of Alma's compaction system prompt, so none is invented. Why: compacting.go matched the compaction prompts of Claude Code, Codex, OpenCode, Pi, Gemini CLI, Qwen Code, Minis and Kimi Code literally. Alma was not in the table, so its compaction fell through to the intent classifier and was routed by another rule's model, making every compaction cost more than the group's compact rule intended. The ask sits at byte 0 of the user message, well inside compactLead (2048), so one table entry recognises it. Test: TestRuleCompactAlma drives a group whose rule 1 is compact and rule 2 is tokens >= 1 through the gateway. With the fix the Alma request is answered by rule 1's member and X-Magpie-Model says a/small; without it the request goes to b/big. The same test asserts a long message that only quotes the ask past compactLead is not a compaction; raising compactLead makes that assertion fail, so the bound is what keeps notes from matching. Run: go test -tags nogui -count=1 -run 'TestCompact|TestCompacting|TestRule' ./internal/gateway/ (ok, 2.839s); go test -tags nogui -count=1 ./internal/gateway/ (ok, 344.144s); go test -race -tags nogui -count=1 -run 'TestCompact|TestCompacting' ./internal/gateway/ (ok, 2.172s); gofmt -l internal/gateway/ (empty); go vet -tags nogui ./internal/gateway/ and with GOOS=linux and GOOS=windows (all ok); go build -tags nogui ./..., GOOS=linux go build -tags nogui ./..., and GOOS=windows go build -tags nogui -o /dev/null . (all ok). Not tried against a real Alma client: the wording is quoted from the report. Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
8ac1c7a563 |
catalog: a model's list price is looked for once a catalog load
The GUI's provider list prices every model of every provider on each
request of /api/providers: ListPrice asks catalog.PricedBy and
MakerPriced by every spelling of the id across every maker's catalog,
and a model none of them lists (most of a relay's) went through all of
them each time. In a CPU profile of the GUI's polls (drift, state,
providers, 40 rounds, a real-account sandbox) ListPrice was 14% of the
process's CPU, PricedBy and makerListPrice most of it.
What PricedBy and MakerPriced find depends on the loaded catalog, the
providers asked and the id, and nothing else, so pricedOnce keeps it by
those for the load's Reset count (gen), as priceIndexOf and AtEndpoint
keep what they build. A Reset (a new catalog synced) starts it again; it
holds at most 32,768 answers and starts again past that. find runs
without the memo's lock, as PricedBy calls itself for a renamed id.
Run on mote (macOS 27, Go 1.26.8) at this tree:
- gofmt clean; go vet ./internal/catalog on darwin, GOOS=windows and
GOOS=linux ok.
- TestPricedOnceALoad 3 of 3 alone, and with -race beside
TestPricedBy*/TestMakerPriced*: ok.
- Broken by hand: the memo never answering, TestPricedOnceALoad red
("looked for 20 times again at one load"); the memo not keyed by gen,
red (the old catalog's 0.15 after a new one's 0.2).
- go test ./internal/catalog ./internal/provider ./internal/usage ok.
./internal/gui: TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
TestMainWindowCorners/macOS_26_SDK (#3949) red, the same two red with
the same output at origin/main
|
||
|
|
ccb75030aa |
gateway: a held request body is known by where it is, not summed again (#4371)
Each of the dozen decodes, topMember reads and validity checks a request
body goes through summed all its bytes with maphash to find what
validMemo knew of it: about 5% of the gateway's CPU on long Codex
requests (#4371). A body being served (holdBody) is not written while
held, so longBody and jsonValid now know it by its address and length,
check and split it once, and keep that in heldBodies.long until it is
released, as factsOf keeps its facts. Any other long body is summed as
before.
Run on mote at this tree:
- gofmt, go vet (darwin, GOOS=windows, GOOS=linux): ok
- TestHeldBodyIsNotSummed, TestHeldBodyNotJSON, TestDecodeJSON*,
TestRequestBodyRawValuesShareIt, TestTopMember*, TestWithoutTopMember*:
ok 3 of 3 alone, ok under -race
- go test -timeout 45m ./internal/gateway: ok (609s)
- Broken by hand: held lookup skipped -> "a held 84077-byte body was
summed 18 times"; release left the finds kept -> "a released body's
finds were kept".
- BenchmarkHeldBodyDecodes (1.8MB Responses body held, 12 decodes plus 12
topMember reads an op): 3.31ms/op before, 7.9us/op after, allocations
the same (24/op).
Real use: sandbox HOME copied from the owner's, real DeepSeek account,
deepseek-flash, four turns of a 115-123KB history through
/v1/chat/completions with masking on: every reply HTTP 200 (three "ok",
one empty at finish_reason length, the model's reasoning using
max_tokens, as on the old binary).
Not run: the full ./... suite; a real Codex account; Windows and Linux
runs of the tests.
Picked onto
|