611ce90d15bbbb2db2edcfc181da4f75ada3cccd
6050
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
611ce90d15 |
agent: OpenBot, magpie's models in its model picker (jiezhengj)
OpenBot (nightly-labs/openbot, openbot.run, v0.58.0) is a new row on the
Agents page. jiezhengj on Discord asked for it: today they type magpie's
address into OpenBot by hand and add each model one at a time.
OpenBot lists the user's own OpenAI-compatible endpoints from
openbot-custom-providers-v1.json in its userData folder:
~/Library/Application Support/OpenBot, %APPDATA%\OpenBot, or
~/.config/OpenBot. Connecting adds an entry with id "magpie" pointing at
the gateway's /v1 and holding the models picked for OpenBot, with
secret null. OpenBot seals an entry's key in safeStorage, which magpie
doesn't open, so the entry has no key. OpenBot hands it to OpenCode
keyless, and the gateway accepts it as a request from this computer.
What the entry keeps to:
- OpenBot's decoders drop the whole list over one bad entry. So the entry
has at most 64 models, only ids OpenBot accepts as magpie/<id>, and a
context window only inside 1,024 to 100,000,000.
- The user's other entries stay. The name, harness and secret they give
magpie's entry in OpenBot stay too.
- A sync with nothing to change doesn't write.
- A file whose version isn't the number 1, or whose providers isn't a
list, is one OpenBot refuses itself, so magpie leaves it alone.
- Disconnect takes out magpie's entry, and the file too when only the
version and an empty list are left.
OpenBot reads the file at start, so while it runs, a notice says to
restart it. The notice is in every language.
OpenBot is detected by its userData folder, OpenBot.app
(app.openbot.desktop), or OpenBot.exe under %LOCALAPPDATA%\Programs or
%ProgramFiles%. Docs updated: agent-wiring.md, reference.md, and both
READMEs.
Run at the pushed head, on mote:
- gofmt -l: clean.
- go vet -tags nogui for internal/agent and internal/gui, and for ./...
with GOOS=linux and GOOS=windows: ok.
- go test -tags nogui -count=1 -timeout 45m on internal/agent and every
package that imports it (., backup, cli, davsync, gui, library,
profile, stats, tui, uninstall, plugins/...): ok.
- GUI: agent-notice-lang, i18n-keys, header-relang and about-notices in
Chromium and WebKit: 58 of 58 pass.
After rebasing on
|
||
|
|
d20caffae1 |
release: notes written again on magpie-releases are copied here each hour
GrayRabbit on Discord (11-02): the "更新内容" dialog in Chinese listed v0.1.2634 on as raw English commit subjects. magpie-releases' release runs got "Insufficient Balance" from DeepSeek for both the changelog and its Chinese since v0.1.2634, so those releases went out with the commit list and no <!-- lang:zh --> part, as v0.1.1233 to 1242 did (#2122). magpie-releases b90a82b now writes such notes again each hour (notes.yml) once DeepSeek answers. - notes-mirror.yml, hourly at :53 and by hand: a release here still without the zh marker gets magpie-releases' notes of the same tag once those have it, with the mirror's footer. The app reads magpie-releases through usemagpie.ai, so this is the GitHub page. - release.yml's notice on #2260 names insufficient_balance_error as a DeepSeek top-up and says the notes are written again by themselves. v0.1.2634 to 2644's notes were written by hand from their commits, in English and Chinese, on both repos' releases. Run: actionlint 1.7.7 (mote) on notes-mirror.yml and release.yml: nothing but release.yml's existing unknown runner labels. No Go or GUI code changed. Not tried: notes-mirror.yml on GitHub's runners before this push. |
||
|
|
e87140242b |
settings: Check in now for one account, its switch left as it is (xiaowu_95660)
xiaowu_95660 (Discord #general) asked for a way to check in one account
right now where its daily check-in switch is, without turning the switch.
- provider: a checkiner can be held to one account (`only`), and
CheckInAccount(ctx, by, key) runs the same claim path once for it, for
WorkBuddy, Trae, MiniMax, Qoder and every plugin with a check-in.
CheckinOff is not read or written.
- gui: POST /api/usage/checkin-account {By, Key}. Settings' daily check-in
group (built-ins and plugins) gets a "Check in now" row under its
accounts. One account checks in at once; several open the app menu to
pick one. The line says done, already checked in, not eligible,
inactive, captcha, own-app or the failure. Only quotas reload, so
Settings isn't redrawn under the button.
- The row and press live in the lazy checkinnow.js (core budget unchanged,
three check-in comments cut). Once loaded it draws at once, so a redraw
by the switch doesn't shorten the page for a moment.
- Strings in zh, zh-TW, ja, de. provider-plugins.md says how it works.
Run at befdfa72b (on origin/main d89f03aa9;
|
||
|
|
9f1734645a |
appdir: exports go to the Downloads folder the system keeps, not home/Downloads
1Shin on Discord (#feedback, 11-02): an export (Settings' backup, a
request saved from the archive, a session as Markdown, the usage file)
joined $HOME/Downloads, which is wrong when Downloads was moved: Windows'
known folder (to another drive or OneDrive) or the XDG one on Linux
(~/下载 on a Chinese desktop).
appdir.UserFolder(kind) asks the system: SHGetKnownFolderPath
(FOLDERID_Downloads/Desktop/Documents, KF_FLAG_DONT_VERIFY) on Windows,
used when magpie's home is the profile Windows keeps it for (a home given
of its own, as a test's, keeps home\Downloads); $XDG_CONFIG_HOME/
user-dirs.dirs on Linux and the BSDs, read as xdg-user-dir does ("$HOME/x"
or "/x", quoted, backslash escapes, the last line wins); ~/Downloads on a
Mac. A failed lookup is home/kind, as before. gui's downloads() tries it,
then home/Downloads, then home. appdir's sharedFolder (a data folder
beside magpie there isn't portable data) adds the system's folders to
home's, and Cursor's AppImage is looked for in the system's Downloads too.
update's isDownloadFolder already asked Windows for its known folders and
is unchanged.
Run at this head (rebased on origin/main):
- mote (macOS): gofmt -l clean; go vet ./internal/appdir ./internal/gui
./internal/agent; GOOS=windows go vet of those and ./internal/update;
GOOS=linux go vet -tags nogui of the three; go test ./internal/appdir ok,
-run "Backup|Export|Archive" ./internal/gui ok, -run
"Cursor|Desktop|Sandbox" ./internal/agent ok.
- wsl-run (Ubuntu 24.04): appdir's UserFolder/SharedFolder/ResolveDownloads
tests and gui's TestExportGoesToTheSystemsDownloads,
TestBackupLibraryRoundTrip and the session exports pass. Against the real
xdg-user-dir in a sandbox HOME, "$HOME/下载", "/mnt/d/My Downloads" and
"$HOME/a \"b\"" read the same; "$HOME/" gives home without the trailing
slash.
- win-run (Windows 11): the appdir tests pass, and
TestKnownFolderIsExplorers checks the known folder against Explorer's
User Shell Folders value (read only). Windows expands that value's
%USERPROFILE% once a process, with the first call's environment, so the
check runs in a child of its own. The real profile gives
C:\Users\yeton\Downloads, Desktop and Documents.
Broken by hand: no user-dirs.dirs read, or no profile check on Windows:
TestUserFolderXDG, XDGLines, XDGConfigHome and TestUserFolderWindows go
red. gui's downloads() without the system's folder:
TestExportGoesToTheSystemsDownloads red in WSL (saved in ~/Downloads, want
~/下载).
Not tried: a Downloads really redirected on Windows (to D:\ or OneDrive).
Moving it means writing the user's own User Shell Folders on the test box,
so the redirect is a faked known folder in TestUserFolderWindows only. Not
run: the GUI suite (no GUI file changed) and a full go test ./....
|
||
|
|
4ffd5b96dc |
provider: the Cursor move asks for plugin 0.2.36 (plugins#550)
Cursor plugin 0.2.36 (magpie-community/plugins@24cd0b9, on npm, checked with npm view --prefer-online): a stateless Run whose step sent its calls and then only heartbeats, with no tool count, hands the calls that came to the caller 60 s after Cursor's last non-heartbeat frame instead of waiting 240 s to go quiet. Windsland52's fifth wire trace: a native stall pushed the retry onto the stateless path, where two calls and no count cost another 4 minutes. keepMovedCurrent updates moved users. Run at this head (mote): go test ./internal/provider -run "Mover|Moved|Migrat|Retir|Plugin|Min": ok. GOOS=linux and GOOS=windows go vet ./internal/provider: ok. gofmt -l: clean. The plugin's own run is in its commit (bun test packages/cursor: 380 pass). Not tried: a real Cursor account on the plugin. |
||
|
|
d89f03aa92 |
settings: trayNoNumber is a key magpie settings sets, and GET /api/quit is the window's own (#4793, #4794)
|
||
|
|
3f393a4fae |
redact: a user name is not masked where code has the same word as a name (Tomyu_2034 on X)
Tomyu_2034 on X: "magpie 里面的 masking 很容易把参数变量名当成 user name
给 mask 掉". No sample was given, so the class was measured: with "User
name in home folders" and "User and computer names" on, two finders took
names in code for the user's.
- Known values (known.go). A user name the home rule found once
(/Users/developer/…) is known from then on when it is 8 bytes or more,
and standsAlone's default bound is a letter or a digit only, so it was
masked wherever the word stood between anything else: def
run(developer, developer_dir), developer_mode = True, const developer
= 1, {"developer": true}, - developer_count := 0 in a diff, a tool
call's old_string. A user name such as developer or workspace1 is a
word code has too.
- The "User:" line rule (more.go). Its unquoted value was any
login-shaped word, so user = current_user, user: UserInfo, login =
loginName, username = target_name, a Go struct's "\tUser UserProfile"
and a TS interface's "user: CurrentUser" went as made-up names.
nameAlone now decides a known USERNAME: it is the user's name as a word
of its own in text (a path's part, name@host, --author=name, ls -l's
owner, uid=501(name), prose, a quoted string, chown name:staff), and
code's where it is joined to another part (_ $ a letter or digit beside
it, or a . or - with one past it), declared (const/let/var/def/func/
class/return/import…), assigned or called (name =, name(, name[,
name :=, x = name), a JSON key ("name":), or a parameter ((name, ,name)
name: str, name string), but for id's 501(name)). Nothing is exempted
by a key's name: a tool call's arguments are read by the same rule as
any text, and a quoted value in them is masked as before. The "User:"
rule leaves an unquoted value made of two or more words (split at _ .
and camel humps) one of which says it holds a user (identParts: user,
name, login, current, target, info, obj, id…); a quoted one, and a
login of words of its own (deploy_bot, john_doe), are masked still.
The boundary costs this: prose that puts the name alone in a list
"(developer, alice)" or before "=" now goes as written; such text reads
as code to this rule. A name under 8 bytes was never matched as known,
so for those only the "User:" half changes anything.
Tests (identname_test.go), with "developer" (a common word) and
"rinakato" (a handle), known from a working directory first:
- TestUserNameInCodeIsNoUserName: a Python and a JS file read, a JSON
file, Go code, a diff and an edit tool call's arguments go as written;
a home path, --author=, ls -l, uid=501(), prose, a quoted string, a
JSON value, chown and a bash tool call's ~name go as the made-up name.
- TestUserLineInCodeIsNoUserName: seven code lines unmasked; User:
deploy_bot, USER=rinak, user: "current_user", ssh config's User and
user = john_doe masked.
Broken by hand: with more.go and known.go as on main both tests are red
(12 and 7 failures); with standsAlone's USERNAME case returning true,
TestUserNameInCodeIsNoUserName alone is red.
Run at this head (on origin/main 89ffc58f5; nothing since touches
internal/redact or the doc), on mote:
- gofmt -l clean; go vet ./internal/redact ./internal/masking, and
GOOS=linux -tags nogui and GOOS=windows go vet ./internal/redact: clean.
- go test ./internal/redact ./internal/masking ./internal/otlp
./internal/pii ./internal/sessions ./internal/settings: ok.
- go test ./internal/gateway -run '(?i)mask|redact|privacy|personal|
standin|restore': ok.
- go test ./internal/gui: TestMainWindowCorners/macOS_26_SDK red, the
AppKit title bar on mote's macOS 27 (#3949, open); nothing else.
Not tried: the full internal/gateway package and go test ./... (the
gateway takes ~45 min; pushed at once per the owner's ship rule); the
local model's PERSON finds, which already leave snake_case and
lower-case words (modelTakes, programWords); the home rule's
"/home/<segment>" in a web route ('/home/dashboard'), which reads as a
home folder and is unchanged; a real request with the reporter's code.
|
||
|
|
a8e98e1abb |
gateway: a Claude Code run that exits mid-reply is a failure, not a 200 (#4822)
A Claude subscription run whose Claude Code exited after its reply began, with no message_stop nor a result (only the message_start, or part of the text), closed its segment as if the reply had ended. The client was answered 200 with nothing or the words so far, and the agent took it as a finished turn. - readOutput: at the end of Claude Code's output, a reply begun on the open segment (KStart, tracked in emit as unended until a KStop or KError) ends with a KError, 502, "Claude Code exited before it ended its reply" and the end of its stderr. -p and the interactive mode share this path. - relay, not streamed: any error is a status, words said before it too (was: a 200 with the partial reply), as a translated reply cut short is (errEndedShort). The try's usage is kept as before ( |
||
|
|
89ffc58f5b |
gui: a card's Refresh says the read's failure, and Claude Code's first-run screens say what to do (#4817, uiuing)
From uiuing's branch (1eeb8928b, 66818dbf6), adapted. A usage card's
Refresh showed nothing when the read came back as a card with an
error: only a thrown request reached status. quotaRefresh now says the
refreshed card's error through quotaError, for a single account and
for a provider whose cards were replaced (the one kept in quotas).
quotaError reads the helper's new "stays on its first-run screens" and
an older magpie's "shows its first-run notes" as "Finish Claude Code's
first-run setup, then refresh", in en, zh, zh-TW, ja and de. Comments in
quotaError and quotaRefresh were cut so the core scripts stay in their
budget (1,533,732 of 1,533,802; main was at 1,533,780), with no raise.
Run at the pushed head, on mote: node --test of claude-quota-onboarding,
quota-refresh-order, usage-card-refresh, usage-refresh,
usage-refresh-flight, account-refresh, editor-quota-quiet,
usage-no-reading, usage-remote-cards, tray-usages, glm-quota-error,
claude-usage-asked, allowance-open-read, api-key-usage,
key-balance-card, copilot-signed-out-account, signin-again, plugin-git
and i18n-keys (chromium and webkit, every language each file runs, 440px
where it sets it): 287 of 287.
go test -run 'Budget|I18n|Lang' ./internal/gui ok.
go test -run "Claude|TUI" ./internal/gateway ok. The full
./internal/gateway (-timeout 45m, before the rebase onto
|
||
|
|
af4ff747bc |
claudetui: Claude Code's first-run screens are gone through as a person would, not the run's end (#4817, steven_4422 on Discord)
With "runs as" Interactive, a Claude Code whose onboarding was never finished (no hasCompletedOnboarding in the state file: steven_4422's every request 502'd, uiuing's /usage read in #4817) stopped on the "Security notes" screen, and |
||
|
|
62ffc40169 |
gateway: a waiting request goes to an account back from rest (01huadalang)
01huadalang on Discord (11-01): three ZCode accounts, three requests at once each. The first two got a 405 and rested, so every request went to the third, and those over its three waited in its lane. Once the first two were back, the waiting ones stayed on the third, behind its long turns, until its requests were cut by hand. Same under Smart, In turn and Stays off. Cause: a request that queued in a lane (lanes.take) waited only for that lane's turn. Nothing looked again when another lane gave a slot back or a rest ended. With ZCode's maxAccounts 2, the third took a seat while the first two rested and was a reserve again once they were back, but the requests already waiting for it stayed. laneMate also gave way to a mate resting, because ready() checks only lane and RPM room. Change: - lanes.take takes a move func. While waiting (lanes.await), it looks again when any lane gives a slot back, when a rest is lifted (Unrest, UnrestAll signal lanes.freed), when the soonest rest among the others ends, and at least every 5s (laneRecheck). waitMate finds the first candidate after it in the planned order (then those probeOne left out for resting) of the same provider, or any member of a group, that has a free slot with no queue (tryTake), minute room, isn't resting, didn't give way, and isn't a reserve as keepAtOnce stands now. The request then leaves its queue (errMoved) and serve runs that candidate with the slot already taken for it. A fallback provider is never one. Strict stays leave no other candidate, so nothing changes there. - laneMate skips resting mates. - docs/subsystems/gateway-routing.md Limits row says so. Tests: - TestWaitingRequestGoesToAccountBackFromRest: 3 keys, cap 3, MaxAccounts 2, k1 and k2 resting (405), 9 requests. 3 go to k3, 6 wait for it, and none reach the resting two. Then the rests are lifted (Unrest) or run out (300ms), and the six go to k1 and k2 while k3's three are still out (9 at once). Run under Smart and Rotate, with Stays default and off. - TestWaitingRequestTakesSlotGivenBackElsewhere: 2 keys, cap 1. A third request waiting for one key goes to the other when that one's request ends, under default, order, rotate and usage routing. - TestFullMemberGivesWay updated. c, waiting for first, now goes to second once second's b ends. d (first's fallback is second) still waits for first. Run on mote (mote-run), rebased on |
||
|
|
6b3a6d42c0 |
agent: VS Code's Agents window (vscode_agent_host) counts as VS Code, its turns as Codex's
justruman on Discord (#general, 11-01): VS Code's Agents window showed
in Usage as a raw "vscode_agent_host" row, 23 calls, 7 failed, beside
the "VS Code" row.
Why: VS Code's agent host runs `codex app-server` with clientInfo
{name: "vscode_agent_host"} (microsoft/vscode main at 8fb6054,
src/vs/platform/agentHost/node/codex/codexAgent.ts CLIENT_INFO; it
bundles @openai/codex 0.163.0). Codex sends that name as its
originator and at the head of its User-Agent, and it reads the user's
~/.codex config, so with Codex connected to magpie its turns come here
under VS Code's name. No agent's UA list had it.
- Usage: vscode_agent_host is in VS Code's UA list
(vscodeAgentHostUA), so those calls are VS Code's. Records are named
again at read time (ReportedAs -> AgentOf), so calls already logged
under the raw name fold into VS Code too. Insiders' and VSCodium's
agent host send the same name and are counted as VS Code (Stable):
nothing in the request tells them apart.
- Routing: fromCodex also takes vscode_agent_host (hostedCodex), so
every Codex rule holds for those turns. The one that fails without
it: one of Codex's own models asked there, which no account in
magpie serves, was answered 404 "magpie knows no model" instead of
going on Codex's sign-in (codexOwnOffMagpie). Also now applied:
spawn_agent's model list, compaction told in the stream on a byte
cap/overflow, Codex's headers to a keyed Codex-only relay.
- A test asked as Codex keeps only Codex's own names (codexNamed) as
Codex's shape: the agent host's headers never become it.
- VS Code's Copilot-proxied names (vscode_codex, vscode_claude_code) go
to GitHub, not magpie, and are not matched.
- docs/subsystems/gateway-routing.md says so.
Run on mote at this change rebased on origin/main 16ce5ed23; the
one commit since,
|
||
|
|
e65bc84731 |
plugins: a git plugin updated past the commit the look found waits no more (#4802)
matrix0487 (Discord, #4802): github:faithleysath/magpie-oh-my-aihub, unpinned. The look at 14:38:55 wrote {version: fdaa691, latest: 3b411a5}; the repository moved on to ba898e7 twenty seconds later, and Update installed ba898e7. The dot, "Update all (1)" and the row's New commits stayed until the next hourly look, and every Update after said only "is up to date". Cause (checked against the source, as the reporter traced it): - PendingUpdates kept a git entry until the commit installed was the recorded latest (GitBehind is installed != head, not "behind"), so a commit newer than latest kept it forever. The npm branch compares versions in order and was right. - Upgrade, Update and add never touched plugin-updates.json; only the next CheckUpdates/CheckNow rewrote it. - The page kept /api/plugins/git's old head (3b411a5) in its heads map, and merge() put it over the plugins' own fresher head after the update, so the row's New commits and Update all stayed even with the file right. Changes: - waitsNoMore (shared by PendingUpdates and the new settleWaiting): a git entry also waits no more once the commit installed is not the one the look saw installed (Version). - settleWaiting rewrites plugin-updates.json without what waits no more, after add (every install, npm Upgrade, Update's pinned path), a git Upgrade, Update (Update all) and InstallMissing. Checked time is kept. - reinstall's #2954 "left it at X" error now needs the commit to have stayed: a moved install that can't ask the repository again (rate limit, offline) isn't reported as stuck on the look's older head. - plugins.js: an action on a plugin (Update all: on every one) drops the page's cached head for it, so the plugins' own head is drawn; a git Update whose commit moved says "{name} updated to {commit}" (zh, zh-TW, ja, de), and the Up to date chip's tooltip prefers the row's head over the check's. Siblings: npm (version order already right; now also rewritten on file), a commit pin (dropped once at the pin: test case), Update all (same flow as Upgrade: test case), the toast (above). CheckNow/CheckUpdates rewrite the file as before. Tests (reporter's literal fdaa691 / 3b411a5 / ba898e7): - TestGitWaitingGoneOnceUpdatedPastTheLook: installed ba898e7, 3b411a5, another commit, still fdaa691 (waits), and a pinned spec. - TestSettleWaitingRewritesTheRecord: git + npm entries gone from the file. - TestGitUpdatePastTheLookWaitsNoMore: fake bun + fake GitHub; look, push, then Upgrade / Update / Upgrade with GitHub down after; nothing waits on file or in PendingUpdates, and the update isn't an error. - plugin-git.test.cjs: the repository moves on after Check for updates; Update installs ba898e7, no New commits, no Update all, toast names it. Run at the pushed head (rebased on |
||
|
|
16ce5ed232 |
usage: an account whose longer window is used up adds no headroom to the all-accounts sum (#4791)
hayden4608 (Discord) and handong66 (#4791) have four Codex accounts. Three show 5 hours 100% left with 7 days 0% left, and one shows 5 hours 0% left with 7 days 22% left. The All accounts strip read "5 hours 75% left", but none of those three can spend its 5 hours until its week starts again. The right figure is 0%. mergeQuotas (quotaall.js) is the one place that sums windows across accounts. It feeds the Usage page's strip, the tray panel's strip and the Routing groups' line. The native menu-bar tray, the TUI, the CLI and /v1/magpie/quotas show one account at a time and are unchanged. The GUI's JSON doesn't carry Aside, Model or the matches, so the call is made in Go. provider.WithHeldWindows marks a window heldBy another window of the same account when that other window: - stops the account for every model, by routing's rule: not aside, no model, no matches, used >= 100, reset not passed, and not Codex credits that go on; and - starts again after this one (by reset times, else by span). So 7 days used up holds 5 hours, but 5 hours used up doesn't hold a week with 22% left. /api/usage/quotas and its refresh apply it. mergeQuotas counts a held share window as 100 used and a held counted one as its limit, and the strip's tooltip says how many were counted that way (en/zh/zh-TW/ja/de). The account cards still show the vendor's own figure. Run on mote (macOS) at this head's parent tree: - go vet for darwin, linux (nogui) and windows: ok; gofmt -l: none. - go test -count=1 ./internal/provider ./internal/gui, before the quota_span leftOut line and an i18n comment fix. The provider package's only red was TestQuotaSpanCarriesEveryWindowField, which wanted heldBy named, and it is now named. internal/gui's only red was TestMainWindowCorners/macOS_26_SDK, which is #3949. - GUI, chromium and webkit, every language, 440px and 360px: quota-*, usage-* (all-accounts, merge, accounts, fold, refresh and more), panel-usage/quota/switch-accounts/balance-order, routing-quota-left, routing-group, tray-usage, i18n-keys, gui-de/ja/zh-tw, old-webkit: 704 of 707. The reds were i18n-keys (a quoted "All accounts" in window_held.go's comment, fixed here) and usage-fold's "17 subscriptions and 29 accounts" in both engines, which is #4790 and is red at origin/main too (see below). At the pushed head, rebased on |
||
|
|
99d9016fd9 |
provider: Devin's mover min is 0.1.32, so a system notice mid-conversation keeps its place (plugins #599)
devin 0.1.32 (plugins 17525a7, leosocy) sends a role:"system" notice that comes partway through a conversation as a user prompt, in its place and with its cache mark. Before, the notice was lost. A notice that arrives while tool calls are still waiting for results goes after those results. keepMovedCurrent now updates every moved Devin user to it. npm has 0.1.32: npm view --prefer-online @magpie-community/opencode-devin-auth version. Run on mote at this tree: gofmt clean; go vet ./internal/provider on darwin, linux (nogui) and windows; go test -count=1 ./internal/provider ok. In the plugins repo, at 647039a merged with main: bun test packages/devin 182 pass, and 4 of the new tests fail on the old index.mjs. Not tried: a real Devin account. |
||
|
|
eb3b9376ea |
plugin load: a model listed by another id gets its plugin's load (axelburks)
axelburks on Discord: a plugin reports a model's load through
input.magpie.load by its own model id. A model the user lists in magpie
under another id (Listed as, settings' ModelIDs) showed no load on the
Providers page, and with Busy models last on it was never judged busy;
models whose id wasn't changed worked. The reporter's reading was right:
plugin.ModelLoad keeps the load by the plugin's id and both callers asked
it by the listed one.
Both call sites of plugin.ModelLoad (grep: there are only two) now map the
listed id back through Provider.OwnModelID first:
- internal/gui/providers.go providerInfoWith (models[].load), which
already computed OwnModelID for models[].vendor; it is now read once
and used for both.
- internal/gateway/fallback.go busyOf (restLast's busy ordering and the
trace's busy).
A listed id whose own id is a model@size (grok -> grok-4.7@256k) still
falls back to the model's load inside ModelLoad. The provider-plugins
subsystem page says the lookup is by the plugin's own id.
Tests:
- internal/gui TestModelLoadListedAsAnotherID: a plugin provider with
fast -> big and grok -> grok-4.7@256k listed, loads noted for big,
grok-4.7 and small; models[].load must be 87.4 / 60 / 12 for fast /
grok / small and absent for quiet.
- internal/gateway TestBusyModelListedAsAnotherID: busyOf at 80 judges
fast, grok and big busy, and an unreported model not.
Run at the pushed head on mote (mote-run):
- at base
|
||
|
|
d2a83de612 |
gateway: a try billed before it failed and handed on keeps its usage row
A Claude subscription run that fails after Anthropic's message_start
(an overload, a dropped connection, a cut stream Claude Code gave up on)
is a 502 so another account can take over. That account is a new Claude
Code told the whole conversation, and writes it to its own cache again.
The first try's usage was dropped twice over: relay threw away the reply
start's usage on that path, and serve wrote a usage row only for the
request's last try (and for refusals). The Usage page counted the second
account's tokens alone, with "2 tries" on the row as the only sign that
the conversation went out twice (hhxk233 and Kayrainforest on X).
- relay keeps the usage of the head's KStart/KUsage events on a failure
before content (streamed), and the collector's usage (not streamed).
- serve writes a handed_on row for any failed try that billed something
and handed the request on, to another account or member or the same
one again. The row is written when the next try begins. The refusal
and turned-away paths keep their own row, and a failure that billed
nothing still has none. Totals count a handed_on row's tokens, not a
request, as for refusals. The Usage page already shows such a row as
"<status> · handed on" with its tooltip in every language.
No same-account double send was found: a fake Claude Code breaking its
stream in nine ways (error before or after message_start, a 529 or 500
result, a cut then an error or an exit, text then an error or an exit),
streamed and not, starts one run per account at most. A failure before
content goes on to the spare once. A failure after text ends the
request with no other run.
Run, at this tree on origin/main
|
||
|
|
de7953e3b8 |
browser: browser_evaluate calls an async()=> function and awaits it
The check that tells a function from an expression wanted a space after
async, so `async()=>{…}` was evaluated as an expression: the function
itself came back, serialized as {}, and its body never ran. And a
parameter list could hold parentheses, so `(async()=>{…})()` counted as
a function and its promise was called ("is not a function"). async may
now touch its parameters, and a parameter list holds no parentheses.
The extension goes to 0.1.2.
Found driving X through magpie-browser from Claude Code.
Run on mote (Chrome for Testing 1234):
- MAGPIE_BROWSER_CHROME=… go test ./internal/gateway -run
'TestBrowser.*InARealBrowser' -count=1: ok (46.5s). Five new evaluate
cases: async()=>, async () =>, async function, an async IIFE and
Promise.resolve, each answering "awaited".
- Broken by hand: with origin/main's background.js the test is red at
the first case (async()=>… doesn't say "awaited").
- go test ./internal/browserext: ok. gofmt -l: clean.
Not run: the full suite; not tried in Edge or Firefox.
|
||
|
|
ccd746e039 |
claude: /usage is read in the interactive mode, typed in it, not through -p
With the interactive mode on, the plan's allowance (the Claude account's
usage card) was still read by `claude -p /usage`, the one -p run left
beside a request. Claude Code 2.1.316's -p /usage also tells only the
session's cost, no window. Now claudeUsage, with claudeTUIOn, runs the
interactive mode's helper (claudeUsageTUI) and gives it a line
{"type":"command","command":"/usage"}. The helper types /usage, waits for
the panel to settle (a "N% used" and a second without change, or three
seconds of anything else, 20s at most), closes it with Esc, and tells
what was drawn as -p's lines say it (usageText: "Current session: 0% used
· resets 5am (Asia/Shanghai)"), so parseClaudeUsage reads it unchanged.
No model is asked. The helper types no other command. The machine
reasons a request is refused for (no shim, OS, missing, off) refuse the
read the same way. Turned off, -p runs it as before.
Run (mote, at this tree on origin/main
|
||
|
|
a25d3d0815 |
claude: a JSON schema is answered in the interactive mode, through an answer tool
With the interactive mode on, a request with a JSON schema was refused
with a 400 since v0.1.2592: interactive Claude Code takes --json-schema and does nothing
with it, its StructuredOutput tool being -p's alone. It now runs in the
interactive mode like any other request.
- serveClaudeSubscription compiles the schema (santhosh-tekuri/jsonschema
v6.0.3, draft-07 unless it says otherwise, as -p reads one; a $ref
outside the schema is refused, never fetched) and adds an answer tool,
StructuredOutput or a numbered name apart from the client's tools, with
the schema as its input schema, through the bridge's MCP server. A
schema that can't be compiled is a 400 before any run.
- mcpCall checks each call against the schema: one that doesn't fit is
told why (isError) to be made again, as -p's is; one that fits is kept.
- At the turn's result the kept input is the reply's structured output.
A turn that ended with no call is told once to call the tool, and
fails "no answer fitting the schema" if it still doesn't. Neither the
call nor the words around it reach the client.
- claudePrint no longer lists the schema. The two refusal tests
(TestClaudeTUIOnRefusesPrint, TestClaudeTUIRefusalIsNoAccountsFault)
now use the case that is still refused before any run: an image by
its URL that can't be downloaded (127.0.0.1, which magpie never
fetches).
- The provider editor's card no longer says -p takes "a JSON schema"
the interactive mode can't (en, zh-CN, zh-TW, ja, de).
- docs/subsystems/claude-subscription-bridge.md: the refusal list, and
how a schema is answered.
Run:
- A real run, haiku, the test account in a sandbox HOME, real Claude
Code 2.1.316 through the helper with --json-schema and a stdio MCP
server named magpie serving the answer tool and its description: the
result's structured_output was null (the premise), and the model
called mcp__magpie__StructuredOutput at once with
{"color":"Sky blue","hex":"#87CEEB"}, which fits the schema's
pattern. 7.2s, one turn. Not run: the whole gateway path with a real
account (the unit tests drive it with Claude Code's real transcript
rows).
- mote, at this tree (base
|
||
|
|
14e3513780 |
claude: Claude Code in WSL runs interactively when Windows can't read its transcripts
With the interactive mode on, Claude Code in WSL was refused with a 502
in two cases: the distro user's own folder unreadable from Windows
(\\wsl$ needs the 9P redirector, which a session over ssh hasn't;
"wslread") and a distro whose home the probe didn't find ("wsl-home").
Both now run interactively: the helper reads the transcript inside the
distro.
- claudetui/wslread.go: before Claude Code starts, a shell run through
wsl.exe notes how much of $HOME/.claude/projects/*/<sid>.jsonl is
there (a resumed session's earlier turns), says "ready", then tail -F's
the rest; the helper copies it to a file of its own and tails that as
any transcript. When Claude Code ends it waits for the copy to stop
growing (settle), then closes the shell's stdin, which ends it.
- claudetui.WSL gets Distro (Projects omitempty); the gateway's tuiWSL
sets it when Windows can't read the folder or the home is unknown.
- the wslread and wsl-home refusals are gone (claudeTUI, claudeWhy,
claudeNotTUIWhy); the GUI's "wsl-home" reason and its 4 strings too.
- docs/subsystems/claude-subscription-bridge.md says how it is read.
Run, at origin/main
|
||
|
|
2739626c38 |
provider: the ZCode mover's min is 0.1.41, nothing to claim is asked again in half an hour (plugins#600)
zcode 0.1.41 (magpie-community/plugins#600) gives a daily claim that
found no gift plan an `until` half an hour out, so magpie asks again
through the day and a plan ZCode drops into its feed later (the weekend
plan from 19:00 Beijing) is still claimed. keepMovedCurrent now updates
every moved user's plugin to it.
npm view @magpie-community/opencode-zcode-auth version --prefer-online
--registry https://registry.npmjs.org: 0.1.41, checked when this landed.
Run on mote (mote-run) at base
|
||
|
|
ff65ebd142 |
provider: Zed's plugin is 0.1.14 at least: a Gemini model's efforts are keyed lowercase and its thinking level goes to Zed uppercase (plugins#215)
Zed's /models now lists a Gemini model's supported_effort_levels
uppercase (LOW/MEDIUM/HIGH), so the plugin keyed its variants LOW and
magpie's pi profile, which maps efforts by key, marked every thinking
level unsupported for zed/gemini-* (Yezike-yyy on plugins#215). And a
thinking level reached Zed lowercase, which its serde enum refuses:
400 "unknown variant `low`, expected one of `MINIMAL`, `LOW`,
`MEDIUM`, `HIGH`" (iron-water, plugins#215). zed 0.1.14
(magpie-community/plugins 3618bf9, from ump45nose's #587) keys the
variants lowercase whatever case /models uses and uppercases the level
only on the wire. The mover's min is raised to it, so keepMovedCurrent
updates every moved user.
npm view @magpie-community/opencode-zed-auth version --prefer-online:
0.1.14 at landing.
Run on mote at
|
||
|
|
59fdab0af7 |
gateway: a caller's folder the user hasn't trusted runs in magpie's, not a 502 (lwjef on X)
lwjef (X, 2116867007799030000): a cwd Claude Code hasn't trusted hangs the interactive-mode bridge (paseo chat). Cause: in the user's own account the helper leaves the trust question to the user (no MAGPIE_CLAUDE_TUI_TRUST) and ends at once saying so. Up to 11-01 that run became -p; since |
||
|
|
bee3ea6753 |
claudetui: the first message waits for Claude Code to list magpie's tools (MinhuWang on X)
MinhuWang (X, 2116836405548916907): in the interactive mode the first
message can go before MCP has loaded, and then has none of pi's tools.
Cause: the helper's ready() took the drawn "❯ " prompt as ready. Claude
Code connects its MCP servers beside the prompt, so a message pasted at
once was answered with no mcp__magpie__ tools. Reproduced with the real
Claude Code 2.1.309 (sandbox HOME, a copy of the owner's account): an MCP
server held 8s before answering initialize got "NOTOOL" for "what is the
secret word, use your tool".
Fix: startRun gives claude-mcp-helper a third argument, a `listed` file in
the run's temp folder, which RunMCP writes after it has answered
tools/list. The helper finds that path in the run's --mcp-config
(mcpListed) and ready() waits for it as well as the prompt, inside the
same ReadyWait (45s); past it the run ends saying the tools weren't
listed. Runs without that server (warm-up, model test) don't wait.
Run (mote, at this tree):
- go test ./internal/claudetui ./internal/claudebridge: ok
- go test -run 'Claude|MCP|Bridge' ./internal/gateway: ok
- real Claude Code 2.1.309 here, a sandbox HOME with a copy of the
account's credentials, the new helper and the real claude-mcp-helper
behind an 8s sleep: initialize answered at 12.7s, the first turn called
mcp__magpie__pi_secret and answered "The secret word is PELICAN".
Without the sleep: answered at 2.1s, same answer. 2.1.309 sends
server/discover before initialize; the helper's method-not-found answer
is taken and initialize follows.
Broken by hand: toolsListed returning true made
TestShimFirstMessageWaitsForTools red ("echo: hello (without magpie's
tools)"); RunMCP not writing the file made TestToolsListedFileWritten
red.
Not tried: Claude Code in WSL (the path is the gateway's Windows temp
path, handed to magpie.exe as the callback path is); a Claude Code that
lists tools only on its first request (2.1.309 lists them at start),
which would now wait 45s and fail saying so instead of answering
without tools; the full gateway suite (run after the next commits).
|
||
|
|
79f83798fd |
kiro: the mover installs 0.1.25, which shows bonus credits on the Usage card (plugins#602)
kiro 0.1.25 is on registry.npmjs.org (npm view --registry https://registry.npmjs.org: 0.1.25, shasum 00882472feb467e0ecb59da3c364bda423c5f12f). It is plugins#602 (GiantGKL), squash-merged as 6053811 in magpie-community/plugins: bonus credits (a first upgrade's 500 trial credits, a promotion's) show as aside windows of their own, with when they lapse, and a month used up while a bonus has credits left is shown only too, since Kiro spends the plan's credits first. keepMovedCurrent brings every moved Kiro user to it. Run on mote: - at |
||
|
|
8569f39f6c |
agent: Claude Code's /model hides its own lineup while magpie's list is narrowed
yyhhyyyyyy on Discord picked only a routing group's models for Claude Code
on the Agents page, and Claude Code's /model still listed a model they had
not picked. Real Claude Code 2.1.316 in a sandbox HOME, with the settings
magpie writes, lists: Default, the group (as Custom Opus), Claude Code's
built-in "Fable 5.1" row, then the group as Sonnet and Haiku, then
magpie's modelPicker rows. The Fable row is Claude Code's own lineup.
magpie leaves ANTHROPIC_DEFAULT_FABLE_MODEL unset for a main model that
isn't a Fable (#2090), so Claude Code shows its own Fable there. The
gateway's /v1/models already follows the picks (CatalogFor), and Claude
Code's gateway discovery is off unless
CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY is set. Neither of those is
where the row comes from.
Claude Code's documented modelPicker.replaceBuiltInOptions hides the
lineup and leaves Default and magpie's rows. In the same sandbox, the
same settings with the flag set list exactly those rows. magpie already
set the flag while "Show Claude Code's own models" is off (#4548). It now
also sets it while Claude Code's list leaves out some of magpie's
catalog: only the picked models, some taken out one by one, or a
visibility of families (claudeNarrowed, CatalogFor's hidden list). A
change to the picks already rewrites settings.json through
catalog.Touched and Sync.
The user's own values:
- A user's ANTHROPIC_CUSTOM_MODEL_OPTION, in the settings env or the
shell, keeps the lineup. The flag would hide that row too.
- availableModels was not used. It also hid the Fable row in the
sandbox, but it is the user's key, it blocks --model, and it is meant
for enforcement.
Run at this head (rebased on origin/main
|
||
|
|
2f4c088dce |
usage: Warm up on a Codex or Claude account's card whose 5 hours haven't started
01huadalang on Discord looked for a way to start one account's 5-hour
countdown on the Usage page, not in Settings. A Codex or Claude account
card whose 5-hour window isn't running now has a Warm up (预热) button on
its account line. It sends the request Settings › Warm-up's Warm up now
sends (POST /api/warm-now {agent, user}), to that account alone: for a
ChatGPT account the scheduled warm-up's one "hi" with the account's own
sign-in, on its cheapest model at low effort (warmModel); for a Claude
account Claude Code's own run on haiku (WarmClaudeVia), so magpie sends
nothing that imitates Claude Code. No new server code.
When it shows: the account is one magpie is signed in to (codexUsers /
claudeUsers), its read has no error, and its 5-hour window is idle as the
scheduled warm-up tells it (idle in codex_warmup.go): nothing used and the
reset a whole window away (within warmSlack), or the reset gone by. A
Claude account never used has no window read and shows it too, as
claudeWindowsExpected fills in; a Codex account with no 5-hour window
doesn't. While the request is out the button is disabled (busy), so a
second press sends nothing; once it went, the account's button stays away
for warmSlack (10 minutes), the time a just-started window still reads as
idle, and the quotas are read again (the server marks the account stale).
Refused, the vendor's reason goes in the status line and the button
comes back. Words in en, zh, zh-TW, ja, de (the tooltip is new; the
button and status lines reuse Warm up now's).
Run (at the head before the last rebase onto
|
||
|
|
09d5dfb87b |
gateway: aliased and magpieAliasAsked read one alias parser (#4667)
magpieAliasAsked copied aliased's four prefixes; a fifth form added to one would leave the other behind. Both now read aliasDigits. Run: targeted alias/member/desktop/science tests, gofmt, vet x3 (mote). |
||
|
|
3d64d6c52f |
gateway: a reply to one of magpie's own aliases keeps the vendor's model name (#4667)
leizh007: with Claude Code Desktop served through magpie, ccusage counted the model as "magpie-2213244526.anthropic…" from the 11-01 release on; before it said the subscription's own "opus-5-5". The asked-name rule ( |
||
|
|
567b648bd8 |
gateway: test #4445 on the reporter's route, Codex's ChatGPT backend path
The reporter's turn came to magpie's /backend-api/codex/responses, with
the Model Map plugin naming remote-magpie/codex/gpt-6.1-sol; the patch's
test asked on /v1/responses only. TestRemoteMagpieCodexModelKeepsLiteOnCodexPath
asks the same Lite request on CodexPath.
Run (mote, at this tree, -tags nogui):
- go test -run TestRemoteMagpie ./internal/gateway: ok
- with additional_tools.go and gateway.go put back as on origin/main, the
new test is red with the report's 400 ("Office:
X-OpenAI-Internal-Codex-Responses-Lite requires `reasoning.context` to
be `all_turns`."), as is the patch's own /v1 test.
|
||
|
|
1ff928139d |
gateway: a remote magpie's codex model gets Codex's Responses Lite as it was sent (#4445)
What changed: a Codex Desktop turn on one of its own Lite models (gpt-6.1-sol) routed through Model Map to a Remote Magpie provider answered 400 "Remote magpie: Codex: X-OpenAI-Internal-Codex-Responses-Lite requires `reasoning.context` to be `all_turns`". liteKept treats a Remote Magpie like any plain Responses upstream, so passthrough ran fromLite (the additional_tools item lifted into tools, reasoning.context taken off) and forwardOnce dropped the Lite header. The remote serves codex/<model> through its ChatGPT account, which passes on what it got, and the ChatGPT backend refuses a request for one of its Lite models without reasoning context "all_turns" (#534): the request arrived stripped of exactly what that model demands. Had it gone as Codex sent it, the remote's account path keeps the Lite shape (liteKept true there) and its answer is 200, as the reporter's codex=as-sent workaround showed. liteKept now also keeps the shape, with the model it is asked for: a Remote Magpie's codex model, named codex/<model> — the ChatGPT account's namespace in every magpie's catalog, so the remote lists one only when that account is there to serve it. Its other models still get what Codex sends a model that isn't Lite (#350), header and reasoning context included in the lift (#350, TangForX). Run: go test -tags nogui -run 'TestRemoteMagpieCodexModelKeepsLite| TestRemoteMagpieOtherModelLeavesLite' ./internal/gateway/ — the first failed with the 400 above before the change and passes after; the second keeps the old behavior. go test -tags nogui ./internal/gateway/ passes. Fixes #4445 Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
6de04a26e2 |
gateway: a Codex memory call on its own bare name follows the session when a provider serves a model under that name too (#4765)
raphael-y7: with magpie as Codex's model provider, the conversation on orbis/gpt-6.1-sol, Codex's memory consolidation — its own background request on its own default consolidation model, asked by its bare name gpt-5.6-terra — went to workbuddy-ai, the only provider of magpie's with a model under that name, and the account it landed on refused it: 400 "model [gpt-5.6-terra] is not allowed for user type [personal_free_user]", three tries, 8.5s, and the memory was never written. The bare name resolved, so codexMemoryStandIn (#742) left the call where it stood; a model of Codex's own asked by its bare name is not a pick of whichever provider has one under that name. Now a memory call whose bare name resolves still follows the conversation's model, as it does on the ChatGPT backend's path (codexFollowTo), when Codex's config names no model for its memories: codexMemoryStandIn asks codexMemorySession first and only falls through to the name's own resolution when there is none to follow. What keeps going as the name resolves: any other call, a model Codex's config names (the user's own pick, a full id or a bare name), a config magpie can't read, and a conversation magpie has no model of (on Codex's own, or nothing answered yet). What this doesn't change: the three tries on a capability refusal, and the model catalog's exposure of a model an account can't serve — the reporter's other two suggestions, both a bigger cut; the auto-review's codex-auto-review and the app's title, description and summary calls, whose as-Codex-sent default is deliberate (codexTitlesTo, codexSideTo; shruru counts a provider serving a luna-named model picking titles up as a feature, #4590). TestCodexMemoryOnACollidingBareNameFollowsTheSession: a provider with a model under gpt-5.6-terra, the conversation on another provider's — the memory call followed the conversation and the named provider got nothing (red before: it got the memory); the config's pick and a plain turn on the name still go to it. Run (darwin arm64, -tags nogui): - go test -tags nogui -run 'TestCodexMemoryOnACollidingBareNameFollowsTheSession|TestCodexMemoryCallsGoWhereItsTurnsGo|TestCodexMemoryStandInFollowsTheSwitch|TestCodexMemoriesFollowTheSession|TestCodexSideCallsKeepTheConfigsModel|TestCodexSideCallsBeforeTheFirstTurnFollowTheSwitch|TestCodexOwnModelOnMagpieThreadGoesOnSignIn' ./internal/gateway: ok (the new test was red before the fix, with the report's routing) Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
206efc90c8 |
gateway: a Codex side call with no setting still goes on Codex's sign-in (#4590 review)
e99e75dab took every side call on one of Codex's own models (title, description, summary, prediction) off Codex's ChatGPT sign-in. With no setting naming a model, codexTitlesTo and its siblings hand back the bare model Codex asked for, which magpie serves nothing for: a user signed in to ChatGPT whose titles worked through the sign-in got "magpie knows no model \"gpt-6.1-sol\"" 404 for every title, description, summary and prediction. A thread's summary has no setting at all, so it always went that way. Now only a side call whose setting names where it goes (CodexTitles, CodexDescriptions, CodexPredictions: a model or "off") stays off the sign-in (codexSideSet); without one it goes on the sign-in as before. Run (mote, at this tree, -tags nogui): - TestCodexSideCallOnOwnModelUnsetGoesOnSignIn (new: signed in, no setting, each of the four kinds): red on e99e75dab, the 404 above for all four; green now. - go test -run 'TestCodexSideCallOnOwnModel|TestCodexOwnModelOnMagpieThread| TestCodexTitlesSetting|TestCodexTitleOnMagpieProvider| TestCodexDescriptionsSetting|TestCodexDescriptionFallbackOnMagpie| TestCodexPrediction|TestCodexSummar' ./internal/gateway: ok - broken by hand: codexSideSet always false turns gua's TestCodexSideCallOnOwnModelNotPutOnSignIn red (the reporter's 404); always true turns the new test red. |
||
|
|
50e8da4c34 |
gateway: Codex side calls on its own models stay with magpie, not its sign-in (#4590)
shruru: with magpie as Codex's model provider, picking any model in the Codex titles setting never took: the thread's title stayed the first message's truncation, and a request for gpt-5.6-luna, Codex's own title model, to /v1/responses was answered 404 "is one of Codex's own models... open ~/.codex/auth.json: no such file or directory". A thread started while magpie was Codex's provider sends to magpie's /v1 (model_providers.magpie's base_url is magpie's /v1), and since |
||
|
|
37d7913c20 |
claude: the interactive mode is given an earlier conversation as a transcript
A conversation no run has (a run lost to an update, a client's own history) was told to a new Claude Code in its interactive mode as one first message, pasted. #4778's 229 messages and 3 images that way were refused; #4780's 56 messages and 25 images were pasted one by one until the paste timed out, and the request got a 502 or an empty reply. Now, when the conversation has a reply that calls no tool, replaySession writes it as Claude Code's own transcript: a session file in the project folder Claude Code reads, a user line holding the conversation before that reply (as renderClaudePrompt tells it, images as image blocks, client cache marks out) and an assistant line holding the reply's words. The run starts with --resume on it, as a saved session's run does, and is typed only the turns after the reply. If Claude Code can't go on from it, start tries once more told whole (req.told). -p (interactive mode off), WSL (no session folder) and a conversation with no such reply are told whole as before. The file goes in the folder of the work path with its links followed: the first try wrote it beside the unresolved /var/folders path on a Mac, and the replay test was red on mote for it. Real run (this Mac, sandbox HOME and CLAUDE_CONFIG_DIR, one of the owner's real Claude accounts by CLAUDE_CODE_OAUTH_TOKEN, real Claude Code 2.1.316 through magpie claude-tui-helper, -p stream-json in, the interactive mode under it, --model haiku): the transcript was made by replaySession itself (a throwaway test on mote, not committed) from 6 earlier messages with 3 images (red, blue, green 64x64 PNGs) and a 455KB file whose line 004321 names a fruit, 464,798 bytes; the work folder was reached through a symlink. Typed only "Name the colours of images A, B and C, and the secret fruit named in line 004321 of the file. One line." Answer in 8.4s: "A: red, B: blue, C: green; secret fruit in line 004321: PAPAYA." Claude Code appended to the same session file (504,788 bytes after). Run (mote, at this tree, rebased on |
||
|
|
949000a36a |
claude: a request the interactive mode refuses is a 400 no account rests for
A request Claude Code's interactive mode can't take (a JSON schema, a branch of a -p run's session, WSL Claude Code whose home wasn't found) was refused with a 502. The fallback asked every account of the subscription in turn and rested some for it: #4778 saw 15 tries across 3 accounts. The refusal is the same on every account, so it is now a 400 (tuiRefusal), which the fallback neither retries nor rests an account for. The message is reworded so that "Models" no longer stands just before the error's "invalid_request_error": "Settings › Models › Replies runs every request as -p\",\"type\":\"invalid_request_error" matched provider.ModelUnserved, which made the 400 retryable again. Run (mote, at this tree): go vet ./internal/gateway, GOOS=windows and GOOS=linux -tags nogui go vet; go test -run "TUI|Claude|Resume|Interactive|Refusal|Fallback" ./internal/gateway ok. gofmt -l clean. Broken by hand: with the 400 mapping taken out, TestClaudeTUIRefusalIsNoAccountsFault is red (502); with the old wording it was red on WSL (retryable true through ModelUnserved). Not tried: a refusal against real accounts. Not changed: a run that starts and fails (tuiNoStart) is still a 502, retried on the next account. Part of #4778. |
||
|
|
df03aeb351 |
provider: Zed's plugin is 0.1.13 at least: a Gemini request's tool-calling mode goes in lowercase (#4657)
Zed's cloud refused every tool-bearing Gemini turn of the Zed plugin with 400 "unknown variant `AUTO`, expected one of `auto`, `any`, `none`" (atticuskk). magpie-community/plugins f4e2ac3 (zed 0.1.13, co-authored with ggbdpq, who found the cause) lowercases the mode in the plugin, where the request is fitted to Zed's wire; the mover's min makes every moved user's plugin that version. Checked: npm view @magpie-community/opencode-zed-auth@0.1.13 version --prefer-online -> 0.1.13. Plugin run (mote): bun test in packages/zed 54 pass; the lowercase line off -> 3 red. gofmt -l clean. Not tried: a live request to cloud.zed.dev. |
||
|
|
97e66bce26 |
library: an uninstalled Kiro CLI is listed to take back what it was given (#4769)
b4c67477f lists Kiro CLI in apps only while kiro-cli is found. held, which lists an uninstalled agent on the rows of what magpie gave it so that can be unticked and taken out of its folder (TestGoneAgentListedToTakeOut), walks apps and agent.All, so once kiro-cli was uninstalled magpie's entries stayed in ~/.kiro/settings/mcp.json, ~/.kiro/skills and the steering file with no row to take them out. Kiro CLI is now always in apps, with Bin the found path or "kiro-cli": Detected (binAt) still decides whether it is a target, so ~/.kiro alone (Kiro Crew, the Kiro IDE) makes nothing a target, as before. Takes tells an app that isn't installed so, rather than recording it and then giving it nothing (the #2254 shape); before, an uninstalled Kiro CLI got "unknown agent". Run (mote, mote-run -tags nogui): - go test -count=1 -run 'Kiro|Gone|Takes|Held|Target' ./internal/library: ok - go test -count=1 ./internal/library (whole package, before this change, with b4c67477f): ok 156s - Broken by hand: apps() back to listing Kiro only when found -> TestKiroCLIUninstalledHeld red ("isn't listed as gone: <nil>", Takes "unknown agent"); Takes' new check off -> red (Takes returns kiro-cli for an uninstalled one). - gofmt -l: clean. Not tried: a real kiro-cli uninstall (the user's live ~/.kiro untouched). |
||
|
|
eb469c70a9 |
fix(library): Kiro CLI gets the Library's skills, MCP servers and instructions (#4769)
The library's targets are agent.All plus apps, and apps held Claude Desktop alone: Kiro CLI, which magpie wires no model into and the Agents page rightly leaves alone, could be given none of the three, and a user of it copied skills, servers and instructions into ~/.kiro by hand (#4769, ump45nose). Kiro CLI is an app now, found by the kiro-cli program alone — PATH, ~/.local/bin, Kiro CLI.app, where provider.KiroExecutable already looked — never by ~/.kiro, which Kiro Crew and the Kiro IDE keep too. It reads ~/.kiro/skills, ~/.kiro/settings/mcp.json and ~/.kiro/steering/AGENTS.md, its global steering's AGENTS.md being always included (kiro.dev/docs). Its mcp.json has a format of its own: entries of command/args/env or url/headers, no type written, the user's fields (disabled, autoApprove, disabledTools, oauth) kept, no SSE named — a url is streamable HTTP, the docs give no way to say SSE — and a ${NAME} in headers or env passed through, Kiro expanding those its Mcp Approved Env Vars approves. What a kiro-cli in a WSL distro is given, and a project's .kiro, stays out: apps are this machine's, and per-tool off stays the user's. Run: go test -tags nogui ./internal/library (ok; TestKiroCLITarget, TestKiroCLINotByItsFolder and TestKiroMCP new); go vet (darwin, linux, windows; nogui) and gofmt -l clean on the package; builds for all three platforms. Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
a97653bf3e |
routing: LeastUsed sends a key with no share behind subs with room, not first (#4535)
A pay-as-you-go key, a prepaid wallet, or an account whose use wasn't read has Seat.Used read 0, and LeastUsed compared that 0 as if it were a share of 0%: any subscription that had used more than nothing went after every such key, so paid balance burned while subscription quota sat idle. Smart and Pace already keep a seat whose allowance isn't known behind those whose share was told; LeastUsed now does too: the shareless go after subscriptions with room and before those running low or spent, ordered among themselves by what a wallet has left and what magpie sent a key lately. A learning account still goes first, once, as in Smart and Pace. Pools of seats that all tell a share, or all tell none, are ordered as before. What changed: - internal/routes/strategies.go: LeastUsed places seats by whether their share was told (Known with a use past 0 or a renewal known) before the Used comparison; its comment says so. - internal/routes/routes_test.go: TestLeastUsedSeatsWithNoShare locks a key behind subs with room, a wallet behind a told share and before a key, keys past low and spent subs, a learning account first, and told shares ordered by use as before. Run: - go test ./internal/routes/ -count=1 (fails on the parent at TestLeastUsedSeatsWithNoShare: [key sub], passes with the fix) - go vet ./internal/routes/, gofmt clean Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
2503520f82 |
codexcat: each Codex model takes official Codex's own instructions for it (#3759, #4008, #4783)
Every magpie model in Codex's catalog (model_catalog_json) carried
gpt-5.2-codex_prompt.md ("You are Codex, based on GPT-5"), so a magpie
GPT-6 model, the auto group's included, ran on a GPT-5.2-era prompt while
official Codex sends GPT-6's own template. magpie still writes no words of
its own into the prompt and leaves the identity line alone: each entry now
takes the text official Codex sends that model, word for word.
- A model's slug (the id's last segment) is matched as Codex 0.166
matches one (longest prefix of an official slug): first in the entries
the user's ChatGPT account handed this Codex (models_cache.json), whose
base_instructions and model_messages go over as sent; then in Codex
rust-v0.166.0's bundled models.json (instructions_template only, as an
older Codex may not read 0.166's model_messages), embedded as
codex_instructions.json.
- Any other model, and a routing group, takes Codex's prompt for a model
it doesn't know (models-manager/prompt.md, model_info_from_slug), which
replaces codex_prompt.md: that is what official Codex sends it.
- ownEntry with no base_instructions, and internal/provider's
codexInstructions fallback, take the same official text.
- testdata holds Codex's models.json and prompt.md at rust-v0.166.0;
TestBundledIsCodexOwn fails when the embedded copies drift from them.
- GET /v1/codex/models (a remote Codex's model_catalog_url): entries are
now ~21 KB, so Codex before 0.166's 1 MiB cap holds about 48 of them
(was ~125). Codex 0.166 reads the catalog whole (models_endpoint.rs
passes no body limit), and it sends ?client_version=, so the cap now
applies only to a Codex below 0.166 or one that doesn't say
(codexReadsWholeCatalog). docs/reference.md says so.
- docs/subsystems/agent-wiring.md: a "Codex instructions" row. The
Antigravity cloak's comment no longer calls the GPT-5 prompt magpie's.
Run (mote's disk is full, 100% with other sessions' runs, so on WSL
magpie-desktop through wsl-run):
- go test ./internal/codexcat/: ok. go vet -tags nogui ./... and
GOOS=windows go vet ./...: ok. gofmt -l: clean.
- go test -tags nogui -count=1 -timeout 45m codexcat, provider, agent,
gui, gateway (every package that imports codexcat): codexcat, provider,
gui ok. agent: TestGrokInstalled and TestOmpDetectedWithPiDir red, the
same at origin/main
|
||
|
|
546cdbde6b |
gui tests: claude-mode moves the pointer off the page once the editor is opened (#4638)
The "both modes on hover" tests found the hover card up before their
hover in WebKit. The click that opens the editor leaves the pointer on
the provider row, at (450,110) at 900px and (210,110) at 420px, and the
editor draws its TUI / claude -p switch there: a probe printed the
switch at [306,96,515,121] (en 900) and [171,78,378,126] (en 420), and
the card up in those runs. WebKit sends mouseenter for a pointer that
never moved once something is drawn under it. openEditor now moves the
pointer to (0,0) right after the click, before the editor is read.
Run in WSL (magpie-desktop, Playwright 1.62.0) at origin/main
|
||
|
|
b4d1c393c1 |
redact: a Chinese session's words before a missing module are read as cheaply (#4766)
The #4766 fix read the last 64 bytes before the quote, but fell back to lowering the whole text before it when those bytes were not ASCII. A session written in Chinese is not ASCII, so it kept the quadratic cost the fix removed. Lowering is rune by rune with no context, so the last bytes of the lowered window equal the last bytes of the lowered whole text; the fallback is dropped. The spaces before the quote are now trimmed before the window is taken, so more than 64 of them no longer hide the words. Run (mote-run, -tags nogui): - go test ./internal/redact: ok. - With ggbdpq's model.go: the new Chinese case is red (450560 bytes made, 8 KiB at most). With main's: red (401408 bytes). With the window taken before the trim: the many-spaces case is red. |
||
|
|
d3bf8f7394 |
fix(redact): an error's words for a missing module are read before the quote, not the whole body before it (#4766)
What changed missingModuleAt said a quoted name is a module an error could not load by lowering everything before the quote. A session's body holds a place a known value turns up at for each turn it has been in the history, and knownSpans asks packageAt at each of them, so every such place paid the body's whole length again — a 555 KB turn held 1m54s in the masking, past the unrouted budget, and was answered 504 (#4766). The words stand right before the quote; what is read of what is before them is the last 64 bytes of it now, as assignedSecret reads the 64 before the value it judges. A letter a lower case folds wider than in those bytes reads the whole text before the quote, as before. Nothing of what is masked changes. Run - RED (product file reverted, test kept): TestMissingModuleReadsOnlyTheWordsBeforeTheQuote fails with "judging the words made 401440 bytes, 8 KiB at most". - GREEN: the test passes; go test -tags nogui ./internal/redact/ passes. - A session that grows turn by turn, Personal on and config-dense as the report has it: a 925 KB turn went from 3.8s to 0.76s, a 560 KB turn masks in 0.2s; the rest of the cost is the rules' own linear scan. - go vet on darwin, linux/amd64 and windows/amd64; builds on all three; gofmt clean; BenchmarkMaskLongSession unchanged on its shape. Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
7126f7de3e |
gateway: only the user's "it sees" lifts the small models' shape guess, and a group's ID stays out (#4359)
Review of ggbdpq's aa378a4f6 (the commit before). Its comment says a
group's, auto's or a subscription's agent-written ID stays out whatever
the user said of it, but the code put those guards inside the same
"user said nothing" branch, so a group/ or auto/ ID with a modelImages
entry entered the pool. And any answer lifted the guess, a "takes no
images" too: that says nothing of whether the ID is a vendor's model,
yet let a colon or *-embed/-tts/-free ID into the searcher's small
model pool, which has no image keep to hold it back.
Now the structural guards stand for every model, and only a modelImages
true lifts the colon/word guess.
Run (mote, -tags nogui):
- TestSmallCandsLiftOnlyWhatTheUserSaidSees, new: red on aa378a4f6
("pool [cn:text-only cn:sees group/g auto/a], want only cn:sees"),
green here.
- TestAutoVisionPicksANamespacedIDTheUserSaidSees (ggbdpq's): red with
search.go at origin/main
|
||
|
|
4932a8bd1c |
fix(gateway): a model the user said sees is picked though its ID carries a namespace colon (#4359)
What changed AutoVision never picked a model of a relay whose IDs carry a vendor namespace (cn:deepseek-v4.1-flash, gateway key 21/cn:…), though the user had marked every one as taking images in settings.json's modelImages: smallCands dropped every model whose lowercased ID holds a colon or a tilde, and the drop came after keep (seesAt) had read the user's answer, so their word never reached the pick — the pool came out empty and seer() said no model sees, while naming the model in vision worked. smallCands now reads the pool's settings once and leaves a model the user gave an answer about (ImageOverride) in the pool whatever characters its ID carries: their answer names one of the vendor's models in full, which is exactly what the colon, the tilde and the nano/lite/image/… words were guessing at. The shape filters stand for every model they said nothing of, and the structural ones — a group's, a found group's, and, on a subscription, what magpie wrote into its agent — stand even for a model they did name. The searcher's pool reads the same answer: the filters are one judgment, and a model the user proved real can be searched with too; a relay is asked to search only where it was before. Run - TestAutoVisionPicksANamespacedIDTheUserSaidSees (new) fails on the old smallCands with "AutoVision = \"\", want relay/cn:deepseek-v4.1-flash, the model the user said sees" and passes now; it also holds that with no answer of the user's the model stays out, and that their "takes no images" keeps it out. - go test -tags nogui -count=1 ./internal/gateway/ (whole package). Fixes #4359 Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
8d7439a1a0 |
gateway: a translated system turn is folded for a Responses upstream, and a relay's "Upstream request failed" 400 fails a group over (#4632)
Two faults, one turn. Claude Code 2.1.296 and later send their
environment as a message with role "system" inside messages
(Request.envInTurns). The Chat and Anthropic builds fold such a message
into the system prompt (responseInstructions); buildResponses wrote the
role as it came, and a relay whose Responses endpoint fronts the ChatGPT
backend — which takes user, assistant and developer alone — answered
every translated turn 400 "Upstream request failed". That 400 matched
none of the wordings that make a 4xx retryable, so the holdWriter held
it as final and the group's second member never ran: the relay's answer
went to the agent, every turn.
What changed: buildResponses folds a translated request's system and
developer messages the way the Chat and Anthropic builds do, keyed on
the read. A Responses client's own instruction items are kept by the
read (#2532) and go where they stood; so do a codex account's, which
its send says as developer ones in place (codexBody — the fold would
move them out of conversation order, so buildFor marks the account's
requests kept). A translated request's system message is the harness's,
so it is said in the instructions, and one after a reply is told as a
user <system-reminder>, as on every other target. A relay's own word
that the provider behind it turned the request away ("sub2api: Upstream
request failed", type upstream_error — the words the Codex compaction
already reads, #866, #1511) joins the wordings that make a 400 or 422
retryable (retryable) and fail a group over (shapeRefused): the next
member is asked, and nobody rests. A 400 that says nothing of the kind
still ends the route, as a bad request would fail on every member
alike.
Run: TestClaudeSystemTurnSaidInTheInstructionsOnResponses and
TestGroupFailsOverARelaysUpstreamFailed, red at upstream/main
|
||
|
|
65fc2efa44 |
gateway: a Chat legacy function_call carrying nothing is left out (#4659)
jinccc-ctrl on #4659: with tools declared and the model answering in text alone, WorkBuddy's stream ended on a frame whose function_call was an empty object where the contract has null, and OpenMausBot, which checks every frame's shape, read the empty object for a legacy call and refused the whole turn ("legacy function_call is unsupported; use structured tool_calls") — so every text reply a tools-carrying request got was a turn lost, while clients that merge silently never noticed. An empty function_call — a name and arguments both empty — says nothing and runs nowhere, so chatTidy leaves it out, as it leaves out an empty reasoning_content, an empty tool_calls and a nameless call (#1475). A null goes as it came, and a call whose name or arguments hold something is one a client may still be reading: both untouched, as is a name or arguments of another kind than a string. Run (darwin/arm64, go test ./internal/gateway/ -tags nogui): internal/gateway/function_call_null_test.go:32: an empty function_call object went out where the contract has null (#4659) — before the fix; after, TestStreamedEmptyFunctionCallLeftOut and TestStreamedNamedFunctionCallKept pass, the full gateway package passes, and gofmt, go vet, -race on the targeted tests and linux/windows/darwin builds are clean. Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
9da9bfabdc |
gateway: Grok's reasoning goes back to it through a Claude, Chat or Gemini client (jenryai on X)
jenryai uses Grok through Claude Desktop and sees repeats and broken tool calls that Grok Build doesn't make. Diffing Grok Build 1.0.67's captured requests against magpie's: Grok Build asks for include ["reasoning.encrypted_content"] and sends every reasoning item, encrypted_content and all, before the function_call it led to. Through a Messages (or Chat, Gemini) client magpie never asked for that reasoning, and those clients have no place to keep a Responses item. So every step of a tool loop reached Grok without the reasoning behind its earlier calls. Now, for a Grok plugin request from a client that isn't Responses: - the request asks for reasoning.encrypted_content (askSealedReasoning); - the sealed reasoning items before a call are kept on disk by hash, the same store as Gemini's thought signatures, and the call's id carries the key: <id>__rk16__<key> (carryReasoning, on both the whole and the streamed paths); - on the way back afterParse strips the key from the call and its result and puts the items in front of that assistant turn (unreasonCalls). buildResponses already sends such sealed parts back. A key magpie no longer has, or an id cut short, goes as before. A Responses client keeps its own items and is unchanged. The test fixture testdata/grok_reasoning_then_call.sse is a real Grok stream (reasoning, then message, then function_call, interleaved). Run (mote): - at the base |