dbcf791e4e5c80f47e42a43b650fddac76b2e29f
531
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
2362bfced3 |
redact: a placeholder the model rewrites ({{ PHONE_x }}, a dropped brace, another case) comes back as the value (shensmart on Discord)
shensmart, with personal data masked, saw {{PHONE_…}} left in the
model's replies. Every reply path already goes through redact.Writer
(serve, Codex's upstream, count_tokens, embeddings, image and video
prompts; plugin-served providers write into the same wrapped writer),
and an exact placeholder came back on all of them, split across
Anthropic, Chat Completions, Responses and Gemini SSE events alike. What
didn't come back is a placeholder the model wrote differently from how it
was given: Jinja-style {{ PHONE_x }}, {{PHONE_x} or {PHONE_x}, the bare
PHONE_x, or the hash in upper case. Restore matched only the exact form.
Restore now finds a placeholder's body (KIND_ and the 8 of the hash), in
any case, at a word boundary, and puts the value back when it names one
magpie made, taking with it the braces and spaces the model put around
it (both braces of a side, or one of each side; a lone { on one side is
the text's own). The 40-bit keyed hash means no other text matches.
For streams, partialTail also holds a tail like "{{ PH", "{{PHONE_x}"
(the second brace still to come) and a last word that starts like a kind
magpie has masked (PH, PHONE_b5pu), and Writer.event now looks for the
tail before restoring, so a placeholder whose closing brace is in the
next event is not put back with that brace left behind in the text.
Not changed: the values stay in memory only. The placeholder key is kept
in redact.key, so after a restart the same value gets the same
placeholder, and the agent's history holds the real value (it was put
back), so the next request brings it again; checked by masking, clearing
the map and key as a restart does, and masking the history again.
Writing the map to disk would keep every masked secret in one file.
Run: go test ./internal/redact ./internal/gateway (sandbox HOME), gofmt,
go vet and GOOS=linux/windows go vet on internal/redact.
TestRestoreRewrittenPlaceholder, TestWriterStreamRewrittenPlaceholder and
TestWriterStreamToolArgsRewritten fail on the old redact.go/writer.go;
with the old writer.go alone the stream test fails with "13987654321 }}"
(a stray brace); with wordTail turned off it fails with a bare
PHONE_zdx44tzn left in the text.
|
||
|
|
b8e23db45a |
backup, davsync: an import or a sync installs the plugins and names the subscriptions to sign in to (yapechan)
yapechan on Discord (Windows, Synology WebDAV): after an import or a WebDAV
sync no providers showed on the other computer; adding the same provider by
hand made the synced settings and usage apply. No error, a restart didn't
help.
Cause. A backup and a sync carry providers.json as stored. For a
subscription that is its model picks and settings alone (no endpoint, no
key), and sign-ins are never carried by design; allProviders lists such an
entry only once an account is signed in here. plugins.json was not carried
at all, so a provider served by a plugin (every moved subscription, any
plugin provider) had nothing to come from on the other side. The import
said "N added" and "Needs a key: , " (the picks entries have no name and no
key), and the sync said nothing. API-key providers do come over: tried with
a nogui build in two sandbox HOMEs (DeepSeek, a custom relay, Kimi Code all
listed after `magpie restore`). No Windows-only path issue found.
What changed:
- provider.Carried(keys): the plugins added from npm or git, on/off and
their options (without keys, options whose names look like a key are left
out, as secret headers are). Folder plugins and plugin-auth.json stay.
- backup.Bundle.Plugins (nil from an older magpie). Restore installs the
ones not here through provider.AddPlugins (plugin.Add, then Off and
Options, then HandOver once); it never removes or changes one already
here. A failed install is reported, not a failed restore.
- Result.SignIn / provider.NotSignedIn: the subscriptions brought with no
account here. NeedKey no longer lists picks-only entries (provider.OnlyPicks).
- davsync: the providers part's hash covers the plugins (unchanged for a
setup without any), take/bring carry them, bring installs (logged on
failure), and Status().SignIn names what to sign in to.
- CLI restore and `magpie webdav`/`s3` status print both; the GUI's import
result and the sync row show them (en, zh, zh-TW, ja, de).
- docs/reference.md says what a backup carries now.
Run:
- go test -tags nogui ./internal/provider ./internal/backup ./internal/davsync
./internal/cli ./internal/gui in a sandbox HOME.
- New tests fail with the change broken by hand: TestPluginsCarried
(installed-skip and the HandOver guard), TestNotSignedIn,
TestRestorePluginsAndSignIn ("Needs a key: [ Acme]" without OnlyPicks),
TestSyncPluginsAndSignIn (bring not installing, Status not naming),
sync-sign-in.test.cjs (the lines removed).
- sync-sign-in.test.cjs: Chromium and WebKit, en/zh/ja/de, 900 and 440px,
16/16; it also caught subNames throwing while providers was still null.
sync-*.test.cjs, s3-sync, i18n-keys, gui-ja, gui-de pass.
- gofmt -l, go vet, GOOS=linux and GOOS=windows go vet -tags nogui on the
touched packages.
Not tried: a real plugin install from a real sync (the installs are stubbed
in tests); a real Synology server.
|
||
|
|
cb003877f3 |
agent: a renamed provider's models follow it in Pi's, OmO's and Prime Agent's enabledModels (#1828, #1919)
The sibling of the StepCode fix before this, and of omp's (
|
||
|
|
b515538ad6 |
gateway: the model list names each model's service tiers for every client, so Cindy offers Fast where it is offered (#1914, tsuixl)
Cindy reads supportsFastMode from a model's service_tiers in /v1/models (a priority entry), and its import link asks /v1/models with no magpie header. The models handler gave service_tiers (codexTiers, the tiers Codex here is offered on each model, #1234) only to a magpie asking with X-Magpie-Drawers, so Cindy never showed Fast on GPT-6-Astra / GPT-6.1-Sol. Every client now gets them; a model with no tier says nothing, and the remote-magpie path is unchanged. The context ring showing "—" in the same report is not touched: per the reporter's own reading it is Cindy's Codex runtime wanting native metadata, which /v1/models already carries as context_window. Run: - TestModelsListTiersForEveryClient (new): a relay's gpt-6.1-sol lists priority, its glm-5 lists none, on a plain GET /v1/models. Red on the old handler ("" for gpt-6.1-sol), green now. - go test -tags nogui ./internal/gateway on every test in the 39 files that GET /v1/models plus every *Tier* and *Fast* test: ok (110s). - gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows. - Not tried in a real Cindy: whether Cindy's Fast then sends service_tier priority through its Codex runtime is left to the reporter on the next release. |
||
|
|
90ac1f0385 |
agent: a renamed provider's models follow it in StepCode's enabledModels (#1919, ggbdpq)
Renaming a provider moved StepCode's defaultModel to the new id and
appended it to enabledModels, but the list kept magpie/<old>/ entries
(the model it was on, others the user listed, a glob), which name nothing
after the rename. StepCode now has a RenameRefs hook, as omp has
(
|
||
|
|
97751188ea |
library: an unreadable skill copy stays in place during sync (#1102)
An unreadable subfolder in an agent's copy of a skill hid edits from the timestamp scan, which ignored read and stat errors. So switching copy/link mode, refreshing the skill, or removing a duplicate copy could replace the copy and lose those edits. Shared-folder deduplication could remove SKILL.md before failing on the unreadable subtree. changedAt and copyIsFresh now return the scan error. The copy is kept in place for that sync (Library.blockedSkills) and reported as a Problem naming the path. This covers agent copies, shared-folder deduplication, project copies and Claude Desktop copies. Other agents still sync, and a later sync tries again once the copy can be read. Merged onto main. #1449 added two callers of changedAt in skill_changed.go: - libraryHash doesn't remember a hash for a folder it couldn't wholly read. - editState says unknown for an agent's copy it couldn't wholly read, so an update from GitHub keeps the library's version aside. TestEditStateUnknownForAnUnreadableCopy covers editState. docs/subsystems/library.md keeps both new rules. Run: - go test -tags nogui ./internal/library/ and ./... (see the PR), go vet for darwin, linux with nogui, and windows, and gofmt. - With changedAt ignoring walk errors again, the four ScanError and EditState tests go red. - With editState ignoring the error, the new test goes red (edited true, known true). - Checked with Unix permissions on macOS only, not as root and not on Windows. |
||
|
|
f82aba090b |
davsync, gui, cli: GitHub sync refuses a repository that isn't private (#1130)
The sealed setup is committed on every sync, so a public repository would hand anyone every version of it, the whole history, to try passphrases on offline. prepare now reads the repository's "private" field and refuses before writing when it is false or missing, naming the repository and what to do. The form's hint, the CLI usage and docs/reference.md say the repository must be private; sync-backup.md lists the rule and its verification command now points at ./internal/cli. Run: go test -tags nogui ./internal/davsync/ and the cli tests (TestGitHubCmd|TestWebdavCmd|TestS3Cmd|Help) green; TestGitHubPublicRepositoryRefused goes red with the check removed. GUI: github-sync, s3-sync, webdav-settings-refresh, sync-other-kind, sync-not-backup, i18n-keys, gui-zh-tw, gui-ja, gui-de in Chromium and WebKit, 72/72. Not tried against the real GitHub API. |
||
|
|
1af326806f |
sync: magpie's setup syncs to an encrypted file in a GitHub repository, beside WebDAV and S3 (#1130)
A third sync kind: github://owner/repo[/folder] keeps the same sealed backup WebDAV and S3 keep, as <folder>/magpie/magpie.magpie-backup in a repository the user already has, written through GitHub's Contents API with a fine-grained token of its own (Contents read and write), kept in sync.json apart from the library's GitHub token. The token goes only to api.github.com: a redirect anywhere else is refused, and the passphrase may not equal it. Each update is a commit; an empty repository is initialised by the first backup. Settings › Sync gets a GitHub kind with Repository, Branch, Folder and token; magpie github mirrors magpie s3. Inactive servers of every kind are kept in Config.Servers (Other stays for older clients). Squashed from yetone/magpie#1130 at 6b5b1c693e1a3a23e177b4d376f3f7f70f3bc23d onto main. Merge resolutions: the CLI moved to internal/cli since the PR was cut, so github_cli_test.go moved there (package cli) and the github command, its help line and `magpie help github` were wired in internal/cli/main.go and help_cli.go; README's Sync row kept main's links and took the PR's wording; i18n.js zh-TW kept both sides. |
||
|
|
1133ca0fe2 |
gui: the window opens on the page you last left, as a Mac app comes back as it was
molvqingtai on Discord asked for Routing to be the first page, and lc for
the sidebar to be reordered by drag. Rather than a setting or a reorder,
the window now reopens on the page the reader last left: show() keeps the
page in localStorage magpie.lastView, and keptView() opens it at start.
- A page asked for in the address (?view=: the tray's links, a reload)
still wins, Agents too.
- A kept name that is no page opens the first page; one gateway mode
leaves out (Agents, Library) opens Providers, through show()'s and
setGatewayMode's existing fallback.
- localStorage is how the window already keeps magpie.navLayout and
magpie.panelTab across restarts; checked on a copy of the installed
app's WebKit store (~/Library/WebKit/com.yetone.magpie), which holds
those keys from earlier runs.
- Opening on the kept page scrolls nothing.
docs/reference.md and docs/subsystems/gui-shell.md say so.
Run:
- internal/gui/tests/last-page.test.cjs (new), Chromium and WebKit, at
1100 (sidebar) and 420 (header tabs): left on Routing, opened again with
no ?view= and reloaded -> Routing, nothing scrolled; Settings kept;
?view=usage and ?view=agents win; an unknown kept name -> Agents;
gateway mode with agents/library kept -> Providers, routing kept ->
Routing. Broken by hand, it goes red: with show() not saving, with the
kept page not restored, with the kept page beating ?view=, and with
both gateway fallbacks removed.
- model-rate.test.cjs opened "/" after Providers and took it for Agents;
it now asks for ?view=agents.
- 171 GUI files that navigate more than once or touch the start page
(gateway-mode, sidebar*, nav-*, click-scroll, view-*, getting-started,
side-toggle, panel-*...) plus 151 that open the bare root URL, both
engines, 5-6 files at once: all green but model-rate (fixed above) and
load flakes that pass alone here and on origin/main
|
||
|
|
419ef30219 |
gateway: Claude Code gets a safety refusal as Anthropic's own, and switches to its fallback model; how many more accounts are asked is a setting (#1925, DD on Discord)
DD on Discord: through magpie, Claude's safety filter refusing a turn never makes Claude Code move to its fallback model, as it does on Anthropic's API. magpie asked every other account and group member (#248), then told Claude Code a 400 "<model> refused this request", which it takes as an API error. Claude Code 2.1.296 switches on stop_reason "refusal" in a 200 reply (the stream's message_delta or a whole message, stop_details giving the category), and only with a fallback model set; a 400, Anthropic's "Output blocked by content filtering policy" or magpie's, is never retried. What changed: - When nobody is left after a refusal, an agent on Anthropic's Messages API gets the held refusal itself, the vendor's 200 with stop_reason and stop_details, streamed or whole (holdWriter.handBack): keyed Anthropic providers, groups, the Claude subscription. Codex and Chat clients keep the 400, since an empty-looking whole reply makes Codex ask again. - Settings' refusalRetries counts how many more candidates (accounts, then group members, another model among them) a refusal is asked of. Unset is every one, #248's behaviour (Koohoko asked for it); 0 hands it straight back. GUI: Settings > Models > Replies > "Ask again after a refusal" (Never ask again, 1, 2, 3, All), en/zh/zh-TW/ja/de. Global, no CLI: magpie has no general settings CLI (as noLoopGuard). Other 400s are still never asked again; refusals still rest nobody. - disabled-models.test.cjs wheels to Enable, which the new row put past the window's foot at webkit de 420. - Docs: reference.md "When the safety filter refuses", gateway-routing.md. Run: - go test -tags nogui ./internal/gateway (full, -timeout 40m: a first run hit the 10m default at load ~70 from other sessions), ./internal/gui, ./internal/settings; gofmt -l clean; GOOS=linux and windows go vet. - GUI: refusal-retries-setting (en, zh, zh-TW, ja, de at 1100 and 420) with gui-zh-tw, gui-ja, gui-de, i18n-keys and every tab=models suite (disabled-models, images-*, loop-guard-setting, member-model-setting, search-*, searcher-pick, vision-mcp), chromium and webkit: 176 pass. - refusal-retries-setting under load (8 runs at once, load ~200): first 4 of 8 failed at en/ja 420, a press landing on the first save's "Saved" note over the row, then WebKit's wheel still moving the view as the press was measured. It now reaches each button clear of anything drawn over it (reader.cjs reach) and waits for the scroll to rest: 16 of 16. Broken by hand: - handBack off: TestRefusalRetriesNoneHandsClaudeCodeTheRefusal, ...CountsTheTries, ...Group, ...ClaudeSubscription and TestRefusalWithNobodyLeftIsAnError fail (400 "refused this request"). - count ignored: those plus ...CodexStillTold400 fail (the next key answers). - GUI keep-on-omit dropped: TestSettingsRefusalRetries fails; the GUI test fails with All sent as undefined, and with the row not appended. Not tried: a real Claude account's refusal, or Claude Code's fallback switch end to end; the refusal shapes are from Claude Code's source and Anthropic's docs. |
||
|
|
3a9d73c5c6 |
gateway: a plugin's deferred usage is billed with its step, never told as the prompt
The Cursor plugin collects a tool step's late usage event with the conversation's next step. It used to add it to that step's prompt_tokens, which agents read as how full their context is: pi saw 366940 tokens (181270 + 185670) on a 300k window where 185670 were in use, and compacted. The plugin now reports it apart, as usage.magpie_deferred (yetone/magpie#1053). The gateway parses the field into Usage.Deferred and adds it only where it bills: the usage records (6 sites in serve), the OTel attempt span and route pricing, as a tier before the request's own, so promptCounted still reads the request's own prompt. What a client is told (Usage.chat, the Anthropic encoding) stays the request's own. A reply without the field is handled as before. docs/subsystems/provider-plugins.md describes the field. Verified: go test -tags nogui ./... (50 packages ok, sandbox HOME, caches pinned); gofmt; go vet on darwin, linux (nogui) and windows; go build on the same three. The new tests were broken by hand and each went red: billed() ignoring Deferred, cUsage dropping the field, routeUsage without the tier, Usage.add forgetting it, the decoder ignoring a usage with only a deferred part, the usage records and the OTel span not using billed(). Not tried: a real Cursor account on this checkout; the plugin side was run against real Cursor (composer-2.5, forced late events), where the deferred totals matched the dashboard's events token for token. Picked from geoqiao/magpie cursor-deferred-usage (595d6384c), as PRs here are collaborators-only. Rebased over the service-tier logging (#1784), keeping its TierAsked/TierSent/TierServed beside billed() at the three usage.Record sites, and Usage's Tier beside Deferred. Run on this tree: go test -tags nogui -timeout 40m ./internal/gateway and ./internal/provider (sandbox HOME); gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows. billed() forced to ignore Deferred: 3 tests and 5 subtests of deferred_usage_test.go go red. |
||
|
|
ab1006bb80 |
gui: each WorkBuddy, Trae CN, MiniMax, Qoder or plugin account's daily check-in can be turned off on its own (#1902, magicLaLa)
settings.CheckinOff lists the accounts left out, by their entry in the
vendor's check-in file ("workbuddy|<uid>", "trae-cn|<uid>", a plugin's
"<provider>|<account>"). checkinNow skips them, both in the loop and on
Check in now. provider.CheckinAccounts() lists every account a check-in
reaches; /api/settings carries it as checkinAccounts, and
POST /api/settings/checkin-account {key,on} turns one off or on. A full
/api/settings save keeps the list. Settings shows an Off/On switch per
account under each vendor's Daily check-in row when it has 2 or more
accounts; the Usage card says "Auto check-in is off for this account" and
offers no Check in now for it. en, zh, zh-TW, ja, de.
Run (on 63a361b5f's tree, then targeted again on
|
||
|
|
d6fd9b3a36 |
provider, agent, gui, cli: Codex can switch only its own sign-in between accounts, never through the gateway (#1907, foobra)
foobra wants Codex Desktop and the CLI kept on their own ChatGPT subscription, moved to the next saved account when the signed-in one is used up and back when it resets, without magpie's gateway in the way. magpie already did the switch (codex_switch.go: 98%, 100% In order, back under 90%, unknown usage never switches), but with more than one Codex account on it also wrote openai_base_url into config.toml so a refused request fails over through the gateway (codexFailover). There was no way to have the first without the second. Now Codex's subscription has SwitchOnly (providers.json "switchOnly", opt-in, off by default so nothing changes for anyone who doesn't tick it): - provider.SetSwitchOnly / provider.SwitchOnly; only Codex's own subscription takes it. An unreadable providers.json reads as on, so magpie's own failover is never written on a guess. - agent.codexFailover is false when it is on: no openai_base_url, no failover note, no magpie models in Codex's list. A base URL the user wrote stays. - The account Save copy keeps it. - GUI: "Only switch Codex's sign-in" tick under Providers > Codex's accounts (with more than one on), posting provider/switchonly; the Agents row's failover title points at it. zh, zh-TW, ja, de. - CLI: magpie accounts switch-only codex [on|off]. - docs/reference.md and providers-accounts.md say what it does and that an open Codex app or app-server stays on its account until reopened. Run (darwin, sandbox HOME, -tags nogui): - go test ./internal/provider -run 'TestCodexSwitchOnly|TestCodexSwitchedWhenUsedUp|KeepLogin' - go test ./internal/agent -run 'TestCodexSwitchOnly|TestCodexFailover|TestCodexOwnModelThroughMagpie|TestCodexHandWritten' - Broken by hand, each red: codexFailover guard removed (agent test), SwitchOnly dropped from the Save copy, SwitchOnly reading false on an unreadable file (provider test), the tick drawn unticked (GUI, 16/16). - GUI: switch-only (new), keep-login, agent-failover, gui-ja, gui-de, gui-zh-tw in Chromium and WebKit, en/zh/ja/de at 1100 and 420: 77 pass. - The built binary's `accounts switch-only` in an empty sandbox HOME: reads off, refuses on with no Codex provider, refuses claude. - gofmt -l clean; darwin go vet. Reviewed and rerun after rebasing onto |
||
|
|
30869e35a7 |
usage, gateway: each request's log row says the service tier asked, the one each try was sent at, and the one the vendor said it ran at (#1784, zhenghaowen0967)
What changed
- usage.Record has tier_asked, tier_sent and tier_served, and the CSV gets
them as its last three columns.
- tier_asked is the client body's service_tier (Claude's speed fast reads
"fast").
- tier_sent is the tier the try's last request actually went out at. It
is noted in forwardOnce after every rewrite (a fast pick's priority,
Ultrafast turned to priority on a plan without it, buildResponses
dropping a tier the host can't take) onto the per-attempt wireAt. So a
handed-on try's own row has its own tier.
- tier_served is only what the reply said: service_tier at the top level,
in response.service_tier, or in an Anthropic usage. It is read by the
relay sniffer and by both translated readers, and is empty when the
reply says nothing. It is never filled in from the ask.
- Codex's own relayed sign-in (codex_backend) records the same three.
- /v1/magpie/route: Route.tier (asked), and each Try has tier and
tierServed. The session route has asked_tier, tier, tier_served and each
try's tier and tier_served.
- docs/reference.md (CSV columns) and gateway-routing.md describe them.
Why
zhenghaowen0967 asked that a request whose Ultrafast was sent as priority
to an account without it show that in usage, per try, without calling
the served tier confirmed unless the reply says so.
What was run
- TestTierRecordedPerTry. With Pro out, the first try is recorded
ultrafast, the second priority, and the final record has asked=ultrafast,
sent=priority and served empty while the fake doesn't echo. With an
echoing fake, served is what it said ("ultrafast", and "default" when
none was asked). It also checks the CSV columns, and the Codex relay path
with priority.
- TestUpstreamTierShapes covers the Chat chunk, Responses
response.completed, a Responses body, an Anthropic message_start and
message_delta usage, null, an over-long tier and non-JSON, as well as
bodyTier per protocol.
- Broke it by hand:
- with forwardOnce's noteWireTier removed, TestTierRecordedPerTry goes
red (route tries' tier empty, TierSent empty);
- with the sniffer's Tier line removed, TestUpstreamTierShapes goes red,
and so does the Codex relay case of TestTierRecordedPerTry.
- go test -tags nogui ./internal/gateway ./internal/usage ./internal/cli;
ledger_test's CSV expectations gain the three empty columns.
- gofmt -l; go vet on darwin; GOOS=linux and GOOS=windows go vet -tags
nogui.
Not done
- The served-tier fixtures are built from the shapes OpenAI and Anthropic
document, not from saved replies. Whether chatgpt.com's Codex backend
echoes service_tier wasn't tried against a real account.
- Bridges that don't go through forwardOnce (the Claude subscription,
Cursor's built-in) leave tier_sent empty.
- There is no price multiplier for priority/ultrafast and no GUI column.
|
||
|
|
62390fe92e |
redact: a masked word is never masked inside tool definitions or schemas, so Codex's apply_patch grammar reaches OpenAI intact (#1911, loveNangua)
What changed: MaskJSON masked custom words as raw substrings in every
string of the request, tool definitions included. A word "pd" turned
apply_patch's Lark rule name update_hunk into u{{TERM_..}}ate_hunk and
OpenAI refused the request with 400 "Invalid lark grammar". Definitions
are now kept by where they sit in the protocol, not by a key's name:
the request's top-level tools, tool_choice, functions, function_call,
toolConfig/tool_config, response_format, text (an object), reasoning,
include, output_format, output_config and generationConfig, and the
tools of a Responses input item of type additional_tools or
tool_search_output. Inside them only "description" strings are still
masked. A "tools" or "text" key in tool-call arguments, a message, a
Gemini part or a Responses message item is masked as before.
Run: go test ./internal/redact/ ./internal/provider/ (ok). The new
tests use Codex 0.162.1's real request (copied from the gateway's
testdata) with the top-level tools and as a Responses Lite
additional_tools item, plus Anthropic/Chat/Responses/Gemini schema
cases and negative cases. With the old json.go both tests fail
(update_hunk masked, every schema case changed). gofmt -l clean; go vet
-tags nogui on darwin, linux and windows. Not tried: a real request to
OpenAI with the word set.
|
||
|
|
488569227e |
zhipu: a GLM Coding Plan key at the pay-as-you-go endpoint is asked again at the plan's, and the provider moves there
@cleverpigo on X: "glm coding plan放在codex/chatgpt里显示余额不足没法用". The editor
showed OpenAI https://open.bigmodel.cn/... red with 429 · 余额不足或无可用资源包,
请充值。 next to a green Anthropic https://open.bigmodel.cn/api/anthropic.
Root cause: the zhipu and zai presets start on their first region, Pay as
you go, whose OpenAI URL is /api/paas/v4. The Anthropic URL is the same in
both regions, and it bills the Coding Plan when the account has one. So a
Coding Plan key left at the default works in Claude Code, while Codex goes
to /api/paas/v4 and Zhipu answers 429 code 1113 (no balance). A provider
made by pasting the paas/v4 URL hits the same wall. Nothing in the key
says which kind it is. LESSONS.md's
|
||
|
|
81f587d7be |
sessions: omp's sessions in a WSL distro are listed on Windows, on the Sessions page and in Usage's Sessions tab, as Claude Code's, Codex's and Pi's there already are (#1150, #1138)
omp keeps its sessions under ~/.omp/agent in the distro's home, and in
a profile's own folder for omp --profile. wslAgents now names omp, and
allFiles reads wslFiles("pi", "omp"), so a distro's omp sessions show on
Windows marked with their distro and resume through wsl.exe. A session
under a profile resumes with omp --profile <name> --resume <id>; a
profile name that isn't plain ([a-z0-9][a-z0-9._-]{0,63}) gets no resume
command rather than one built from it (resumeCommand takes the session's
path for this).
Squashed from yetone/magpie#1150 at d7968f11b2ef419e30e1a6a169554b12e58c885a
onto main; docs/subsystems/gui-shell.md conflicted and keeps main's
"Streamed output speed" section and the PR's "Stored agent sessions in
WSL" section.
Run at this tree: gofmt; go vet darwin, GOOS=linux -tags nogui,
GOOS=windows; builds for all three; go test -tags nogui on
internal/sessions, internal/gui and internal/agent (agent with
-timeout 45m, it took 17 min on a loaded machine) green.
Broken by hand: with omp taken out of wslAgents, TestWSLSessionsListed,
TestWSLOmpSessionDeleted, TestWSLOmpProfiles, TestWSLStoppedDistroKept
and TestWSLStoppedSinceNotOpened go red.
Not tried: a real WSL distro with omp on the Windows box.
|
||
|
|
79099d6adb |
provider, gui, tui: Ollama, LM Studio and oMLX take an address, so a server on another port or computer is the preset's provider (#1165)
The three On this machine presets were pinned to localhost and their default port: one started on another port, or on another computer on the LAN, had to be rebuilt as a custom provider or typed URL by URL in the CLI. They now take an Address (scheme, host and port), and each of their URLs keeps its own path there (provider.AtAddress, AddressOf; no scheme means http, only http/https, port 1-65535, a pasted path is dropped, anything else refused with nothing changed). - GUI: the add and edit editors have a Server address section under the key, folded unless the saved address isn't the preset's, opened and focused on a refused one. The Endpoints, Test and Refresh follow what is typed; URLs are sent only when the address changed, so ones set apart (an import, the CLI) are left alone. zh, zh-TW, ja, de. - TUI: adding a local preset asks for its address before the key (Enter keeps the default), and w edits it. - CLI: the usage shows provider add ollama url=... anthropic=.... - LM Studio's and oMLX's notes say "port N by default". timonwong's PR head e63cf18e, merged onto main, which had given oMLX a decision API (#1641) since: presets.go keeps main's oMLX Decide; app.js keeps both the Vertex block and the address one; the docs row and -run list take both. Run: see the next commit. |
||
|
|
eba7187368 |
gateway, provider, cli, gui: a group can route By weight, each member's share set beside it (#1910, DD on Discord)
DD asked for weighted round robin as a group routing, next to In turn.
A provider's keys could already route by weight (#841). Groups could not.
What changes:
- provider: Group.Weights maps a member's spelling to its weight, 1 to
1000. A member left out, or set to 0, weighs 1. SaveGroup accepts
routing "weight". It also cleans weights the way it cleans fast and
off: it strips :fast, drops weights of members that are gone and of
members weighing 1, and refuses a weight below 0 or above 1000.
Weights follow a member when it is renamed (RenameMember, Rename,
RenameGroup) and survive Share/Import.
- gateway: planLevel treats each member of a weight-routed group as one
unit: a model with its keys in its provider's order, or a nested group
routed its own way. weightedUnits orders the units by smooth WRR on a
round per group ("group/<id>"), sharing wrrPick with the keys. The
round's pick goes first and the rest stay in member order for
failover. A unit whose head is resting leaves the round. When a
conversation is kept on another member (session/turn/cache/strict),
the charge moves to that member (wrrSeat, wrrMove).
- cli: routing=weight (also weighted, wrr). weight=<model>=<n>[,...]
sets weights and keeps the rest; weight= on its own clears them. The
group view shows "· weight N" for each member.
- tui: By weight is in the group routing list.
- gui: the group editor offers By weight. Each member then shows
"Weight N · S%", its share among the members that are on. Clicking it
edits the number in place: Enter or blur keeps it, Escape cancels,
and a value outside 1 to 1000 shows a warning. The trace header uses
group wording for a weight-routed group. Strings are added in zh,
zh-TW, ja and de.
- docs: reference.md, gateway-routing.md, and site start pages in en,
zh and ja.
Run:
- go test -tags nogui ./internal/provider ./internal/cli ./internal/tui:
ok.
- ./internal/gateway: ok in 988s with -timeout 45m. The first run hit
the default 10m timeout at load average ~170. The test running at
that moment had been running for 2s; it was not a hang.
- go vet -tags nogui on those packages, for darwin, GOOS=linux and
GOOS=windows: clean. gofmt -l: clean.
- New group-member-weight.test.cjs: 8/8 in Chromium and WebKit, en and
zh at 1100, en and de at 420. The WebKit de 420 case also passed six
runs at once.
- gui-zh-tw, gui-ja, gui-de, i18n-keys, routing-*, group-*,
panel-routing*, settings-groups and agent-model-groups: all green
except two.
- routing-steady (WebKit) is #1804. It is red 2/3 alone on origin/main
|
||
|
|
c984adfbc7 |
sessions: a renamed or moved Claude Code project folder is relocated with its sessions, from the Sessions page or the CLI (#1131)
Renaming or moving a project folder left Claude Code's transcripts under the old encoded project path: magpie listed them with a resume command for a folder that no longer exists, and Claude Code in the new folder didn't find them. A Claude Code folder row on the Sessions page now has Relocate project, which opens magpie's own dialog with the new absolute path, a read-only preview and a confirm that carries the preview's token; `magpie sessions relocate-claude --from --to [--confirm <token>]` does the same in a terminal (inside WSL too). The whole project store moves, session ids, subagents, tool results and memory with it; the transcripts' top-level cwd and the sessions index are rewritten, message text is not. The originals and a recovery manifest are kept outside Claude's project list, writes are staged before the originals are renamed, a change since the preview is refused, and a failed publish rolls back. An existing target store, recently written files, a malformed transcript, a symlink, an ambiguous encoded path or a long hashed name are refused. Desktop's stores are left alone. Recovery is in docs/session-relocation.md. Jianyu's PR head e8263cde, which conflicted with main: the button moved into main's folder() row, the CLI test into internal/cli beside sessions_cli.go, and both sides of sessions_manage.go and i18n.js kept. Run: see the next commit, which adds the zh-TW/ja/de strings and the GUI test. |
||
|
|
63a361b5ff |
gui: a plugin that took over Trae's, WorkBuddy's, MiniMax's or Qoder's check-in keeps that switch after a state refresh (#1912)
The previous commit reads the saved pluginCheckins map before /api/settings' list, but /api/state has neither the list nor, for a provider whose own switch was never set, a map entry. Such a plugin follows the built-in check-in it took over (provider.PluginCheckinOn: traeCheckin for trae-cn, workbuddyCheckin, minimaxCheckin, qoderCheckin), so a refresh still drew it off while the scheduler kept checking in. pluginCheckinOn now falls back to that built-in's switch, from PLUGIN_CHECKIN_INHERITS. Run: plugin-checkin.test.cjs gains cases for the inherited switch in /api/state's shape (red with the fallback removed) and a test that the map names the same ids and settings keys as Go's PluginCheckinOn (red with an extra entry); plugin-checkin, i18n-keys, gui-zh-tw, gui-ja, gui-de in Chromium and WebKit: 32 pass. No new strings. |
||
|
|
762db7c5a2 |
gui: a plugin's saved auto check-in stays on after a state refresh (#1912, 1939323749)
Reported by 1939323749 with a custom provider plugin on Windows. Read the persisted pluginCheckins map before the derived settings-only list, preserving explicit false and the existing default fallback. Verified plugin-checkin tests in Chromium and WebKit across en, zh, zh-TW, ja and de, plus all three translation GUI suites. The WebKit English Usage-card regression fails without the fix: saved auto check-in stays on after a state refresh (false !== true). Reviewed and landed from the reporter's branch (755c1f0): with the old pluginCheckinOn the new refresh assertion fails in WebKit for every language; with it, plugin-checkin, i18n-keys, gui-zh-tw, gui-ja and gui-de pass in Chromium and WebKit. |
||
|
|
5e5b6a5ac3 |
provider: every account of a provider keeps its queue, limits and routing, not only the first (#1899)
A second WorkBuddy AI account queued requests for 62s with the provider's queue wait set to 1s. The gateway takes each candidate's QueueLimit, QueueWait, LaneLimit (MaxConcurrency) and Routing from the Provider value it is handed. The account the agent is signed in to comes from All, which lays the user's saved picks from providers.json over it. The other accounts on beside it come from AlsoOn. For Claude and Codex, AlsoOn copies p, so they had the picks. Every other sign-in builds its extra accounts afresh: all plugin accounts (pluginAlsoOn) and the built-in extras (WorkBuddy, Grok, Copilot, ZCode, Kiro, Devin, Command Code, Qoder, Zed, Factory, MiMo, the Gemini sign-ins). They had none of the picks. A few getters (LaneLimit, RPMLimit, AccountCap, proxy) already fell back to providers.json. The queue, the provider-wide concurrency and routing did not, so an extra account waited forever on a full lane. The overlay All does is now withPicks. AlsoOn calls it on every account it returns, from p as All has it. This one choke point covers every sign-in's extra accounts, plugin and built-in, moved or not. The LaneLimit, RPMLimit and AccountCap comments now say what still reads providers.json, and so does gateway-routing.md's Limits row. Tests: - TestPluginSecondAccountKeepsTheQueue (gateway, fake plugin under bun): two accounts, one at once each, a queue of 1 and a wait of 1s, every request pinned to the second account. The third request gets 429 "queue is full" at once, and the queued one gets 429 "waited" after its second. The vendor sees only the second key. - TestWorkBuddyAI: the second account from AlsoOn has the provider's queue 1/1s, MaxRPM 7, Routing ordered and LaneLimit 2. Broken by hand (AlsoOn returning alsoOn's accounts as they are): - The gateway test fails at its AlsoOn check. With that check off, it fails on "no reply in 10s", which is the reporter's symptom. - TestWorkBuddyAI fails with "queue 0, wait 0s, rpm 0, routing "", at once 0". Run (sandbox HOME, private GOCACHE, worktree): gofmt -l; go test -tags nogui on ./internal/provider, ./internal/gateway, ./internal/gui, ./internal/cli and ./internal/agent; GOOS=linux and GOOS=windows go vet -tags nogui on internal/provider and internal/gateway. Not tried with a real WorkBuddy AI account. |
||
|
|
087985c778 |
usage, gui: a Codex turn of one call too short to time tells its whole-turn floor only at 1,000 tokens or more, as Claude Code's does (Fallmonkey on Discord)
Fallmonkey's report: an 11-token gpt-6-astra answer in 2.75 s, too short
after its first token to be measured, showed "≥4 tok/s" from the
whole-turn fallback (
|
||
|
|
7df0a5bf32 |
catalog: a vendor's own model name is kept ahead of the catalog's, and fallback names never collide (#1188, fixes #1119)
Command Code's Flash Fast showed the catalog's "Flash", the same name as plain Flash, so the picker had two "Flash" rows. An unprefixed `name` from a vendor's /models now wins over the catalog fallback (magpie_label and display_name still come first). A `Vendor: Model` name such as OpenRouter's falls through to the catalog as before, so OpenRouter's names don't change. A catalog fallback that would give two ids one name keeps the id instead. Exposed fills names only for unlisted picks and checks every available name and id for a collision; listed picks keep exactly what Available returned, Antigravity's id-only names among them. TestNameOf's case-variant expectation changes on purpose: glm-5-turbo and GLM-5-Turbo together keep their own ids. Kenoia's PR head f538b19e, which conflicted with main in internal/catalog/live.go and live_test.go; the conflict was resolved keeping both main's live-name changes and this one. Run on this tree (origin/main |
||
|
|
848d2ea9b8 |
contributors: ggbdpq is watched for tests that pass on the old code and siblings left out
Their fixes are useful, but on 10-13 two batches each needed a follow-up: |
||
|
|
657e48abbf |
routing: a request whose agent left in the retry pause says it was canceled, not "tried again in 2s" (#1894, heng91)
heng91's relay was unreachable while their proxy was off; magpie answered the relay's 503 with its short same-one retry (or a group's replan), and they closed the Claude Code / Codex window in the pause. The gateway already stopped there: the pause selects on the request's context, the route ended with 499 and the upstream was asked nothing more. But the trace never said so: the last try kept only its Again, so the Routing page's story ended on "... it is tried again in 2.0 s" and the list said "499 · failed", which reads as the closed session still retrying. - gateway: the three pauses (the last one left asked again, the same after spentAfter, and the group's replan through pauseAlive) mark the try whose pause it was `Gone` when the agent leaves in it. - Routing page: such a try says the agent canceled the request before the retry and nobody is asked again (en, zh, zh-TW, ja, de); the request list and the outcome label say canceled; the replay's dot goes home. - docs/subsystems/gateway-routing.md says so. Reproduced first with a fake upstream (httptest) answering 503 and one hanging, a real gateway server and a client that disconnects: single provider, group replan, streamed and not, hang mid-try. In every case the route ended at once with nothing in flight and the upstream saw no further request (the hanging one saw its request canceled); only the trace's last line was wrong. The plugin fetch path already sends the host an abort on cancel (host.js "abort"). Run: - TestAgentGoneInTheRetryPause (new, -race): agent leaves in the pause, single and group; upstream count stays, route done 499, no try in flight, last try Gone. Red with the Gone marking removed (Gone false), and red with the pauses ignoring the context (route not done). - routing-agent-gone.test.cjs (new): Chromium and WebKit, en/zh/ja/de, 1100 and 420 wide, 16/16; red (0/4) with the story and label change reverted. - go test -tags nogui ./internal/gateway ./internal/gui; routing-*, rest-try-now and ledger-retried GUI tests on both engines; gofmt -l; GOOS=linux and GOOS=windows go vet -tags nogui on both packages. Not tried: the reporter's own relay and proxy, or a real Claude Code / Codex window closed mid-pause. The one other red in that GUI run, routing-wb-restricted at 420 in Chromium under the full run (passes alone 3/3), is filed as #1905. |
||
|
|
1d927bcfe9 |
gui: a copy nothing could make says so, with the text to copy by hand (#1881, BabyLy233)
copy() tried /api/copy, then navigator.clipboard.writeText, then the copy command, and when all three failed it put the bare text in the footer with no word that nothing was copied. Now that magpie refuses a copy it can't read back (the commit before), that last case is reachable in the app on Linux, so it reads "Couldn't copy. Select it here and copy it yourself: <text>" as an error (role=alert, 8s) and the button isn't flashed as copied. Translated in zh, zh-TW, ja and de. The order of the tries and the success path are unchanged, on macOS and Windows too. docs/subsystems/gui-shell.md: the host's copy row says how a Linux copy is made and checked, and where the page takes over. Run: - tests/copy-fallback.test.cjs (new): /api/copy 204 (no page copy), 501 + clipboard API, 501 + API refused + copy command, all refused; en, zh, zh-TW, ja, de; Chromium and WebKit: 40 pass. With the failure line put back to status(text), the 10 "nothing copies" cases go red. - copy-command, key-copy, model-copy-id, library-mcp-copy-config, i18n-keys: pass. - go test -tags nogui ./internal/gui: pass. Not tried: WebKitGTK's own clipboard API and copy command inside the real Linux app window when /api/copy refuses (the container run drove the host's copy directly). |
||
|
|
6d7e5b53a0 |
library: the Library page opens without looking at the same folders thousands of times (#1771, oxyuan)
oxyuan's profile after v0.1.1214: every page opens at once but the
Library, ~1.3s a visit on Windows, 68% of it in library.resolve and the
read 97% system calls.
Cause: resolve follows links a part at a time, and for each part it
called linkTarget (an Lstat, and a Readlink for a link) and then Lstat'd
the same part again. One read of the page resolves a few hundred paths,
most of them many times over (each agent's skills folder for each skill,
CC Switch's folder and the source for each skill, home and the shared
folder once per skill), so the same ~150 folders were looked at
~10,000 times a read. On Windows each look is a cgocall.
Fix: while a read of the page (Read, Glance) holds the library's lock,
lookPart (linkmemo.go) keeps what each entry was found to be, one Lstat
and a Readlink for a link, for the rest of that read; linkTarget and
resolve both go through it, so the second Lstat is gone too. No change
runs while the read holds mu, so nothing the read keeps can be changed
by magpie under it. Nothing is kept past the read: the next visit looks
again, so a link made or moved on disk between visits shows. A look that
failed for another reason than "not there" is unknown and isn't kept. I
looked at a cache across visits keyed on the folders' times; checking it
costs one stat per folder on the way, the same as the memo's single look,
so it would save nothing over this.
Numbers, 11 agents, 40 skills from a linked folder given to all of them,
10 MCP servers (the package's sandbox, test binary built for each):
Windows 11 x64 box, median of 7:
Glance 10,144 looks, 116ms -> 117 looks, 26ms
Read 10,473 looks, 150ms -> 284 looks, 61ms
macOS (arm64), median of 7:
Glance 11,660 looks, 41ms -> 159 looks, 13ms
Read 12,040 looks, 53ms -> 360 looks, 28ms
The rest of a full Read (comparing the agents' copies, found skills)
runs without the lock, as before, and isn't memoized.
Tests: TestReadLooksAtEachFolderOnce (red with the memo taken out, and
with it outliving the read), TestLinkChangedBetweenVisitsShows (red with
a memo kept across visits), TestUnreadablePartIsLookedAtAgain (red when
an unknown look is kept).
Run: go test -tags nogui ./internal/library ./internal/gui (ok);
gofmt -l; GOOS=linux and GOOS=windows go vet -tags nogui
./internal/library; node --test internal/gui/tests/library-*.test.cjs,
chromium and webkit: 450/450 on the second full run. The first full run
had library-mcp-tool-switch red in WebKit (#1609, filed) and
library-chip-fan red once in Chromium under --test-concurrency=4; it
passed 3/3 alone and in the second full run. Not tried on oxyuan's
machine or with their library.
|
||
|
|
2d721f7f3d |
library, gui: the skills in your agents can be picked and removed together
wongxy on Discord: 资源库技能支持批量删除 (batch delete for the Library's skills). The library's own skills already have this: Select, then Remove…, since #1852 ( |
||
|
|
e528aeb3ce |
agent: DevEco Code, Huawei's OpenCode, as an agent (#1885)
foobra asked for DevEco Code (npm @deveco/deveco-code), Huawei's
HarmonyOS coding agent. It is OpenCode underneath, so it joins through
openCodeLike as MiMo Code did (
|
||
|
|
c3bbf16022 |
agentplug: an agent plugin's keys are written in the order it gave them (#1890)
What: connect's result is taken from the module as JSON text (moejs AppendJSON keeps JS insertion order) instead of rt.ToGo, which made a Go map at every level. An object or array connect returns reaches the writer as a json.RawMessage, so edit.SetJSON writes it in the plugin's order; strings, numbers, booleans and null are their Go values as before (the gateway-key mark still matches a string). edit.SetYAML now takes a json.RawMessage too, as a block-style node in the text's order (it would have written the bytes as a list of ints), and the env format writes it compact as before. Why: Kilo's agent plugin (magpie-community/plugins#90) returns each model's effort variants weakest first, low, medium, high, the order Kilo lists them in. Go maps marshal sorted, so Kilo showed high, low, medium. magpie's own OpenCode wiring already keeps order (openCodeVariants). The key paths connect returns are still applied in sorted order: each is a separate edit, and the user's file around them is untouched. Siblings: rt.ToGo's other caller (middleware's string lists) writes no file; the Library's MCP block for a plugin agent is built by magpie, not returned by the plugin. Run: - TestPluggedKeepsPluginOrder (Kilo-shaped connect, a kilo.jsonc with a comment, a theme, $schema, a provider of the user's own with keys zeta, alpha and a trailing key) and TestPluggedKeepsPluginOrderYAMLAndEnv. With agentplug.go put back: FAIL, variants written high, low, medium and provider keys sorted. With yaml.go put back: FAIL, the object written as a list of byte values. Both pass with the change. - gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., the three builds: OK. - go test -tags nogui -timeout 40m ./... under a scratch HOME: all ok. (A first run with the default 10m timeout timed out in internal/gateway while four other sessions' suites ran on this box and the disk was full; the gateway package took 973s under that load and passed.) - Real use, sandbox HOME: this build, `magpie plugin add` of packages/kilo at plugins PR #90 head b67360cb7, a provider whose fake-chat has efforts stored high, low, medium; `magpie kilo magpie/fakeup/fake-chat` wrote variants low, medium, high with the user's comment, $schema, theme and own provider in place, and @kilocode/cli 7.8.8 `kilo models magpie --verbose` lists them low, medium, high. `magpie kilo default` put the file back; the only difference is Kilo's own one-time permission migration. |
||
|
|
b0e3177d9d |
provider: Ollama Cloud shows its plan's included allowance and its bought credits in Usage and magpie quota (#1888)
What: an ollama-cloud key (any provider whose base is on ollama.com) is read at GET https://ollama.com/api/balance with Authorization: Bearer <key>. included.{balance_usd, allowance_usd, period} becomes a plan card (PlanQuotas, planQuotaSourceOf) with one window in USD: spent of the allowance, named Month when the period is a month long, resetting at period.until. purchased.balance_usd becomes the key's balance card (KeyBalances, balanceSourceOf). Routing weighs the key by that window as it does other plan keys (keyWindows), and the window is Aside while bought credits are left, since spending past the allowance draws on them. Absent fields are unknown, never $0: no included, no allowance, an allowance of 0 or no balance_usd gives no window (and, as for MiniMax and Command Code, no plan card); no purchased gives no balance card (new errNoBalance, which KeyBalances leaves out instead of showing an error); null period gives a window with no reset. A reply with neither object says its shape. A refused key's balance card says Ollama's reason. Why: #1888 asked for Ollama Cloud's balance and plan quota beside the other key-bought plans. Run: - go test ./internal/provider -run 'Ollama|TestPlanQuotaSource|TestBalanceSourceByHost|TestKeyBalances' in a sandbox HOME: pass. Broken by hand five ways, each red: no ollama.com plan source (TestOllamaCloudCards, TestPlanQuotaSource), missing purchased read as $0.00 (TestReadOllamaBalanceMissing, TestOllamaCloudCards), KeyBalances not skipping errNoBalance (TestOllamaCloudCards), missing included.balance_usd read as 0 (TestReadOllamaBalanceMissing: a $20 allowance shown 100% used), Aside dropped (TestReadOllamaBalance). - The built binary in a sandbox HOME with an ollama-cloud provider and a fake key: `magpie quota` asked the real ollama.com and showed `ollama-cloud balance 401 Unauthorized: {"error":"invalid credentials"}`, no plan card. - gofmt -l, go vet (darwin), GOOS=linux go vet -tags nogui, GOOS=windows go vet, go build for darwin, linux (nogui) and windows: clean. - go test -tags nogui ./... in a sandbox HOME at load ~27: 48 packages ok; internal/agent and internal/gateway hit the 10m timeout, and in gateway TestIntentClassifierGroup (#1813, 3.63s against its 3s bound) and TestHistoryKeepsDaysAndDropsOld (filed #1892) failed. Rerun with -timeout 40m both packages pass (1032s, 1138s). Neither package reads ollama.com or these readers. Not tried against the real API with a real key: the owner's magpie has no ollama-cloud provider, so the fixtures are the issue's literal JSON and the free-plan and missing-field shapes are guesses from it. Whether a spent allowance really falls through to bought credits (Aside) is not verified either. Reported-by: yangmingyuan380 |
||
|
|
fa44fde461 |
netproxy: a proxy's user and password stay out of every log line, error and status that names it (#1886)
What: netproxy.Redact is the one place a proxy address is made fit to show. It is the rule |
||
|
|
88f237e91b |
gui: the Agents list's footer has Manage, to hide or unhide many agents at once (#1302, eryajf)
Users who use a few agents had to hide the others one row menu at a time, and disconnecting doesn't help: most are unconnected already. The Agents list's footer now has Manage beside the fold control (shown even when nothing is folded). Its dialog lists every agent, folded and hidden ones too, with search by name or id, select or invert the search results, select the unconnected ones, and clear. Hide selected / Unhide selected save one arrangement each through the existing POST /api/agents/arrange, keeping the order and every agent outside the selection; a failed save keeps the selection for a retry. While it saves, Done, Escape and the backdrop can't close it, and a state read that left before the save can't put the old arrangement back (agentsVisibilityRevision). Nothing connects, disconnects or edits an agent's files; the tray panel is unchanged. Strings in en, zh, zh-TW, ja and de. docs/subsystems/gui-shell.md says how it works. mobile-web's desktop comparison leaves the new footer out while the baseline hasn't it. Squashed from PR head 2a24d59e onto main, without the PR's unrelated parts: the plugins.js search redraw and its plugin-market test change, the purpose-filter and redact-rule-row test workarounds (main fixed those flakes at their cause), and a .warm-at input min-width. Conflicts: load() keeps main's reads with the PR's revision guard, i18n.js and app.css keep both sides, the gui-shell doc keeps main's window-corners note. Run (both engines; every agent* test, gui-de/ja/zh-tw, i18n-keys, mobile-web, panel-fold, library-mcp-tools, click-scroll): 516 pass. Two webkit zh-TW agent-failover failures were ENOSPC launching the browser and pass on a rerun. mobile-web's 1280 comparison and a narrow-width measure in agent-bulk-visibility needed fixes, in the next two commits. Broken by hand: without closeConfirmAsk's saving guard, "saving blocks Escape and backdrop" fails (success and failure); without the visibilitySince block in load(), "an older state read cannot undo a completed bulk save" fails. Not tried: the real app with real agents. |
||
|
|
b6831d83e1 |
gateway, gui: Codex's thread descriptions go to a model picked in Settings, apart from its titles (#1198, congee949)
Codex asks its own model, through its ChatGPT sign-in, for each thread's description (thread_description), even while the conversation runs on magpie's models. Settings › General gets "Codex thread descriptions" beside "Codex thread titles". It defaults to Codex's own, which sends the request as Codex sent it, or it can name one of magpie's models or a routing group. The answer is wrapped as description-only JSON. The titles setting is untouched. Usage and Routing show these requests under their own Description purpose. The setting is kept across unrelated Settings saves. There is no Off yet, because Codex's handling of an empty description hasn't been checked. This is a first slice of #742. Squashed from the PR and merged onto current main. Conflicts resolved: - codex_backend.go: the description branch comes after the title branch, ahead of main's subagent pick. - gateway.go: main's CC Switch #1301 comment above the compaction block is kept; the PR had shortened it. - app.js: the gateway-mode list of hidden rows takes the new row. - i18n.js and settings_keep_test.go: both sides kept. - purposes.js: regenerated with go generate ./internal/usage. Run on the merged tree: - gofmt -l is clean. - go vet passes on darwin, linux -tags nogui and windows; the builds on all three succeed. - go test -tags nogui passes for ./internal/gateway, ./internal/gui, ./internal/settings and ./internal/usage. - GUI, chromium and webkit: codex-titles, gateway-mode, purpose-filter, routing-purpose-state, gui-de, gui-ja, gui-zh-tw, i18n-keys, settings-general/-groups/-sections/-search and click-scroll: 118/118. Broken by hand: with the description branch removed from codexBackend and handle, TestCodexDescriptionsSetting, TestCodexDescriptionFallbackOnMagpie and TestNoDescription fail. Not tried: a real Codex thread_description request, and whether Codex's sidebar takes the answer. |
||
|
|
7cc393bcc1 |
gateway: a relay reading thinking off as effort none, refused naming its levels, is asked with thinking left to the model (#1465)
MengXiangxi's Claude Code auto mode on a Sub2API's gpt-6.1-sol blocked
every action: "Sub2API: gpt-6.1-sol does not support reasoning effort
"none"; use low, medium, high, xhigh or max" (400).
Cause: Claude Code's classifier (and every side query magpie turns
thinking off for, thinkingOffUnlessAsked) goes to Sub2API's Messages API
as it was sent, with thinking {type: disabled}. Sub2API's
anthropicReasoningEffort reads disabled as effort "none", and
ValidateGPT61SolReasoningEffort turns none away for gpt-6.1-sol
(Wei-Shaw/sub2api, backend/internal/pkg/openai/constants.go). magpie's
Anthropic retry for a refused thinking-off knew only the alwaysThinks,
mandatoryReasoning and thinkingOffRefused wordings, so this 400 went to
Claude Code. The refusal is about the model on that relay, not the
account: the same request with thinking left out is taken.
Change:
- refusesThinkingOff (anthropic.go) is the one list of thinking-off
refusals, now also one turning a quoted "none" away while naming the
levels taken (effortLevelsNamed && noneQuoted). Both routes use it: a
relayed Messages request (passthrough) and a request translated to an
Anthropic endpoint (forwardTranslated, thinkingBackOn).
- The relayed route now remembers the refusal (markUnfit(offRefused),
the mark the translated route and passthrough effort fitting already
read) and sends that model's later requests with thinking left to the
model at once, so the classifier, which asks on every action, doesn't
pay a 400 round trip each time.
- Chat/Responses routes already retried this wording through
effortLevelsNamed (reasoning_effort none -> lowest level); unchanged.
- docs/subsystems/gateway-routing.md says so.
Tests: TestSub2APIThinkingOffRefused (the reporter's literal message;
the classifier relayed is refused once, asked again, then sent without
thinking at once, title asks included; a 400 for another level stays the
agent's), TestRefusesThinkingOff, and the Sub2API wording added to
TestTranslatedThinkingOffRefused. Broke the fix by hand twice (the new
clause off; the remembered send off) and watched each go red.
Run: gofmt -l internal/ (clean); go vet ./internal/gateway on darwin,
GOOS=linux -tags nogui, GOOS=windows; go test -tags nogui
./internal/gateway -count=1 -timeout 40m: ok in 669s (load ~40 from
other sessions; an earlier run hit the default 10m timeout under that
load). Not tried against a real Sub2API.
|
||
|
|
2c31129692 |
gui: on macOS 26 the main window has a plain title bar's corners (TextEdit's, not Finder's), its traffic lights still in the header (waitingsnow) (#1042)
* gui: on macOS 26 the main window has a plain title bar's corners (TextEdit's, not Finder's), its traffic lights still in the header (waitingsnow) From macOS 26 a window with a toolbar has larger corners than one with a plain title bar: 26pt, Finder's, against 16pt for TextEdit or an Electron app. The main window has an empty toolbar only to inset its traffic lights into the page's header (Wails' MacTitleBarHiddenInset), so its corners were a toolbar window's. On macOS 15 a toolbar doesn't change them (12pt either way, measured on 15.8). On macOS 26 and later plainTitlebar now takes the toolbar off (insetLights, titlebar_darwin.go), and MagpieLights keeps the lights and the title bar's 66pt height where the toolbar had them. AppKit lays the title bar out again at its own 32pt after a resize or zoom, a new title, a new appearance and leaving full screen; the lights are put back once it is done, and AppKit's hover tracking is told where they went. Their autoresizing mask keeps their distance from the top: AppKit draws a new system appearance (light or dark, more contrast, less transparency) before the run loop turns, which drew them 8pt above the window for one frame. A sheet, such as the folder chooser, still begins below the title bar (Wails' window delegate gets window:willPositionSheet:usingRect:, which places this window's sheets only). A first press while another app is in front still moves the window from anywhere in the 66pt title bar, as AppKit moved it with the toolbar (firstPress, a local mouse-down monitor). AppKit's own band is now a plain title bar's 32pt; below it the page doesn't take a first press, so the press would only have brought the window forward. A press on a view that takes a first press (a traffic light, a resize edge) is left alone, as AppKit leaves it. The macOS version is asked at run time. go build and go test build the cgo objects for the Mac's own macOS, where @available(macOS 26.0, *) is compiled away: a test binary built so on 26.7.1 took the toolbar off on 15.8. An older macOS, the lights on the right (a right-to-left language) or a title bar not laid out as expected keep the toolbar. Linux and Windows are unchanged; the GTK 3 comment now says its corners stay square. TestMainWindowCorners (new; darwin, run by CI's macOS job) measures the main window beside a plain and a toolbar window in a process of its own (runAppKit, so WebKit's data stays out of the real ~/Library): once shown, after a new title and size and a new system appearance, as AppKit draws that appearance, a first press 20, 40, 60 and 70pt below the top while no window is key, and where a sheet begins. TestMainWindowRightToLeft launches it right to left. Both pass on macOS 26.7.1 (3 runs in a row), 26.6.2 (CI's) and 15.8 Intel, where the toolbar stays. With each part taken out, they fail: - the change itself: "corners of 26.00pt; a window with a plain title bar has 16.00pt, one with a toolbar 26.00pt"; - putting the lights back: "traffic light 1 at [16 16] (x, y from the top left), the toolbar had it at [26 26]"; - the height: "a title bar 32pt tall, the toolbar's was 66pt"; - the mask: "as AppKit draws a new system appearance, traffic light 1 is at [26 -8]"; - the sheet's place: "a sheet on a short window begins 16pt below its top; below the toolbar it began 66pt"; - the press monitor: "a first press 40pt below the top, with another app in front, began 0 window drags; with the toolbar it began 1"; - the right-to-left check: "the traffic lights are on the right, and the main window's toolbar was taken off"; - the run-time check (@available instead), on 15.8: "a toolbar doesn't change the corners on this macOS, yet the main window's was taken off". The presses are sent within the test's own process, and a drag is counted, not begun; no system setting changes. The real app on 26.7.1, built from this commit and driven through Accessibility under a HOME of its own, has 16.25pt corners (26.50pt on main) and its lights where main has them, through resize, zoom, light and dark, a new title, full screen, minimise, close and show, a maximised start, and the window lightweight mode makes again. A real pointer and a key window's press were not tried. go vet, the three builds and go test -tags nogui ./... pass. * gui: where AppKit gives magpie the Mac's earlier design (an SDK before macOS 26's, or UIDesignRequiresCompatibility), the main window keeps its toolbar (waitingsnow) The main window's toolbar comes off only in the design of macOS 26, where a toolbar gives a window larger corners. AppKit gives a program that design from macOS 26 when the program is linked against the macOS 26 SDK or a later one and its Info.plist doesn't set UIDesignRequiresCompatibility; the last commit asked only for the macOS version. A program linked against an earlier SDK gets the earlier design on macOS 26 too: yetone's test binary (Go 1.26.3, Xcode 26.2) names SDK 11.0, and on 26.2 every window there had 12pt corners, yet the main window's toolbar was taken off and TestMainWindowCorners failed at every stage. designOf26 now reads each at run time: the macOS version (NSProcessInfo), the key (NSBundle) and the SDK the program names. The SDK is in LC_BUILD_VERSION, or in LC_VERSION_MIN_MACOSX in a program that runs on macOS 10.13, as go build links one for an Intel Mac. The header is read through _NSGetMachExecuteHeader (crt_externs.h): dyld_get_program_sdk_version is declared only in dyld's private header, and it doesn't see the key (27.0 in a bundle that sets it, where AppKit gives the earlier design). The comment no longer says go build builds for the Mac's own macOS: the program names 11.0, and it is clang that compiles the cgo code for the Mac's own macOS (ld: "built for newer 'macOS' version (26.0) than being linked (11.0)"), where @available(macOS 26.0, *) would be compiled away. TestMainWindowCorners now runs the windows' program twice, as linked against the macOS 26 SDK and against macOS 15's (runAppKitSDK; stampSDK rewrites the SDK in a copy and signs it again), so on macOS 26 it checks both designs whatever SDK the toolchain names. In the earlier design it checks that the main window keeps its toolbar. gui-shell.md says which design gets the change, which SDKs the test runs with, why the key has no test, and how to run it as for an Intel Mac. Both subtests and TestMainWindowRightToLeft pass on 26.7.1 (arm64, 3 runs in a row, and amd64 under Rosetta), 26.6.2 (arm64, as CI) and 15.8 (Intel). With each new part taken out, its subtest fails: - reading the SDK (designOf26 answering yes after the macOS and the key): "a toolbar doesn't change the corners in this design, yet the main window's was taken off", with macOS 15's SDK; - 26.0 itself (> for >=): "corners of 26.00pt; a window with a plain title bar has 16.00pt, one with a toolbar 26.00pt", with the macOS 26 SDK; - reading LC_VERSION_MIN_MACOSX, or 26.0 there, built for amd64: the corners message, with the macOS 26 SDK; - the macOS version, asked with @available instead, built on 26.7.1 for amd64 and run on 15.8: the toolbar message, with the macOS 26 SDK. Taking out the last commit's parts fails the macOS 26 SDK subtest or TestMainWindowRightToLeft as before. UIDesignRequiresCompatibility is checked by hand, not in a test: AppKit reads it from an app bundle's Info.plist, LaunchServices registers each bundle that runs (and keeps a temporary one after it is deleted), and in a process run from a bundle a press sent within it began a window drag in only 3 of 12 runs. On 26.7.1 the test program in a bundle whose Info.plist sets the key has 12pt corners like every window there, and keeps its toolbar; in a bundle without the key it has 16pt and no toolbar, as when run on its own. With the key's check taken out, the toolbar is taken off although AppKit gives the earlier design. The bundles were unregistered (lsregister -u) and deleted. go vet, the three builds, go test -tags nogui ./... and go test ./internal/gui/... pass. The real app wasn't run again. * ci: run the checks again (waitingsnow) test (macos-latest) failed in TestRelayKeepsClientAlive (internal/gateway, 1 ping in a 150ms gap), a timing test this PR doesn't touch; it passes on main and 5 times of 5 locally. |
||
|
|
1d8134605a |
plugin: a plugin pinned to a version, or turned off, keeps both throu… (#1076)
* plugin: a mover installs the version its user pinned, not @latest
plugin.Add installs the spec it is given and appends @latest to a bare
package name, so installPlugin — the mover's installer, for
keepMovedCurrent, Move and HandOver — handing it a bare name quietly
replaced <pkg>@1.2.3 with <pkg>@latest in plugins.json. The pin was the
user's choice, and it was destroyed behind their back every time the
mover's min was raised.
installPlugin now hands Add the entry's own spec when the user has one.
A pin older than the move needs is left pinned and reported by the check
that was already there below it ("%s %s is installed; moving needs %s
or newer"), whose remedy is to unpin it; a pin that satisfies min still
returns early and is not reinstalled. A user with no entry for the
package keeps the bare name, which is a first install and there is no
pin to keep. A plugin the user turned off is still refused before any of
this, as it was.
TestInstallPluginKeepsTheUsersPin pins fake@0.1.5 with the move needing
0.2.0 and writes the version plugin.Version reads into the plugins folder
it is read from. It asks Add for fake@0.1.5 — against installPlugin as it
handed over the bare name it fails with "asked Add for [fake], want the
pinned fake@0.1.5" — and gets "needs 0.2.0 or newer" back rather than a
silent install of @latest. It also checks that a plugin the user turned
off is refused and not asked for at all. addPlugin is a var beside
pluginProviders and removePlugin so the test can read the spec handed
over without the Bun that Add runs.
Rebased on main as of
|
||
|
|
4419ebf7d6 |
cli, agent: magpie <agent> <field> shows that field and a field's name or DEFAULT is no longer written as the agent's model (#1129, waitingsnow)
What: `magpie codex model` wrote model = "model" into config.toml (and
applied.json, stash.json); any agent's field name given alone, or as a
value, was set as its model, and `magpie codex DEFAULT` wrote
model = "DEFAULT". Now:
- `magpie <agent> <field>` (any case) prints that one field and writes
nothing;
- a field's name given as a value is refused with a hint
(`magpie claude effort Ultracode`);
- DEFAULT in any case takes magpie out, as `default` does;
- Claude Code's tier names (opus/sonnet/haiku/fable) still set the model,
since agent.ModelAliases marks them, and the agent's help says so.
agent.Field matches key and label in any case; agent.Running is a var
so the cli tests can say Codex isn't open.
Why: ported from waitingsnow's #1129 (commits bbe75c91f, 00bb38581,
244b24a67) onto internal/cli, where the CLI moved after the PR was
opened. The PR's --help part landed earlier as
|
||
|
|
184f9184d3 |
gateway: a Chat turn's thinking is read in every spelling the client … (#1075)
* gateway: a Chat turn's thinking is read in every spelling the client sends it back in A client sends the previous assistant turn's thinking back in reasoning_content (DeepSeek's, which OpenCode and most clients send), reasoning (OpenRouter's) or reasoning_details (OpenRouter's structured one). parseChat read only reasoning_content, so a request translated to a non-Chat upstream lost the thinking of every turn sent another way and the model went on without its own reasoning, which a tool-calling session shows from its second turn on. chattidy's passthrough has read all three since mistralThinking (#494); the parse layer never got the same reader. The assistant branch now reads the thinking through reasoningText, messageReasoning's own reader, in the order the passthrough keeps it: reasoning_content, else reasoning, else reasoning_details' text. TestParseChatReadsEveryReasoningSpelling (a tool-calling turn per spelling) and TestParseChatTakesTheFirstReasoningSpellingSent fail without the change ("the assistant turn's parts: [{Kind:tool_call ...}]"). go vet -tags nogui ./internal/gateway/..., builds for windows, darwin and linux, and the package's chat/reasoning/thinking tests pass. * docs: the Chat parse layer reads the thinking's spellings too The change reads a Chat turn's thinking through messageReasoning and reasoningText, so parseChat takes the same three spellings the passthrough has taken since mistralThinking (#494). AGENTS.md asks for the owning reference to be updated in the same PR, and gateway-routing.md said nothing of it: its reasoning bullets are about holding a reply's own reasoning for a failover and about what a translated Responses reply gives Codex, not about what a client sends back. A bullet beside the held-reasoning one now records the spellings, the order they are read in, and the gap that was there: the parse layer read reasoning_content alone, so a tool-calling session whose client spelled it another way went on without the model's own reasoning. --------- Co-authored-by: TryWorld <TryWorld2026@users.noreply.github.com> |
||
|
|
dfbe001ff9 |
usage, gui: re-land def3a41e3, a Codex one-call turn timed only over a second and 100 tokens after its first token
|
||
|
|
fe08c8ddb5 |
gateway: a Claude run started for a tool loop with no history chunks its messages too, so AgentSummary reads the last one's cache (#1716)
#1716 chunked only the history: the messages before historyEnd's split. A conversation with no reply that calls no tool, as a sub-agent's loop of tool calls that Claude Code's AgentSummary asks a summary of with its last results (JinJieBeWater on #1716), has split 0, so it was told in one block and its one mark stayed on the instructions: every such request wrote the whole loop again. Such a conversation now has its every message but the last chunked. A later request with a history is told it wrapped from its first message, so it never matched past the instructions before either. What was run: - TestClaudeToolLoopCachedAcrossNewRuns (new), TestClaudeHistoryCachedAcrossNewRuns, ClaudePrompt*, ClaudeInstructions*: pass. - Broken by hand, each seen red: no split-0 chunking; the last message chunked when it ends a chunk (a 32-message loop); boundaries counted from the end; the mark left on the instructions too; no chunk mark. - Real Max account, claude-haiku-5-5, Claude Code 2.1.296 through a recording proxy, each run started anew with magpie's rendered prompt, a loop of 20 then 24 tool rounds (42 then 50 messages): origin/main: second run read 3,790, wrote 70,764 #1716 alone: second run read 3,791, wrote 70,813 with this: second run read 48,661, wrote 25,993 Grown history (21 then 41 messages) and same history with a new ask are unchanged from #1716 alone (22,348/28,178 and 40,848/9,678). Every request kept to four marks, all 1h. - Not tried: a long turn to answer after a history is still one block, and images count toward Anthropic's 20-block lookback. Co-authored-by: deephbz <13776377+deephbz@users.noreply.github.com> |
||
|
|
96eb536f85 | gateway: a Claude Code run started anew marks its history's last whole chunk of messages, not only the instructions, so a later run for the same conversation reads the history from the cache instead of writing it all again | ||
|
|
aabdd6126a |
gui: a model's speed leads with the figure from more replies, counts written out, TTFT on its own line
Fallmonkey (Discord) read "75 tok/s (3) · ≥54 tok/s (289)" on the Output
speed card and the Usage ranking as the 3-reply figure being the model's
speed, with the 289-reply floor tucked behind it, and "(3)" not saying
what was counted.
Now, everywhere a group's speed shows (the Output speed card, the
overview lists and the Usage ranking by speed):
- the figure from more replies comes first and is the big one; a tie
keeps the measured one first. The ranking orders and bars by it.
- counts are written out, without parentheses:
"≥54 tok/s · 289 replies; 75 tok/s · 3 timed replies"
zh "≥54 token/秒 · 289 次回复;75 token/秒 · 3 次计时",
with zh-TW, ja and de strings of their own.
- on the card the second figure is its own line, and the average wait
for the first token is a line of its own with its count
("first token in 1.2 s on average · 3 timed replies"), wrapping rather
than cut off. In the big figure the count is a muted caption without
the dot, so a wrapped count never starts a line with "·".
- the tooltips are unchanged; the threshold for the floor is unchanged.
What was run:
- usage-speed and usage-ttft-rounding now expect the TTFT line's
count; green in both engines.
- usage-speed-count.test.cjs (rewritten for the new rule) in Chromium
and WebKit, 5 languages x widths 1400/983/789/700/560: 26/26 each.
On origin/main's assets it fails ("125 tok/s (1) · ≥50 tok/s (259)").
- 55 related suites (usage-*, ledger-*, reasoning-speed, routing-*-speed/
metrics, panel-usage, gui-de/ja/zh-tw, i18n-keys, click-scroll,
tray-usages) in both engines: all green.
- gofmt -l, go vet darwin, GOOS=linux -tags nogui, GOOS=windows on
internal/gui; go test -tags nogui ./internal/gui: ok.
- Screenshots of the card and ranking at 560 and 1400 in en, zh, de.
Reported-by: Fallmonkey (GitHub MonkeyLeeT)
Co-authored-by: MonkeyLeeT <MonkeyLeeT@users.noreply.github.com>
|
||
|
|
5b14ebf49a |
gateway: a Claude subscription run is told the user's words after a tool result as theirs, not the tool's (#1878)
JinJieBeWater found that Claude Code's AgentSummary label request ("Describe
your most recent action in 3-5 words. Do not use tools.", sent as a text
block after the sub-agent's last tool_result) reached the inner Claude as
tool output, so it went on with the task instead of answering the label.
Two paths had it:
- renderParts (a run started anew, or a resumed turn) wrote the text right
after the tool's last line. A text or file part after a tool result in the
same message now closes it with "[end of tool result id=…]" and is marked
"[user message]". A result followed by nothing or by another result is
told as before, so existing prompts and their cache prefix don't change.
- match folded the text into the last result, and continueWith handed it to
Claude Code as the MCP result. It no longer folds; saidWithResults takes
the words, and continueWith writes them to Claude Code's stdin as a user
message before handing the results over, waiting for Claude Code's
command_lifecycle "queued" for that uuid (2s at most). Claude Code then
tells its model the message with the result as one the user sent while it
worked, in the same turn.
Going on in the run, rather than starting a new one for such requests, keeps
the cache prefix (#1716/#1717) and #872's mid-turn messages, which use the
same shape. #872's text is now queued as the user's instead of appended to
the result. Words in a message that holds images (pi-ai's "Attached
image(s) from tool result:" captions) still fold into the result, decided by
the message's parts, not its text. A tool whose output says "Do not use
tools." keeps it inside its result. The fork test's fake Claude now models
mid-turn absorption the way Claude Code does.
Run: gofmt -l; go vet on darwin, linux (-tags nogui), windows for
./internal/gateway; go test -tags nogui ./internal/gateway/ -count=1 green;
-race -count=3 on the new tests. Broken by hand, each red: no end marker;
an end marker after every result; the words not passed to continueWith; the
old fold into the result; the words queued after the result is handed over.
Real Claude Code 2.1.296 driven through the gateway in a sandbox HOME
against a local mock of Anthropic: on continuation the next request's
tool_result holds "SOURCE_LAST_LINE" then the "user sent a new message
while you were working" reminder with the label request; on a new run the
prompt holds the closed result and "[user message]".
Not run: the owner's real Claude subscription (its credentials are in the
Keychain, off-limits here), so the real model's answer to the label isn't
seen; Windows tests; the full ./... suite.
|
||
|
|
1502433978 |
gui: a key's value can be changed in place, keeping its name, place and settings, and its rest is lifted (#1869)
A key rotated at its vendor had to be removed and added again, which lost its name, its place in the order, its weight, protocol, models, proxy and concurrency, and any gateway key restricted to it. As decided on #1869, in multi-key mode the row now has a Change key action, with a double-click on the row as a shortcut. - provider.ReplaceKey(id, ref, key) sets the key's new value and moves what providers.json keys by the key's fingerprint (AccountModels, AccountProxies, AccountConcurrency) to the new one. An empty value, an unknown key and a value another key of the provider already holds are refused. The same value is a no-op. - access.ReplaceAccount moves gateway keys' Accounts entries from provider/old to provider/new, under the caller-keys lock. - gateway.Server.UnrestAll lifts a rest key and every per-model rest under it. The GUI's keys/replace lifts the key's rest (provider#key, and the provider's own rest key when it is the only key on), so the new value is asked from the next request. - app.js: a pencil beside the key's copy button opens a password field in place of the masked value. Enter saves, Escape leaves it, and a double-click on the row away from its controls opens it too. The button has its own class (.key-edit) with the copy button's look. - i18n: four strings in zh, zh-TW, ja and de. - providers-accounts.md: ReplaceKey in the Keys table. Past requests keep the old fingerprint in history, under the same name. A rest is lifted only in the gateway this magpie serves. Run: - go test ./internal/gateway ./internal/provider ./internal/access ./internal/gui -count=1: ok. New TestReplaceKeyKeepsItsPlace, TestKeysReplaceKeepsTheKeyAndLiftsItsRest and TestUnrestAllLiftsAKeysModels each fail with their change taken out. - gofmt -l clean; go vet darwin, linux -tags nogui, windows. - key-replace.test.cjs (new): en/zh/zh-TW/ja/de, chromium and webkit, 1100 and 420px. Checks the post, order, note, no sideways scroll, and no scroll on change or on double-click plus Escape. - With key-copy, rest-try-now and key-import: 96/96. - 72 key*/routing*/rest* GUI files at concurrency 6: 863/871. The 8 reds were key-copy, whose button.copy locator matched the pencil; that's why it has its own class now, and key-copy passes. - Under load, about one run in 300 saw the editor body go back to the top after the copy button's double-click, with no script scrolling it. That is #1504 (findings added there). The test checks scroll before that step. |
||
|
|
fd907c986e |
gui: every resting key or account can be tried again by hand, on Routing and in the provider's key list (#1869)
A key resting after a 429 with a long Retry-After (a relay's 3600s) came back only by waiting or a restart, though relays often recover in a minute or two. The Routing page offered the lift (/api/gateway/unrest, which already takes any rest key) only to verify and restricted rests. - routing.js: every resting row with a rest key gets the button: "Try now" for quota, rate, retry-after and backoff rests, the old wording for verify and restricted. A lifted rest is remembered by key and the time it was lifted (liftedAt), so the history re-render, which reuses the try's rest, doesn't show it again; a newer rest still shows. - app.js: "Try now" beside the "resting · back at …" note in a provider's key list, posting the key's own rest key; not hover-only. - i18n: the three new strings in zh, zh-TW, ja and de. - gateway-routing.md: any rest can be lifted; only the rest ends, the backoff count stays. Run: rest-try-now.test.cjs (new: Routing row with the issue's zx retry-after rest, key list row; en/zh/zh-TW/ja/de, chromium and webkit, 1100 and 420px; asserts the post, the note gone, no sideways scroll, reached by wheel, the click doesn't scroll) 40/40, red on the old app.js/routing.js. 71 key*/routing*/rest* GUI files at concurrency 6: 826/831; the 5 reds (key-balance-card, routing-group-fold) pass alone and are timing under load (routing-group-fold fixed in the next commit). go test ./internal/gui passes. |
||
|
|
a68d2ac944 |
gateway: a held stream lets through only text, reasoning or a call, so a 200 that only framed a reply fails over (#1418)
Aliceonly's trace on #1418: sub2api answered 502 "Upstream HTTP/2 stream failed", then Codex account A answered 200, sent only the frames before a reply, and failed server_is_overloaded 37s in. Five candidates after it were never asked, and Codex ended the turn. The stream had been let through (h.passing), so holdWriter.failed() was false and neither the next candidate nor a replan was tried. Two ways a frames-only stream went through: - streamEvent's default was eventContent: any event it didn't know (and an item of a type said() didn't know) counted as the reply begun. Now only the events of each protocol that carry text, reasoning, a call or a reply's end (replyEvent) count; anything else is eventLead, held as a ping is. An unknown item counts only when it is a call or a tool's (web_search_call, server_tool_use, mcp_*). A stream that ends well is still released whole, so this can only delay, never drop, a reply. - a reply under a Content-Type that says neither JSON nor a stream, once the agent had a stream's headers, went straight through when its first bytes were SSE (sseStart -> pass()). It is now held as a stream from there and read event by event. Which event Codex's backend actually sent isn't in the trace; the test uses a keepalive, response.rate_limits.updated and an unknown item type. Run: go test ./internal/gateway -count=1, green (428s). TestFramesThenOverloadedGoesToTheNext (new: 502, then 200 frames + unknown events + server_is_overloaded, then a third member) and TestStreamEventUnknownOnlyFrames (new) fail on the old fallback.go: the overloaded stream reaches the agent and c is never asked. TestHeldUnsureStreamPasses/KeptAlive now expect the stream held until its first word, and TestHeldUnsureStreamFailsHeld (new) a failure among held frames; all fail on the old code. Not tried against the real ChatGPT backend. |
||
|
|
4a6c81e038 |
gateway: a group's Patience is waited out in full, not cut at 90s by the round count (#1418)
A group asks its busy members again after pauses of 2s, 4s, 8s, 16s, then 30s, for as long as its Patience lasts, but replanRounds stopped it after 6 rounds: 90s of pauses whatever the group was set to. real-jacket's trace on #1418 shows patience=240 with replan=6 and ~103s in all. replanRounds is now 12, a backstop sized so that the pauses alone reach PatienceLongest (240s) in 11 rounds, and the patience is what ends the wait. It stays bound by kept.tooQuiet, as before. The longest pause is now 30 x retryPause (30s in use), so the tests' 1ms retryPause doesn't grow a 4s pause at round 12. Run: TestPatienceIsUsedUp (new) counts replan's pauses for 30s to 240s of patience, and TestReplanRoundsOutlastPatience (new) sums the backstop's schedule. With replanRounds back at 6, both fail: patience 3m0s and 4m0s pause 1m30s. go test ./internal/gateway -run 'Overload|Patience|Replan|WaitsOut|Busy|Codex' is green. Not tried against a real overloaded vendor for 240s. |