e17b6cefc7b25c19d1e522f9e8a9626bf68912d9
6387
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e17b6cefc7 |
provider: the Qoder movers install opencode-qoder-auth 0.2.61 (plugins #692, #638)
0.2.61 puts business.model_key in the request, as qodercli 1.1.82 does, so Qoder and Qoder CN bill the model chosen, not Auto. 0.2.61 also holds 0.2.60's 429-message change (c1a625d is an ancestor of the 0.2.61 tree). Run (mote): go test ./internal/provider -run 'TestQoderMovers|TestMovedBuiltinsSayTheirPlugin|Mover' ok. With min put back to 0.2.60 the new TestQoderMoversNameTheModelInTheBusinessRecord fails. npm view @magpie-community/opencode-qoder-auth@0.2.61 --prefer-online --registry https://registry.npmjs.org prints 0.2.61. gofmt -l clean. Not run before this push: the full suite (run after the tag). Not tried on a real Qoder or Qoder CN account. |
||
|
|
247794c613 |
codex: an account that is out takes over for other models too (reverses f37742e14)
With one ChatGPT account out and nothing to serve Codex's own model on (provider.CodexServesWhileOut false), |
||
|
|
68c43bba65 |
copilot: a Copilot account draws with the image models its /models lists
Copilot CLI draws with an image model (GPT Image 2.5 Flare) at the API base's /images/generations and /images/edits, OpenAI-shaped. copilotModels kept chat models only, so such a model was never seen. It is now saved as a drawer (Draws, so agents' chat lists still leave it out), found by the entry's capabilities.type or, for an unknown type, by an id that names images. The gateway lists them in DrawersOf and sends generation as Copilot CLI does: model, prompt, size, quality (and n). Run: gofmt; go vet (host, GOOS=linux -tags nogui, GOOS=windows) for provider, gateway, catalog; go test of the same three packages, all ok, on mote. New TestCopilotDrawsItsImageModel uses a fake Copilot API. Broken by hand: copilotDrawsModel returning false turns it red. Not tried: a real Copilot account. The model's real id, its /models type value, n and the edits shape on Copilot's side are unconfirmed. |
||
|
|
6d1e3f1e29 |
gui tests: library-problems-hide and panel-open-once load with a minute's room
nav-timeout (#4470) holds every page given a short default timeout to a navigation timeout of at least a minute. Two files broke it on main: |
||
|
|
2741b749f9 |
sessions: a codex fork's rollout-<n> turn does not end the copied head (#5090)
ownTurn ended a Codex fork's copied head at the first turn id the parent's
file didn't hold (
|
||
|
|
90bf96a23d |
search: a plugin can give a web search API (its search hook)
treeman on Discord #help asked for web search to be pluggable so users can
add search vendors. A plugin's `search` hook, {search: {<id>: {name, keysURL?,
keyOptional?, url?, execute({query, count, key, url}, ctx)}}}, adds an API to
Settings > Models > Web search as `<plugin>:<id>`. It is added, keyed, ordered,
switched off and removed like Tavily or Brave. The built-in APIs stay built in.
How: host.js collects the hook's entries (id [a-z0-9-], an execute) into
Loaded.Searches and runs one with the `search` op (timeout from ctx, an error
with a numeric status comes back as a refusal). The host notes them in
plugin-searches.json (internal/plugin/search.go); provider.AllSearchVendors
adds the noted ones of plugins that are on to SearchVendors, so Ready, check,
the CLI and the GUI list see them. askSearchAPI hands a plugin vendor to
askPluginSearch below askSearchAPIKeys, so keys, rest on 401/402/403/429,
order, the masked query and the request-log row are the built-ins' own.
Run (mote, on this tree, whose base
|
||
|
|
df7c94bdf5 |
gateway: inline image descriptions survive a restart (#5121)
The vision description cache (Server.sights) was in memory only, so a restart, update or handover described every image of a long conversation again (62 calls in 2.5 minutes in the report). Completed descriptions of inline images are now appended to vision-cache.jsonl (0600) in the config dir before their waiters are released, and New restores them under the same 2048-entry LRU. URL images stay in memory (their bytes can change); failures are never written. Appends and compaction go through a file lock, a corrupt or truncated line is skipped (and backed up before compaction), and shutdown waits for pending saves within the drain window. Patch by MYCF711, applied clean on main. One change: the Unix permission test now makes the config folder before it pre-creates the file (it failed on a fresh sandbox, where the folder doesn't exist yet). Run (mote, at this tree): go test ./internal/gateway filtered to the vision/sight/cache tests, ok; gofmt -l clean; go vet ./internal/gateway for linux and windows, clean. Broken by hand: saveSight call removed from see(), TestDescriptionSurvivesGatewayRestart red (2 descriptions, want 1), green again with it back. Windows: the same filtered tests on xiaomi-gpu via win-run. Not tried: full go test ./..., go vet ./... for linux (wails cgo doesn't build off-platform on mote), a real process kill or a real handover, a real gateway with a real vision model. Co-authored-by: MYCF711 <323101370+MYCF711@users.noreply.github.com> |
||
|
|
6673171595 |
update: the app and magpie web follow each other's update (visamzh on X)
visamzh on X: with the desktop app and magpie web both open, an update
from either side left the other still offering it ("↑ 更新") until it was
quit by hand.
Cause: the app and magpie web are two processes over one program, each
with its own updater (state, download, latest) in memory. One restarting
to update puts the new binary in; the other is told nothing. Its
replaced() (the binary on disk is no longer the one it started from) was
read only on a click of its own Update or on magpie update's gateway ask
(restartBeside), which reaches only the process serving the gateway. And
a browser's page reloaded (backAsNew) only after a restart it asked for
itself, so magpie web's tab kept the old page and its pill even once
the process under it was new.
Fix:
- followReplaced (update_beside.go): every updater stats its binary each
5 s and, once another magpie replaced it, restarts into it through
restartBeside, once: at once when idle, else after the gateway's
requests (waitIdle), as for magpie update's ask. Not for what this
process put in itself (installed, set by install, cleared by
wontStart), not twice (followed), not for a build that isn't a release
(make dev, go build rebuild in place). It stops with backendCtx, so a
copy left draining after a handover doesn't look.
- waitFor (update_wait.go): a wait for the gateway restarts into what
another magpie put in whatever the feed says now; before, a feed out
of reach or a "latest" answer ended the wait with nothing restarted.
- boot.js names the version that served the page (bootPrefs.version);
app.js's servedAnew reloads a browser's page (web) when /api/update's
current names another, on the reads it already made (load, focus, back
into view) and once a minute while shown. The app's own windows come
back with their new process and are left alone.
- docs/subsystems/gui-shell.md describes it.
Run (mote, through mote-run, at
|
||
|
|
452c28a78c |
cli: GET /api/context/reply is named as the window's own (#5026)
TestEveryRouteHasACommandOrIsNamed was red on main: the route came in with |
||
|
|
0e1054ce19 |
statusline: the gateway serves Claude Code's status line to another computer (steven_4422)
steven_4422 (Discord) runs magpie in Docker and Claude Code on the host.
The status line square writes the host's settings.json, which the
container can't reach, with a command naming a binary inside the container.
GET or POST /v1/magpie/statusline answers the line `magpie statusline`
prints, as text/plain, so the host needs only curl:
curl -fsS -m 1 -H 'Authorization: Bearer <key>' --data-binary @- http://<host>:3425/v1/magpie/statusline || true
Claude Code's stdin JSON (session_id) adds the model, as /v1/magpie/route
does; ?session= and ?only= work too. The renderer moved to
provider.StatuslineText, shared by the CLI and the endpoint. A caller that
isn't this computer needs a gateway key (lanGuard, unchanged; the handler
also refuses a non-local caller without one). A read-only key is allowed
(GET and POST in readOnlyRoutes) and gets the windows without the model; a
key held to budget, models or accounts sees only its own (scopeQuotas).
corsGuard and origin checks are untouched.
magpie web shows the command in Settings -> About (en, zh, zh-TW, ja, de).
Docs: reference.md, agent-wiring.md, gateway-routing.md, docker pages en/zh/ja.
Run at this head (rebased on
|
||
|
|
59c1306035 |
claude: an auto-mode client's tool loop keeps its interactive run (#4804)
Auto mode's safeguards change with every tool batch: prior_turn_context grows by the turn before. An interactive Claude Code run read them once, from CLAUDE_CODE_EXTRA_BODY in its environment as it started. So a tool loop either started the run again (the whole conversation written to the cache again), or kept it and sent the classifier the context it started with, which is not what real Claude Code sends. Each turn's safeguards now reach the running run: - The bridge writes the extra body to <run tmp>/guard.json and hands its path to the helper as MAGPIE_CLAUDE_GUARD (mapped for WSL in newTap). - tap.js, on each /v1/messages request whose string body has a safeguards key, reads the file and puts its safeguards in the body. It also sets CLAUDE_CODE_EXTRA_BODY to the file's text, so Claude Code's own later reads agree. The first time, it writes guard.json.live. - setSafeguards rewrites the file (temp and rename, retried for Windows) instead of restarting, once .live exists. Without .live (a Claude Code that doesn't load the tap), it falls back to the old rule: keep the run when only the varying parts changed, otherwise restart. A beta change, or safeguards appearing or going, still restarts. The tap changes only the safeguards value; any other byte of the body is Claude Code's own. Bodies without safeguards, count_tokens and non-string bodies are passed through untouched. The tool-results path logged "process expired" alone while the run's end read "magpie ended it". It now aborts the run with the reason and logs "tool results process expired: <reason>". continueWith's "not waiting for tool results" does the same. Tests: - TestClaudeTUIToolLoopCarriesEachBatchsSafeguards: three tool batches with growing prior_turn_context, then the answer. Checks one run and that each request carried its own batch's safeguards. - TestClaudeTUIToolResultsLogWhyTheRunEnded: no tap and the rules change. Checks that the log has the reason. - TestTapPutsTheGuardFilesSafeguards (bun and node): the rewrite, the bodies left alone, the env, and .live. - TestTapEnv: MAGPIE_CLAUDE_GUARD is passed through, WSL-mapped. Run (worktree at |
||
|
|
d8b3749ef7 |
agents: Copilot CLI reaches magpie's models through its providers.json (BYOK)
tony9759 on Discord asked for Copilot CLI to be wired to magpie, since its
docs say it takes a custom model provider URL.
What Copilot does (1.0.105, @github/copilot-darwin-arm64's cli-main.js,
`copilot help providers` / `help environment`; GitHub docs
docs.github.com/en/copilot/how-tos/copilot-cli/customize-copilot/use-byok-models):
env BYOK (COPILOT_PROVIDER_BASE_URL, _TYPE openai|azure|anthropic, _API_KEY,
_WIRE_API completions|responses) and a providers.json at
$COPILOT_PROVIDERS_CONFIG, else <COPILOT_HOME or ~/.copilot>/providers.json:
{providers:[{name,type,baseUrl,apiKey}], models:[{id,provider,name,
maxPromptTokens,maxOutputTokens,...}]}, picked as <provider>/<id> in
settings.json "model". Neither needs a GitHub sign-in. The multi-provider
file is marked experimental in the SDK types. The version BYOK started in is
not verified (github/gh-aw#25014 says 1.0.19; GitHub's changelog of
2026-04-07 announces it).
magpie writes the persistent file, not the environment: provider "magpie"
(openai chat completions, the gateway's /v1, the agent-named key) and one
models entry per catalog model, then model = magpie/<ref>. Only entries
naming magpie are magpie's; the user's providers, models and other keys stay
through connect, Sync and Disconnect (which also restores the model they were
on); a file that does not parse is never written over. COPILOT_HOME and
COPILOT_PROVIDERS_CONFIG are honoured (the latter added to agentenv.Vars).
Copilot's own models stay in the field's list.
Run at this head (a4fb75bfd's tree on
|
||
|
|
47b7ba3030 |
models: a model its provider lists at $0 says free in the pickers and Routing (jiangguochao666 on X)
jiangguochao666 asked for each provider's free models to show in Routing and the model settings, to route to them. The green free tag was shown only for a plan's free model or a model with "free" in its name. provider.PricedFree says a model is free only when its price for that provider is known to be $0: - A price the user set comes first (provider/model, provider/*, then the model's own key). A $0 one makes it free, and any other price, a paid tier included, makes it paid. - Otherwise the provider's own catalogs decide. A $0 from a plan's catalog (-plan, membership catalogs) is the plan's per-token price, not free. A $0 from only the model's maker is not free either: a relay serving Zhipu's free glm-4.7-flash may charge for it. - No known price means not free. FreeModel (Free first, Cheapest first routing) is unchanged. From the local models.dev cache this tags: - every model of NVIDIA NIM and ModelScope; - the :free / -free models of OpenRouter, OpenCode Zen and Go, Kilo, AIHubMix, ZenMux, Vercel, Requesty and other relays; - Zhipu's and Z.ai's glm-4.x-flash. No coding or token plan is tagged. Where it shows, with the hover "free: listed at $0 on this provider": - an agent's model picker (agent.Option.Zero); - the provider editor's model chips, and its Free only button (modelJSON.Zero); - Routing's Add a model and classifier pickers (modelRef.Zero). The word is new in en, zh, zh-TW, ja and de. Tests, each red on the old code: - TestPricedFreeIsTheProvidersOwnZero: own, plan, maker-only, unpriced and user prices. - TestPickerSaysAZeroPricedModelIsFree: Option.Zero, cleared at once by a price the user saves. - TestZeroPricedModelsSayFree: the editor's and Routing's JSON. - zero-priced-free.test.cjs: the three surfaces, in Chromium and WebKit, at 1100 and 420px, in all 5 languages. It checks the tag's text, hover and fit, that the paid model has no tag, that a plan's free model keeps its own hover, no sideways scroll and no page errors. Broken by hand (each restored, diff checked): - The source check ignored (maker and plan $0 count): the provider test goes red on the plan model and the relay's glm-4.7-flash. - PricedFree always false: the provider, agent and gui tests go red. - The user's price ignored: the provider and agent tests go red. - The badge's o.zero / m.zero and Routing's zero dropped in app.js and routing/client.js: zero-priced-free goes red, "the $0 model has no free tag in the agent's picker". Run at this commit's tree (base |
||
|
|
1cb346f2dc |
gui: on Linux the folder and Backups buttons start the opener and return (pkh1585)
pkh1585 on Discord: on Linux, clicking the Library's folder / Backups button froze magpie and the file manager that opened closed by itself. Cause: Linux openFolder was Wails' OpenFileManager, which runs the desktop's file manager (the inode/directory .desktop Exec, or xdg-open) with cmd.Run under a 10 second context. A file manager that isn't running yet stays in the foreground, so the click waited the full 10 seconds and then the context killed the window that had just opened. Windows had the same shape and was fixed earlier (folder_windows.go); macOS's `open` returns at once. Fix: proc.OpenFolder (Linux) starts xdg-open (else gio open, exo-open) with no stdio and a session of its own, reaps it in a goroutine, and returns. All callers go through Host.OpenFolder (Library folder, Backups reveal, usage and backup saves, logs/config reveals, browser reveal), so every sibling is reached. macOS keeps Wails' way (folder_other.go is now !linux). Run: - mote-run go test ./internal/proc, wsl-run (magpie-desktop) go test ./internal/proc: ok. New TestOpenFolderDoesNotWaitForTheFileManager: with the Wait made synchronous it fails on WSL (waited 1m0s); with Setsid off it fails (shares magpie's session); green with the fix, -count=3. - Real XFCE (magpie-desktop, DISPLAY :0, real Thunar): the old way (`timeout 10 thunar dir`) blocked 10s and killed Thunar (rc 124, no thunar left); `setsid xdg-open dir` returned at once and Thunar stayed up 12s later. - gofmt clean; go vet ./internal/proc for linux, windows (mote), linux (wsl); go vet ./internal/gui on macOS. Not tried: a built Linux magpie GUI clicking the real button (WSL has no gtk4/webkitgtk-6.0, so internal/gui can't build there, and linux gui vet wasn't run); Omarchy/Hyprland; AppImage env (LD_LIBRARY_PATH) leaking into the opener, which is unchanged; the full go test ./... suite and GUI tests (no GUI or JS file changed). |
||
|
|
b045362a92 |
routing: importing a shared group whose id is one of yours replaces that group (issennknight)
Import on the Routing page always added a new group. When the pasted text
carries the id of a group of the user's own (not one magpie found), the
box now says so before it is pressed: the button reads "Replace <name>"
and a line under the box says its models, routing and rules are replaced
and its accounts and folder rules stay. Pressing it posts groups/import
with replace, and provider.ImportGroupOver saves the text's group over
that one, in its place in the list. Matching is by id only; no other group
changes. Kept as the user has them, since the text can't carry them: the
group's accounts, its folder rules (that still fit the new members) and
its on/off switch. A name another group has gets a number. A text whose
id nobody has, a found group's id, or any import that doesn't ask to
replace adds a group as before. ImportGroup is unchanged.
Run on mote at the pushed tree before rebase:
- go test ./internal/provider (Share|ImportGroup): ok; the new
TestImportGroupOverReplacesSameID is red with the match switched off by
hand (replaced=false, id three-2).
- go test ./internal/gui -skip TestMainWindowCorners: ok. TestMainWindowCorners
fails on mote's macOS 27 box and on an untouched origin/main checkout
alike (
|
||
|
|
c360d9d30d |
gui: a tap that slides off its Form | JSON option still picks it (refeccd)
A trackpad's tap lifts a few pixels from where it came down. On the small options of a segmented control (Form | JSON in the MCP server editor) the lift can land off the option, so the browser clicks neither it nor the option it came down on: the press shows (the option shrinks) and nothing is picked, and the next tap, lifted in place, works. segsPress already clicked the same option again when a redraw replaced it between down and up; it now does so too when the option is still there but the press was let go off it, within tapLike's bounds (under 300ms, under 12px). A press dragged farther, or held longer, is still no pick, as for any button. Every segs control (the same helper) takes it, in the editors, Settings and the lists. Test: library-mcp-first-click presses near the top of the option, slides 8px up, off the switch, lets go inside 300ms, both ways, in en zh zh-TW ja de, Chromium and WebKit, at 1100 (desktop) and 390 (web). Red on the old code (12 of 22: every 1100 case in both engines), green with the fix (22 of 22), run through mote-run. Not tried: the reporter's own trackpad and video (not seen); the whole GUI suite is run before the push, see the push record. |
||
|
|
12d4825afa |
gateway: a turn of only waits (sleep, wait, delay, pause, poll) is not a tool loop
xiaozhi09400 (Discord, Codex): clock__sleep {"duration_ms":60000} called 8 times
while CI ran was stopped as "the same tool call, the same result". A wait
is asked again with the same arguments and answers the same by design; the
time passing is the progress, and a request carries no timestamps to
measure it, so the guard now skips a turn whose calls are all waits.
A call is a wait when the tool's own name (after server__ / namespace
prefix, so a server called "wait" does not count; snake and camelCase
split into words) has sleep, wait, delay, pause or poll, or when its
arguments are only duration keys with numbers (duration_ms, seconds, ms,
timeout...). A turn that waits and also runs another call is judged as
before. Any other tool repeated 8 times is still stopped.
Run (mote-run): TestToolLoopLetsWaitsBy is red on the old code (8 wait
shapes stopped; guard disabled by hand) and green now; ./internal/gateway
-timeout 45m ok (696s); GOOS=windows and GOOS=linux -tags nogui go vet ok;
gofmt clean. Not tried: a real Codex with the clock MCP server; Codex's
exact namespaced name is taken from the report (clock__sleep).
|
||
|
|
a6f5d738fc |
gateway: a group's serial walk has a total budget of 540s (#5113)
Nine members at a 60s first-token wait took 660s, past the 600s a client
waits. The client hung up first and the member it was on was told as the
failure. Nothing bounded the sum of the members' waits.
groupBudget (540s) counts from the walk's start. A member asked with less
left than its FirstToken gets only what is left (holdWriter.budgeted); when
that runs out, or the walk has used the budget, no further member is asked,
the member isn't rested (it was cut short, not slow), and the error is a 504
naming the budget. A client cancel was already read first (nobody blamed),
and is unchanged.
Reported by mycf_711 in #5112; #5113 stays open for the reporter.
Run at the pushed head (rebased on origin/main
|
||
|
|
e2d52b5012 |
provider: ZCode's mover min is 0.1.49, whose -Trial entry is no longer answered "quota exhausted" after a free-first refusal (Can4ry_ on X)
Can4ry_ on X: GLM-5.3-Flash-Trial answered "429 · ZCode's limited quota
for glm-5.3-flash is exhausted or temporarily unavailable" in magpie while
ZCode's own app was served. The plain GLM-5.3-Flash also kept going to
the Coding Plan after the Start Plan opened at 23:00. And there was no
freeFirst under Providers › ZCode.
zcode 0.1.49 (plugins 36a017a):
- A free-first gift refusal that isn't a quota answer (405/3012) now
rests only free first's use of the model. Before, it shared the rest a
-Trial entry obeys, so the Trial answered a local 429 without asking
ZCode.
- The local 429 keeps the spent words last. 0.1.48 appended "(ZCode
answered 429 …)" after them, so zcodeSpentWords didn't match and the
account rested whole.
- free first is a switch, "Free quota first", in the provider's editor
under Plugin options, just above Advanced (auth.options free_first,
on by default).
keepMovedCurrent updates every moved user to 0.1.49.
The gateway test gets 0.1.49's rested wording, which rests the Trial
entry alone, and 0.1.48's, which rested the account.
Correction to plugins 36a017a's body: its old-code block-page test
fails because the old code has no `sidelined` map. Its second plain
request did not go to the gift again.
Run on mote, at this tree (rebased on origin/main
|
||
|
|
7aff42d863 |
plugin host: the sign-in lock and file waits no longer freeze the event loop (#5112)
pause() was Atomics.wait, which blocks Bun's one thread. lockAuth spun on
plugin-auth.json.lock with pause(5) for up to 2 x AUTH_LOCK_STALE (20s),
and writeDurable and readFileSteady waited up to 500ms each, so one
plugin's renewal storm stalled every plugin's requests, model lists and
check-ins (499s while the port still answered). Reported by mycf_711.
- pause() is gone; sleep() is an awaited setTimeout.
- lockAuth, writeDurable, keepAuth, writeAuth and changeAuth are async,
and so are their callers (setAuth, removeAuth, settle, save, apiKey,
staleAccess, import/take/signOut, pi.js modify/delete).
- changeAuth takes in-process changes one at a time (authQueue) before
the file lock, so a host's own changes don't poll against each other;
the lock poll backs off 5ms to 50ms. Stale-lock takeover (10s) and the
change being made on a fresh read under the lock are unchanged.
- The sync readFileSteady (readAuth, hot path) no longer waits: it retries
twice at once, and readAuth keeps the last good read when the OS still
refuses (a failed read is unknown, not none). Under the lock the wait
is async (readFileSteadyAsync, 50 x 10ms as before).
Test: TestAuthLockWaitDoesNotFreezeTheHost holds the lock 600ms and checks
a timer keeps ticking while changeAuth waits, 20 concurrent changes lose
none, and a lock 11s old is taken over. On the old host.js it fails
("the lock is still held at 300ms": the loop froze 10s). Verified by
putting the old host.js and pi.js back.
Run (mote, at this tree): go test ./internal/plugin ./internal/gateway
./internal/provider all ok; gofmt, GOOS=windows/linux go vet of
internal/plugin clean. Not run: full go test ./..., a real Windows host
under a renewal storm. The serial-fallback total budget is #5113.
|
||
|
|
e4bc3eeb6f |
gui: the context window card's head keeps its title, icons and model apart at every width
packinggoods on Discord, in #feedback: in a narrow window the Routing page's "Context window" head drew the provider's icon over the end of the title. The mono model id (remote-magpie/claude/cla...) and the Live pill sat beside it. The cause was .ctx-fold, the title's button when the card can fold. It had min-width:0, so it shrank under the route, and the title's nowrap text ran on under the icons. The title no longer shrinks (flex:none). The route and the state now go together in .ctx-end, and the head wraps. Where the title leaves them too little room they take a line of their own, ending at the right, and the model id is cut there with an ellipsis. A folded card stays one line. At 520px and below it drops the agent's name and the lab part of the route. At 420px and below it drops the route and the state's word, keeping the state dot and the bar. The fold button keeps an outer height of 20px (margin -1px), so opening the card doesn't move the page. New test, ctx-head-narrow.test.cjs. It uses the reporter's model, live and counted, with and without the agent, with and without a known window. It runs en, zh, zh-TW, ja and de, at 1100 down to 340px, open and folded, in Chromium and WebKit. It checks that the title's text is whole, that no drawn parts overlap (boxes clipped to their overflow ancestors), that an icon is never part-cut, and that nothing runs past the card. Run at this head (rebased on a fresh origin/main), on mote, both engines: ctx-head-narrow, ctx-route, context-window, routing-context-fold, routing-ctx-still, routing-ctx-fold, routing-live-patch and i18n-keys: 188 pass, 0 fail. The whole GUI suite is running on WSL (Linux, both engines) and had not reported when this was pushed. Mote was busy with three other sessions' full suites. The owner's rule is to ship a verified fix at once. Any red it finds that this change caused gets an issue. Broken by hand: ctx-head-narrow on the old context.css/js is 52 of 52 red (e.g. "open at 580px: the title is whole ... cut:true", "title and lab icon overlap"). Not tried: the real Wails app (WebKit on macOS, WebKitGTK on Linux, WebView2 on Windows). |
||
|
|
9ce59b8340 |
routing: a request's row says the credits its reply said it cost (jiabubu)
jiabubu on Discord (#feedback): the Routing page's request list showed no credits for a request that spent them. The gateway already read a reply's usage.credit (#2512) into the usage ledger, which the Usage page shows, but the route trace's RouteUsage had no field for it. RouteUsage now carries Credits (the reply's, nil when it said none). The Routing page's request row shows "N credits" after its cost, or alone when the request has no known price (it read "—" before), with the Usage page's help text under the pointer; By session sums them in the session's cost, shown even when no request in it was priced. The help text "What it cost in its plan's credits, as the reply said" moves from the Usage plugin's i18n.js to the core's, since two plugins say it now. Tests: TestPluginPlanCreditsReachTheLedger also checks the route's usage carries 0.01 on every endpoint (red without the field: Credits <nil>). routing-credits.test.cjs: credits alone, priced plus credits, none, and a session's sum, in chromium and webkit, en zh zh-TW ja de, at 1100 and 420, with no overflow. Broken by hand: the old client.js makes routing-credits 10 of 10 red. Run at the pushed head on mote: gofmt -l clean; go test -run 'TestDailyCredits|TestPluginPlanCredits|Credits' ./internal/provider ./internal/gateway ok; GOOS=linux go vet -tags nogui and GOOS=windows go vet of provider, gateway, gui ok (rebased on origin/main |
||
|
|
ec3111d873 |
usage: a pool set aside counts in its card's credits a day (jiabubu)
jiabubu on Discord (#feedback): Usage → Overview's "Credits used per day" for WorkBuddy left out the extra credits, and read 0 every day while only extra credits were spent. The WorkBuddy plugin (0.2.19) sends the plan's "Credits" and "Extra credits", the one whose running out doesn't stop the account set aside (aside: true), usually Extra credits. creditWindows dropped every window set aside whenever the card had one that wasn't, a rule meant for CodeArts, whose buckets set aside are its 总积分's credits again. So WorkBuddy's extra credits, Kiro's bonus credits and a MiniMax credits window set aside were never counted. Now every credit window is read, and noteDailyCredits tells a breakdown from a pool by what the readings used: a window set aside counts unless the card's counted windows in its unit used at least as much over the same span, which makes it their credits again (CodeArts). It is kept as creditsAccount.Part; a window set aside that is a breakdown, with no days of its own, isn't shown. No vendor is named in the rule. Days before this release can't be recovered: magpie never kept the extra credits' readings, so the chart counts them from the first reading after the update. Tests: TestDailyCreditsPoolSetAside, WorkBuddy's card shaped as the plugin sends it for a China free account (CN_FREE_SUMMARY's 0 / 500 and 282 / 2900 in the plugins repo's workbuddy usage.test.mjs), the plan untouched while extra credits grow, then the plan spent and set aside instead; and a Kiro card with bonus credits. Red on the old credits_daily.go (no days for Extra credits or Bonus credits). TestDailyCreditsEveryVendor (CodeArts' buckets) still counts only 总积分. Broken by hand: Part always false makes TestDailyCreditsEveryVendor red (基础积分 counted beside 总积分). Run at the pushed head on mote: gofmt -l clean; go test -run 'TestDailyCredits|TestPluginPlanCredits|Credits' ./internal/provider ./internal/gateway ok; GOOS=linux go vet -tags nogui and GOOS=windows go vet of provider, gateway, gui ok (rebased on origin/main |
||
|
|
b92b3bc5b1 |
provider: raise the ZCode mover min to 0.1.48
0.1.48 (npm, checked with npm view --prefer-online) puts ZCode 3.17.2's prompt texts in the Start Plan request (jinpy666's plugins#682). 0.1.46 said 3.17.2 in the headers with 3.14.3's system blocks in the body, which zcode.z.ai has answered with 405/3012 since 11-03 while the ZCode app works on the same accounts (plugins#348, Discord reports). Run: go test -timeout 45m ./internal/provider on mote, gofmt -l clean. Not tried: a real ZCode account; the plugin side rests on #682's live run. |
||
|
|
7785c42787 |
provider: raise the ZCode mover min to 0.1.47
0.1.47 (npm, checked with npm view --prefer-online) sends a free gift
model such as GLM-5.3-Flash-Trial to ZCode spelled as the registry does
("GLM-5.3-Flash"), as the 3.17.2 app sends it, not the lowercase bucket
name, and the plugin's own 429 says when ZCode answered 429 to the last
request for the model (rested a minute). Reported on Discord as the
free Flash model failing in magpie while working in the ZCode app.
Run: go test -timeout 45m ./internal/provider on mote: ok. go vet for
linux and windows: no errors. gofmt -l: clean. The plugin side ran
bun test packages/zcode on mote.
Not tried: a real ZCode account; the cause is not proven. A 405/3012 is
ZCode's account risk control (plugins#348) and this does not lift it.
|
||
|
|
4c0cfafcf8 |
gui: a tap that slides a few pixels is a click, not a drag (refeccd)
A trackpad's tap-to-click presses and lets go within tens of ms and the pointer can slide a few pixels between. dragRows and dragCards lifted the row after 4px and marked the handle dragged, so the click that followed was swallowed: an agent row's logo, a provider row, a usage card took a second tap. A press let go under 300ms and under 12px from where it came down now sets nothing down and lets the click through (tapLike). A real drag, held or long, still moves the row. Reported by refeccd (Discord #feedback, 2026-11-03). Run at the pushed head (mote, node --test, Playwright chromium + webkit): tap-click.test.cjs (new; en/zh, window/panel, slid 0/5/9px; 26 ok), and account-arrange, agent-grip, drag-rows-shift, fold-show-grip, gateway-key-arrange, grip-inset, group-arrange, group-member-drag, list-sort, panel-arrange, usage-arrange, click-scroll: ok. Broken by hand: with the old app.js tap-click is 18 of 26 red (every slid 5px and 9px case, both engines); the 0px case passes on both. routing-rule-drag chromium is red on the old app.js too (known: #3789, #5088), not from this. Not run: the whole GUI suite (another session's was running on mote), a real trackpad tap (can't be done from a test), and hover-revealed controls that shift under a tap, none found to be the cause. |
||
|
|
7033f50722 |
gui: the panel opens the main window from its edge nearest the tray
isaac_bai on Discord, after v0.1.2857 named the header's icon "Open the
main window": with Windows' taskbar at the bottom, the panel stands above
the tray and its header is the panel's whole height from the icon; the
button left of Quit was where his pointer already was. yogurt36 had asked
for one opener, not two, so the panel still has exactly one, now on the
edge nearest the tray:
- Hung below its icon (the Mac's menu bar, a taskbar or bar at the top)
it is the header's icon, as before.
- Standing above it (Windows' bottom taskbar, a bottom panel on Linux) it
is "Open the main window" left of Quit in the foot (#openMain), and the
header has no icon. The string is the one the icon's name already
uses, in all five languages.
Which side: once togglePanelNow has placed and shown the panel,
tellPanelSide reads the panel's bounds and its screen's and sends
magpiePanelOpenAt("foot") when the panel is nearer the screen's bottom,
"head" otherwise (panelOpenAt, panelside.go; the Mac is always "head").
Under Wayland a window can't read where the compositor put it, so there,
and until the app says, layout.js sets body[data-open-at] by the system:
"foot" on Windows, "head" elsewhere. CSS shows one of the two from it.
Tests:
- TestPanelOpensTheWindowFromTheEdgeNearestTheTray: Windows bottom/top
taskbar, a tall panel, a second screen above the first, Linux X11
bottom/top, Wayland, a screen not read, the Mac, unknown places; only
"head" or "foot" reach the page.
- TestPanelToldItsSideWhenShown: both show paths in togglePanelNow call
tellPanelSide after placing; app.js has magpiePanelOpenAt.
- panel-open-once.test.cjs, Chromium and WebKit x en/zh/zh-TW/ja/de:
on a Mac platform exactly one opener, the header's, named per
language, opening /api/window/main, foot ["profBtn","quit"]; told
"foot" it moves. On Win32 exactly one opener, the foot's, left of Quit
(["profBtn","openMain","quit"]), the foot's buttons fitting apart with
their words whole at 360px, opening /api/window/main; told "head" it
moves back; an unknown side changes nothing.
Run on mote via mote-run:
- At this head (rebased on
|
||
|
|
8468afecb3 |
claude: a turn's images say they are attached, so the file notes after them are not taken for the images
Claude Code notes each image it is given ([Image: source: .../images/N.jpg])
in a note after the message, with a path in the gateway's temp folder. With
no history before the turn, nothing said what they are: the model took the
paths for the images, said it could not see them and quoted the paths as on
another computer (sinsoul1647 on Discord, v0.1.2862, 7 tool-result photos).
The prompt (renderClaudePrompt) and a saved session's turn (renderClaudeTurn)
now say the images, tool results' too, are in the message.
Tried: real claude 2.1.316 on mote against a fake Anthropic server, with
-p user images, MCP tool-result images, a url source, the TUI paste and a
resumed transcript: every one reached the API as image blocks, so the loss
is the model's reading of the notes, not a dropped image.
Not tried: the reporter's client; whether the model stops quoting paths.
Broken by hand: with the note left out, TestClaudePromptSaysToolResultImagesAreAttached is red.
Run at the pushed head (rebased on
|
||
|
|
8e27369bd6 |
browser: record_start and record_stop make a GIF of what an agent did
Asked for in chat ("Magpie Browser MCP 也要支持录屏哦"), like
claude-in-chrome's gif_creator. The browser tool gets two actions:
- record_start: from now on, after each action that can change the page
(not tabs, snapshot, text, console, screenshot, tab_close), the gateway
takes a picture of the session's window, 800 wide, with the action and
what it was done to written in a strip under it (the url, ref, key or
drag; never what was typed).
- record_stop: the frames as an animated GIF, a second a frame and the
last three, each frame after the first only the rectangle that changed.
It is kept an hour behind the image server's tokened files link and
named in FilesMeta, so `magpie tool` saves it; the text says to curl it.
The gateway does it all through browser_screenshot, so every extension
version records and nobody has to reload theirs. At most 300 frames;
a recording nobody stops goes after 30 minutes. A picture an action's
screenshot: true asks for is the same one the frame is made from.
Run on mote (macOS, Chrome for Testing 1234 headless):
- GOOS=darwin/linux/windows go vet ./internal/gateway, gofmt -l: clean.
- MAGPIE_BROWSER_CHROME=... go test ./internal/gateway -count=1
-timeout 45m: ok (794s).
- New: TestBrowserRecordsAGIF (real Chromium: navigate, type, snapshot,
navigate → 3 frames, GIF fetched from the link, 800 wide),
TestBrowserGIFFramesHoldWhatChanged, TestBrowserRecSayKeepsTypedTextOut,
TestBrowserRecordStopWithNothing.
Broken by hand: with browserRecWorth always false, TestBrowserRecordsAGIF
is red ("no frames").
Not tried: a real headful Chrome, Edge or Arc; Windows and Linux browsers.
|
||
|
|
51fa4b7eb0 |
browser: agents work in tabs of their own, behind the user's
The owner: Magpie Browser "老是会代替掉用户正在浏览的网页". A call that
named no tab, from a session with none, took the tab the user had in
front and navigated it away under them. Now:
- such a call opens a new tab of the session's (about:blank), behind the
shown one, in its Magpie tab group, in the window used last, or an
unfocused window of its own when none is open (open() in background.js);
- browser_tabs new / tab_new open behind too; front: true shows the tab,
for when the user asked to see it (background is still taken, and is
now the default);
- a screenshot of a tab behind shows it for the picture, then gives the
window back the tab the user had in front;
- a link with target=_blank clicked in a tab behind: Chrome shows the new
tab and names the user's shown tab as its opener. It is still followed,
grouped in the session's group, and the user's tab is put back in front.
- the tool descriptions say so; the user's tabs are acted in only when a
call names one.
Extension 0.1.4. When an older one connects, the gateway writes this
magpie's over its folders (browserext.Refresh; only folders already
written, never a newer one's: browserext.Older), so the browser picks it
up when it starts again or on the extension's reload in
chrome://extensions. Before, only opening Library's Browser page did. The
dir helpers moved from gui to browserext for it.
Tried and dropped: telling the extension to chrome.runtime.reload()
itself. In Chrome for Testing 1234 on mote an unpacked extension that
calls it never comes back (headless and headful, --load-extension and
CDP Extensions.loadUnpacked, with an onInstalled listener), which would
leave the user with none until a restart.
Run on mote at
|
||
|
|
1e1068c86c |
codex: "Same as the lead" holds every subagent to the lead's model (cleverpigo on X)
cleverpigo (Windows, Codex App 26.1027.6604.0) had Codex's lead on WorkBuddy's DeepSeek-V4.1-Flash, the subagent model on what the GUI called "Same as the lead", and the Routing page still showed a subagent on gpt-5.6-sol through Codex's own sign-in. Cause: that setting, unset, never held a subagent to anything. Since |
||
|
|
50265256ba |
library: a note on a skill or an MCP server, the library's own (youyo.p_10001)
youyo.p_10001 on Discord: with many skills and MCP servers installed, you can't tell what each is for or which to use. A skill has the description its author wrote for models, often in English and about what it does, not why you installed it. An MCP server has nothing but its command and its tool list. So each now takes a note in the user's own words. - Server.Note and Skill.Note in library.json: one line of at most 200 characters, whitespace run together (checkNote), as a hook's description (#2011). A longer one is turned away, not cut. - The server editor has a Note field under the name. A skill's reader (2a19043af's file reader) has one over its files: Save shows once it changes, saves the file being edited with it, and a changed note is asked about before the dialog closes. SkillNote, POST skills/note. - A row shows the note in place of its command or description, so rows keep their height; the tooltip gives the note, then that line. The skills' filter matches notes. - No agent is given a note: not in any agent's MCP entry, a project's file, the MCP router's list or a skill's copied SKILL.md. - A sync carries it (CarriedSkill.Note; a server goes whole), and clearing it is carried too. An older magpie on another computer doesn't know notes: a bundle it writes has none, so a sync from it clears them. The TUI's server editor keeps a note as it was. Run at the pushed head: Run at the pushed head (on origin/main |
||
|
|
a80575cc86 |
library: an MCP server's command wraps, and the editor shows the server as JSON (hema_17384)
hema_17384 on Discord: in Library > MCP servers, the editor's Command
field was one line, so `npx -y universal-db-mcp --type sqlserver --host
... --user sa --password ... --database ...` was cut off, and they asked
to see and edit the server as JSON.
- The command is a box that wraps (lineBox, a textarea of one row that
grows with autosize). It is still one line: Enter saves, Escape
closes, and a newline is a space between words (a shell's \ before it
too, except on Windows, whose lines keep their backslashes). At 390
wide it wraps over several rows; nothing scrolls sideways.
- The editor's head has a Form | JSON switch (the app's segmented
control, not a <select>). JSON is the server as Copy config gives it
for Claude Code: {"mcpServers": {name: {type, command, args, env}}},
or {type, url, headers} for a URL, with ${NAME} references as written.
An edit there is read as a paste is (serversIn) and becomes the form's
at once. JSON that isn't one server's marks the box invalid, says so,
and keeps the dialog from saving or going back to the form, and
counts as unsaved for Cancel. The agents, sync and the startup
timeout and OAuth app stay in the form and are kept as they were.
⌘/Ctrl-Enter saves from the box; a paste into it is the box's, not
the dialog's "paste a README's JSON".
- Strings in en, zh, zh-TW, ja and de.
Run at the pushed head (on top of the note commit, which shares these
files):
Run at the pushed head (on origin/main
|
||
|
|
94d0fbfcd3 |
provider: the ZCode mover installs opencode-zcode-auth 0.1.46 (plugins#676, #678)
ZCode 3.17.2's marketing feed answers empty to the 3.16.3 the plugin
signed in as, so from 11-03 the daily claim found nothing (plugins#676,
jinpy666; rick_49551 on Discord). 0.1.45 (#678, jinpy666) reads the feed
under 3.17.2's version header and drops billing/preview, which the 3.17
client no longer polls. 0.1.46 sends every call as 3.17.2, since the
client says the Start Plan balance judges capability by the real
app_version, and takes a sign-in whose only Start Plan starts later, as
the client's resolveStartPlanBalanceAvailability does, instead of
refusing it as "ended or never started" (sliyrainbow on Discord, whose
account works in the official client). Checked against
zai-org/ZCode@a9fe401. Raising min moves every moved user onto 0.1.46
through keepMovedCurrent.
npm has 0.1.46 as latest (published 2026-11-03T13:41:44Z, plugins
8fc12a3).
Run on mote at this change (on f168dd278; the rebase onto
|
||
|
|
93b1b49047 |
gui tests: searcher-pick waits for the reloaded Settings to be drawn (#1745)
After the reload, the test took the first searcher row it found and
scrolled to it. Settings draws the row when the page opens and again
when load() has the state, so on a busy machine the row was replaced
under scrollIntoViewIfNeeded: "Element is not attached to the DOM"
(webkit zh alone on WSL at
|
||
|
|
f168dd2784 |
gateway: a relayed Messages stream is read in whole events, however its reads are cut (#4868)
anthropicTextCalls (the filter that turns calls a model wrote into its
text into tool_use blocks, on a Messages passthrough that offered tools)
split each read with bytes.SplitAfter on "\n". The piece ending a read
always left a trailing empty slice, which line() took for the blank
line that ends an SSE event. So an upstream that flushed `event:` and
`data:` in separate reads had its events dispatched early: a
content_block_start reached the client without its data ("Unexpected
end of JSON input"), or a held block start was joined to the next
event without a blank line ("Unexpected non-whitespace character after
JSON"). Claude Code retried and gave up; hugemulberry on Discord sees
499s often.
The filter now reads whole events with tidyEvents and eventData, as
responsesTextCalls, phaseTidy and idTidy already do. Because tidyEvents
hands out slices of a buffer the next write reuses, the held block
start and stop are copied (startHeld, stopHeld); nothing else the
filter keeps past an event points into the buffer (pending and held
are strings, m is read within the call).
Siblings: the other SSE writers that cut a read on its last "\n"
(textCallTidy, geminiTextCalls, chatTidy, crTidy, usageSniffer) handle
each line alone and keep no event across lines, so the trailing empty
piece goes on as nothing; phase.go's withData and redact's splitEvent
split a whole event. Only this filter gathered lines into events.
Port of oDaiSuno's fix (7bee8c4d0) and tinytub's regression tests and
doc line (d1a7b02a8); yetone/magpie PRs are collaborators-only. Added
here: TestAnthropicTextCallsSSEChunksKeepFraming feeds each stream in
two reads cut at every byte (LF and CRLF), and
TestAnthropicMessagesSSEChunksKeepFraming cuts the handler's upstream
after each line and adds a request with no tools.
Run on mote at this tree (origin/main
|
||
|
|
bdb856b23c |
icon: the bird is white in macOS 26's clear and tinted icon styles, where it was a dark glass bird on a dark tile
psikent (Discord #feedback, 11-03) sent a dark Launchpad where magpie's icon was a near-black tile with a near-black, glassy bird. AppIcon.icon gave the bird a fill for the light and dark appearances only, so in the Clear and Tinted styles (System Settings, Appearance, Icon & widget style), which draw from the tintable rendition, actool used the light fill: the bird at 0.086 grey, whose luminance is what the system tints. On a dark tile that is dark on dark. The bird now has a "tinted" fill of white, so it takes the tint (or the clear glass) at full brightness. Light and plain Dark are unchanged. Not (a) or (c): the shipped Assets.car (v0.1.2816 in /Applications, same sha as build/darwin/Assets.car) matched icon.json, its dark rendition already a 0.957 bird on the dark grey tile, and the release build (magpie-releases release.yml, `make app`) copies that file. Run at this head, on mote (macOS 27.2, Xcode 27.2): - xcrun actool on build/darwin/AppIcon.icon, as `make icons` runs it; that output is this Assets.car (sha 72fe0ee3). The old one was made by Xcode 26.5; StorageVersion 17 and the 25 renditions are the same, and this Mac's macOS 26.2 assetutil reads it, the tintable group now filled with Color-2 (white). - A test bundle (build/darwin/Info.plist, magpie.icns, the Assets.car) drawn by IconServices for appearances 0-3 x variants 0-3, and by NSWorkspace iconForFile under AppleIconAppearanceTheme RegularLight, RegularDark, ClearLight, ClearDark, TintedLight and TintedDark (mote's setting put back after). The old Assets.car reproduces the report in ClearDark and TintedDark; the new one shows a bright bird in all six, and RegularLight / RegularDark look as before. - Broken by hand: a colour-coded icon (light red, dark green, tinted blue) showed Clear and Tinted draw from the "tinted" fill. Not tried: drawing it on macOS 26 itself (no macOS 26 test box; mote is on 27), and macOS 15 or older, which use the flattened renditions that this change doesn't alter. IconServices' variant 1 with dark appearance (no setting in the six themes maps to it) still draws the light bird on a black tile, as before. |
||
|
|
d16dcba227 |
routing: the stage's agent and magpie columns grow with their words, up to 15% of the stage
refeccd on Discord (#help): on the Routing page, in a full-screen
window, the stage kept the agent and magpie in columns of 124px each, so
the agent read "Claude Desk…" (and its model auto/claude-opus… was cut)
while the group's member rows ran on across the rest of the stage.
The two columns are now fit-content(max(124px, 15%)): as wide as their
words, at least 124px (min-width on .rt-srcs/.rt-hub, dropped again in
the narrow layout), at most 15% of the stage. Where 15% is no more than
124px (a stage up to ~826px) they are exactly as before, so the member
rows lose nothing on a narrow window; the narrow layout (560px and less)
is unchanged. The stage's ResizeObserver now also watches the agents'
and magpie's cards, so the wires follow a card that changes width while
the stage keeps its size (a new agent name or gateway address).
Run, on mote:
- new routing-stage-wide.test.cjs: 60/60 (chromium + webkit, en zh
zh-TW ja de, 2560/1920/1100/800/560/390px): name, model and address
read whole at 1920+, columns 124px..15%, exactly 124px where 15% is
less, wires start and end at the cards, no sideways scroll.
- broken by hand: with the old routing.css the same test is red in all
20 cases at 2560 and 1920px ("Claude Desktop" cut, columns 124/124).
- every routing-*.test.cjs + i18n-keys at 8d7583a78 (this change on
|
||
|
|
4c0c6c02b8 |
plugin: keep idle plugin sign-ins alive in the background (#5080)
A plugin with auth.refresh had a sign-in renewed only when something used the account (a request, its models, usage or check-in) within its refreshLead of expiry. An account left idle past its token's life lapsed. OrcaTerm's WeChat token lives two hours, and after that its refresh answers SESSION_EXPIRED for good, so the user had to sign in again (orinsid, magpie-community/plugins#675). The gateway now renews each such sign-in as it comes due (provider.KeepPluginsSignedIn, started beside KeepPluginsListed): - Due times come from plugin-auth.json through filememo (plugin.RenewAt: expires less the lead the host reckons, now listed as Provider.Renews/RenewLead). Nothing is asked, and no host started, until an account is due. The loop sleeps until the next one, at most 5 minutes, and renews them one after another. - A due sign-in goes through the host's own renewal (host.js keepSignedIn, which shares renewal() with fresh()). It is one at a time per account whoever asks: a request arriving meanwhile waits for the same promise, under the cross-process lock file, through the account's proxy. - Kept: accounts switched on and not marked, of a plugin provider not switched off, hidden (leftAlone) or being moved. - A failed renewal marks nothing. It is held back for 1m, doubling to at most 30m, for that sign-in only. Only the plugin's signIn:"expired" marks it, as at a request. - A plugin can opt out with auth.keepAlive: false. None in the plugins repo needs to: no refresh costs quota, the ones rotating single-use refresh tokens (Cline, Factory, Nous, SenseNova, CodeArts, Qoder, MiniMax) rotate at use already, and kimi-work's reference accounts and Raccoon's desktop reuse never refresh another app's token. Docs: provider-plugins.md "A sign-in nothing uses"; leftAlone list in providers-accounts.md. Run at the pushed head, on mote (mote-run), -tags nogui: - go test -count=1 -timeout 45m ./internal/plugin ./internal/provider ./internal/gateway: ok (109s, 119s, 637s), rebased on origin/main |
||
|
|
b088fd0f09 |
gui: the panel's header icon is named "Open the main window"; a double-click on the Windows tray icon opens it
isaac_bai on Discord missed the "Open magpie" button beside the quick panel's Quit, and was setting the tray click to open the main window just to get back to it; he asked for a double-click on the tray icon. History: the foot's button (#openMain) was taken out on purpose in |
||
|
|
78667e9b77 |
gateway: a request in flight shows its model's context window
packinggoods on Discord: Routing's context window card said "the model's
window isn't known" for a request on remote-magpie/claude/claude-opus-5-5
that was still answering, though the remote magpie's list gives that
model's window. The window was put on a route's prompt only when the
request ended (calibrate at the route's end). A live request always
showed it as unknown, on every provider.
Now the window of the model a try goes to is read as the try goes out.
That is windowOf(c.p, c.model), the same call the route's end makes. It
is kept on the route (Route.window, unexported), and the prompt shows it
while the request is under way (livePrompt). This holds whether the
prompt is read before or after the try starts. A fallback to another
model updates it. At the end the answering model's window still comes
first, as before. Codex turns through magpie's Codex backend now work out
Codex's own window (CodexWindow, else models.dev) when the turn begins,
not when it ends, so they show it live too.
Run at this head (rebased on
|
||
|
|
6cfe786351 |
agent: Codex that can't be joined again isn't connected by its helper models alone (#3868)
why8023: Codex switched off and on again showed 「已接入」 with its subagents' and memories' models back, while its own model never reached magpie. |
||
|
|
d3de7e8f3e |
agent: a provider of the user's own at magpie's gateway, under OpenCode 2's providers, stays theirs (#3915)
Found while fixing #3883. OpenCode 2 keeps a provider under providers, its base URL in settings.baseURL, and reads it there before the same name under provider, OpenCode 1's spelling: the one under providers is taken whole, and the other is only a WARN, "retained native value over legacy value" (packages/core/src/config/normalize.ts, mergeMaps, at v2.1.4). OpenChamber's provider form saves a provider there and takes it out of provider (packages/web/server/lib/opencode/config-v2.js, writeSectionEntry). magpie read the user's own providers under provider only, in the two places that look for them: - ownGatewayProvider: a provider of the user's own at magpie's gateway that lists the model, as a layout of one provider per family of magpie's models has, gets a pick of that model of magpie's as <theirs>/<model>, with no provider.magpie beside it. One under providers wasn't seen, so the pick went to magpie/<model> and magpie's provider was added beside the user's. - openCodeSpelled: a model on a provider named as one of magpie's and at the gateway (relay/glm-4.6 on the user's own relay) counts as magpie's. Under providers it didn't, so Agent.Models left it out. On origin/main |
||
|
|
0ed9891de0 |
agent: magpie's provider under OpenCode 2's providers is kept current (#3883)
Murciee (#3883, OpenCode 2.1.4 as OpenChamber bundles it, Windows): a model added in magpie never reached OpenCode 2, though magpie said it was exposed. ~/.config/opencode/opencode.json held magpie's provider twice, provider.magpie with 43 models and providers.magpie with 38, and opencode models listed the 38. OpenCode 2 keeps a provider under providers, in words of its own, and still reads OpenCode 1's provider: a provider named under both is the one under providers, whole, and the other only a WARN in its log, "retained native value over legacy value" (packages/core/src/config/normalize.ts, mergeMaps, at v2.1.4). OpenChamber's provider form saves a provider under providers and takes it out of provider (packages/web/server/lib/opencode/config-v2.js, writeSectionEntry). Once it had saved magpie's, magpie's next sync put provider.magpie back, as a model of magpie's was picked, and from then on brought only that one up to date. Where an OpenCode config keeps magpie's provider under providers, each sync and model pick now write it there too, and the wiring check reads it there (opencode_providers.go). It is written as OpenCode 2 reads magpie's provider.magpie (packages/core/src/v1/config/migrate.ts, migrateStandardProvider and migrateModel): npm as package "aisdk:<npm>", options as settings, a model's modalities as capabilities beside tools, its variants a list of {id, settings, body} with the options OpenCode 2 reads itself in settings and the rest in body (provider-options.ts, COMPATIBLE_KEYS: a fast variant's service_tier), and reasoning, which it doesn't read, left out. As under provider (theirsKept, openCodeKept), magpie's models are written whole, a key of the user's in the block stays, and so does a variant the user put on a model of magpie's. A variant is magpie's when it says what magpie's of its name says, split as OpenCode 2 splits it or all in settings, as OpenChamber carries one over from provider (toModelVariants). A config without providers.magpie doesn't get one: provider.magpie is still what magpie writes, and OpenCode 1 and 2 both read it. Taking magpie out of OpenCode or OpenChamber takes out both blocks, as OpenChamber's own delete does. agent-wiring.md says so beside #2379's variants. Old data: a config already in the reporter's state is brought up to date by the next sync, which SyncCatalog runs over every agent at each start and update of magpie. A providers.magpie an older magpie left behind when taking magpie out (it took out provider.magpie alone) is kept up to date from now on, and goes the next time magpie is taken out. Not changed: - Air: its magpie-opencode.json is magpie's own and holds provider.magpie alone. With OpenChamber's providers.magpie in the global config and nothing else of magpie's there, OpenCode 2.1.4 handed Air's file as OPENCODE_CONFIG still listed the model only Air's file had. - MiMo Code and DevEco Code go through the same code. Their configs hold no providers block unless something of theirs writes one; not checked against their source. - A provider of the user's own at magpie's gateway kept under providers isn't read by openCodeSpelled and ownGatewayProvider, which read provider alone: #3915, filed with this. - What else OpenChamber's form puts on a model of magpie's under providers (a modelID, a cost) goes with the rest of the model at the next sync, as a key on one under provider does today. What was run (tree 61b3fff7, on origin/main |
||
|
|
af55a7917f |
tui: quitting where magpie opens at login says how to have the gateway handed on (#3756)
With #3372, Open at login on Linux reads a package's own autostart entry in $XDG_CONFIG_DIRS (nixpkgs ships one). JoeyWu-tech's #3756 asked what `magpie daemon install`'s guard and `magpie tui`'s hand-off as it quits should count on a box no desktop logs into (NixOS-WSL, a server over SSH), where nothing ever starts that entry. Decided: both keep counting what Open at login shows (autostart.Enabled). A session check can't tell (an SSH login into a desktop box has no DISPLAY either), and counting less than the switch shows would install the service beside an app the desktop does start. The install already refuses with "run `magpie autostart off` first", which is the way out. The terminal's quit only said "the gateway stopped", with nothing about why or what to do; it now says magpie opens at login and serves it then, and that `magpie autostart off` has magpie tui hand it on where no desktop logs in (atLoginNote). Off Linux and with nothing connected the note is as before. What was run (wsl-run, magpie-desktop Ubuntu 24.04, go1.26.8): go test -tags nogui -count=1 ./internal/autostart ./internal/daemon ./internal/testenv ./internal/tui: ok With keep.go as before (the test kept): TestKeepGatewayAsTheTerminalQuits red, "app at login: ... the gateway stopped with magpie tui; ..." gofmt -l: nothing Not tried: a real NixOS-WSL login; mtul0729 ran the #3372 patch on real NixOS + COSMIC, at the systemd generator's level. Batch run, at tree 104d75f0a (the twelve coffemon ports together, on origin/main |
||
|
|
ab25a2317b |
autostart: on Linux the switch follows a package's own entry (#3372)
mtul0729, packaging magpie for nixpkgs (#3372, COSMIC on Wayland, v0.1.1334): a package that ships its own autostart entry ($XDG_CONFIG_DIRS/autostart/magpie.desktop, /etc/xdg when unset) has magpie open at login, but enabled() read only $XDG_CONFIG_HOME/autostart, so Open at login said off over it. Off removed a user file that wasn't there, and the package's entry went on starting magpie. On wrote this copy's own path over the package's entry: under a package manager a versioned path, gone once the package is upgraded and collected. The package doc says the switch "can't say one thing while the system does another"; on such a system it did. Now, as the XDG Autostart spec has it: - The entry that counts is the user's, else the first of the $XDG_CONFIG_DIRS folders (/etc/xdg when unset or empty) that has one. A relative folder has none, as the spec says, and neither has a file listed there, a folder this user can't search or a name too long, which systemd's generator and GLib can't open either. The user's own folder listed there too, by any name (os.SameFile, so /home linked to /var/home too), is still the user's. - An entry is read as GLib's key file and systemd's parser read it: the keys of its [Desktop Entry] group alone (a [Desktop Action]'s Exec is not the entry's), spaces around = and CRLF lines as any others, the last of a key given twice, true or 1 for Hidden. It opens magpie when it is an application (Type=Application) with an Exec other than true (below), not Hidden. - X-GNOME-Autostart-enabled=false (or 0) reads off too, as the issue asks. GNOME's and Cinnamon's sessions read it; systemd's generator (KDE's and COSMIC's sessions under systemd) doesn't, so there such an entry reads off while it starts. - Off, over a package's entry that some desktop starts, writes an entry of the user's that hides it; that includes one GNOME has off, which systemd's generator still starts. Otherwise off removes the user's entry, as before. On, over a package's entry that starts magpie, removes the user's entry and writes no path; otherwise (no package entry, a hidden one, or one GNOME has off) it writes this copy's entry, as before. The hiding entry is "[Desktop Entry] Type=Application Name=magpie Exec=true Hidden=true". A session holds back the entries of a name only once it has read one, and each reads differently (from their source): - gnome-session (main and 42.0) and cinnamon-session load an entry with g_desktop_app_info_new_from_filename. GLib (main, g_desktop_app_info_load_from_keyfile) refuses one with no Type or Name, or whose Exec names a program it can't find, and the session skips an entry it can't load, so the package's starts. - mate-session's egg_desktop_file_new refuses an application entry with no Exec, and the entry then takes no app id. - cosmic-session without systemd never reads Hidden: it starts what Exec names, and takes the name once that ran. - systemd's generator (main, xdg-autostart-service.c) reads Hidden first, and hides an entry it can't parse, which still holds back the rest. true is on every system by that name, so each session reads the entry, and COSMIC's runs true where it would have run magpie. A copy of the package's own Exec would stop holding the package's back on GNOME once its store path is collected. With this box's GLib 2.72.4 (Ubuntu 22.04's) and 2.84.2 (anaconda's), through ctypes: Exec=true and no Exec load, hidden; an Exec naming a store path that is gone, and a bare "[Desktop Entry] Hidden=true", don't load. An entry that runs true opens nothing, so it reads off: XFCE's Session and Startup lists the hiding entry as magpie, unticked, and ticking it there writes Hidden=false into it (xfae-model.c), which runs true, not magpie. On takes it away for the package's. What is no entry, and what can't be read: a path where no regular file is (a folder, a link that leads nowhere or round in a loop) is no entry, as systemd's generator and GLib pass over it, and on leaves a folder there alone. A file that can't be read (EACCES, EPERM, EIO) counts and starts nothing, as systemd's generator has it; GLib passes over it, so where the first entry is unreadable GNOME starts the next folder's while Open at login reads off. Any other failed read, magpie out of files or memory, says nothing of what the desktop reads at login: Set returns it and writes nothing, and Open at login reads on, as the package's doc has it for a system that can't be asked (Windows' Run key that can't be read is not a no either). The user's entry is written where the desktop reads it. A link there (to magpie's launcher, which install.sh writes, the usual way to have an app open at login; or into a read-only store), or a hard link, is replaced by the entry, not written through: edit.WriteAtomic writes a link's target, and a hard-linked file in place, so off over a package's entry would have left the launcher running true, and failed over a read-only target with the switch still on. Main's enable() wrote through such a link too, when on was asked over one (a linked launcher already reads on); it goes through the same write now. Old entries: a user entry an older magpie wrote stays and still counts over a package's, as before. The switch reads on over it, so in the app taking it away is off, then on; `magpie autostart on` does it in one step. One whose store path was collected reads on as well, though systemd's generator starts nothing for it and still holds the package's back, so on COSMIC or KDE magpie doesn't open while the switch says on; GLib passes over it, and GNOME starts the package's. The daemon and the terminal: `magpie daemon install` refuses while magpie opens at login, so the app and the service don't both serve the gateway, and `magpie tui` quitting hands the gateway on (keepGateway, |
||
|
|
8cf9dbe6bd |
testenv: the test home holds XDG_CONFIG_DIRS too (#3372)
Isolate pointed HOME, USERPROFILE, the XDG_*_HOME folders, APPDATA and LOCALAPPDATA into the temporary home, and left XDG_CONFIG_DIRS as the machine has it. The next commit has Open at login on Linux read a package's autostart entry in $XDG_CONFIG_DIRS/autostart, /etc/xdg when it is unset or empty (#3372), and the gui's settingsState reads Open at login (api.go's loginState) in many tests. On a machine with a package's magpie.desktop (NixOS, or a distro's package some day) their s.Login would follow that entry, and a test switching it would write a hiding entry where it expects none. LESSONS has the rule: give the sandbox every variable the code reads ( |
||
|
|
c0dd5838c2 |
library: the write-failure card can be hidden until a new failure (#3745)
Zachary-wW (#3745): the Library's "Some of the Library couldn't be written" card had Try again and nothing else. Their Grok Build has an AGENTS.md magpie can't stat, and every change writes every agent again, so the card stood over the page through every edit on the Instructions tab, with no way to put it away. The card has a × beside Try again now, named "Hide until something new can't be written". It hides the write failures the card lists, on every tab, and sends nothing. The page keeps what was hidden by agent and item ("grok" and "instructions"). After every answer, a read or a change, it lets go of a hidden failure that no longer stands, and a failure not hidden brings the card back with all it lists; so does a hidden one whose item was written in between and fails again. So the card stays hidden while the reporter keeps editing, though each change fails on Grok Build's file again, and a new write error shows it again. The key is not the error's text: a write goes through a temp file named anew at each try (edit.WriteAtomic), so a folder that can't be written fails with a new text at every sync, and the card would never stay hidden. Meanwhile each change's toast still names what failed, as before, and a skill that couldn't be given keeps the dot on its agent's chip. The list magpie keeps (lastProblems) is not touched. The × is named by its title, as the Library's other × buttons are. An agent's own skills in the library's way are the agent's to settle, not failures: they stay, under their own title, with no ×. The view keeps its scroll as the card goes, as render() keeps it for Try again; Chromium's scroll anchoring moved it. From the keyboard the focus goes to the card's next button, or to the tab open. On a phone the × is 44px wide and as tall as Try again. The card's title keeps its words whole: with less than 10em beside it, Try again and the × go to a line of their own (beside them, a German title at 320px broke "Bibliothek" and "geschrieben" inside). library-problems-hide.test.cjs is new. Its API answers as internal/gui/library.go does: a change's problems are its full sync's, an Instructions change keeps the rest and puts its own in, and a read gets the list with no result. Its error texts are the ones magpie's own sync gave in a sandbox HOME, through Handler in a scratch Go test (not kept): Grok Build's AGENTS.md a link into a folder magpie can't search, its folder read-only, and its skills folder read-only. Not covered: what was hidden lasts as long as the page, so a reload shows the card again. The × hides, it doesn't fold: while the card is hidden, its error texts and Try again are out of reach, though any change writes every agent again. An agent's instructions, and its whole MCP file, have no mark of their own as a skill's chip has, so with the card hidden only a change's toast names their failure (#3987). What was run (tree f98a4b99, on origin/main |
||
|
|
985b9f1a0a |
gateway: Reasonix's session-context snapshot is the agent's (#3938)
keeyangyy (#3938) named their client: Reasonix 1.x, which sends no session header (it sets x-opencode-session on its OpenCode Go paths only) and opens every conversation on a snapshot it writes, the same bytes in every conversation started in one workspace while its memory and skills catalog don't change: {"role":"user","content":"<session-context version=\"1\">\nThis host-generated snapshot supersedes every earlier session-context snapshot.\n\n## Environment\n...\nDigest: sha256:<hex>\n</session-context>"}, {"role":"user","content":"the question the user actually typed"} userWords didn't know the block, so the commit before this one still hashed it alone: every conversation a workspace opened had one id, and under Stays = session each new one was kept on the account that answered the first. "<session-context" joins injected, beside Codex's "<environment_context>", with no closing ">" so that its version attribute matches. What asks userWords now passes over the snapshot as it passes over Codex's context: - the conversation's id runs from the snapshot through what the user typed (conversationOpening); - the turn count: [snapshot][typed] is turn 1, where it was 2 (turnIn); - a group's conversation key is the typed words, where it was the snapshot, the same for every conversation in the workspace (firstWords, in ruleKey and the affinity scope); - the turn before, which the classifier is told (turnBefore): on a conversation's first turn, and on each turn a new snapshot comes with, it was the snapshot, workspace and memory and all, as the user's previous message with no reply; now it is nothing on a first turn, and the user's words before the snapshot and the reply to them on a later one; - the classifier's question, Copilot's Auto and gatewayQuery take the user's last words before a snapshot sent after them, and the Claude subscription takes one after tool results as the agent's notice (agentNotice). A Reasonix conversation under way when this lands gets an id of its own on its next turn and is routed once as a new conversation, as the previous commit says of the others: it may move to another account, and its cache there starts over. The shape is the report's, which keeyangyy read from Reasonix's source (internal/sessioncontext) and didn't capture; its folder and digest are left out as they left them, and the tests use it as written. Not changed: the prompt breakdown (promptBuilder.userText) keeps its own list of Codex's blocks and still files the snapshot as a chat turn, so a Reasonix conversation's first turn shows there as two turns, where Codex's context adds none. That is left for a commit of its own. What was run (tree 71364f08, on origin/main |
||
|
|
55a190f195 |
gateway: conversations opened on one fixed message no longer share an id (#3938)
keeyangyy (#3938): with no session header, conversationID named a conversation by the raw bytes of its first user message alone. Some agents open every conversation on a message they write themselves and send what the user typed as the next user message: {"role":"user","content":"<environment_context>cwd=/w/proj ...</environment_context>"}, {"role":"user","content":"the question the user actually typed"} That message is the same in every conversation started in one folder, so all of them had one id: under Stays = session each new one was kept on the account that answered the first, and rotate never moved on. conversationOpening now says what is hashed, from the first user message on (Chat and Anthropic messages, Responses input, Gemini contents, where an omitted role is the user's): - A first user message that holds anything of the user's own is hashed alone, as the request has it, exactly as before: their words (userWords, which already tells an <environment_context> or <user_instructions> block or an instruction file from what the user typed), an image, a file or a recording (userOpens). So is one that holds a tool's result. - One the agent wrote alone is hashed with the user messages after it, in order, through the first that holds the user's own. A system or developer message between them is passed over. - A reply, a call, its output, reasoning, a tool's result (Gemini's function result too), an item without a role (Chat, Responses) or one that can't be read ends the opening. With nothing of the user's before it, the first message is hashed alone, as before. Every later turn repeats the opening before the first reply, so the id holds through the conversation. A Responses input that is one string is hashed as before. An opening of several messages is hashed as writeOpening reads them, one after another: every object's members in key order with no space between, no cache_control at any depth, and a content of one text part as that part's text. An agent marks its newest user message for the cache and moves the mark on next turn, so the typed message's bytes change at turn 2; some spell a marked message as a list of one part and an unmarked one as a plain string (dsh does). Hashed as sent, an opening of several would get a new id at its second turn, and on /v1/messages under rotate that turn would go to the other key as a new conversation (below). writeOpening reads the messages where they are: the id of a 1.1 MB body whose opening holds a screenshot allocates about 10 KB (TestOpeningHashReadsInPlace). Every conversation whose first user message is the user's own keeps the id it has, so no stick record needs moving. One that opened on an agent's message and is under way when this lands gets an id of its own on its next turn and is routed once as a new conversation: it may move to another account, and its cache there starts over. The record they all shared stays under the old id. A tool's result (Anthropic clients send it as a user message) ends the opening: it answers a call the model made, so the opening is over. A history that starts with one was cut by its client (magpie takes such orphans, TestMessagesOrphanToolResultWithoutACallBecomesText). Its opening is gone, and whatever was taken in after the cut would move the id each time the client cuts again, so its first message is hashed alone, as before. Not the issue's "first two user messages", nor every user message up to the first reply: in an ordinary conversation the second user message is the next turn, so the id would move when it arrives, and every record would need the migration the issue describes. And a run of every user message takes in what dsh sends after the typed prompt, its runtime context, where the Context page finds dsh's sessions by the typed prompt's hash alone; TestDshSessionConvsAreTheGatewayIDs and TestDshRoutesCarryTheSessionConvs go red under such a run (below). What reads the id moves with it: stickKey (session, turn and strict affinity, and rotate's spread of new conversations), the Routing trace's conv (convOf), a sealed task's lead (leadProvider, loggedAnswerers), extraBody's ${sessionId}, Kilo's task and session headers (KiloClient), X-Magpie-Conversation to plugins and OpenCode's x-opencode-session fallback (openCodeSeed). A group rule's key reads conversationID without a body, beside firstWords, which already passes over the agent's blocks, so it doesn't change. One reader rebuilds the id itself: sessions' dshConvs, which the Context page joins dsh's sessions by (joinConvs). It hashes dsh's typed prompt, a first user message of the user's own, which is still hashed alone, so its ids stay the same. Nothing else in sessions, gui or elsewhere rebuilds a "magpie-" id. The comments that named the first user message, and the Gateway routing and Providers and accounts pages, say what the id is now. Siblings left for a decision, each in an issue filed with this patch: #3988, ChatGPT accounts (conversationKey in internal/provider/codex_request.go, for a client that sends no prompt_cache_key), and #3989, Antigravity accounts (antigravitySession in internal/provider/google.go). Both hash the first user message in the provider package, and userWords is the gateway's. Not changed: a fixed first message that userWords doesn't read as the agent's is still hashed alone, so the conversations an agent opens on it still share one id. A first user message hashed alone is hashed as the request has it, cache mark and all, so a client without a session header that marks that message on its first turn only gets a new id at its second, as before. An agent that answers its own first message with a fixed reply before the user's turn ends the opening at that reply, so its first message is hashed alone too. What was run (tree 523c770b, on origin/main |