4794de398ea8337d223a91e207181c56fcf4ad76
3181
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
43b6959fcd |
catalog: a relay's rename of a model models.dev knows only as another entry's canonical_model_id is that model now (#1564, ggbdpq)
What changed: renamed, which takes a relay's prefix and a window mark off an id, knew only ids models.dev lists. A model no catalog lists by its id — OpenAI's gpt-5.6-cyber, served as gpt-daybreak-red-latest whose canonical_model_id is openai/gpt-5.6-cyber (23 such ids in today's api.json) — stayed unknown to the rename, so claude-gpt-5.6-cyber (a relay's, #1383) had no price, no window, no name and no capabilities, though #1520 prices the id when asked as given. The rename now reaches what models.dev knows as an entry's canonical_model_id, and a canonical id is never taken for another, as a listed one never is: cortecs's claude-sonnet-4 is claude-sonnet-4-0, and were a catalog to list a sonnet-4-0 of its own, Claude's model would not become it. Review (yetone's session): the two tests fail on the old catalog.go (PricedBy of the three renamed spellings false, ContextOf 0; Drift's 99, 32000 and "Drift Sonnet" for claude-sonnet-4-0) and pass with it. The 23 canonical-only ids were counted in the local models.dev cache (gpt-5.6-cyber only under openai's gpt-daybreak-red-latest, claude-sonnet-4-0 under cortecs and requesty). The cortecs fixture was made literal (name "Claude Sonnet 4 (latest)", pdf input, output 65000) and the Daybreak Red one given its input limit 272000. A sweep of every listed and canonical id, plain, with claude- and with [1m], through PricedBy, ContextOf, OutputOf, Thinks, SeesImages, NameOf, EffortsOf and Knows on the real catalog: no answer for a listed id changed; only canonical-only ids and their renames gained one. The full suite, gofmt and the cross-OS vets were run on the series. Author's run: the red/green above; go test -tags nogui ./internal/catalog ./internal/usage ./internal/provider green; gofmt -l clean. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> |
||
|
|
05cf7814eb |
gateway: a translated reply cut short reaches a client that asked for no stream as the error too (#1563, ggbdpq)
What changed: every translated request is asked of its upstream as a stream, and a client that asked for no stream gets its reply assembled from it. translate read that stream and rendered whatever came as the whole reply, so an Anthropic upstream that stopped with no stop_reason and no message_stop, or a Responses one with no response.completed, handed the client a truncated answer presented as finished — the same cut a streaming client is told of in its stream (errEndedShort). The read now watches for the upstream's last event the same way (upstreamEnds), and ends with the 502 "the reply ended before it was complete" instead: nothing has been sent, so the next candidate is asked, and the last one's error reaches the agent. An error the upstream said still reports itself; a stream that said its last event (stop_reason, message_stop, response.completed) is served as it came. Review (yetone's session): with the cut check disabled by hand TestNonStreamEndedShort fails (both subtests 200 with "Let me look at the"); restored, green. The 502 takes the same path as the read-error 502 beside it (cutMidReply): nothing written yet, retryable() lets the next candidate answer, and no account is rested for it as content. The full suite, gofmt and the cross-OS vets were run on the series. Author's run: TestNonStreamEndedShort (new; Anthropic and Responses cases) fails on the old code — both cuts came back 200 with finish_reason "stop"; with the change both come back 502 naming the cut, and a reply whose last event came is served 200 whole. gofmt -l clean; go vet and go build on darwin, linux, windows; go test -tags nogui -race -count=20 on the relay-stop tests; the full go test -tags nogui ./... (TestOffline and TestSearchFollowsTheSearchersProxy red on the clean baseline too). Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> |
||
|
|
e435fe00f1 |
gateway: a translated Responses reply the upstream cut short ends in an error, not as if whole (#1562, ggbdpq)
What changed: streamTranslated ended a translated reply in "the reply ended before it was complete" when an Anthropic upstream's stream stopped with no stop_reason and no message_stop; a Responses upstream's stream that stopped with no terminal event (no response.completed, response.incomplete, response.failed) was still finished as if whole, and the agent's turn ended a few words in with nothing to say why — the same reply the passthrough already tells apart (sniff.whole, #370). It now ends in the same error, asked again in place where the upstream goes on from a prefill, as an Anthropic cut is. The event that ends a stream is read by its type as the passthrough reads it (upstreamEnds, was anthropicEnds, already lastEvent), so a response.completed carrying no status field still counts as the reply's last. Chat (may end without [DONE] and be whole) and Gemini stay as the passthrough treats them. Run (review, yetone's session): TestResponsesUpstreamEndedShort passes; with the Responses half of the end check taken out by hand it fails ("a cut reply finished as whole", finish_reason "stop", no error). TestRelayStream*, TestRelayStop* ok. The full suite, gofmt and the cross-OS vets are in the series' last commit. Author's run: the red/green above, -race -count=20 on the relay-stop tests, gofmt, go vet and go build on darwin, linux, windows, go test ./... (TestOffline red on the clean baseline too, offline machine). Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> |
||
|
|
cf8a16cf56 |
provider: a provider's keys given the same name are two cards told another magpie, not one (#1561, ggbdpq)
What changed: cardKeys, which says which of a provider's keys the plan
and balance cards are read with, answered a map keyed by the display
name, so of two keys given the same name it held the last one alone.
Each key's card is read and kept by the key itself (keyTag), and the
Usage page shows two, so what CachedCards told another magpie after a
restart lost the first key's reading: one card where the page has two,
and withKeyReadings laid routing's reading of one key over the name
they shared and never reached the other's. cardKeys now answers one
entry per key, in the order requests try them.
Changed in review (yetone's session): with both keys of one name in
cardKeys, withKeyReadings found the first card of the name for each of
them, so the second key's reading went over the first key's card and
its own card still got none. Each card is now taken by one key, in the
order cardKeys gives them, the order PlanQuotas and KeyBalances make the
cards in; a card made for a key is taken too.
TestKeyReadingsReachBothCardsOfOneName pins it.
Run (review): TestCachedCardsKeepBothKeysOfOneName fails with
cards_kept.go from before the patch ("got [main $2.00]") and passes with
it; TestKeyReadingsReachBothCardsOfOneName fails with the per-card claim
taken out and passes with it. go test -tags nogui ./internal/provider:
one run of four failed with its output cut off, the other three (one at
-count=2) green; the full suite, gofmt and the cross-OS vets are in the
series' last commit.
Author's run: the red/green above, gofmt, go vet on darwin, linux and
windows, go build on all three, go test ./... (all ok but TestOffline,
offline machine).
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: yetone <yetoneful@gmail.com>
|
||
|
|
440fded2dc |
gateway: a turn stopped with its tool call out is answered on Google's APIs, not refused by them (#1560, ggbdpq)
What changed: a client replaying a conversation whose turn was interrupted with the tool call still out — the call in the history, no result for it — had every later turn refused by Google's APIs with 400 "Please ensure that the number of function response parts is equal to the number of function call parts of the function call turn", the conversation with it, however it was routed: a Google sign-in (Code Assist), Vertex AI, a custom provider's Gemini URL (#1346) and a model pinned to Gemini ( |
||
|
|
fa5ef88d63 |
gateway: a Chat client's sampling is asked again without it when the Claude it is translated to refuses it by a name magpie can't read (#1559, ggbdpq)
What changed: forwardTranslated's retry loop now answers the "`temperature` is deprecated for this model" refusal (#1454) the way passthrough's does: asked once more with temperature and top_p left out. samplingAsTaken drops the sampling up front only where the model's name on the wire is one claudeLine reads; a Chat or Responses client's request to a Claude behind a relay that spells it otherwise carried the sampling into a 400 that reached the client, where the same request relayed from an Anthropic client was asked again without it. Review (yetone's session): the new case fails on the old code (400 "`temperature` is deprecated for this model" reaching the Chat client) and passes with the retry. The retry is scoped to an Anthropic upstream, a 400 matching samplingDeprecated and a request that carried sampling, so it is asked at most once and before anything reached the client; no account is rested for it. The doc conflict with main's prefill line was resolved keeping main's line. The full suite, gofmt and the cross-OS vets were run on the series. Author's run: the new case "a name magpie can't read is asked again from chat" red then green; the sampling/thinking/prefill tests ok; go test -tags nogui ./... ok except internal/testenv TestOffline (offline machine, red on the baseline too); gofmt -l clean; go vet and go build on darwin, linux, windows. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> |
||
|
|
adbff63225 |
provider: Antigravity's -tiered Gemini ids take their model's thinking levels, so Pi and every other agent offer an effort for them (PapainTea on X)
gemini-3.6/3.7/3.8-flash-tiered is one id that thinks at the level the request asks, but the catalog gave it no Efforts (Antigravity's list has none, and models.dev doesn't know the id). Pi's models.json then had "reasoning": false and no thinkingLevelMap for "Gemini 3.8 Flash (Tiered)", so Pi offered no thinking level; OpenCode, Crush, Codex and the GUI picker read the same Efforts. A -tiered id now takes the levels of the family it is a tier of (gemini-3.8-flash: low, medium, high); one with no such family keeps none. Real use: through the dev gateway on the owner's Antigravity account, antigravity/gemini-3.8-flash-tiered with reasoning_effort low, medium and high thought 651, 3830 and 10071 tokens on one question. In a sandbox HOME with a copy of the owner's Antigravity provider and cached list, `magpie pi magpie/antigravity/gemini-3.8-flash-tiered` wrote reasoning true and thinkingLevelMap low/medium/high (others null); real pi 1.1.0 `--list-models` shows thinking "yes", and `pi -p --thinking low|medium|high` sent reasoning_effort low|medium|high (captured), and answered through the gateway. TestCollapseAntigravityModels, TestAntigravityLegacyPicks and TestAntigravityUnnamedModels fail without it. gofmt, GOOS=linux and GOOS=windows go vet, go test -tags nogui -count=1 ./... under a scratch HOME pass. |
||
|
|
90a5c57c89 |
agent: Claude Code's /model lists magpie's routing groups, so a group saved as its model is there to pick (#1575, yanjieee)
writePicker built settings.json's modelPicker from viaMagpie("claude")
but skipped every option in RoutingGroups, since the picker was first
written (
|
||
|
|
1d016ee3f3 |
provider, gui: Token Plan 企业版 shows its usage on the Usage page, read with the account's SecretId and SecretKey (#1574, undirectlookable)
#1574 asks for Tencent Cloud Token Plan's usage on the Usage page through TokenHub's cloud API (api/1823/132270). That API covers the enterprise plan only (Token Plan 企业版; the previous commit added its regions). The personal plan (api.lkeap.cloud.tencent.com/plan) has no usage API, only the console, so it has no card. The API takes the account's API key, a SecretId and SecretKey signed TC3-HMAC-SHA256, never the plan's sk- key. provider (tencent_usage.go): - A provider at /plan on tokenhub.tencentmaas.com (ap-guangzhou) or tokenhub-intl.tencentmaas.com (ap-singapore) with a SecretId and SecretKey gets a card per team plan in PlanQuotas (tencentPlanQuotas), each key and region asked once. - It asks DescribeTokenPlanList, then DescribeTokenPlan per plan (version 2026-03-22), all at tokenhub.tencentcloudapi.com. Where a reply leaves a part out, the list's copy of it is kept. - The window is TotalUsed of CycleQuota (else TotalQuota), in credits (专业套餐) or tokens (轻享套餐, enterprise-auto). It resets at TokenSummary.CycleEndTime. Without that, it counts months from StartTime and stops at ExpireTime. - The docs don't say whether TotalUsed is the cycle's or the package's. This reads it as the cycle's. - A plan that isn't enable shows its status beside the plan's name. - An AuthFailure or UnauthorizedOperation reply says to check the key and its CAM rights. No plan visible to the key says so (a sub-user sees only the plans it made). - The SecretId and SecretKey sit in the AccessKeyID and SecretAccessKey fields Volcengine's access key uses (#1427). They are stored, kept out of key-less backups and dropped from cached cards the same way. AccessKeyVendor tells the two vendors apart. gui: - The listing tells whose access key a provider or preset takes. presetAccessKey lists the regions that take one: Tencent Cloud's two Enterprise regions. - The editor names the fields SecretId and SecretKey, with Tencent's hint, and shows them only at those regions (or at an endpoint none of the regions has). - A SecretId with no SecretKey is refused only where the fields are shown. The new strings are in zh, zh-TW, ja and de. - docs/subsystems/providers-accounts.md and the GUI tests README describe it. Run: - TestTC3SignMatchesDoc pins the signing doc's worked example (payload hash 35e9c5b0…, Signature 10b1a37a…). - TestTencentPlanRegion, TestTencentPlanWindow and TestTencentPlanQuotas use the API docs' own response examples. The last is an httptest fake that rechecks each TC3 signature and the X-TC-* headers, and fails if the plan's key is ever sent. - TestProviderListTellsTencentAccessKey covers the listing, alongside TestVolc* and TestPlanQuotas. - Breaking the action's lowercasing in the signature, or dropping TokenSummary, turns them red. - GUI: tencent-access-key.test.cjs (new) 12/12 in Chromium and WebKit at 420px, en and zh. It goes red with the region hook or the vendor labels taken out. volc-access-key, tencent-cloud, i18n-keys, gui-ja and gui-de pass. - gofmt; go vet on darwin, linux and windows; the full go test ./... Not tried against the real API: we have no Tencent Cloud account. What is read is what the docs show, and the reporter is asked to try it. |
||
|
|
c05dd8b6fb |
provider: Tencent Cloud has Token Plan 企业版 as a region, Enterprise plan · China and · Global (#1574, undirectlookable)
#1574 asks for Tencent Cloud Token Plan's usage through TokenHub's DescribeTokenPlan API (api/1823/132270). That API covers Token Plan 企业版, the team plan, only. magpie's Tencent Cloud preset knew the personal plan (api.lkeap.cloud.tencent.com/plan) and TokenHub's pay as you go, not the enterprise plan, so a provider at it had nowhere to sit. The preset gains two regions, after the old three so imports and links are unchanged: - enterprise: https://tokenhub.tencentmaas.com/plan/v3 (chat completions and Responses) and /plan/anthropic, Guangzhou. - enterprise-intl: the same paths on tokenhub-intl.tencentmaas.com, Singapore. Both use the plan's docs (product/1823/130659, 131173 for the 轻享套餐, same endpoints) and the Token Plan console as the key page. Their model lists are the doc's tables for each site, with the three GLM models it says went away on 2026-10-09 left out, and without the deepseek/… ids. An entry imported at those endpoints, a magpie://import link with region=enterprise(-intl) and a provider moved there in the editor land on the region; TokenHub's pay as you go at the same hosts stays at its own. The site's import pages (en, zh, ja) list the two regions, and the region names are translated in zh, zh-TW, ja and de. Run: go test ./internal/provider (TestTencentCloud, TestTencentCloudEnterprisePlan, red before the regions), gofmt; GUI tencent-cloud.test.cjs in Chromium and WebKit, en and zh, 8/8. Not tried with a real enterprise plan key: we have no Tencent Cloud account. |
||
|
|
47269f448f |
usage, gateway, gui: the Requests card counts requests once, a try handed on to the next isn't a failure, and says how many were answered on a retry (小一 on Discord)
小一's Codex-on-credits ledger read "5,482 · 1,094 failed" while many rows said "2 tries/3 tries" and had been answered. "Failed" counted usage rows, not requests: besides each request's final row, the gateway writes a row for every try a vendor refused or turned away (hw.refused/hw.turnedAway), and each of those was counted as a call and a failure even when a later member answered. (Ordinary failovers write no row; 499 cancels and the agent's own client-side retries are separate requests.) In the owner's own usage.jsonl, 24 of the 71 "failed" rows were such refusals a later member answered. Now a request counts once, by how it ended: - usage.Record gains `tries` (final row, when the route took more than one) and `handed_on` (the row of a try that failed and handed the request on). Totals.count skips handed-on rows; a failure is a request whose agent got an error (LostRequest); one answered after a failed try is Totals.Retried (RetriedRequest), with a `retried=1` filter. - Logs written before this are read the same way: the log index marks a failed, non-rejected row followed by another of the same route id as handed on and raises the later row's tries (routeRows); the packed row and its snapshot carry both. - Panel card, Usage overview tile, ledger card, rankings and group rows, `magpie usage` and the TUI say "N answered on a retry"; the CSV adds `tries` and `handed_on` at the end. A row says "· handed on" (with why in its title) or "· N tries". - On the ledger's Requests card "N failed" and "N answered on a retry" are buttons that switch the list to the Failed / new Retried filter, and back when pressed again. The lines wrap rather than cut a button off (German). zh, zh-TW, ja, de strings added. - Docs: reference.md (counting, filter, CSV columns), gateway-routing.md. Run: - go test -tags nogui ./internal/usage ./internal/usageapi ./internal/tui ./internal/gateway . : ok. New TestRequestsCountedOnceWithTheirRetries (JSONL fixture: legacy refused row + 200, handed_on + 200 tries 3, 502 tries 2, plain 200, routeless 429 → 5 calls, 2 failed, 2 retried, across Ledger, QueryPage, Summarize, heatmap, filters, CSV) and TestRetriedRequestCountsOnce (group a refuses, b 500s, c answers → 1 call, 0 errors, 1 retried; a lone 400 → 1 error). - Broke each by hand (count without the HandedOn skip, gateway without HandedOn, log index without routeRows): each test went red; restored. - go test -tags nogui -timeout 40m ./... under the gotest lock, rebased on origin/main |
||
|
|
310991d78f |
gui: a group with measured replies and floors shows both, the measured speed first, "125 tok/s (1) · ≥50 tok/s (259)" (Fallmonkey on Discord)
A group's speed showed its measured speed when it had one and dropped its floors. With the commits before this one, a Codex model can have one measured reply and hundreds of floors, and "125 tok/s (1)" stood for all of them. Fallmonkey asked to see both. ledGroupSpeed now joins the two, the measured one first: "125 tok/s (1) · ≥50 tok/s (259)". Its tooltip has a line for each, and the measured line drops "the others tell no speed" when the others tell a floor (new strings in zh, zh-TW, ja and de). The Output speed card keeps the measured speed as its figure, so a narrow card isn't clipped, and puts the floor in its sub line. A ranking by speed still orders and bars a group by its measured speed, or by its floor when it has none. docs/reference.md says so. Tests: usage-speed-count.test.cjs adds floors to sol and a new measured-only group (astra, 62). It checks the joined text and the two tooltip lines, the card's figure and sub line, and the ranking order and bar, in en, zh, zh-TW, ja and de, in Chromium and WebKit, at 1400 and 560 px, with no clipping. It fails on the old app.js. Ran: usage-speed-count, usage-session-speed, usage-ledger-detail, usage-speed, reasoning-speed, usage-ledger-fit, usage-model-at-provider, routing-request-metrics, gui-ja, gui-de, gui-zh-tw and i18n-keys in both engines; go test ./internal/gui; gofmt -l; GOOS=linux/windows go vet. |
||
|
|
e5b82cf38a |
usage, gui: Codex rows tell the least they wrote at: a call in a turn of several over its whole time, a turn of one call that reasoned by its answer after the first token (Fallmonkey on Discord)
Codex's session rows told no floor. A call in a turn of several could be
timed from inside itself; the commit before this one times it from what
asked for it, before its first output item, to its last, as Claude Code's
is. So Codex joins usage.FloorAgents and app.js's LED_FLOOR_AGENTS, and
such a call tells its output over its whole time, by the same 1,000-token
rule. On 622 stripped recent rollouts only 4 of 1,367 such calls have
1,000 tokens or more, so the floors will be few, but they are true.
A Codex turn of one call that reasoned has its first token (the turn's
time_to_first_token_ms) but not its first text, so DecodeOf tells no
speed. Fallmonkey asked for its whole output, reasoning too, over the
time after the first token. That reads high: OpenAI's reasoning is
written before the first content, so it isn't in that time. On a gateway
reply of 496 tokens, 224 of them reasoning, 827 ms after a 10.2 s first
token, that is 600 tok/s against a measured answer speed of 415 (the
bug
|
||
|
|
5d1d2f66dd |
sessions: a Codex call in a turn of several is timed from what asked for it to its last output, not from its own tool's output (Fallmonkey on Discord)
An older Codex rollout (no token_usage_record) writes a call's token_count after the output of the tool that call ran. The call was timed from the last thing the model was given, which by then was its own tool's output, so its window was a millisecond or two: on 517 stripped copies of the owner's Aug/Sep rollouts gpt-5.6-sol's multi-call calls read p50 65,500 and up to 1,844,000 tok/s. A count written seconds after its tool's output gives the mid-range outliers (sol 972) Fallmonkey reported. Now a call begins to answer at its first output item (reasoning, a tool call, an assistant message). It is timed from what the model had last been given at that moment, and, when its own tool's output came before its usage line, it ends at its last output item rather than after the tool ran. Newer rollouts, whose token_usage_record comes before the tool's output, are timed as before: on 622 stripped recent rollouts every call reads the same (sol p50 44, max 82). On the older ones sol now reads p50 34, p99 53, max 54. A long output line (a large patch) is read by its head. The call cache goes to calls-v11 so cached calls are re-read. TestCallsCodexTimedFromTheAsk is built on a real 2026-09-06 rollout's shape with content stripped; on the old code it reads [15000 0 0 0] instead of [15000 29000 8000 9000], and with the long-line branch taken out it fails too. Ran: go test ./internal/sessions, gofmt -l, GOOS=linux/windows go vet. |
||
|
|
e2b3eb7406 |
agent: an npm -g agent under mise's Node says its version and updates with that Node's npm, not "can't tell how it was installed" (flp on Discord)
On Windows with Node managed by mise, the Agents page read "无法判断安装方式" for an agent installed with npm install -g. howInstalled decided from the binary's path, and a mise shim leads nowhere near node_modules: on a Mac or Linux it is a symlink to the mise binary; on Windows a copy of mise-shim.exe (exe mode, the default), a .cmd plus a bash script running `mise x --` (file), or a hard or symbolic link to mise.exe. A shim is now recognised (a link to mise, or a file in mise's shims folder: parent "mise", a .mode file, or MISE_DATA_DIR/shims) and mise is asked which program it runs, `mise which <cmd>` from the home folder; how it was installed is read from that program. On Windows mise names npm's extensionless sh script, so the .cmd beside it is used. The update runs that Node version's own npm with --prefix, then `mise reshim`: on Windows npm install -g makes no shim for a new command (seen on the box), mise's Unix npm wrapper reshims itself, so it is harmless there. Siblings: - asdf shims (scripts with "# asdf-plugin:" and `exec asdf exec`) are asked with `asdf which` the same way; asdf-nodejs's npm reshims itself and asdf has no Windows build. - proc.UserBinDirs on Windows also looks in mise's shims folder (MISE_DATA_DIR, else XDG_DATA_HOME\mise, which mise follows on Windows, else %LOCALAPPDATA%\mise) for an agent PATH doesn't reach. - Install side: npmIn accepts npm.exe beside node as well as npm.cmd. - WSL agents get no update path (CLI skips them) and wsl.go's probe already lists mise/asdf shims: unchanged. - MISE_DATA_DIR and ASDF_DIR join agentenv.Vars, so a test sandbox clears them (TestFolderVarsAreListed). Fixtures are real bytes: internal/agent/testdata/mise-windows from mise 2026.10.7 on the Windows box (file-mode snow.cmd and snow, .mode files, npm's snow.cmd/snow in the Node folder); the Mac layout and the asdf shim's text from mise 2026.10.7 and asdf 0.20.2 release binaries in a sandbox home. Run: - flp's own layout (where.exe claude: installs\node\24.20.0\claude, claude.cmd, shims\claude.exe; mise which claude names the extensionless script): TestMiseShimWindowsFiveAgents covers claude, pi, codex, opencode and codebuddy through shims\<cmd>.exe; run on the Windows box, red with the fix removed by hand, green restored. - go test -tags nogui ./internal/agent ./internal/proc -run 'Shim|HowInstalled|UpdateCLI|NpmIn|InstalledVersion'; with installedAt skipping the shim by hand TestMiseShimIsNodesNpm, TestUpdateCLIThroughMiseShim and TestAsdfShimIsNodesNpm go red, green again restored. - Real mise on the Mac (sandbox home, mise 2026.10.7, node 22.23.3, snow-ai): detection through the real shim and `mise which`, and a real update 0.9.1 -> 0.9.2 through UpdateCLI. - Real mise on Windows (the box, sandbox USERPROFILE/LOCALAPPDATA, mise 2026.10.7, node 22.23.3, snow-ai): the Windows test binary's unit tests (TestMiseShimWindows, TestHowInstalledWindowsShim, TestNpmIn) pass; a temporary test through the real shim in exe, file and hardlink modes found npm.cmd --prefix <node>, version 0.9.2; after npm install -g snow-ai@0.9.1 a real UpdateCLI took it to 0.9.2 and reshimmed; snow.exe ran 0.9.2. Symlink mode was not tried (needs developer mode); it is the link-to-mise case the Mac covers. flp's own machine was not tried. - go test -tags nogui -timeout 40m ./...; gofmt -l; GOOS=linux and GOOS=windows go vet -tags nogui ./... |
||
|
|
de1ba9f123 |
settings, gui: a masking rule can be edited in place, not only removed (nf1qaz2w on Discord)
nf1qaz2w on Discord: "自定义脱敏规则现在只有移除,能否增加一个编辑功能方便调整规则". Settings → Privacy listed each custom masking rule with Remove only, so changing a pattern meant removing it and typing it again at the end. Each rule's row now has Edit beside Remove. Edit opens the rule in its own row, where it stands, with its name, Prefix/Regex (the app's segs, no <select>) and match filled in, laid out like the add row; a narrow window puts the match, Save and Cancel on a line under the name and Prefix/Regex. Save (or Enter) sends that one rule to the new POST /api/settings/redact-rule with its index and its current value; editRedactRule tidies and checks it with redact.CheckRules as an added rule is, and refuses one that doesn't compile, matches the empty string, is left with no prefix or pattern, repeats another rule, or is no longer at that index (changed or removed meanwhile). A refusal is said in the row in red, what was typed kept, and every rule stays as it was. Cancel or Escape leaves the rule untouched and sends nothing. The gateway reads the rules from settings per request (redactionOptions), so the edit masks the next request. The two fixed refusals are translated (zh, zh-TW, ja, de); the other strings (Edit, Save, Cancel, Name, Prefix, Regex) were already there. docs/subsystems/gateway-routing.md now describes the user's own rules and the edit. Run: - TestRedactRuleEdit (internal/gui): a valid edit is saved in place and redact.Mask with the saved rules follows it; a bad regex, a pattern that matches nothing, a short prefix, an empty rule, a duplicate, an index out of range, a negative one and a stale "was" are each refused with the reason, the rules unchanged. With api.go from before this change it fails: "edit: 404 404 page not found". - internal/gui/tests/redact-rule-edit.test.cjs: Chromium and WebKit, en, zh, zh-TW, ja, de, 1100px and 420px (20 tests, all pass): Edit opens the rule in its place with its values, fields don't overlap and stay in the row, the page doesn't scroll sideways, no click moves the page, Cancel sends nothing, a refused regex is shown with the typed values kept, a good one is saved by Enter in the same place. With the old app.js it fails: no button.rule-edit (locator timeout). redact-rule-row.test.cjs and i18n-keys.test.cjs pass. - Whole GUI suite in both engines, under heavy machine load: 5647 of 5667 pass. Each failing file was run again alone: agent-expand-steady, azure-endpoint, balance-currencies, gateway-key-groups, library-desktop-skills, library-all, plain-names, purpose-filter and usage-ledger pass. skill-install-agents-all (chromium 420px "view:5,0") failed the same on the base commit and passes after rebasing onto |
||
|
|
afe0c59d2d |
gui: on a Mac window a popover that opens upward stops under the traffic lights, not over them (#1573, lyston11)
In a short Mac window, Pick (an agent's model list), the field picker (#pop) and every app menu (placeMenu) were held only 8px from the top when they opened upward or were held to the window's top, so they covered the traffic lights and header.top, which the system draws them over. popTop(pad) is now the highest a popover's top edge may go: 8px under header.top's measured bottom on a Mac window (so it follows --zoom), and 8px from the top everywhere else, as before. openAgentModels, placePop and placeMenu use it in place of pad for the top. placePop also holds #pop's max-height to the room between that edge and the foot when its CSS max-height doesn't fit, so a picker held to the top scrolls inside itself instead of running off the bottom (it already did run off before this change in a very short window; moving the edge down would have made that worse). Nothing else clamps a popover to the top: the remaining getBoundingClientRect placements (profiles in the panel, the heat-map tip, the rail tip) are kept inside their own card or panel. Run: - new internal/gui/tests/popover-mac-chrome.test.cjs: Chromium and WebKit, en and zh, MacIntel and Win32, 480px wide: 8/8 pass, 4 runs in a row. On the old app.js it fails (model list top 8 < 58 on Mac, the picker off the bottom on Windows). Breaking each placer by hand turns it red on its own: model list top 8, picker top 8, menu top 17. - related GUI tests, Chromium and WebKit, all pass: click-scroll, agent-models, agent-models-picker, -all-hidden, -loading, -only-picked, -redraw, agent-model-groups, menu-scroll, proto-menu-overflow, codex-app-menu-cap, desktop-model-menu, editor-short-window, removed-groups-menu-scroll, agent-start-pick, agent-leave-magpie, claude-picker-fold, header-zoom-fit, header-centre, text-size. - HOME=<scratch> go test -tags nogui ./internal/gui: ok. - GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gui: ok. |
||
|
|
f3c098da80 |
provider: TestGrokPluginSignInInstallsCLI sees the install under way before letting it finish
Red once on ubuntu CI (909d76747's run, about 1 in 60): StartPluginSignIn
returned State "waiting" with the plugin's URL, not "installing". The
fake installer finished at once, so the goroutine StartPluginSignIn
starts could install, ask the plugin to authorize (which only answers
once FAKE_GROK exists) and move the state on before StartPluginSignIn
read its own state back. The product is right: the state is whatever the
sign-in has reached. The test now holds the fake installer until it has
seen "installing", as the Devin siblings (install_test.go,
plugin_moved_test.go) already do; the hold is let go in a cleanup too, so
an early failure leaves no installer waiting. The uv_cwd error in the
same log is the plugin host outliving the test's removed TempDir, after
the failure, not its cause.
Ran: a 2s sleep injected before StartPluginSignIn's return: the old test
red ("started {... State:done ...}"), the new one green; plain -count=20
and -race -count=5 green; go test ./internal/provider; go vet and
GOOS=linux go vet; gofmt -l clean.
|
||
|
|
96d497e687 |
antigravity: a refused or failed model list says what magpie does next, and an account that couldn't refresh says so (#1553, AnxForever)
AnxForever's Google AI Pro account (loadCodeAssist: current tier
free-tier, paid tier g1-pro-tier, project aicode-consumers) gets
"Request contains an invalid argument." for fetchAvailableModels with
entitlement.userTier g1-pro-tier, and ends up with the catalog's
models. magpie already asks once more with {project} alone after that
refusal, but the log didn't say so, and when that second request also
failed nothing was logged at all: antigravityPoolModels kept the
account's last list silently whenever another account (here the
reporter's free one) succeeded.
What changed (logging only; the requests are unchanged):
- a refused tier's line now ends "; asking with <next> next" or
"; asking with none next";
- a failure of the request with no entitlement is logged with the
endpoint and project;
- the pool logs each enabled account whose refresh failed, with the
error and how many models it keeps from before.
Why the request is not changed: no authoritative source for the value
the official client puts in entitlement.user_tier for a paid account
was found. The Antigravity app is not installed on this Mac. The
extracted language-server schema (jkfujinami/antigravity-grpc-schemas,
model_configs.proto / entitlement.proto) confirms the field shape magpie
sends: FetchAvailableModelsRequest{project=1, request_id=2,
entitlement=9 {user_tier string}, location=3}; the LS also has
License{userTier, tierDisplayName, projectId, location} and
SelectLicense, so the tier it names may come with its own project or
location, but nothing public shows the values. Every open-source client
that serves Pro accounts sends {"project": ...} only, on
daily-cloudcode-pa: CLIProxyAPI (sdk/cliproxy/antigravity_models.go),
sub2api (backend/internal/pkg/antigravity/client.go),
Antigravity-Manager (src-tauri/src/modules/quota.rs, which notes the
list is the same for free and Pro accounts), syrtis. magpie's fallback
already sends exactly that, so a guessed tier value is not added.
TestAntigravityProInvalidTierAsksWithoutOne is built from the
reporter's log lines: the first fetch is
{entitlement:{userTier:g1-pro-tier}, project:aicode-consumers} and gets
400 INVALID_ARGUMENT, the second is {project:aicode-consumers} and its
list is used; then, with the second refused too, the account keeps its
3 models and both failures are in the log. Removing the pool's log
line turns it red.
Run: gofmt -l; go vet -tags nogui ./internal/provider (darwin,
GOOS=linux, GOOS=windows); go test -tags nogui -count=1 ./internal/provider;
go test -tags nogui -timeout 40m ./... under a temp HOME: every
package ok but internal/provider, where only
TestAccountDiscoveryOffReadsNoSignIn failed ("the watch didn't answer a
read: {}{}"). It fails the same way at every run from this agent's
checkout under .claude/worktrees, and passes at this same commit and at
origin/main from a checkout under the scratchpad, where the whole
internal/provider package passes too; it touches no Antigravity code.
Not verified: no Google AI Pro account was available. Whether the
reporter's second request ({project} only) succeeds or fails, and why,
is not known; this commit makes the next release's log say which.
|
||
|
|
9bb68615b0 |
gui: a scroll not the reader's made just before a click is put back, not kept as where the reader was (#1554)
skill-install-agents-all.test.cjs was red on main in Chromium at 420px (en, ja, de): the install picker's All chip, clicked, left the Library view 5px down. Cause: the browser tells the page of a scroll at the next frame. The test clicks while the Library view is still sliding in (view-in, translateY 5px), and Playwright's click scrolls the chip into view first; with the view 5px taller than it is high at 420px, that scroll takes the view to its 5px foot. The click came in before that scroll's event, so the click guard took its snapshot (held.chain, held.top) at 5px and every hold() after kept it there, the scroll event included. A real click can do the same: WebKit scrolls a field focused on the press, or code scrolls just before the click, and the scroll was adopted as the reader's. Fix (app.js, the click guard): before taking a click's snapshot, a view not scrolled by the reader (no purposeUntil window, no scrollbar drag) is put back where the reader left it (backToReader), as the scroll listener would have done a frame later. A click in quick turn after another still holds that one first, as before. The guard is shared by every view, so every picker and button is covered; the library picker needs no change of its own (the MCP editor's picker is in #modal, outside any view). Tests: - click-scroll.test.cjs: new "a scroll the page hears of after the click is still put back" (scrollTop += 40 and a click in one task). Red on the old app.js in Chromium and WebKit (expected 2020, actual 2060), green with the fix. - sessions-manage-paging.test.cjs scrolled with Playwright's scrollIntoViewIfNeeded and clicked Show more before the next frame, so it passed in Chromium only through this bug (the guard puts that scroll back a frame later; it was red in WebKit on main). It now scrolls with the reader's wheel; green in both engines. - docs/subsystems/gui-shell.md says a click is taken where the reader left the view. Run: skill-install-agents-all.test.cjs red before (en/ja/de 420px, "view:5,0"), green after in Chromium and WebKit, every language; click-scroll.test.cjs green in both engines; 306 GUI test files that assert on scrolling or touch the library/skills/MCP, then the other 253, both engines. Failures seen there were rerun alone: purpose-filter (WebKit, 1px, #1291) and search-api (WebKit zh, #1442) fail the same on the old app.js; the rest pass alone. No Go changed. |
||
|
|
1c746a7e85 |
testenv: the machine's proxy variables no longer stand in a test binary's first routed request (#1570, ggbdpq)
What changed:
- net/http reads HTTPS_PROXY and its siblings once per process, at its
first routed request. A test binary that lets the machine's stand froze
that read with the developer's shell: on a machine with https_proxy set,
whichever test reached net/http first (a plugin host's catalog read was
the earliest single one) fixed the machine's proxy into every later
route, and a test that set its own afterwards read the machine's —
TestSearchFollowsTheSearchersProxy's Auto ask follows ALL_PROXY alone
for exactly that reason, and its searcher went to a proxy that cannot
reach the test's servers (red in the full package run, green alone).
Offline's refused hosts were carried for real by the machine's proxy on
loopback, red-lining TestOffline the same way.
- testenv.ClearProxy unsets the eight variables. Isolate calls it, and so
does the gateway's own TestMain (the package isolates itself) and this
package's new TestMain. TestIsolate now sets a proxy variable and holds
Isolate to having cleared it.
Run: TestSearchFollowsTheSearchersProxy alone green, red with
TestClinePluginPinsDeepSeek run before it, green again with the fix
(TestClinePluginPinsDeepSeek|TestSearchFollowsTheSearchersProxy); without
ClearProxy the pair is red, TestOffline fails with "models.dev: <nil>"
(the request went through the machine's proxy) and TestIsolate fails with
"HTTPS_PROXY is still set"; both green with it. go test -tags nogui
./internal/testenv ./internal/gateway (the gateway package whole) green.
Review: reproduced on main (
|
||
|
|
c409693806 |
proc: a test's own signalGroup put back no longer races the kill loop still reading it (#1568, ggbdpq)
What changed:
- group.kill's retry loop outlives its caller: it keeps signalling a
process group every 5ms for up to 10s after the caller (a probe's
cmd.Cancel on exec's watchCtx goroutine) has gone. It read the package
var signalGroup on every pass, so a test that swaps the var for its own
and puts the old one back when it ends (TestProbeKillEndsWhatTheSignal-
Missed's cleanup) raced the loop's reads: go test -race ./internal/proc/
went red with "WARNING: DATA RACE" (write at probe_test.go:151, read at
tree_other.go:43), 5 of 5 runs.
- kill now takes the kill function once at its entry and the loop uses
that copy. In production nothing changes (the var is never written);
a test's swap is seen by every kill started after it, and a loop under
way finishes with the function it was started with, which is the one
that must answer whether the group is empty.
Run:
- go test -race -tags nogui -count=1 -run TestProbeKillEndsWhatTheSignalMissed
./internal/proc/: FAIL with DATA RACE without the change (1 warning,
5 of 5 runs), ok with it, and -race -count=20 ok.
- go test -race -tags nogui -count=1 and -count=1 ./internal/proc/ ok.
Nothing else in the tree reads or writes signalGroup (grep).
Review: on main (
|
||
|
|
671e2b44e6 |
backup: a backup file a BOM-writing tool saved over still opens (#1567, ggbdpq)
What changed: Open reads through a UTF-8 byte order mark in front of the
sealed JSON (edit.TrimBOM, the trim #1534 gives a file read some other
way than edit.Read). The backup file is written back through
edit.WriteAtomic, which keeps the mark the file at that path starts with,
so a backup a Windows editor's "UTF-8 with BOM" or PowerShell 5.1's
Set-Content put a mark on opens as it is, where it read as "not a magpie
backup" — and, in a sync, ranked as a file never to rebuild over.
Test: TestOpenReadsThroughABOM (backup.Open, three shapes: a marked
sealed backup opens with its bundle whole; a marked page that is no
backup is still ErrNotBackup; a marked backup cut short is still
ErrCorrupt, so a sync may still rebuild it) fails on the old code with
"a backup with a byte order mark: not a magpie backup" and passes now;
the backup and davsync packages' other tests pass unchanged.
Run: go test -tags nogui -count=1 ./internal/backup ./internal/davsync;
gofmt -l; go vet and go build on darwin, GOOS=linux -tags nogui and
GOOS=windows.
Review: reproduced on main (
|
||
|
|
dca04af14f |
edit: a comment at the start of a model group's line stays when the group is taken out (#1566, ggbdpq)
What changed: delItem read the "is the element alone on its line" check
from the comment-blanked copy, so a JSONC comment written before the
element on the same line (VS Code's chatLanguageModels.json carries the
user's notes beside their groups) counted as blank space, the delete took
the line from its start, and the comment went with the element. It reads
raw now, as delJSONBytes does for the same check on an object member, so
only the element (and its comma, or its line) goes.
Test: TestDelJSONItemKeepsACommentBeforeTheElement (edit.DelJSONItem,
three shapes) fails on the old code with "the comment before the element
went with it" and passes now; the edit package's other tests, among them
the CRLF and among-others deletes, pass unchanged.
Run: go test -tags nogui -count=1 ./internal/edit ./internal/agent; the
full go test -tags nogui ./... in a sandbox HOME (TestOffline red as on
the baseline; gateway's TestSearchFollowsTheSearchersProxy red once under
the full run, passes alone, no path from this diff); gofmt -l; go vet and
go build on darwin, GOOS=linux -tags nogui and GOOS=windows.
Review: the test fails on main (
|
||
|
|
8a881dc203 |
provider, agent: the sign-in watch tests count no reads of their own check, in both packages
TestAccountDiscoveryOffReadsNoSignIn (internal/provider) is the sibling |
||
|
|
909d767472 |
gui: with MAGPIE_PUBLIC_URL set, Gateway's Connect starts at it until the user picks an address, and magpie web shows it as the gateway's address (#1551, everpcpc)
everpcpc runs magpie web in Docker behind a reverse proxy with
MAGPIE_PUBLIC_URL=https://magpie.example.com. The page is opened from
other machines, yet Connect's Base URL, the copied shell/curl/Python/Node
snippets and the gateway's address on the Gateway page started at
http://127.0.0.1:3425. v0.1.1174 kept a picked address; the public one
still had to be picked once on every browser.
- /api/providers' gateway carries publicURL: MAGPIE_PUBLIC_URL when it is
among the addresses Connect offers (shared, or MAGPIE_ADDR on the
network). With no address kept in magpie.connectAddress, Connect starts
there, so the snippets and the gateway key picked for it follow. An
address the user picked, this computer's included, still wins.
- The option is labelled "Public address" instead of "Local network".
- /api/settings carries publicURL under the same condition, and Settings >
About lists it beside the local Gateway URL, which stays the address
agents here are pointed at.
- In magpie web, a page served to other machines, the Gateway page's
address and Settings' web-search MCP server show the public URL; in the
app they stay local. Agents' own config wiring is unchanged (#373).
- New strings in zh, zh-TW, ja, de; docs/reference.md says where it shows.
Run: public-url-default.test.cjs (new) on chromium and webkit, en, zh,
zh-TW, ja, de, at 1100 and 420 wide, 26 pass; on the old app.js 12 of 13
chromium cases fail. Making the public URL override a kept pick turns it
red too. TestPublicURLInConsole and the new TestPublicURLOnlyWhereOffered
pass. Sibling GUI tests (connect-address-kept, the gateway-key-* and
gateway-connect/caller-keys tests, api-key-theme, public-url, lan-docker,
phone-web, search-mcp, settings-sections/groups, gui-ja/de/zh-tw): 192
pass; phone-web failed once under the parallel run and passes alone on
both engines. gofmt, GOOS=linux and GOOS=windows go vet -tags nogui
./internal/gui, go test -tags nogui ./... under the queue lock: its one red
is TestAccountDiscoveryOffReadsNoSignIn (internal/provider, from
|
||
|
|
4ee491e7c7 |
provider: a routing group shared as text leaves out its rules by folder, which name the sharer's own paths
|
||
|
|
3f57024211 |
provider, gui: a routing group is shared as text and imported into another magpie (laincatx on X)
A group row's menu has Copy to share: the group as JSON marked "magpie": "routing-group" with a format version (provider.ShareGroup), holding its members as it names them, patterns, routing, rules, classifier and settings. A group holds provider/model ids only, so no key, account or address goes with it; derived matches and the found/hidden/off flags stay behind. The Routing page's Import (by New group) opens a box the text is pasted into, words or a code fence around it allowed. POST /api/groups/import (provider.ImportGroup) adds it under a free name, never over a group. A member whose provider the importer has is kept; else the same model under one of their providers (listed as used instead); else it is left out and listed, with the rules that send to it and its off/fast place; a classifier gone takes the intent rules and auto effort. Nothing is added when no member is left. Other text, a newer format or none is refused in the reader's language (provider.ShareError, code "share"). Run: - go test -tags nogui ./... (gateway failed once on a full disk, then passed alone); new TestSharedGroupRoundTrip/MissingMembers/BadText and TestGroupShareAndImport; the version check broken by hand turns them red - gofmt -l; go vet ./...; GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet ./...; go build - group-share.test.cjs in chromium and webkit, en/zh/zh-TW/ja/de, 420px; every group-*, settings-groups, filter-ime, panel-routing GUI test (210 pass); routing-* (550/557: webkit fold tests timed out only under --test-concurrency=6 and pass alone; a webkit routing-* run under the same load fails one test on origin/main too, a different one each run) - real use: the owner's 12 groups from a sandbox copy of providers.json each shared (no key in the text) and imported back whole |
||
|
|
ae70d8eac8 |
routing: a group's rule can hold by the folder the agent works in (Cario0x on X)
Cario0x on X asked to route by the project being worked on. A group's rule now has a "folders" condition: it matches when the request's working folder is one of the listed folders or inside one. It combines (AND) with the existing conditions: tokens, images, intent, time, agents and quota. - gateway/workdir.go reads the folder each agent states in its own request: - Claude Code: "Primary working directory", including "(was …)" after a move. - Codex: <environment_context><cwd>. - Pi: <cwd>. - OpenCode: <env> "Working directory". The last one stated wins. Assistant text and tool results are ignored. A request that states no folder matches no folder rule: unknown, never empty. - provider/rulefolder.go matches a folder only at a path boundary. - ~ is the home folder. - C:\x is the same folder as /mnt/c/x, and \\wsl$\Distro\x as /x. - Case is ignored on macOS and Windows, and always for a drive. - A rule's folder must be a whole path. Pause rules can't have folders. - The trace's RuleHit.Folder makes the Routing page say "The agent works in …". - GUI: an "in folder" condition in the group editor, hidden on pause rules. Strings in zh, zh-TW, ja and de. - CLI: `magpie group rule add … folders=~/oss,"~/My Project"`. The TUI shows the condition. - Docs: docs/subsystems/gateway-routing.md and site start.html (en, zh, ja). Fixtures are real requests from Claude Code 2.1.296, Codex 0.162.0 and Pi 1.1.0, run in a sandbox from a folder named "a&b <c> 中文" or "My Proj", with the sandbox path replaced. Run at this head: - go test ./... green. - gofmt -l clean. - go vet green for darwin, GOOS=linux -tags nogui and GOOS=windows. - GUI routing-folder.test.cjs: chromium and webkit, en, zh, zh-TW, ja and de, 1100px and 390px (no horizontal scroll). It fails on the old routing.js. - Related routing, group and i18n GUI tests: 85/85. - Full GUI suite: 5611/5631 under --test-concurrency=6. Rerun alone, every failure passes except: - skill-install-agents-all (chromium, 420px), which is red on origin/main too: #1554. - The menu-scroll track flake, which flakes on main as well: #1550. - e2e: a sandbox HOME, a dev build and fake upstreams, with real Claude Code 2.1.296 (`claude -p --model group/fd`). - From proj/acme/web, rule 1 matched and the request went to kb. - From proj/acme-old, no rule matched and the request went to ka. The trace and UI showed the folder. |
||
|
|
3964ea656c |
usage, gui: a group's speed says how many replies it is of, "125 tok/s (1)", and one with only floors says "≥100 tok/s (30)" (Fallmonkey on Discord)
Fallmonkey: the Usage ranking and the Output speed card showed
gpt-6.1-sol's tok/s from the one reply of its 260 that used no tool (the
only Codex turn its session file times) beside "260 requests", while
Claude Code, whose Requests rows say "≥N tok/s" by the dozen since
|
||
|
|
c702d9cfe1 |
provider tests: TestClaudeSavedAccountDir and the other sign-in tests wait up to 90s for the sign-in to end, not 2s (#1552)
waitDone gave a sign-in 100 x 20ms (about 2s) to leave "waiting". The
sign-ins it waits on that finish through the browser callback (Claude's
SavedAccountDir, AddsAnAccount and logout tests among them) run fake CLIs:
after the callback the fake `claude auth login` polls 50ms, forks
cat/echo/rm/kill, exits, and magpie then runs the fake's `auth status`
before it records the account. Alone that is a few hundred ms; under a full
`go test ./...` on a loaded Mac (where every new executable is also checked
on its first run) it passed 2s, and the test failed with "sign-in never
finished" after 3.45s. The paste-path tests didn't fail because
claudePaste itself waits up to a minute for the end.
waitDone now polls against a 90s wall-clock deadline: above every bound
the flows keep themselves (claudePaste's minute, claudeSignedIn's 15s), so
a flow that times out reports it in its own state; it still returns the
moment the state changes, and still fails a sign-in that never ends.
Reproduced by injecting the delay, not rerunning: with `sleep 2.5` added
to the fake before "Login successful.", TestClaudeSavedAccountDir failed
on the old waitDone ("sign-in never finished", 2.53s) and passed with the
new one, as did TestClaudeSignIn*, TestClaudeSavedAccountDir and the
logout test. The injection is not committed. No fake was left running
afterwards (ps); the fake's own loop already ends once its folder is gone
(
|
||
|
|
6f4fb883eb |
library, gui: an MCP server's tools are listed by name and description (nf1qaz2w on Discord)
nf1qaz2w on Discord: "mcp现在好像只能看到有几个工具,看不到具体的工具名和描述等, 能否支持下?" The Library's MCP check kept only len(tools) from tools/list. What changed: - internal/library/mcp_check.go: ServerHealth carries ToolList (json "toolList"): each tool's name and the first paragraph of its description, whitespace collapsed and cut at 500 runes (a tool with only a title gets the title); names cut at 128; at most 500 tools kept while Tools still counts all. tools/list is now asked through listTools, shared by the stdio, streamable HTTP and SSE checks: it follows nextCursor up to 10 pages, each page with a step budget of its own (the #1467 per-step timeout), and a page after the first that is refused ends the list there. Before, nextCursor was ignored and only the first page counted. - internal/gui/assets/library.js/.css: a server whose check listed tools shows a chevron on its "N tools" status; a click opens the list under the row (name in the code font, description under it, "N more not shown" when magpie kept fewer than the server has, and Check again). Clicking the count again shuts it. A server with no listed tools keeps the old click, which checks it again. The list stays while it is checked again, no editor opens, no left-border stripe, no native select. The click guard keeps the clicked status in place (a centred row gives up 1px as it grows). - i18n: "Click to see them", "Click to hide them", "{n} more not shown" in zh, zh-TW, ja, de. - docs/subsystems/library.md: the check's tool list and paging. There is no CLI/TUI output of a server's check, so nothing changed there. What was run: - go test ./internal/library: TestCheckKeepsToolNames runs the check on the tools/list reply @modelcontextprotocol/server-filesystem really gave (captured with npx, testdata/filesystem-tools-list.json, 14 tools, the longest description 457 chars); TestCheckToolPages (no description, title only, a 1000-char description cut, two pages by nextCursor, the JSON the page reads); TestCheckToolPagesEnd (a server that pages forever is asked 10 times). With the list not kept and paging off, the first two fail: "got {State:ok Tools:14 ToolList:[] ...}, want ok with 14 tools, each listed" and "...Tools:3 ToolList:[]..., want ok with 4 tools over 2 pages". - GUI: internal/gui/tests/library-mcp-tools.test.cjs, Chromium and WebKit, en/zh/zh-TW/ja/de, at 980 and 420 wide: 20/20 pass; against the old library.js it fails. library-*.test.cjs, mcp-signin, search-mcp, i18n-keys and click-scroll in both engines: 377/377 pass. - gofmt -l (nothing), go vet / GOOS=linux / GOOS=windows go vet -tags nogui on internal/library and internal/gui, go build for darwin, linux and windows (nogui). Full go test -tags nogui ./... under the queue lock: every package ok but internal/provider, where TestClaudeSavedAccountDir failed "sign-in never finished" (waitDone's 2s bound on a fake claude process under full-suite load); alone it passes 5/5. Not touched here. |
||
|
|
1c9747f611 |
usage: a Remote magpie provider's gateway keys each show their own limit, used and left, period and reset on the Usage page (#1547, PennyVibe)
A computer that uses another magpie through gateway keys that magpie gave it saw the other magpie's subscription cards, but not what each key may still spend there. What changed: - provider/remote_key_limits.go: each key of a remote-magpie provider gets a section on one card, "<remote>/~keys", read from the remote's existing GET /v1/magpie/limit asked with that key alone (the endpoint answers only the calling key, from access.Caller; nothing in the request picks another key, so a key never sees another's numbers). A window per cap (tokens, spend) named for its period (today / this week / this month / this cycle), used against the cap, with its reset; SubscriptionQuota.GatewayKey carries what is left, calls, the cycle's days, used up and unpriced calls. A key with no limit shows one "Limit: Unlimited" window. Kept for remoteCardsFor like the remote's cards; the card's refresh reads the named key again. - A failed read keeps the last numbers, dated (AsOf); with nothing read the section says why, never zero and never "no limit". A remote from before /v1/magpie/limit (404) says it is too old to tell. - GUI: the card is named "Gateway keys · <remote>" (main page and the tray panel), a line under each key says the cycle, calls and "used up", and the two new errors are said plainly; strings in zh, zh-TW, ja, de. - magpie quota (CLI) shows the same cards; a window with no cap now reads "Limit unlimited" there, not "Limit 0%" (quotaCell). - docs: providers-accounts (Allowance), gateway-routing (Remote magpie APIs, verification), reference (/v1/magpie/limit). Run: - New tests fail on the old code: TestRemoteMagpieKeyLimits (provider) and TestRemoteMagpieKeyLimitCards (gateway, a real Handler, real chat requests moving the numbers) with the key cards taken out of RemoteCards; usage-remote-key-limits.test.cjs on HEAD's app.js. TestKeyLimitTellsOnlyTheCaller guards what was already so (key A can't read key B by query, header or no key from the LAN), so it passes on both. TestQuotaCell's unlimited case reads "Limit 0%" on the old code. - provider, gateway -count=3; go test -tags nogui ./... (full suite). - GUI: the new test in chromium and webkit x en/zh/zh-TW/ja/de x 900/400px (20 pass); the whole GUI suite. - gofmt -l clean; go vet -tags nogui darwin, linux, windows. - Real two-magpie run, both this build, sandbox HOMEs, 127.0.0.1:38461 (remote) and :38471 (local); the upstream was a fake OpenAI server (fixed 175 tokens a reply). Remote keys laptop (1000 tokens/day), desk (5000/week), spare (no limit); local "office" Remote magpie with all three, routing rotate. After 17 chats through the local gateway, magpie quota on the local read laptop 1050/1000 (100%), desk 1050/5000 (21%), spare unlimited (in --json; the text line read "Limit 0%", which the quotaCell change above fixes), matching the remote's own gateway-key list; laptop's spent key was passed over (every chat 200). With the remote stopped each key said it couldn't be reached, never 0. Not run against a real vendor, nor a real magpie older than /v1/magpie/limit (unit-tested with a 404). |
||
|
|
612b759d21 |
agent: Claude Desktop installed on Windows and not yet opened is listed (#1482, edussss)
Claude Desktop was listed by its data folders (%APPDATA%\Claude, %LOCALAPPDATA%\Claude, the MSIX LocalCache), which it makes when first opened. desktopdir.Installed now also counts Squirrel's %LOCALAPPDATA%\AnthropicClaude\claude.exe and the MSIX's package folder; an AnthropicClaude folder left without claude.exe doesn't count. Run: TestClaudeDesktopInstalledNotOpened (red without Installed) on macOS and on the Windows box, the existing TestClaudeDesktop* tests, the full suite, gofmt -l, go vet -tags nogui on darwin, linux and windows. |
||
|
|
0b904a3e60 |
agent: on Windows an agent CLI in ~\.local\bin, npm's, Volta's, bun's folder or on the registry's PATH now is listed, though magpie started before it was installed (#1482, edussss)
Detected and cliBin asked exec.LookPath against magpie's own PATH only. On Windows that is the PATH magpie started with (proc.UserPath does nothing there; a self-update restarts with the same one), so Claude Code's native installer, which puts claude.exe in ~\.local\bin and adds that to the user's PATH in the registry, and an npm -g install, weren't seen by a running magpie. The sign-in already found the CLI through proc.FindTool (#839); binAt now does the same for Detected and cliBin, so the Agents page lists it and shows its version. On the Windows box the ssh session's PATH lacks ~\.local\bin although the registry has it. Run: TestClaudeFoundWhereWindowsInstallsPutIt (Windows-only) on the Windows box: passes with this change, all five cases red with the fallback disabled. go test of internal/agent on macOS, the full suite, gofmt -l, go vet -tags nogui on darwin, linux and windows. |
||
|
|
36839d503a |
agent: Claude Code kept in CLAUDE_CONFIG_DIR is listed on the Agents page, and a model picked for it goes to the settings.json it reads (#1482, edussss)
The Agents page looked for ~/.claude/settings.json alone, while the
sessions, the Library, the sign-in, the account import and the gateway's
Claude subscription all read $CLAUDE_CONFIG_DIR. A Claude Code whose
folder is elsewhere (CLAUDE_CONFIG_DIR set) wasn't listed when its CLI
wasn't on magpie's PATH either, and a pick, a tune and the gateway's
stand-in went to a ~/.claude it never reads. The sibling of CODEX_HOME
(
|
||
|
|
26816de2f9 |
library, agentplug: an agent a plugin adds is given the Library's instructions, MCP servers and skills where its agent.library says (AlmarionAI on X)
Agent plugins wired models and keys only: library.targetOf had no case
for them, so the Library's instructions, MCP servers and skills never
reached an agent a plugin adds, while the announcement said the
Library carries over.
An agent export can now say
library: { instructions, mcp, mcpFormat, skills }
each a path (~ and $VAR expanded, as config is). mcpFormat names the
agent whose MCP file it is shaped like (agentplug.MCPFormats: claude,
codex, gemini, opencode, cursor, zed, ... 18 of the library's
mcpFormats). A format outside the list, or an mcp without one, keeps
the plugin from loading. library.pluginTarget makes such an agent a
Target, so it is written as any agent is: magpie's marker block in the
instructions file, servers merged beside the user's own (their fields
kept), skills linked or copied, Applied recording only magpie's part,
backups kept. Takes refuses a place the plugin doesn't name, and says
which agent.library key would give it.
Docs: docs/subsystems/library.md and agent-wiring.md; plugins.html
(en, zh, ja) gets the library field and what magpie does with it.
Run:
- internal/library/agent_plugin_test.go: TestPluginAgentGetsTheLibrary,
TestPluginAgentWithoutAPlaceIsRefused, TestPluginAgentMCPFormat,
TestPluginMCPFormatsAreWritten. With targetOf's plugin case and the
check() validation taken out by hand, the first three go red.
- e2e: a nogui build in a scratchpad HOME (env -i, no live configs),
`magpie plugin add` of a throwaway toy agent plugin; `library
instructions set/agents`, `library mcp add/rm` wrote and took back
only magpie's block and server, the user's "mine" server, its "note"
field and other keys kept, backups made; with mcp dropped from the
plugin, `library mcp add ... agents=toy` is refused naming
agent.library.mcp.
- go test -tags nogui ./... (one unrelated FIFO flake in internal/agent,
fixed in the commit before), gofmt -l clean, go vet for GOOS=linux
and GOOS=windows clean. No GUI code changed.
|
||
|
|
5421f44689 |
agent: TestAccountDiscoveryOffAgentsReadNoSignIn counts no reads of its own check when the FIFO answers it twice
fifoWatch writes "{}" on every 200us loop that finds a reader still in
the FIFO, and notes each. Under a full `go test ./...` the test's own
sanity read got "{}{}" and failed ("the watch didn't answer a read"),
and the extra opens would have been counted as reads of sign-ins.
The check now takes one or more "{}", and only opens after it count.
Run: reproduced by opening the FIFO and sleeping 5ms before reading
(red on the old check, both ways); green with the fix, and -count=20
plain. Breaking the guarantee still fails: any open after the check
is reported.
|
||
|
|
5d88dd8427 |
lastgood: the same unreadable file kept aside a second earlier is not kept again
KeepBad only compared the bytes against copies named in the current
second, so the same bad file kept on either side of a second boundary
got two .bad-<time> copies. macOS CI went red on
|
||
|
|
6b8dc4cdd8 |
proc, agent: magpie finds an agent CLI under the Node nvm's default names, not the folder whose name sorts last (v9 after v22)
proc.UserPath added "the newest-looking" nvm Node to magpie's PATH, the
last folder of ~/.nvm/versions/node/*/bin in string order. That isn't
the Node a terminal gets, and string order puts v9.11.2 after v22.12.0
and v22.3.0 after v22.12.0. So magpie could find, run and update a
codex/claude/gemini under a Node the user's terminal doesn't use (found
while answering 悠悠哥 on Discord,
|
||
|
|
8c5b9f928d |
provider, agent, gui: subscription accounts can be turned off, and then no agent's sign-in is read (#1535, MaxHaiCom)
What changed: Settings → Privacy → Subscription accounts (On/Off), `magpie accounts discovery [on|off]` and MAGPIE_NO_ACCOUNTS=1 turn off account discovery. It stays on by default. While it is off, magpie reads none of the agents' sign-ins: ~/.claude/.credentials.json, .claude.json's account, ~/.codex/auth.json, Copilot's, Cursor's, Devin's, Kiro's, Gemini's, ZCode's, Command Code's and OpenCode's files. It runs no `security` / `secret-tool` for the Keychain or Secret Service, and asks no agent CLI who is signed in. It serves no subscription. API-key providers, middleware plugins and Pi extensions work as before. Why: the reporter runs magpie on machines where reading other tools' credentials isn't wanted. The owner delegated the call. How: settings.NoAccountDiscovery (kept per computer by KeepOwn) and settings.AccountDiscoveryOff(). The variable only ever turns discovery off. The gates sit at every reader (readAccountFile, discoveryOff) and at every route that reads or writes a sign-in, so a route that skips Accounts still reads nothing: - Accounts, All, Logins, usage, renewal, warm-up, session identities, check-ins; - switching, forgetting, SetLoginOn, StartSignIn, the imports; - moves onto plugins. The ones that write refuse with an error that names how to turn it back on. On the agent side, Agent.Source and OpenCode's auth.json are gated, and Codex wiring goes by magpie's stash instead of auth.json, so a toggle never rewires Codex. logins.json and plugin-auth.json are left untouched and serve again when discovery is turned back on. A change applies at once (ForgetAccounts). Docs: providers-accounts.md, README (en, zh-CN), and the site's CLI table (en, zh, ja). Run: - TestAccountDiscoveryOffReadsNoSignIn (provider) and TestAccountDiscoveryOffAgentsReadNoSignIn (agent). Every credential path is a FIFO that records each open, and security, secret-tool, claude, codex, cursor-agent, devin, kiro-cli, copilot and grok are fakes on PATH. Both fail with the gate removed: they show the opens and `security find-generic-password -s Claude Code-credentials`, among others. Both pass with the gate in place. - TestAccountDiscoverySetting and TestAccountsDiscoveryCmd. - account-discovery.test.cjs: chromium and webkit, 900 and 360 wide, en/zh/zh-TW/ja/de, 32/32. The neighbouring privacy, redact, settings-sections and i18n-keys GUI tests: 49/49. - The full `go test -tags nogui ./...`, gofmt -l, and go vet for darwin, linux and windows on the touched packages. Not tried: a real machine under fs_usage, and Linux and Windows at runtime. The FIFO tests are !windows. |
||
|
|
0192edf133 |
gui: a long Claude Code reply read from its session file shows the least it wrote at (≥98 tok/s), and a short one no longer says it wasn't streamed (Fallmonkey on Discord)
Claude Code's session file has no first token, only when the line that
asked for a reply and its last line were written, so every Claude Code and
Claude Desktop call that didn't go through the gateway showed no speed,
with "Not streamed" though it was streamed. A reply of 1,000 output tokens
or more over a second or more now shows its tokens over that whole time as
a floor (ledFloorSpeed, "≥" in the cell, "At least: …" in its tooltip and
the row's details); the wait for the first token is inside it, so the
speed after the first token is never under it. Gateway rows and timed
session rows are unchanged, and the period's speed counts timed calls only.
Only Claude Code's and Claude Desktop's rows tell one. The contributed
version gave every session-file row a floor; a Codex call in a turn of
several is timed from the last tool output before its token count, and in
a month of real rollouts (4,588 multi-call calls) 2,968 were timed from the
output of a tool that same call asked for, written before its count, so
the window begins inside the call and a floor from it could read high.
Those rows keep "—" with "The session file has no first token". OpenCode's
created→completed time isn't checked against real sessions, so it tells
none either.
Checked against the shape of real Claude Code files (read-only, 30 days,
~198k messages, 2,011 files incl. subagents): block lines are stamped at
each block's end (single-line 1,000+ token text replies read a median 110
tok/s, not the thousands a start stamp would give); no sidechain lines in
main files; no assistant line out of clock order; a message's later lines
keep the time its first was asked (Began), so the 15,779 tool results
written between one message's blocks don't shorten it. Floors shown: 23,518,
p50 102, p99 141, max 156 tok/s for claude-opus-5-5.
Run: usage-session-speed.test.cjs (now also a Codex multi-call row, a
Claude Desktop row, and a 560px window) in Chromium and WebKit, en and zh;
red with the agent check taken out ('≥500 tok/s' !== '—'). The related
suites (gui-de/ja/zh-tw, i18n-keys, ledger-*, usage-ledger*, usage-speed,
reasoning-speed, routing-burst-speed, usage-ttft-rounding,
usage-computers): 146/146 in both engines. go test -tags nogui ./...,
gofmt, and go vet for darwin/linux/windows on internal/gui.
Co-authored-by: Ted Li <tl2493@columbia.edu>
|
||
|
|
c0a13dee3c |
gateway: a queued stream's agent, kept alive while it waited, goes on hearing a keepalive every 15s once the request goes to its vendor, not up to 30s of nothing
keepQueued keeps a streaming agent alive while its request waits for a
slot (MaxConcurrency) or for room in its minute (MaxRPM): past
keepHeldAfter it sends the stream's 200 and a comment every
keepaliveEvery (15s each). When the wait ends, keepQueued stops and the
try's watch starts, and watch only called keepQuiet once keepHeldAfter
(15s) had passed since it began, as if the agent had heard nothing yet.
An agent sent its last keepalive just before the handoff then went up
to keepHeldAfter + keepaliveEvery, ~30s, with nothing while the vendor
was quiet, twice the cadence magpie promises. Found while fixing
TestQueuedStreamKeptAliveForTheMinute's flake (
|
||
|
|
9f407cafa1 |
agent, gui: an agent CLI found off the terminal's PATH says where it is (悠悠哥 on Discord)
悠悠哥 (macOS) saw "Codex 0.162.1 · 未接入" under 未设置 on the Agents page while `which -a codex` found nothing and ~/.codex wasn't there. Detected() is true when the agent's command is on magpie's own PATH, and proc.UserPath adds to it the folders users' tools go in (~/.local/bin, npm's prefixes, nvm's newest Node, bun, volta, pnpm, Homebrew), which a desktop app launched from the Finder needs. A codex left in one of those that the terminal's PATH no longer has (an npm install under a Node nvm no longer uses) is found, runs, and gives its version, so the row looked made up. Reproduced in a sandbox HOME: PATH=/usr/bin:/bin, no ~/.codex, @openai/codex 0.162.1 under ~/.nvm/versions/node/v22.12.0; after UserPath, Codex is detected with CLI 0.162.1. ChatGPT.app's bundled codex (Contents/Resources/codex-cli, 0.162.0-alpha here) is never on magpie's PATH and isn't what was found. The agent is still listed: the CLI is real and runs (a lazy-loaded nvm leaves the same folder off a login shell's PATH while the user does run codex from it). What changes is that it says so. CLI gains path (the file magpie runs) and offPath (its folder isn't in proc.LoginPath; false when the login PATH can't be told, or for a CLI found at a fixed path rather than through PATH). The Agents row shows "Not on your terminal's PATH" after the version, its tip and the version's naming the file and that it can be deleted if left from an uninstall; en/zh/zh-TW/ja/de. The note gives way at the narrow width, where the version's tip still says it. docs/subsystems/agent-wiring.md says how detection and the note work. Run: TestCLIFoundOffTerminalPath (red with OffPath forced false); agent-cli-offpath.test.cjs in Chromium and WebKit, five languages, 560 and 440px (16 failures on the old app.js), with agent-app-version, agent-cli-missing, cli-update and agent-update-all (66 pass); go test ./internal/agent ./internal/gui; full go test -tags nogui ./...; gofmt; GOOS=linux and GOOS=windows go vet -tags nogui on both packages. |
||
|
|
cb25d3861b |
gateway: a Claude subscription's tool calls reach their run on a MAGPIE_ADDR that isn't loopback (#1546, jiayeZhu)
With MAGPIE_ADDR pinned to a concrete address outside 127/8 and gateway keys on, the Claude subscription bridge's MCP helper posted its tool calls to http://<that address>/_magpie/claude-mcp/<token> with no key. lanGuard answered 401, the call never reached the run, and every turn of tool results found "no run waiting" and started a new Claude Code told the whole conversation; the reporter's cache hits fell from ~95% to ~30%. - lanGuard lets that callback in by its run's own token: a POST to /_magpie/claude-mcp/<token> whose token (24 random bytes) is one a live run registered (addCallback in startRun, dropCallback in removeRun), compared in constant time. No path is exempt on its own: an unknown, ended, truncated, extended, percent-encoded or GET form is still asked for a key, and so is every other route. - The helper is handed the callback URL in a 0600 file in the run's own temp dir rather than as an argument; RunMCP reads a path as that file. The test fakes read it from there. - docs: claude-subscription-bridge, gateway-routing's HTTP surface and reference.md's network section say how the callback is let in. Run: - TestClaudeToolCallbackOnANonLoopbackAddress (new): a gateway behind lanGuard on this machine's own non-loopback IP, MAGPIE_ADDR set to it, fake Claude Code making a real helper call; red on the old guard with the reporter's "refused POST /_magpie/claude-mcp/... no API key was sent" line, green now. - TestOnlyALiveRunsCallbackSkipsTheKey (new) and TestNetworkGatewayGuardsEveryRoute (now also tried with a live run's token as a Bearer key): red with a blanket path exemption put in by hand, green now. - Real use: sandbox HOME, magpie serve on MAGPIE_ADDR=10.0.0.111:3561 with a gateway key, a fake claude driving the real claude-mcp-helper. origin/main: callback refused, "tool results no run waiting", a new Claude Code told the whole conversation. This build: the result reached the same process (pid unchanged), nothing refused, a made-up token still 401. - go test -tags nogui ./... (full suite), gofmt -l, GOOS=linux and GOOS=windows go vet -tags nogui on internal/gateway and internal/claudebridge. |
||
|
|
6536982756 |
edit: an agent's config saved with a UTF-8 BOM is edited through it and keeps it — magpie claude <model> no longer says "invalid JSON/JSONC" (#1534, AnxForever)
On Windows, PowerShell 5.1's `Set-Content -Encoding UTF8`, Notepad and
Claude Code channel switchers save ~/.claude/settings.json with a UTF-8
BOM in front. Claude Code reads such a file; magpie's JSON layer handed
the BOM to json.Valid and gjson, so `magpie claude <model>` failed with
"<path>: invalid JSON/JSONC" and the agent couldn't be wired at all. TOML
refused the same with "UTF-8 BOM is not supported", though Codex's own
parser (toml_parser's lexer) skips a BOM, and env/YAML files glued the BOM
to their first key's name.
The fix is at the package's two choke points, so every format and every
caller of edit.Read gets it:
- edit.Read returns the file without a leading BOM (the agent package's
own readers, Claude Desktop, Ante, Empryo, Snow, Pi MCP etc. go through
it).
- WriteAtomic puts the BOM back when the file it replaces starts with one
and the new bytes don't (keepBOM). The user's file keeps the encoding it
was saved in: the tools that wrote it may expect it, and the agent read
it with the mark before, so keeping it is the user's own bytes, not a
guess. A file without a BOM never gets one; an emptied file stays empty.
This is what astrbot.go already did for AstrBot's cmd_config.json.
- PatchJSON (bytes in, bytes out) reads through and keeps a BOM too.
- The TOML "BOM is not supported" error is gone with the case it named.
- Siblings read outside edit.Read: Claude Code's settings.json and CC
Switch's legacy config.json in the importer, and Crush's provider list,
trim it with the new edit.TrimBOM.
- Prime Agent's Disconnect (beforeMagpie.restore, on main since this
work began) compares the file with its copy from before through the
BOM, so a BOM'd settings.json is put back byte for byte and the copy
removed; it used to stay as magpie left it, the copy beside it.
The reporter's fork commit (AnxForever/magpie 0bb750c1) was reviewed: it
trimmed the BOM in the seven JSON entry points and wrote the file back
without it; this change keeps the BOM instead and covers TOML, YAML, env
and the readers outside the JSON layer.
Run:
- New tests built on a Windows-shaped settings.json (BOM + CRLF + the
user's env and permissions): TestJSONSettingsWithBOM, TestPatchJSONKeepsBOM,
TestJSONItemWithBOM, TestTOMLConfigWithBOM, TestEnvAndYAMLWithBOM fail on
the old code ("invalid JSON/JSONC", nothing found) and pass; with keepBOM
disabled by hand four of them go red. TestWriteAtomicAddsNoBOM.
TestPrimeAgentRoundTripWithBOM fails on main (not put back) and passes.
TestClaudeConfigDirImport (BOM case) and TestImportCCSwitchConfigWithBOM
fail on the old importer ("invalid character 'ï'") and pass.
- Full chain in a sandbox HOME: old binary `magpie claude
deepseek/deepseek-flash` on a BOM'd settings.json -> "invalid
JSON/JSONC"; new binary -> "✓ Claude Code model", BOM and CRLF kept, the
user's env untouched; `magpie claude model default` after it leaves no
blank line. Old `magpie codex gpt-5.5` on a BOM'd config.toml -> "UTF-8
BOM is not supported"; new -> set, BOM kept.
- Windows box: the edit package's test binary passes whole; magpie.exe
`claude deepseek/deepseek-flash` on a settings.json written by
PowerShell 5.1 Set-Content -Encoding UTF8 (sandboxed USERPROFILE/APPDATA)
sets the model and keeps ef bb bf.
- go test -tags nogui ./internal/edit ./internal/agent ./internal/provider
./internal/library; gofmt -l; go vet (darwin, GOOS=linux, GOOS=windows)
on the touched packages; the full suite.
|
||
|
|
947dc24aa3 |
edit: a key or array element taken out of a CRLF JSON file takes its whole line, no blank line left behind (found on #1534)
DelJSON, PatchJSON's deletes and DelJSONItem cut a member that sits on a line of its own together with that line's end, but only looked for a bare \n after it. In a file with \r\n line ends (a Windows settings.json, VS Code's chatLanguageModels.json) the \r stopped the line end from going, so each set-then-delete left one more blank \r\n line, e.g. magpie connecting and disconnecting Claude Code. pastLineEnd now takes \r\n or \n. Found while writing #1534's round-trip test on a CRLF settings.json. Run: TestDelJSONTakesCRLFLine and TestDelJSONItemTakesCRLFLine fail on the old code (a "\r\n\r\n" left where the key was) and pass now; go test -tags nogui ./internal/edit/ passes. |
||
|
|
6876125a19 |
agent, library: an npm agent or winget's RTK under Program Files updates after Windows' administrator prompt, and says why when it can't (新v学员 on Discord)
On Windows the official Node.js installer leaves npm's global prefix at C:\Program Files\nodejs, which only an administrator can change. magpie runs as the user, and writable() on Windows always said true, so the Agents page offered the update and npm failed with EPERM (mkdir ...\node_modules\@scope), with nothing saying why. The same user then reported RTK and other actions needing elevation all failing, and asked for a setting to run magpie as administrator. There is no such setting: an elevated magpie would write the agents' configs as the administrator, couldn't start with Windows without a UAC prompt at each login, and widens what can go wrong. Instead each action that needs an administrator asks Windows for one, alone. - agent: writable() on Windows makes and removes a file in the folder (update.Writable) instead of always saying yes. An npm CLI in a folder the user can't write in is still offered on Windows, marked Admin, and its update runs through update.RunElevated, never as the user. Elsewhere (/usr/lib, would want sudo) nothing is offered, as before. - update: RunElevated (Windows) runs the command through ShellExecuteEx "runas" on a .cmd script that sets the env that differs from an elevated process's own plus PATH, cds to the folder, and sends output to a log read back; the exit code comes from GetExitCodeProcess (a non-zero one is update.ExitError, for its code). A declined prompt is ErrCanceled; no prompt to be had is the new ErrNoAdmin. Other systems: CanRunElevated false. - library: RTK installed by winget for every user (under Program Files) is upgraded through the same prompt when only an administrator can change rtk's folder; the card's Upgrade title says Windows asks first. Install, and an upgrade whose folder looked writable, run winget as the user and go through the prompt only when winget answers 0x8A150019 (command requires admin). winget's codes from the elevated run are read as before (0x8A15002B: no newer RTK, no failure). - A declined or impossible prompt is agent.AdminError (Via npm or winget); the GUI answers it with code needs_admin and says, in the reader's language, what needs an administrator and what to do: try again and allow it, or run the command in a terminal opened as administrator, and for npm also moving npm's prefix (npm config set prefix "%APPDATA%\npm") and reinstalling. - Install another agent: its npm commands note when npm's prefix (npm prefix -g, memoized) is such a folder. - Checked, not changed: autostart uses HKCU's Run key, no admin needed; magpie never runs npm uninstall; plugins install into magpie's own folder with bun; agent CLIs update only on a click; RTK's PATH fix writes HKCU's Environment and rtk init -g the user's own agent folders; the library's only other exec is the MCP server check. Run: - go test -tags nogui ./internal/agent ./internal/update ./internal/library (and the full ./... under the lock). TestNPMUpdateNeedsAdmin fails with the admin branch removed and with runAdmin bypassed; TestRTKUpgradeAsksForAdmin and TestRTKInstallRetriesAsAdmin fail with runRTKInstaller never elevating (checked by hand). - gofmt -l; go vet (darwin), GOOS=linux and GOOS=windows go vet. - GUI, Chromium and WebKit: cli-update-admin (en, zh), library-rtk-admin (en, zh exact; ja, de, zh-TW translated, no npm advice; fails with the old Upgrade title), library-rtk-upgrade/-path/-nohook/-gain, gui-ja, gui-de, gui-zh-tw, cli-update, i18n-keys. - Windows box (10.0.0.132): TestWritableSeesDeniedFolder passes, and fails on the old writable(). A portable Node 22 with Program Files' ACL (Users RX, Administrators F): as a non-elevated token (runas /trustlevel:0x20000) npm install -g failed with the reporter's EPERM, Writable said false, and dsh's CLI() said Via npm, Admin true; elevated it said Admin false. RunElevated from the elevated ssh session installed @deepseek-ai/dsh into that folder for real, and a missing version came back as exit status 1 with npm's ETARGET output. The library's RTK tests ran there too (TestRTKInstallRetriesAsAdmin passes; the shell-fake ones skip on Windows). - Not tried: the UAC prompt itself, allowing or declining it, as nobody sits at the box; the ErrNoAdmin path on a real system; a real machine-scope winget RTK (none is installed on the box). |
||
|
|
7c632ad0b4 |
lessons: 10-10/10-11 review; tests ending with their test and timing room move to the code standards
The nightly review of 10-10 13:51 to 10-11 05:20 (191 commits, v0.1.1155 to v0.1.1172, every tag on a green run). - Two lessons hit a third day and move into docs/code-standards.md: whatever a test starts ends when it does (#1524's three-step fix), and a timing test leaves room on both sides (TestMaxRPM was a real gap). - "A failed read means unknown" seen again: stash.json had readLogins' bug (fixed in |
||
|
|
77af08869f |
gui: the address and gateway key picked in Gateway's Connect are kept across restarts and updates (coeo91 on Discord)
coeo91: after an update or a restart, the Base URL picked in Gateway's Connect (http://192.168.110.23:3425/v1) went back to 127.0.0.1. The pick lived only in a page variable (connectURL), so every new page (a restart, an update, lightweight mode's window made again, a reload) started at this computer's address, and the gateway key with it. It was also thrown away whenever the LAN address wasn't offered yet, as right after a start before the network is up. Settings' Share on local network address (lanSelectedURL) was lost the same way. Both addresses and Connect's gateway key are now kept in localStorage, like the API and snippet picks beside them (magpie.connectAddress, magpie.connectKey, magpie.lanAddress). An address not offered right now shows this computer's (or the first LAN address) without forgetting the pick, and it comes back once the address does; a kept key that is gone falls back to the first enabled key as before. Run: connect-address-kept.test.cjs on chromium and webkit, en, zh, zh-TW, ja and de, at 1100 and 420 wide (20 pass; on the old assets it fails waiting for the kept key after the reload), plus gateway-caller-keys, gateway-connect-keys, gateway-fold, gateway-systemone, api-key-theme, json-tree, public-url, request-archive, sse-body, settings-sections and phone-web (102 pass). go test ./... under the lock. |