ac4af582301a4e8a29245dbba767eba31334ddf9
7089
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
cd0875f5a0 |
provider: a Claude sign-in whose keychain write fails leaves logins.json alone (#4563)
addLogin wrote logins.json before the credential was stored, and a keychain write that failed (the login keychain out of reach over ssh) left the account kept all the same: importing the same file again reported it as already there. The credential is stored first now; the login is written only once it is in. Reviewed and applied from #4563 (ggbdpq, 7b42e98a1, SHA-256 matches). The test runs in signIn's sandbox HOME with a fake `security` first on PATH that exits 51. proc.Command looks PATH up at call time, so the real Keychain is never reached. Switching to a saved login still writes its On marks before the credential: #4592. Broken by hand: signin.go back at main with the test kept, and TestClaudeLoginKeychainWriteFailureKeepsLoginsFile fails. Run (on mote, through mote-run): - Full `go test -tags nogui -count=1 -timeout 45m ./...` with this stack on |
||
|
|
d1b62f4604 |
usage: price a local session's call at the provider its file names
What changed A call read from an agent's own session file (omp's model_usage, say) has no billing provider of ours — its row reads session-unknown — so Pricer priced it only through the maker lookups, which answer nothing for models no vendor catalog lists as its own, even when the models.dev catalog lists the model under the provider the file recorded (openrouter listing typesafe/jev-1.14 at $0.042/M in, #4278). When the effective price is unknown and the record is one of those, its session provider now prices the call — but only what the catalog itself affirms: the very model id, listed under that provider, with a price. A provider models.dev doesn't know, a model it lists that provider without, and an entry with no price stay unpriced, the CSV cost empty, rather than priced at another entry's guess; the pricer's memo is keyed by the session provider too, so two files naming different routes price apart. Run - go test -tags nogui -run 'TestUnknownProviderPricedBySessionProvider' ./internal/usage — red before (the named route stayed unpriced), green after - go test -tags nogui ./internal/usage/... — ok - gofmt -l internal/usage — clean Generated-by: GLM-5.3-FlashX (ZCode) Reviewed and applied from #4278 (ggbdpq, 645e80ab2). It differs from the patch hashed on the issue only in its git-version trailer. The reporter's own call stays unpriced for now. models.dev's default api.json, which magpie fetches, does not list openrouter typesafe/jev-1.14; only api.json?type=all does. #4278 stays open for that. The Sessions page prices a session-unknown call through its own priceOf, by model only: #4591. Broken by hand: ledger.go back at main with the test kept, and TestUnknownProviderPricedBySessionProvider fails. Run (on mote, through mote-run): - Full `go test -tags nogui -count=1 -timeout 45m ./...` with this stack on |
||
|
|
c8df9ecbbc |
gateway: a search round ended without its stop hands on its held text (#4562 review)
textCallRound holds text from where a written call may begin, and gives it back at KStop. A round whose channel closes without a KStop is one searchRounds takes as ended, and its held text was lost with it. The routes without a search give it back at their reply's end (gateway.go's held(), continuation.go's release), and the round now does the same after its loop. The previous commit's doc comment for textCallRound had also been put between searchReply's comment and its func. searchReply's comment is back on searchReply. TestTextCallRoundReleasesHeldAtEnd: a round that sends "Let me look." and the start of a DSML call, then closes. Broken by hand: the t.release() taken out. Red: it handed on only "Let me look.\n\n". Run (on mote, through mote-run): - Full `go test -tags nogui -count=1 -timeout 45m ./...` with this stack on |
||
|
|
90f8a10566 |
gateway: a search route's reply reads the calls written into its text (#4562)
searchReply's rounds answered a request that carried a hosted web search — Messages' web_search_20250305, Chat's web_search_options, Responses' web_search — for a model that can't search by itself, and never ran the text-call recognizer: a call the model wrote into its text (#823) reached the client as that text, while every route without a search made it a call (streamTranslated, forwardTranslated and the relayed Chat stream each wrap their reply in textCallSee or textCallTidy). The three routes the reporter lists all pass through searchReply, so its round is wrapped: textCallRound hands every round's events through a textCallSee over the client's tools plus magpie's own, and a call written out — the client's or the search tool itself — is read as the call it is. A reply that made a call of its own keeps the text as it came, as elsewhere. A round with no tools keeps the round it was: textCallNames is nil and the round passes unwrapped. Verification on the branch's base |
||
|
|
f2ae7bdecc |
gateway: plainSchema judges a self-reference by whole segments (#4561 review)
The previous commit's selfRef took a $ref as a self-reference when the
walk's path began with the ref's pointer as a string. So
"#/properties/a" inside /properties/ab, a sibling, was cut down to
{"type":"object"} instead of being resolved. A self-reference is now
the pointer itself or one of its containers: path == ref, or path
begins with ref + "/".
A "#/…" pointer that names nothing where it points also falls back to
its last segment as a $defs or definitions name again, as every ref did
before pointers were walked ("#/components/schemas/Mode" with Mode in
$defs).
TestPlainSchemaSelfRefBySegment covers both.
Broken by hand: selfRef and localRef back to the previous commit, test
kept. Red: "inner" and "mode" both go out as {"type":"object"}.
Not tried: a real Antigravity request with dsh's tool schema. The
fix is in the flattening, and the gateway tests send the result
through a fake upstream.
Run (on mote, through mote-run):
- Full `go test -tags nogui -count=1 -timeout 45m ./...` with this stack
on
|
||
|
|
abaf2c4e8f |
gateway: plainSchema resolves a $ref into properties (#4561)
A $ref that points inside the schema ("#/properties/func/properties/
triggers/items", as dsh's tool parameters carry one) is a local JSON
pointer like a "#/$defs/x" one, but plainSchema read a ref only by its
$defs or definitions name: the pointer's last segment named nothing
there, and the field it stood for went out as a bare {type: object} on
the Antigravity path, the tool losing that field's shape.
Any local pointer is resolved now, where it names; a self-reference —
a ref to the site or one of its containers — stops at the target's
type alone, as the plugin's googleSchema has it.
A test with the error's path fails on the old code.
Reviewed and applied from #4561 (ggbdpq, branch head ab39ddcbc; the
patch's SHA-256 matches the issue). A review fix follows in the next
commit: selfRef matched a pointer as a string prefix.
Broken by hand: plainSchema back at main with the test kept, and
TestPlainSchemaResolvesPointerIntoProperties fails ("again" goes out as a
bare {"type":"object"}).
Run (on mote, through mote-run):
- Full `go test -tags nogui -count=1 -timeout 45m ./...` with this stack
on
|
||
|
|
29d0ab39fb |
sessions: Antigravity CLI (agy) sessions can be deleted (ysm119 on Discord)
ysm119 (#help) could delete Codex sessions on the Sessions page but not agy's, and wanted to clear out empty ones. A delete now moves a conversation to magpie's trash the way agy's own /resume delete (F4) removes it: brain/<id>/, conversations/<id>.db with the -wal, -shm and -journal SQLite leaves beside it, and annotations/<id>.pbtxt. Restore puts them back. What agy keeps of a conversation, read from real agy 1.4.12 in a sandbox HOME against a fake Gemini endpoint (the live ~/.gemini was only read): the files above, presence/<id>.lock, a row in conversation_summaries.db, an entry in jetbox_summaries_proto.pb, and cache/last_conversations.json. agy's own delete removes the files, the row and the jetbox entry. It leaves the lock and last_conversations.json. magpie leaves the row and jetbox entry too, because agy keeps both files open and jetbox is an unknown protobuf. agy's /resume list leaves out a row whose files are gone, so it never lists a deleted conversation. A conversation agy has open is not deleted: agy flocks presence/<id>.lock for as long as it has it open, idle too, and a held lock (or one that can't be tried) is ErrActive. On Windows how agy locks it hasn't been seen, so the minute since a write decides there alone. Siblings: Hermes, Alma, OpenCode, ZCode, Cline, Grok Build, Kimi Code and Claude Desktop (Cowork) sessions still can't be deleted. Each keeps an index magpie would have to edit or leave stale; filed as #4595 with what each needs. Run at d018b9302 (on origin/main |
||
|
|
2cca111764 |
gateway: a 413 byte cap or an overflow tells Codex context_length_exceeded, so it compacts instead of reconnecting 5/5 (celestial_eagle_99230 on Discord)
A Codex user on a DeepSeek model kept getting "stream disconnected
before completion: 1017dp: 413 Request Entity Too Large: a web page,
not an API reply ... (request_too_large)" with "reconnecting 5/5".
The big body took the vendor past keepHeldAfter, so Codex's stream
had begun, and streamError sent response.failed with code
server_error. Codex (codex-api sse/responses_error.rs) reads any code
it doesn't know as Retryable, so it sent the same body five more
times. Each was refused the same way, and nothing compacted.
context_length_exceeded is the one code Codex stops on: it marks the
window full and compacts, and core compact.rs trims the oldest items
for as long as the compaction is refused too.
- streamError: a 413 on the Responses shape is code
context_length_exceeded, for every Responses client. The text still
says request_too_large for pi.
- failTo: Codex reads a 413 told by HTTP status as UnexpectedStatus,
and a 400 context_length_exceeded as InvalidRequest
(api_bridge.rs). Neither compacts. So when Codex (fromCodex, or
Claude Code's Codex plugin) asked for a stream, a byte cap or an
overflow goes to it in a stream even before one began
(keptAlive.compactsInStream). A vendor's own overflow, released
until now, goes this way too. Other clients keep the status they got
before.
- Nothing changes for resting: a 413 still rests nobody, and a group
still tries the next member first.
Tests: codex_byte_cap_test.go. It replays the reporter's nginx page
mid-stream and before the stream, plus a vendor overflow 400, and
checks a non-Codex client keeps its 413. Red on the old code:
TestCodexByteCapInStreamCompacts got "server_error" (the reporter's
exact text), and both TestCodexByteCapBeforeStreamCompacts cases got
a 413 or 400 JSON. TestStreamErrorByteCapInEveryShape now expects
context_length_exceeded for Responses.
Run on mote (mote-run, this tree): go test ./internal/gateway on the
byte-cap, stream-error, overflow, compact and Codex tests: ok. GOOS=linux
and GOOS=windows go vet ./internal/gateway: ok. gofmt -l: clean.
Full suite: mote-run go test -timeout 45m ./... at
|
||
|
|
c30d3b7b63 |
plugin pages: a page the reader left is told, and let go after 10 minutes unless it keeps itself
A plugin's page kept its frame, with its scripts, timers and
connections, for as long as the window was open once it had been
looked at: show() only hid its view, and a frame in a hidden view isn't
hidden to itself (its visibilityState doesn't change), so a page
couldn't even pause on its own. Asked by the owner: is that by design?
Only the lazy first load was.
- The kernel's leave hook now reaches the page part: the page is told
{event: "visibility", data: {visible}} as the reader leaves and comes
back. The bridge has magpie.visible and magpie.onVisibility(fn); hello
carries visible, for a page left before it said hello.
- A page left 10 minutes (IDLE_MS) has its frame removed and loads again
when next opened. Back sooner, it is the same frame. Its hello timer is
cleared, so nothing says it broke.
- magpie.page.keepAlive: true (plugin.PageSpec.KeepAlive, keepAlive in
/api/plugin-pages) keeps a page however long, for one that works while
no one looks at it. Anything but true is false, read as raw JSON so a
wrong type never drops the package's page.
- plugin-runtime.md's page row says so.
Run on mote. The Go suite and most GUI files ran at this change on
|
||
|
|
b75fa328ce |
gui: the ban warning is said once, not again beside accounts signed in
The owner, on Claude Code's editor with four Claude accounts in it and "Claude 账号可能被封禁" shown on Add another: "这里就不要显示可能被封禁了". A subscription that warns before a sign-in (Claude, Antigravity and the plugin-served ones with risk) now warns only while it has no account signed in, and never to sign one of its accounts in again. startSignIn asks hasLogins(agent), and its o.user, before the risk step. The import box keeps its note. What goes with it: Factory's warning offered "Use an API key instead…". Factory is retired and the Add sheet leaves it out with no account, so that warning was reachable only beside an account, and no longer is. Its accounts list's "Add an account by API key…" row still offers the key; factory-key.test.cjs now starts there. signin-close and signin-proxy no longer click "Sign in anyway" in editors with accounts. claude-risk.test.cjs: a new case opens a Claude editor with an account, clicks Add another, and wants the sign-in asked at once with no warning (chromium and webkit, en and zh). The first-account case is unchanged. Run, on the Linux box (magpie-desktop): - Broken by hand: the old app.js with the new test: red in both engines, nothing asked. - All 46 GUI files that reach a sign-in or the warning, plus i18n-keys: 739 ok, 2 red. login-import chromium en timed out waiting on its import box, then passed 4 of 4 alone. i18n-keys' "a plugin's words are its own" is red the same at origin/main |
||
|
|
fb29cd30f9 |
tray: the Mac's menu bar figures are regular weight, a lone one in the menu bar's own font (qingnianxiaozhe on X)
Beside Surge's speeds and another app's stacked "0 KB/s", magpie's
"93% / 98%" read visibly bolder, and a lone "98%" too small and too
heavy, so the reporter kept it out of the menu bar. mpRowFont drew two
stacked rows in 9.5pt semibold and one row in 11pt medium, both since
|
||
|
|
30cd39f19b |
provider: Devin's plugin is 0.1.29 at least, its Claude models keep the client's cache marks (plugins#566)
Devin 0.1.28 asks its Claude models on Anthropic's Messages API and sends each of the client's blocks as a prompt of its own, with Devin's cache mark (prompt_cache_options EPHEMERAL) where the client put cache_control. A grown Claude Code classifier history read 558 tokens from the cache and wrote ~7.3k again; on a real account it now reads 7,318 and writes the 560 it grew by (haiku-5-5 and opus-5-5). 0.1.29 says a failed tool result in its text, "Error: " first, as the chat path does. npm view @magpie-community/opencode-devin-auth version --prefer-online: 0.1.29 when this landed. Run: mote-run go test -timeout 45m ./internal/provider/... ok (102.8s). Not tried: a magpie gateway with Claude Code end to end on the new plugin. |
||
|
|
59ea5dc8f8 |
gateway: a failure with this computer off the network rests nobody (usrname1833)
usrname1833 on Discord: with the computer offline, a routing group's
members failed to connect one after another, each rested, and the first
stayed behind the others once the network was back.
A 502 whose error says no connection was made (dial, lookup, refused, no
route, TLS handshake timeout, and Bun's ConnectionRefused / ENOTFOUND
for a plugin's fetch) now asks whether this computer has a network,
unless any upstream answered in the last 15s: no interface up with a
global address means none; otherwise up to three hosts of the user's
other providers (not p's own, not proxied ones, not localhost / LAN) are
dialled at once (2s), and none taking the connection means offline. The
verdict is kept 5s and asked by one request at a time. Offline, the
member is passed over as a down proxy is (failProxy): no rest, no count,
the trace says Fail "offline". One provider that can't connect while
another's host takes a connection, or while replies came lately, still
rests as before.
Covered where every rest passes: restAfterMarked (so decide_group's and
count_tokens' rests too), the serve loop's next-member path, and the last
member's label. Routing page: "network down" tag and a story for the
next-member and last-member cases, in zh, zh-TW, ja and de.
Run (mote, at this tree):
- gofmt -l clean; go vet ./internal/gateway on darwin, GOOS=linux,
GOOS=windows: ok
- go test -run 'TestOfflineRestsNobody|TestProxyDownDoesNotRest' -v
./internal/gateway: ok; go test -timeout 45m ./internal/gateway:
ok (708s)
- GUI: routing-offline.test.cjs (new) 10/10 and routing-proxy 4/4,
Chromium + WebKit, en zh zh-TW ja de. Every routing-*.test.cjs at once
(load 30-44 on mote): 1997 pass, 29 fail. The untouched base
|
||
|
|
e0eb74987c |
plugins: a dist branch not read is unknown, not "not on npm", and its read isn't cut off by one ask
ferock on Discord (v0.1.2399): the Plugins page showed the Chat page plugin (@magpie-community/page-chat, on the community repo's dist branch only, never on npm) as Coming soon. Cause: Info asks each package under npmEach (6s). npm said 404, and npmAsk turned to distInfo -> distPkg, which read the ~1.6MB index.json (GitHub and the jsDelivr mirror) under that same 6s context, holding distMu. On a slow link the read was cut off, distPkg returned nil as if the branch had no such package, and npmInfo kept "not on npm" (ok=true, empty NPM) for an hour, saved to plugin-npm.json. distWait then held a new read back for a minute. Fix: - distPkg returns (*distPackage, error): nil, nil only when the branch was read and lacks the package (or it is out of scope); an error wrapping errDistUnread when the branch couldn't be read (last read failed or not finished) and the kept index doesn't have it. - The index is read in its own goroutine (readDist), apart from the asker's context, with its own distReadFor (2m). One read at a time (distReading); askers wait for it or their own ctx, distMu is not held across the network read. A read that ends after its asker stopped waiting is kept for the next ask. - npmAsk: npm's errNotFound with the dist branch unknown becomes the dist error, so every caller that keeps "missing" (Info/npmInfo, newestOf in store.go, the update checks in updates.go) treats it as unknown and asks again. Readme says the branch couldn't be read instead of npm's not found. installDist returns the unread error rather than "has no". - mendDist was checked: it reads only local files, no dist read. Old data: a "not on npm" already kept in plugin-npm.json by an older build is asked again once it is an hour old, as before. Tests: TestDistReadSlowerThanAnAskIsntMissing (index.json held past npmEach: not kept as missing, and the next Info after the read ends has 0.1.7) and TestDistReadFailedIsntMissing (index.json 503: unknown, asked again; a read branch without the package is still errNotFound). fakeDist's reset waits for a read under way (distSettled). Run (mote-run; vet at base |
||
|
|
8e9da4e832 |
provider: Zed's plugin is 0.1.12 at least: a string message content goes as a text block (Been on Discord)
npm view @magpie-community/opencode-zed-auth version --prefer-online: 0.1.12 at landing. The plugin's change: magpie-community/plugins 3e940bc, bun test 49 pass on mote, its new test red 2 of 2 with the change reverted. |
||
|
|
7dc8a18d0e |
provider: a plugin's Gemini model is tested on generateContent, as the gateway asks it
A plugin's @ai-sdk/google model is served by the gateway on Code Assist,
which it sends to the plugin's fetch as Gemini's generateContent. Test
models kept only chat, Responses, Anthropic and Gemini, so such a model was
sent the body of the plugin's first other API: Zed's cloud read a chat body
as a Google request and answered 400 "failed to parse Google AI request:
missing field contents" for every Gemini model (Been on Discord), while
agents were answered. Its test now goes through the gateway's translator
(testTranslated), with the plugin's longer wait.
Run (mote-run): go test ./internal/provider ./internal/gateway ok (120s,
710s) at e0bb3c30a; go vet ./internal/provider ./internal/gateway on
darwin, GOOS=linux and GOOS=windows ok; after rebasing on
|
||
|
|
484b45d825 |
provider: WorkBuddy's mover asks for plugin 0.2.8, which lifts deepseek-v4.1-flash's 100k cap on copilot.tencent.com (plugins #561)
@magpie-community/opencode-workbuddy-auth 0.2.8 (plugins 42a5055) takes
0.2.7's 100000-token cap on deepseek-v4.1-flash off the China build: three
users' China Free-plan accounts took 110k to 992k-token prompts on it, and
the vendor's own refusal names 1048576 as the maximum. The cap made agents
compact at 100k. A prompt WorkBuddy does find too long is its own 400
"prompt is too long", passed on as it came, which overflowed() reads as an
overflow (no rest, not retried). keepMovedCurrent brings every moved user
to it.
Run: go test -timeout 45m ./internal/provider/... on mote at
|
||
|
|
63cb1af3cb |
library: the MCP router's mark is the bird with its tail routed out to three ends
The owner asked for a mark that says MCP routing and picked, from three
generated drafts, magpie's bird whose tail fans out into lines ending in
dots. It is drawn as SVG on the bird itself, not a picture, so it stays
sharp at 17px and takes the theme's colour: the bird clipped short of its
tail (#bird-notail, beside #bird-tail in index.html), three strokes from
where the tail was and a dot at each end. Every place hubMark draws (the
Library's MCP router row, the Connect an app sheet) gets it.
Run on mote (macOS 27): library-mcp-hub now checks the clip, the three
routes and their ends (red on the old mark). library-*, i18n-keys and
old-webkit, both engines: 895 pass, 5 fail. The reds are i18n-keys
"a plugin's words are its own" (#4524) and library-row-remove's 3
subtests (#4304); both red the same at origin/main
|
||
|
|
557f51dbf0 |
library: a skill linked into an app version the update deleted follows it to the current one (tjhhhh on Discord)
tjhhhh: ego lite keeps its skills in its framework's Versions/<v>. After the app updated, the skill was in the new version's folder, the old folder was gone, and magpie still linked the old one. |
||
|
|
49b8c64559 |
dsh: deepseek-acp gets magpie's route in settings.yaml, and the key store is owner-only
liby233 on Discord: dsh in an editor over ACP (deepseek-acp, CodeG, the
desktop app) listed only DeepSeek's own models. Checked against the real
packages from npm (deepseek-acp 0.9.0, dsh 0.2.1-rc.5): deepseek-acp
mounts FileSettings on $DSH_HOME/settings.yaml alone, never profiles/,
and loads the pi-ai plugin only when that file mentions "llm-pi-ai". Its
credentials-local store throws when .credentials.yaml is readable beyond
its owner ("run chmod 600"), so a 0644 store stops it from starting.
- settings.yaml gets llm-pi-ai.providers.magpie, built by the same code
as the profiles' route (dshPutProviders), at 0600 when magpie creates
it. It gets no agent-default-model of magpie's. The user's routes,
other sections, comments, mode and the api they chose for magpie's
route are kept. Disconnect takes only magpie's route out, and the
section too when nothing else is left in it.
- dsh 0.2 renames settings.yaml to settings.yaml.imported (over the one
before) at each full start and imports it into the profile. The
serving round, Sync, Set and Unwire write it again. The user's own
import from before magpie's first write is copied once to
settings.yaml.imported.kept, so magpie's import never overwrites it.
- .credentials.yaml is made owner-only (go-rwx) on every write and every
Sync, whoever made it 0644. In a WSL distro, a file written through
\\wsl.localhost comes out 0644, so the chmod runs inside the distro:
wsl.exe -d <distro> -e chmod go-rwx <path>. A failure is logged and
doesn't fail the write.
Run:
- internal/agent on mote (ok) and its Dsh/WSL tests on Windows
(xiaomi-gpu, ok); gofmt; go vet on darwin, GOOS=linux -tags nogui
and GOOS=windows.
- The new tests (dsh_acp_test.go) were broken by hand, each turning red:
dshSettingsAgain disabled, ownerOnly disabled, dshKeepImported
disabled, and the round's call removed.
- Real runs on mote in a sandbox HOME (~/runs/realdsh-home), never a
live ~/.dsh. After magpie's Pick, real deepseek-acp's session/new
listed magpie::deepseek/pro and magpie::deepseek/flash; without
settings.yaml it listed only DeepSeek's. With a 0644 store its boot
failed with the credentials-local error, and it started once magpie
had made the store 0600. `dsh --profile web --dump-config` shows
agent-default-model magpie and the route. `dsh headless` ate
settings.yaml into the headless profile, and magpie's round
(dshWiredOnce) wrote it again, after which ACP listed magpie's models
again.
- On magpie-desktop: `wsl.exe -d magpie-desktop -e chmod go-rwx` takes
a file written through UNC from 644 to 600.
Not tried:
- magpie's own write into a real WSL distro end to end; only the
command form above, and fakeWSL in tests.
- A WSL distro has no serving round, so after dsh eats settings.yaml
there, it comes back only on magpie's next Sync or model pick.
- A dsh from before profiles (config.yaml only) is left as before.
Also: fakeWSL answers the chmod without recording it, since it is neither
a start nor a probe (TestWSLMoreAgentsStopped counts starts).
|
||
|
|
a51776f9c3 |
gateway: a socket's turn writes its conversation once, not through json.Marshal twice
Codex sends each turn on its Responses WebSocket with only what came after the reply before it, and the gateway put the conversation back together and wrote the body the HTTP route would have had: json.Marshal of the list, then json.Marshal of the body around it. encoding/json writes a json.RawMessage through its scanner a byte at a time into a buffer that doubles and is then copied out, so a 3.2 MB conversation allocated 9.6 MB on every turn. marshalRaw (#1532) had fixed this for the HTTP routes' rewrites; the socket's turn was left on json.Marshal. turnBody writes the same bytes, keys sorted, each value checked by jsonCheck and compacted with <, > and & and U+2028/2029 escaped, into one slice sized for them: its length plus the five bytes each <, > and & grows by, counted with bytes.Count, since code is full of them. A value encoding/json would refuse still goes to json.Marshal, which says why. Live heap on the owner's running app had 8.8 MB under this json.Marshal between collections. Run on mote (M5 Pro), at this tree: - TestTurnBodyIsJSONMarshal: byte for byte json.Marshal's for 0, 1 and 40 pretty-printed items with literal <, >, &, U+2028, U+2029, tabs and CJK; nil input is null; a broken item is refused. - TestTurnBodyWrittenOnce: a 3,225,123-byte turn allocates 3,252,336 bytes (1.01x); json.Marshal twice, 9,605,256. Broken by hand in the mote copy, each red: the escape count dropped (2.9x, the slice grew twice); values written without HTML escaping (bytes differ for all three sizes); json.Marshal back inside turnBody (3.0x). - TestResponsesSocket* and TestCodexSocket*: ok. - go vet ./internal/gateway/ for darwin, linux and windows; gofmt clean. - The whole internal/gateway package at the parent, v0.1.2406: ok (772s). Real use: this build (go build -tags nogui) in a sandbox HOME with the owner's DeepSeek key only, magpie serve on 127.0.0.1:3581, and Node 22's WebSocket on /v1/responses: a 30 KB first turn of 400 lines with <ZEBRA&n> and code, asked for the last one, answered <ZEBRA&399>; the second turn, previous_response_id and one new message, asked for the first, answered <ZEBRA&0>. The log: 2 turns, 1 continued, 88003 bytes sent on as whole requests. Not tried: a real Codex CLI session on the socket (the client here sends what Codex sends: response.create, previous_response_id, input). |
||
|
|
2cfb8351d0 |
install.sh: a Linux desktop without WebKitGTK 4.1 has it installed through sudo, then gets the desktop app (shuhai)
shuhai on Discord, on f68ddca37's hint: "为什么不能帮用户直接装好?" On a
desktop without WebKitGTK 4.1 the installer put in the terminal build and
told the user to `sudo apt install libwebkit2gtk-4.1-0` and run it again.
Now, on a desktop without the libraries (and with --gui), when someone is
at the terminal, the script installs WebKitGTK 4.1 (GTK 3 comes with it)
with the distribution's package manager, says first in one line what and
why, and installs the desktop app:
- apt-get install -y libwebkit2gtk-4.1-0 (Debian/Ubuntu family), and when
that fails, apt-get update and once more (lists missing or stale);
- dnf install -y webkit2gtk4.1 (Fedora/RHEL family);
- pacman -S --needed --noconfirm webkit2gtk-4.1 (Arch family; no -Sy, so
no partial upgrade);
- zypper --non-interactive install libwebkit2gtk-4_1-0 (openSUSE).
Through sudo, which asks for the password itself; as root, without it.
"At the terminal" is /dev/tty opening (in a subshell, since a failed
redirection would end the script): curl | sh gives the script the pipe
for stdin, so every package command reads /dev/tty too, never the script.
No terminal, no sudo, the package manager missing, Void/Gentoo/another
distribution, or the install failing: the terminal build and the command,
as before, with "didn't work (see above)" when it was tried. --tui and
MAGPIE_CLI=1 install no package; a headless computer neither.
MAGPIE_TTY points the check at another file for the tests.
Docs: reference.md Install, README en/zh, docs start (en/zh/ja).
Run:
- sh -n, dash -n; shellcheck -s sh: only SC2010 at the uninstall's
ls | grep, there before.
- site/install.test.mjs, 5 new tests (fake sudo, id and package managers;
every distro's command, root without sudo, no tty, no sudo on PATH,
Void, NixOS, a failing install, apt's update-and-retry, --gui, --tui,
MAGPIE_CLI, headless): red on origin/main's install.sh (the 5 new fail,
19 pass), green after. CI's site step (sh -n + node --test
site/*.test.mjs) at this head, rebased on origin/main: 63/63 on mote
(macOS sh) and 63/63 on magpie-desktop through wsl-run (/bin/sh = dash).
- Real installs in fresh containers (Docker on xiaomi-gpu, amd64), a user
u with sudo, DISPLAY=:0, `cat install.sh | sh` (stdin a pipe), the
terminal kept with setpriv (su -c starts a session without one),
v0.1.2399/2400 from the real feed; then ldd (nothing missing),
`magpie version`, and the package query:
- Debian 12, sudo with a password, typed by expect at sudo's prompt,
package lists deleted first: install failed "Unable to locate", apt-get
update, retry ok, desktop app, libwebkit2gtk-4.1-0 installed;
- Ubuntu 24.04 (NOPASSWD): libwebkit2gtk-4.1-0, desktop app;
- Fedora 44, password via expect: webkit2gtk4.1, desktop app;
- Arch (archlinux:latest): webkit2gtk-4.1 2.54.2, desktop app;
- openSUSE Tumbleweed and Leap 15.6: libwebkit2gtk-4_1-0, desktop app;
- Debian 12 as root: apt-get without sudo, desktop app;
- Ubuntu 24.04 --gui: installed, desktop app; --tui: terminal build,
nothing installed;
- Debian 12 without -t (no terminal): terminal build + the apt line, no
install tried; without sudo at a terminal: the same;
- Ubuntu 20.04 (no WebKitGTK 4.1 in focal): install, update, retry all
fail "Unable to locate", then the terminal build and the "didn't work
(see above)" hint.
Not tried: a real desktop VM (the containers fake one with DISPLAY=:0);
the installed app wasn't opened, only `magpie version`. Void and Gentoo
stay hint-only (Gentoo would build WebKit from source). Debian 11 failed
in the container's own setup (archives unreachable), so focal stood in
for a distribution without 4.1. A held dpkg lock (unattended-upgrades)
would fail the install and fall back; not reproduced. On focal the hint
still names libwebkit2gtk-4.1-0, which focal lacks, as before.
|
||
|
|
ccc791231f |
gateway: a long turn sent to a Chat upstream is copied once, not five times
A 3.2 MB Codex /v1/responses request served by a Chat provider allocated about 70 MB in the gateway, and that garbage, at GOGC 100 over the app's live heap, set the peak footprint. Four copies went: - unquoteJSON built an escaped string (any text with a newline) in a buffer and then copied it into a string; the buffer is the string now (unsafe.String, nothing writes to it again), with a copy only when \u escapes left more than a quarter of it unused. - turnIn joined every user text of the conversation (userSaid) only to see whether any was there; saysAnything stops at the first. - buildChat's user message grew a strings.Builder part by part across a merged turn; joinTexts sizes it once and takes a lone part as it is. - marshalItems ran json.Marshal, whose buffer doubles and is then copied out, over one message that holds the whole turn. marshalSized sizes the maps, lists, strings, bools and ints a body is made of first and writes them into one slice of that size, as encoding/json writes them (HTML escaped, � for bad UTF-8, U+2028/2029); any other value is json.Marshal's own. A []any item, reached by its address, is a *any, which went to json.Marshal twice (to size, then to write) until it was dereferenced; TestMarshalBodyAllocatesTwoBodies caught that at 154 MiB for a 47 MiB body, now 52. Run on mote (M5 Pro), at this tree: - TestLongTurnCopiedFewTimes, a 2.0 MB 300-turn Responses body with CJK and newlines: read 6.72 MB -> 4.76 MB (3.4x -> 2.4x), turnIn 1.93 MB -> 10 KB, buildChat 27.3 MB -> 6.06 MB (13.7x -> 3.0x). Broken by hand one at a time in the mote copy, each red on its own bound: unquote back to string(b) 3.4x; userSaid back in turnIn 1.9 MB; the Builder back 7.4x; json.Marshal back 6.2x. - TestMarshalSizedIsJSONMarshal: byte for byte against json.Marshal over all 256 bytes, bad UTF-8, a lone surrogate, U+2028/2029, HTML characters, keys needing escapes, nil maps and lists, floats, RawMessage, pointers, and a func json.Marshal refuses. - go test -count=1 -timeout 45m ./internal/gateway/: ok (582.9s). - go vet ./internal/gateway/ for darwin, linux and windows; gofmt clean. - Gateway bench (120 requests of a 3.2 MB Responses body, 4 at a time, through a fake Chat provider, 200 MB ballast held live), 3 runs each, old/new: TotalAlloc 8368-8403 MB -> 5889-5891 MB (-30%), GCs 26-27 -> 18-19, phys_footprint_peak 795/806/807 MB -> 763/762/749 MB, CPU 7.89-7.92 s -> 8.01-8.17 s (the size pass costs about what the copies saved). Real use: this build (go build -tags nogui) in a sandbox HOME with the owner's DeepSeek key only, magpie serve on 127.0.0.1:3581. A 180 KB /v1/responses request (a long CJK turn with <tag> & "quotes" \ tabs, a function_call and its output holding U+2028, then a question) to deepseek/deepseek-flash, served through buildChat: answered with both code words as sent (<ZEBRA&42>, MANGO), non-streamed and streamed. Not tried: an Anthropic-in, Chat-out request, and the live app's own peak (the bench stands in for it). |
||
|
|
7d11f7d428 |
gui: Rex opens sessions in a Rex session of magpie's own, with none, one or several open (#4565, StringKe)
StringKe tried |
||
|
|
f85a221c96 |
plugins: a plugin installed twice says "another copy" once, not its own name per provider (plugins#565)
ferock (plugins#565) installed the CodeArts / OfficeAce plugin from two
specs. Each copy serves codearts and officeace, so each card got one
clash line per provider, built from the other copy's shownName, which
is the card's own name. In zh it read "CodeArts / OfficeAce 也登录 CodeArts;
由这个插件提供" and then again for OfficeAce.
clashLine is now given groups (clashGroups): a row's clashes grouped by
side (served here or by the other plugin) and by which specs they clash
with, with the provider names joined. When every other spec's name is
this row's own name, the line says another copy of this plugin ({spec})
does it. Otherwise several names use new plural keys, and one name uses
the old key. All four new keys are in zh, zh-TW, ja and de. The
existing zh and zh-TW singular line now reads "{other} 也能登录 {name},
现由这个插件提供" in place of the clipped "也登录 …;由这个插件提供".
Run on mote, at this tree rebased on origin/main
|
||
|
|
73a12e8bf6 |
wsl: a distro's agent folder that is a link is opened where it leads (#4502)
On Windows, adding a skill or switching RTK on for an agent in WSL failed with `mkdir \\wsl.localhost\<distro>\root\.codex: Cannot create a file when that file already exists` (linusxiong). In the distro ~/.codex is a link to /mnt/c/Users/<user>/.codex. Through \\wsl.localhost Windows can't follow a link the distro has: a mkdir of it says it exists, and nothing below it can be made, written, read or listed. ggbdpq found and explained the link (thanks); their patch, which takes that EEXIST as "there", wasn't used: the writes below the link fail next (its test passed because a symlink here is followed). The fix, for every agent folder and every writer through \\wsl.localhost: - The WSL probe asks `readlink -f` in the distro where each agent folder, its skills folder and the folders beside them lead (wslLinkPaths -> distro.Links; a $HOME that is itself through a link is left alone), and which drive each Windows mount is (win:/mnt/c C: -> distro.Drives). - distro.open opens a path at or below a link where it leads: on a Windows drive, the drive's own path (C:\Users\<user>\.codex); elsewhere in the distro, through \\wsl.localhost again. native spells it back through the link, so the agent is told its own path. - A link readlink couldn't resolve is never guessed at: distro.open errors, and the agent is unreached (Agent.Unreached: its notice says why; every field Set and Sync returns it). - Writers: the agents' own files (place.join/place.open, every filepath.Join(at.home, ...) in internal/agent), the library's WSL targets (wslOpen/wslOpened; one "wsl" problem per agent and nothing written), RTK (rtkAt, rtkInstall checks agent.WSLOpen before its mkdir), the Sessions page's WSL reads (sessions.WSLHome.Open) and the Copilot CLI sign-in read (provider.CopilotWSLHomes -> CopilotWSLDirs). - Not changed: magpie's image MCP server opens arbitrary paths an agent in WSL gives it the same way; filed as #4578. Links deeper than the probed paths (other than <agent dir>/skills) aren't resolved. A distro probed by an older magpie has no Links until probed again (each run). Run: - Real Windows box (xiaomi-gpu, distro magpie-desktop, sandbox /tmp/x4502/home with .codex -> /mnt/c/Users/yeton/runs/x4502-target/.codex, .claude -> /tmp/x4502/data/claude, .pi -> a missing folder), a throwaway Windows test running the real probe with that HOME: probe said link:.codex /mnt/c/..., link:.claude /tmp/x4502/data/claude, link:.pi, win:/mnt/c C:, win:/mnt/d D:. The old way, MkdirAll(\\wsl.localhost\ magpie-desktop\tmp\x4502\home\.codex\skills\pdf) = "Cannot create a file when that file already exists" (the report's error). distro.open wrote SKILL.md to C:\Users\yeton\runs\x4502-target\.codex\skills\pdf and to \\wsl.localhost\magpie-desktop\tmp\x4502\data\claude\skills\pdf, both read back with cat in the distro through the links; .pi said "~/.pi in WSL magpie-desktop is a link magpie couldn't follow". Sandbox and target removed after. - New tests with a fake distro whose ~/.codex and ~/.claude are links to /mnt/c/... that don't exist here, so, as through \\wsl.localhost, nothing below them can be made: TestWSLFolderIsALinkToC, TestWSLFolderLinkUnresolved, TestRTKWSLFolderIsALink, TestRTKWSLFolderLinkUnresolved (library); TestWSLProbeLinks (runs the probe script), TestWSLOpenThroughLinks, TestWSLAgentFolderIsALink (config and a Claude session read on C:), TestWSLAgentFolderLinkUnresolved (agent). - Broken by hand: the library tests on the base (with a no-op FakeWSLDrives) fail with "mkdir .../home/me/.codex: file exists", the report's error; with ggbdpq's patch applied they still fail (the skill mkdir, and RTK's hook not written). - mote: go build ./...; go vet of agent, library, sessions, provider for darwin, GOOS=windows (and linux for agent, library); gofmt -l clean; go test -timeout 45m ./internal/agent ./internal/library ./internal/sessions ./internal/provider: all ok. - Windows (win-run): the same four packages. The new tests pass (the RTK ones skip: the fake distro runs sh). 32 tests are red, all already red at the base |
||
|
|
3ecc02b78b |
agent: Claude Desktop is off magpie only when Desktop itself would be (dev_quj on X)
dev_quj on X: "magpie 一直提示Claude Desktop不经过magpie,我重启了依然还是
这个提示" — the Agents row said "已不经过 magpie:配置已变更" while
Desktop ran on magpie.
The check required deploymentMode "3p" in both Claude/ and
Claude-3p/claude_desktop_config.json. Desktop decides otherwise (m4 in
4.4212's and 2.7032's index.pre.js): with a 3p configuration applied it
starts in 3p when the profile has disableDeploymentModeChooser, whatever
deploymentMode says, and otherwise unless Claude-3p's file says "1p". The
Claude folder's deploymentMode is never read. And Desktop 4.4212 deletes
Claude-3p's deploymentMode itself: a stored "1p" with no claude.ai sign-in
is dropped at start (W5r -> "[custom-3p] deploymentMode written { mode:
undefined }") and Desktop relaunches in 3p on magpie. So a file left
without the key, by Desktop or another tool, was called off magpie, and
nothing magpie could do (Reconnect writes "3p" back) kept Desktop from
dropping it again.
desktop3p now asks Desktop's question with the applied profile (magpie's
or the user's for magpie's gateway). The appliedId, address and key
checks are as they were. appReads (the "restart Desktop" notice) reads
the same effective mode instead of the two files' words, so Desktop's own
write at start isn't a change to restart for.
Real Claude Desktop 4.4212.0 (macOS zip, on mote, sandbox
--user-data-dir, never the live config): three starts with magpie's
profile applied and Claude/ {} or "3p"; Claude-3p "1p" + chooser
disabled, "1p" + chooser not set, and {} — each ran in 3p with
apiHost=http://127.0.0.1:3425 in Claude-3p's main.log, and each left
Claude-3p's file without deploymentMode. The "1p", chooser-not-set case
started in 1p, logged "deploymentMode written { mode: undefined }" and
came back in 3p. An earlier start with both files "3p" kept them.
Run at the pushed head on mote (mote busy with other sessions' GUI and
gateway suites, so the touched package only, not the full suite):
go test -count=1 -timeout 45m ./internal/agent: ok
go vet, GOOS=linux go vet, GOOS=windows go vet ./internal/agent: ok
gofmt -l internal/agent: clean
Broken by hand: desktop3p put back to the old rule (both files "3p"):
TestClaudeDesktopModeAsDesktopReadsIt red on the dropped key, the Claude
folder's key gone, "1p" with the chooser disabled, and none with the
chooser on; TestClaudeDesktopChangedSince red too. Green with the fix.
TestClaudeDesktopMSIX and TestClaudeDesktopChangedSince's 1p cases now
turn the chooser on first, as Desktop needs for 1p to count.
Not tried: Windows' Desktop (MSIX or classic) and a real gateway request
from Desktop; a signed-in claude.ai cookie (Desktop keeps "1p" then,
which magpie says only with the chooser on); dev_quj's own files, so
this is the class the report is in, not their proven trigger. No other
desktop agent reads a mode the same way; Codex/WorkBuddy checks unchanged.
|
||
|
|
ba7c890223 |
sidebar: the gateway's address at its foot is lit as by a torch too
The owner asked for the gateway address row under Settings to get the torch light the page rows got in |
||
|
|
3d063e34fd |
providers: the editor names a routing group listed alone that keeps a model from agents (hayden4608)
hayden4608 on Discord: with a provider's "Only through routing groups" switched off, its models still weren't on the Agents page. Switching it off does bring them back to every list (tried in a sandbox HOME on mote: POST /api/provider/save unlisted:false, then /api/agent-models/codex, /api/state's Codex options and provider.Catalog all list them; nothing caches the old list). What still keeps them out, with the switch off, is a routing group whose Model lists is "The group alone" (Group.Unlists, #1783): its members leave every agent's list. The editor said nothing of it, so the switch looked broken. The provider's JSON now carries keptBy (provider.GroupKept: model -> the names of the groups listed alone that keep it out, a signed-in subscription's models excepted as Catalog excepts them), and the editor says under the models, and on each chip, which group keeps which model out and that its Model lists is changed on the Routing page. Words in zh, zh-TW, ja and de. unlistedByGroups returns the groups' names now instead of a bool; Catalog and Unlisted read it as before. Not confirmed for hayden's own setup: the other reasons a model is missing there are Codex's list in "Only models I pick" (the editor already names that agent) and GitHub sync bringing the other device's providers.json back (newer wins per part). The reply asks which. Run on mote at |
||
|
|
c63c2136b2 |
agent: with Claude Code's own models hidden, a tier's model keeps its /model row and the switch rewrites settings.json at once (#4548)
Two gaps in the previous commit's replaceBuiltInOptions: - writePicker leaves out the row of a model a tier is on at an effort (#1616), since Claude Code shows it as that tier's row. With replaceBuiltInOptions Claude Code drops the tier rows along with its built-in lineup (2.1.316: only the Default row and the picker's own stay), so such a model was in /model nowhere. While the switch hides Claude Code's own models, every model keeps its row. - SetOwnModelsHidden saved the setting without catalog.Touched, unlike SetHiddenModels, so flipping the switch in the GUI left Claude Code's settings.json as it was until some other change re-synced it. Tests: TestClaudePickerLeavesOutATiersModelAtItsEffort gains the replace case (Terra on Haiku at max is listed); TestOwnModelsSwitchTellsTheAgents counts catalog.Changed per flip. Reviewed and run by yetone at the batch head over |
||
|
|
509d8e7d14 |
agent: a portable VS Code reads its User folder in its data folder
YOUIMARK's Windows has Scoop's VS Code 1.143, a portable build: magpie showed the editor, but its Dir stayed %APPDATA%\Code\User, which doesn't exist — code.cmd on PATH was detection enough — so the provider, models and settings.json magpie wrote went where the build never reads. Before: vscodeUserDir always took the OS's place for the User folder, %APPDATA% on Windows; only detection ever looked at the editor itself, by its launcher alone, so any portable build was found and then read and written in a folder it doesn't use. Now: a build whose launcher has a data folder beside it is portable, as VS Code itself takes a build for portable by that folder alone — a zip's own data folder, or Scoop's, whose apps\vscode\current\data is the persisted one, current a junction into apps\vscode. Its User folder is data\user-data\User there: found, wired, connected and disconnected there. The launcher is found as detection finds it, and a Scoop shim stands for the launcher the .shim beside it names, which proc.Unwrap doesn't read. Zoo Code, which keeps its settings in VS Code's User folder, is laid out by the same function and follows it. An installed build's launcher has no data folder beside it, and keeps the OS's place; so does a portable build before its first run, whose launcher alone is still detection enough, its writes then making the folder where it reads. VSCodium portable is left as it was: its data folder is named by its product.json, which no report asks after. This is the other half of the branch the Copilot-launcher fix came from (taken along with |
||
|
|
6585315e32 |
gateway: a DeepSeek member's reasoning streams through once it has answered cleanly three times running (#4512)
|
||
|
|
2672ba429b |
agent: Claude Code's /model honors the own-models switch too (#4548)
The "show the agent's own models" switch filtered magpie's pickers alone (agent.Picks, #1642): Claude Code's own /model rows stayed put, because nothing magpie wrote for Claude Code looked at the switch — while /model is fed by magpie all the same (modelPicker's rows are writePicker's). raclen traced the whole chain (#4548). writePicker now sets modelPicker.replaceBuiltInOptions (Claude Code's own key: with it the /model picker shows only the listed rows) while the switch is off, and drops the flag again when it is on, so the whole picker is written either way. The Default row stays under both settings: Claude Code keeps it as its own fallback. Tests: TestClaudePickerOwnModelsSwitch writes a settings.json and checks modelPicker carries the rows plus the flag with the switch off, and the flag without it with the switch on. Verification on the base |
||
|
|
7804dfbb03 |
gateway: drop the locked sampling fields for Kimi on Volcengine Ark too
Volcengine Ark's plans lock the sampling parameters of the Kimi models they serve: any request carrying temperature != 1 is refused 400 "Volcengine Ark: `temperature` only 1 is allowed for this model" (#4495, kimi-k3.1-pro / kimi-k3 / kimi-k2.8-preview at ark.cn-beijing.volces.com/api/coding/v3), before any token is read — clients that send their own defaults (Claude Code, Copilot) fail every call, and a routing group spends its failover window on each try. kimiLockedSampling already drops temperature and top_p for the locked models on Moonshot's own endpoints (#1197), but its isKimi guard knows only Moonshot's hosts and presets, so the same models behind an Ark host went through with the fields. The refusal names the model ("for this model"), not the path, and the preset's Agent Plan and pay-as-you- go regions list the same kimi-kX.Y models, so the guard now also takes isArk — the ark.<region>.volces.com check the draw and video code already uses, which covers the preset's plans and a provider added by hand — and kimiLockedSamplingModel keeps deciding per model, as it already does for kimi-k2.5 and later, kimi-for-coding* and k3*. Ark's other models (doubao, glm, deepseek, minimax) are untouched, as is everyone not served by Moonshot or Ark. Run: TestKimiLockedSampling in internal/gateway grew four cases (the coding plan's chat and anthropic routes, an Ark model the server doesn't lock, a provider added by hand on an Ark host): the three drop cases fail on the unmodified code and pass with it, the keep case passes throughout. go test -tags nogui ./internal/gateway ok (499s); gofmt clean; go vet -tags nogui on darwin, linux and windows clean; go build -tags nogui ./... on darwin, linux and windows ok. Generated-by: GLM-5.3-Flash (ZCode) Reviewed and run by yetone at the batch head over |
||
|
|
e94fb18b8f |
usage: a page's cells and the heatmap's days read strings where they were decoded (#2278)
partsOf, cellsBefore and heatDaysOf read each chunk through a chunkRows that copied the chunk's whole string section first. What they keep is unique's handles (a cell), a date made by Format and numbers (a day), so the copy was thrown away chunk by chunk. They now read through lentRows(), as newest and the Codex readers already do. Run on mote: - go test ./internal/usage/ -count=1 -timeout 45m: ok (40s). - -race -count=3 on TestPartsReadStringsWhereDecoded, TestRowBufferKeptPastCollections, TestRequestCells*, *Heat*, *PageSplit*: ok. - TestPartsReadStringsWhereDecoded (new): 8 packed chunks, 1.1MB of strings. With the three sites put back to `var rows chunkRows` by sed it is red: partsOf 1,188,672 bytes, cellsBefore 1,197,568, heatDaysOf 1,187,616. Green with the change; the cells' names and the days' counts are right after the buffer was decoded over again. - Real history copy (66GB, ~12k session files), magpie web in a sandbox HOME, heap profile 40s after start, two rounds each: unpackReusing 183MB / 174MB before, 106MB / 113MB after; partsOf 76MB / 78MB before, 55MB / 56MB after. A warm poll of every page reads cached parts and is unchanged. Not tried: the Windows and Linux boxes (no OS-specific code). |
||
|
|
cac655c14f |
gateway: GET /v1/magpie/mcp lists magpie's own MCP servers that are on (ferock on Discord)
ferock on Discord: the community chat page's "use all of magpie's MCP
servers" gave a chat only the servers in library.json, never magpie's own
web search, image recognition or image generation. Nothing told an app
which of magpie's own servers are on, so the page couldn't add them.
GET /v1/magpie/mcp (OwnMCPPath, own_mcp.go) answers
{"servers":[{"name","title","path"}]} for the ones on now, each named
as its initialize names it: magpie-web-search while plugins/search serves
and something searches (canSearch), magpie-vision while a model sees
(seer: not Off), magpie-image while a model draws (drawer: not Off),
magpie-tools while plugins/tools serves and a plugin that is on gives a
tool (plugin.ToolsOn; a note that can't be read lists it). It holds no
secret, so a read-only gateway key may read it (readOnlyRoutes); it is
otherwise guarded as every /v1/magpie/* route is. It is in / "apis".
page-chat 0.1.7 (magpie-community/plugins) reads it in every route the
page takes its MCP list from (readMcp: the list, a chat's tools, a tool
call, the connection check). Documented in gateway-routing.md.
Run (mote, at
|
||
|
|
2987f5e2b7 |
gateway: a Chat usage's magpie_cache_unknown is read, as an Anthropic one's (#3991, #3979)
Trae CN users see cache read 0 / write 0 on every call. Trae's chat token_usage stopped naming any cache count around 10-28 (modeyang's 786 trae-cn calls on 10-29 all at 0; plugins#434). opencode-trae-auth 0.2.26 now says magpie_cache_unknown on such a usage, as the Kiro plugin does, but only aUsage read that flag: cUsage, which a Chat plugin's usage goes through, dropped it, so the zero still counted as a 0% miss. cUsage now reads magpie_cache_unknown into Usage.cacheUnknown, so the route and the usage ledger mark the call's cache as unknown instead of a miss. A counted 0 (prompt_tokens_details.cached_tokens: 0) stays a miss. The flag is read, never told by chat(); a same-protocol reply is passed through as it came, as Kiro's is on /v1/messages. Test: TestChatCacheUnknownReachesTheRoute, with the plugin's Chat output for chansee97's real token_usage (plugins#455): pi whole, pi streamed, translated for Claude Code, and a counted miss. Run (mote): - go test -run 'CacheUnknown|CacheCounted' ./internal/gateway: ok - broken by hand: the old chat.go fails 3 of 4 subtests (the counted miss stays green) - go vet ./internal/gateway on darwin, GOOS=linux, GOOS=windows: ok - gofmt -l internal/gateway: clean - go test -timeout 45m ./internal/gateway: ok (641s), at base |
||
|
|
d9845432f7 |
gui: a same-tagged answer is written twice, never held whole (#2278)
writeSame wrote each answer into a buffer to hash and send it, and kept
two such buffers between polls (answerLinger). The Sessions tab's stats
answers are ~6 MB each over a full history, so 12.5 MB of a warm start's
169 MB live heap was those buffers (heap profile, bytes.growSlice under
statsAnswer). Now write is given an io.Writer and called twice: once into
the hash for the tag, and once straight to rw (32 KB bufio) when the page
hasn't got that answer. statsAnswer encodes a part at a time into a small
buffer. The stats route still answers "same" from its kept tag without
encoding at all when nothing changed, so the second encode costs only on
a changed answer. answerBuffers, answerBuffer, keepAnswer go.
Run on mote (M5 Pro), from this tree:
- go vet ./internal/gui ok; gofmt -l clean.
- go test -count=1 ./internal/gui: FAIL only TestSettingsSaveKeepsWhatItDoesNotSend
(#4514) and TestMainWindowCorners/macOS_26_SDK (#3949), both filed, both
untouched by this change. TestStatsAnswerWritesWhatEncodeDid (bytes are
the whole Encoder's) and the new TestSameAnswerNotHeldWhole pass.
- Broken by hand: writeSame's bufio sized 64 MB, TestSameAnswerNotHeldWhole
red ("allocated 67117776 bytes for a 4194304-byte answer").
- Warm start on a copy of the owner's real history (11,925 Codex .zst,
4,696 Claude .jsonl, 5,000 listed sessions), the page's 10 reads every
5s, interleaved, load ~25-34:
before (
|
||
|
|
3561697a40 |
provider: WorkBuddy's mover min is 0.2.7 (plugins #561, #563)
0.2.7 lists a "none" level for deepseek-v4.1-flash and -sg. WorkBuddy
takes it (0 reasoning tokens) though its config calls them onlyReasoning
(#563). On copilot.tencent.com, deepseek-v4.1-flash's context is capped
at 100000 tokens, the reporter's literal "prompt is too long" limit (#561).
npm shows 0.2.7 (npm view --prefer-online, at landing).
Run at
|
||
|
|
e2a65cbc9b |
dsh: a start on a found group's old id moves onto the id its route lists (zyh6036 on X)
zyh6036 on X: DeepSeek Harness Desktop showed no model after magpie turned dsh on and the app restarted, while the profile's patch file was full of magpie's gateway. Cause: a dsh start (agent-default-model) magpie had set to a found routing group keeps the id the group had then, group/auto-<slug>. Since |
||
|
|
bb5eb83c3e |
gui: the Sessions list goes out a row at a time, never held whole (#2278)
writeJSONRows built the whole answer in a buffer to hash it and send it.
Over the owner's full history (16,600 sessions, 5.8 MB list) that buffer
grew to 25 MB, was kept between polls, and was 25 MB of a warm start's
183 MB live heap. Now a first pass encodes each row into one small
buffer for its hash and the answer's tag. What is sent is encoded again,
straight to the ResponseWriter through a 32 KiB bufio.Writer, and a delta
holds only the rows the page hasn't got. The bytes and the tag are the
same as before, so the page's delta and "same" answers don't change.
Run on mote (macOS 27), real history copy (~16,600 session files):
- warm start, 75 s of poll.sh (what an open window asks every 5 s):
- before (v0.1.2382): steady footprint 240-265 MB, live heap 183-193 MB;
- after: steady footprint 216-233 MB, live heap 168-178 MB.
- The phys_footprint peak is about the same (257-267 vs 264-289 MB over
3 interleaved pairs): a poll's own spike still sets it.
- /api/sessions from each binary on the same history: the same tag
06a661d3…, the same sha256 of 5,842,606 bytes, X-Magpie-Same on its
tag, and the full list for an unknown tag.
- TestJSONRowsNotHeldWhole is new: red on the old writeJSONRows (9.5 MB
allocated for a 4.2 MB answer), green now. TestWriteJSONRowsWritesWhatMarshalDid
(bytes and delta) is green.
- go test ./internal/gui: ok except three reds that are already filed.
TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and TestMainWindowCorners
(#3949) are red the same way with the old api.go in the same copy.
TestColdTurnsTaken (#4510) was red in the full run and passed 3 of 3
alone.
Not run: the GUI (Playwright) suite. app.js isn't touched and the
answer's bytes are the same.
|
||
|
|
d6e1116380 |
codex: each end of the Codex app's app-server says why, and list flaps are guarded (#4550)
|
||
|
|
1dc22a37c5 |
gui: a custom provider's icon from an image URL, or its name's letters (usrname1833)
usrname1833 on Discord: many sites serve no {HOST}/favicon.ico, so a custom
provider's icon came out wrong or missing, with no way to give it one.
The provider editor's icon row now has Get icon, a pull-down that opens the
app's own menu (no native select) headed Icon:
- Automatic: the site's icon from the base URL, as before.
- Image URL…: a url box under the row, focused; Enter fetches the address,
Escape puts it away and gives focus back to Get icon.
- Letter icon: the name's first letters on a coloured tile (letterIcon).
POST /api/icons/url (provider.IconFromURL) fetches the typed address the way
a favicon is fetched: guardClient (public addresses only), iconURL (https,
public host, no userinfo), fetchIcon's 15s timeout, MaxIcon 1 MB and the
type sniffed to PNG/JPEG/GIF/WebP/ICO/SVG. An address that can't be used
gives the letter tile with a warn note saying why, and the box stays for
another try. The old From the website button and its two strings are gone;
eight new strings in zh, zh-TW, ja and de. app.js +1,484 bytes to
1,309,847 (budget 1,316,874), core 1,534,839 (1,539,856); no budget raised.
Run at this tree (rebased on origin/main
|
||
|
|
5cc2eea2fe |
dsh: a dsh CLI that has booted no profile yet is wired in its web profile, not config.yaml (liby233)
liby233 on Discord: in WSL magpie wired dsh in ~/.dsh/config.yaml, and dsh saw magpie's models only once they were written to its settings.yaml. With no ~/.dsh/profiles, dshAt fell back to the "pre-0.1.5" config.yaml. No dsh on npm reads that file. 0.0.1-rc.1 (the first), 0.0.1-rc.5, 0.1.0-rc.8, 0.1.1-rc.1/rc.2, 0.1.2-rc.1, 0.1.3-alpha.2 and 0.2.1-rc.5 all boot $DSH_HOME/profiles/<name> (grepped from their npm tarballs). A dsh makes no profile until one is first booted, so a fresh CLI install, in a distro or not, was wired in a file that nothing reads. - With no profile, and a dsh that is not from before profiles, magpie writes profiles/web/cordis.patch.yml as dsh's template, as it does for Desktop (#2279). dsh's initProfile adds package.json, pnpm-workspace.yaml and cordis.yml next to it and keeps the file. - "Before profiles" is judged by the CLI's version where it is known (locally from its package.json; in a distro the WSL probe now asks dsh --version). Otherwise config.yaml is used only when it holds an entry that isn't magpie's. That keeps the legacy path for a genuinely old dsh. - The sync carries a magpie model already wired in config.yaml (the reporter's state) into the profiles and drops magpie's entries from config.yaml. It does this whether or not dsh has since booted a bare web profile, and only where no profile has a model or wiring of its own. - Disconnecting before dsh ever booted the web profile removes what magpie made, as for Desktop. Tests: TestDshCLIWithNoProfileYet and TestDshConfigYamlCarriedToProfiles (new), plus wslMore's dsh row, now profiles/web. All three are red on the old dsh.go: "names .../.dsh/config.yaml, not the web profile's patch list", and the web profile is left as dsh's bare template after the sync. Tests pin dshVersion, so a dsh on the test machine decides nothing. Run (go test -timeout 45m, logs teed and grepped): - gofmt -l internal/agent: clean. go vet ./internal/agent on darwin, GOOS=linux and GOOS=windows (mote): ok. - go test -run 'TestDsh|WSL' ./internal/agent: ok on mote (macOS), magpie-desktop (WSL Ubuntu 24.04, nogui) and xiaomi-gpu (Windows 11). - Full suite `go test ./...` on mote at this change on origin/main |
||
|
|
e484b1e936 |
provider: an account Codex holds in another of its folders can be removed in magpie (charliepu)
charliepu on Discord (Windows), after v0.1.2385: the account that read no
allowance couldn't be removed. Remove answered "<email> is signed in to
Codex in C:\Users\charl\.codex-db-backup-20260803: sign it out there
(CODEX_HOME=... codex logout) to remove it". That folder is a backup no
Codex runs in. appdir.CodexHomes finds it by name (".codex*" holding an
auth.json), and rememberLogins read its account back at every look, so
forgetLogin refused rather than have it come back.
Now Remove forgets the account and sets that folder's sign-in aside in a
record of magpie's own (codex-homes-removed.json: the folder to a sha256
of its refresh token, or of its access token when it has none).
codexHomeLogins passes over a folder while it holds that sign-in. The
folder's files are left as they are: nothing in it is written, moved or
deleted. A sign-in made
in that folder again (Codex run there, a new token) isn't named by the
record, and is listed again with no step of the user's. With the record
unreadable, which sign-ins were removed is unknown, and no other folder's
account is read that time (accounts saved already stay listed).
Not done: treating ".codex-db-backup-*" folders as not Codex homes by
name. They are found by the same rule as ~/.codex-work, and their
sessions/ are still read for Sessions and usage as before; a name rule
would guess at what a user's folder is for. Removing is the user's own
answer, and works for any such folder.
Run at this head (origin/main
|
||
|
|
70d50254cb |
codex: a change to the model list alone no longer ends the Codex app's app-server
The Codex app crashed and relaunched every few minutes (indekkusu141209 on X, #4550: 08:06, 08:12, 08:26). Cause. KeepCodexAppOnItsProvider ends the app's app-server whenever codexAppRoute changes. Since |
||
|
|
b9e5bc6cb3 |
gui: Rex is a session terminal, opened through its rex CLI (#4565)
Rex (com.superlogical.rex) claims no .command file, so Launch Services never listed it and `open -a` can't hand it a script (StringKe). Sessions' terminal list now offers Rex when its CLI is found: a native `rex` on PATH, or one inside a Rex*.app in /Applications or ~/Applications (Rex puts rex on PATH only in its own terminals). Perl's Rex installs a script named rex too, so only a Mach-O or ELF program counts. Resume, carry and an agent's Open then run `rex run --label <title> -- /bin/sh -c '<command>; exec login shell'`: no shell parses the label or the command on the way. With no session to add a tab to (exit 3) it runs `rex new`; with Rex's server not running (exit 4) the error says to open Rex. Rex is then brought forward with `open -b`. The GUI already lists s.terminalApps, so no JS changed. reference.md's Session terminal says it. Parts 2 to 4 of #4565 (accounts run per account, OSC 7501 status, folder mapping) build on #992, which isn't merged; not done here. Ran, at this tree on origin/main |
||
|
|
01813c681a |
accounts: switch next takes accounts that are off too, as Use does (#4532)
`magpie accounts switch claude next` (v0.1.2376) took only accounts switched On. An account the user signed in to themselves, picked up by rememberLogins, starts off, so next said there was nothing to switch to while the switch list and the GUI's Use took that same account (StringKe). On is whether the gateway routes to an account beside the one signed in, not whether the agent may be signed in to it, so NextInOrder now takes every switchable account (no token, no home of its own) that isn't the signed-in one and isn't spent, On or not. NextLogin, the automatic switch when one is used up, still moves only to accounts that are On; that is unchanged. reference.md and providers-accounts.md say so. Ran, at this tree on origin/main |
||
|
|
e90a635a9a |
provider: a Codex account held in another Codex folder offers Sign in again when its refresh is refused (charliepu)
charliepu on Discord (#general 1566029465107173518, Windows): a ChatGPT account whose sign-in had lapsed had no button to sign in again in the Providers editor. The account was one Codex keeps in another of its folders (CODEX_HOME=C:\Users\...\.codex-db-backup-...). OpenAI refused its refresh, but renewSaved only wrapped the refusal in "run CODEX_HOME=... codex login", and codexSignInRead skipped marking it: a saved account's refused refresh is marked by savedRefreshFailed, which never runs for a folder-held one. So the row never got a lapse, and the GUI's Sign in again (renderAccounts' signedOut, SIGN_IN_GONE) never showed. - logins_on.go: renewSaved wraps such a refusal as codexHeldRefusal and names no command to run. - login_usage.go: codexSignInRead marks a codexHeldRefusal signed out (markRevoked), as it does Codex's own, so the row reads "Sign-in required" with Sign in again, which runs magpie's Codex sign-in for that user (startSignIn), the flow every other revoked Codex account uses. - signin.go: addLogin writes the new tokens back to the Codex folder that holds the account (codexHeldFolder, saveCodexLogin) and clears its gone mark, or the next look would read the dead tokens back over them. ~/.codex/auth.json is not touched. - account.go: codexRefresh's failure says "sign in to this account again", not "run codex login". - chatgpt_api.go (sibling): a ChatGPT API account's kept lapse is listed on its row too, so it gets the same Sign in again. No GUI change: the row already shows Sign in again for a Codex lapse (revoked-signin-account.test.cjs covers it); the backend never set one. Run at origin/main |
||
|
|
8680ffa419 |
claude bridge: a caller's environment in a message is named by its folder, not as the last one given
packinggoods on Discord, a third time: a Mac Claude Code through a Windows magpie's Claude subscription (remote-magpie/claude/ claude-opus-5-5) is still told to use PowerShell. The model sees the Mac client's environment (darwin, zsh, /Users/...) and then a later one from the Windows host (win32, PowerShell, C:\...\magpie-claude-work, Windows 11), and follows the later one. |