8a4e32febef69bb797cdf3003ec1395e725d5d63
2619
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
5dfbca6274 |
cli: magpie settings list|get|set|reset, through the window's own save (#4745)
Stage 1 of #4745 (StringKe): every setting POST /api/settings saves can be read and set from the terminal. - internal/settingsapi holds the save the handler made: Merge (the carry of keys a page leaves out, moved verbatim from api.go, plus upstream's RouterNote line), the vision/imageGen/searcher checks, settings.Save's own checks, catalog.Touched. POST /api/settings and `magpie settings` both call settingsapi.Apply, so a value is checked and saved one way. It sits outside internal/gui so the nogui build has it. - `magpie settings` (list, the default, with value, default and choices; get; set; reset to settings.Defaults()), --json on list and get. Body sends the whole file with one key changed, so a key the save keeps when absent (noBird, refusalRetries, ...) is set even to off. A flag where a key or value goes, an unknown key (with near matches named) or a refused value writes nothing and exits 1; --help prints usage. - Parity guards: TestKeysAreWhatTheSaveWrites (each Settings field sent changed on its own; what the save takes must equal Keys), TestSettingsCLISetsWhatTheWindowSaves (every key the page's prefsKeep and savePrefs send is a key), TestEveryRouteHasACommandOrIsNamed (each /api route has a command or a reason in notYet, which later stages shrink; 36 have one now). - Item 3 of the stage (per-provider CLI-only fields in the window) is left for stage 2. - The open app's in-process follow-ups (fonts, Dock, tray menu, alerts, language, update re-check) run only from the window's save: #4752. Run (mote, at the pushed head |
||
|
|
647323409e |
gui tests: TestColdTurnsTaken asks once the warm-up holds its turn (#4510)
The test closed `asked` and asked at once, while the warm-up's goroutine might not have taken its turn yet. The page then took the turn first, a right order, and the test called it "answered while the warm-up's step read". Its t.Fatal left the step blocked holding the turn, so with -count above 1 every later run waited to the timeout. The step now closes `holding` once it has its turn, and the page asks after that. sessions.go is unchanged. Run (mote): go test -tags nogui ./internal/gui -run 'TestColdTurnsTaken$' -count=200 -cpu 1,2,8 -race ok (35.7s). Broken by hand: coldTurn not taking a turn turns it red at once. |
||
|
|
344a59f9db |
gui: an unchanged Sessions poll answers Same without making the rows
The Sessions tab asks for every session each 15 s. When nothing had changed, the handler still copied the kept listing, made a row of each session, merged the gateway's sessions, read Codex's effort and the vias, encoded every row and hashed them, only to answer X-Magpie-Same. Over ~17k real sessions (69 GB of Claude Code and Codex history) that was ~140 ms of CPU and ~24 MB of garbage per poll. Now the handler keeps, per ?limit, what the last list it sent was made from: the sessions listing (sessions.ListUnless's number, which changes whenever the listing is made again, and at least once a minute), the usage log's version (usage.LogVersion), the user's usage aliases, and the agents' names and icons with the folders. An ask whose X-Magpie-Had is that list's tag, while all of these stand, gets X-Magpie-Same before any row is made or the listing copied. Anything else a row shows (a Codex thread's effort, a gateway title) follows within the minute the kept listing stands. writeJSONRows returns the tag it sent. Measured on the real history (a sandbox HOME with APFS clones of ~/.claude/projects and ~/.codex/sessions, 17,140 files), 30 polls of /api/sessions + stats + overview, the same script for both builds: before ( |
||
|
|
b646a91277 |
gui tests: the Settings save guard sets BusyLoad (#4739)
TestSettingsSaveKeepsWhatItDoesNotSend has been red since
|
||
|
|
01ccbd40a0 |
library: an MCP router says which computer it is, so an agent can pick between two (packinggoodsllc_07668 on Discord)
Two magpies, one in China and one in Los Angeles, each serve the same tools through their MCP router (/mcp/magpie/hub). An agent connected to both saw two identical web fetches and couldn't pick the one in Los Angeles to reach Google. Each router now says where it is: - initialize's instructions end "This router: <name>. Each of its tools' descriptions starts with [<name>]; ...", and serverInfo.title is "Magpie MCP hub · <name>"; - each tool's description in tools/list starts "[<name>] " (once: a description that starts so already, another magpie's router behind this one, isn't given it twice). <name> is the user's words (settings.RouterNote, one line, 80 characters at most) to every caller. With none it is this computer's name, to callers on other computers only: an agent on this computer has one router at hand, and its prompts stay as they were. RouterNote is this computer's own (KeepOwn): library.json is synced, settings.json isn't, so a sync never brings the other machine's name. It is set in the Library's MCP tab, in a Router name row under the router's address (shown while the router is on): a plain field with the computer's name as placeholder, saved on Enter or leaving it, Escape puts the saved words back, an input method's Enter is its own. POST /api/settings keeps it. Translated in zh, zh-TW, ja, de. docs/subsystems/mcp-router.md has the rule. Run (mote, at |
||
|
|
5a0c79ed9d |
i18n: ja for removing the agent's only account names {agent} twice, as zh does (#4580)
a7b47d57e's ja for "{agent} is signed in to {user}, the only account in
magpie it can be signed in to…" said {agent} three times ("magpie で
{agent} がサインインできる唯一のアカウント"), so gui-ja's "ja has every
zh string, with its placeholders and tags" was red on main. The third
is dropped: "これは magpie でサインインできる唯一のアカウントで", the
subject already being {agent} in the sentence before.
Run on mote at this head: node --test gui-ja.test.cjs and
i18n-keys.test.cjs, 7 pass, 0 fail (gui-ja was red 1 of 13 at
c903c3a41's base with the same file). Not tried: the sentence in the
running app.
Closes #4580
|
||
|
|
c903c3a411 |
usage: Use on Codex's window lands over 7 and 30 days, a model's own Compact at named apart (hoobnn on Discord)
hoobnn on Discord (11-01): "观测-用量-上下文里,在7天或者30天的选项里,点击
应用codex的上下文,没生效。" Over 7 or 30 days the range held calls on a
model whose provider has a Compact at of its own (430K); today's didn't.
Tuned for you's "Now" was the largest compaction point over every model
in the range, so it came from that model. Use put the advice in Long
conversations, which did move Codex's other models (Codex's list had
them at the advice), but the card still read 430K and then turned held
("compacts at its own 430K, which comes first"), so nothing seemed to
happen. And with Long conversations at magpie's default, a range of
only such models offered a Use that could move nothing.
codexWindow (internal/gui/tune.go) now reads "Now" from the models Long
conversations moves, and lists each model with its own Compact at as
Apart (largest first). Only a range whose every model has its own is
held (Own), whatever Long conversations says. The card names each
model kept apart under the row: "{model} compacts at its own {value},
which this doesn't move", in en, zh, zh-TW, ja and de.
provider.CompactSetIn is CompactSet with the caller's settings and
group finder, as CompactFor takes them.
Siblings: Claude Code's knob is per model (no max over models), so it
has no such mix. 1, 7 and 30 days go through the same codexWindow;
the GUI test covers 7 and 30 and the Go test the 1-day sample.
Run on mote at
|
||
|
|
7b6b7492a9 |
claude: an account on overages is read with its windows and switched off (#4532)
Claude Code's /usage line "You are currently using your overages to power your Claude Code usage…" was in claudeUsageDenied, so the whole reading became an error: the card lost its windows, and NextLogin, which stays on an account it can't read, left Claude Code billing overages while other accounts had room (StringKe's audit, item 3). Now the line is no error. The windows under it are read as usual, and a Text row "Extra usage" with Used 100 is added (claudeOveragesWindow), so usedPast/roomLeft count the account spent and the switch moves off it. The row ends when the last used-up window renews (the time Claude Code says it switches back), else at the next reading. Routing skips Text rows, so the gateway's own account choice is unchanged. The GUI says the row "In use" in the reader's language (quotaText; a plugin's text row keeps its display as it came). The overages case is out of TestClaudeUsageFailureDoesNotHideAccountErrors: it was the bug. Run (mote): - TestClaudeUsageOverages, TestClaudeSwitchOffOverages: red on the old claude_usage_cli.go (an error; switched to ""), red with the row's Used set to 0 by hand, green now. - go test -tags nogui ./internal/provider -run 'Claude|Usage|NextLogin|Next|Switch' ok. - GUI: claude-overages (new, 5 languages, chromium + webkit) red 8 of 10 on the old app.js (en passes there), green now; with quota-text-row, quota-name-translated, i18n-keys, usage-no-reading: 40 pass. - go vet darwin/linux/windows; gofmt clean. Not tried: a real account on overages; the text is Claude Code 2.1.316's string table, and the windows under it are what StringKe describes. |
||
|
|
9097687a31 |
gui: Hide accounts leaves the user's own account names and plans in sight (#3656)
With Hide accounts (账号打码) on, the name a user gave an account (#1515) was blurred like the account, so faketrader's several Antigravity accounts couldn't be told apart; and an Antigravity account whose value is "Google" blurred "Google" of its plan "Google AI Pro" on Usage and on the Providers row. The name the user gave an account is shown text, not an identity. The account is. - provider: a card's Alias says whether it is the user's own name (SubscriptionQuota.Named, set by withAccountNames from AccountNameOf), since Alias is also a plugin's name for an account (PluginUserOf, a masked phone, #4416) or a seat's key plan, and the Usage page and tray panel may have no /api/providers to tell them apart. labelProvider is AccountLabelOf's "plugin:" lookup, shared. - app.js names(): the user's own names (accountNames) and named aliases are no longer accounts to hide; accountUsers, an unnamed alias and a seat still are (noteAccounts keeps an alias without named). - app.js mask(): labels are scoped by element, never by value (LESSONS: scope an exemption by where the value sits). In .own-name, .plan, .acct-plan (the Providers row's plan pill, new class), .model-value and .subscription-head > b only an address is hidden; a plan's and a model's tooltip too (TIPS). The own name's tooltip ("name · account") is masked in full. - .own-name is set only where the text is the user's own: the editor's rename span when it has one (else it shows the raw account and stays hidden), Usage's quota-alias and the panel's pq-user when q.named. From skygunner's patch (95c0511 on |
||
|
|
66c0ddc19a |
gui: Busy models last takes a custom threshold, 1 to 9999 (axelburks)
axelburks on Discord: a vendor that queues reports loads past 100%, and
the only way to a threshold such as 150 was settings.json. Settings ›
Network and sharing › Busy models last now ends in Custom…, one more
choice in the same in-app switch (no <select>). It opens a small field
in the row whose sub says what the number means: a load in percent as
the plugin reports it, 100 is all the vendor serves at once, past 100
requests queue (200 is twice that), 1 to 9999. Enter or Apply saves it
through settings/busy-load, Escape or Cancel closes it untouched. A
value that is not a whole number from 1 to 9999 is said in red in the
sub and nothing is posted; the field keeps it to correct. The number
saved shows as its own choice ("Over 150%"), and Custom… opens with it
filled in. The site docs (en, zh, ja) and gateway-routing.md say
Custom… instead of settings.json. Code in plugins/gateway/settings.js
and i18n.js only, so the core budget is untouched.
Run on mote at this tree:
- node --test model-load, i18n-keys, bare-ids, gateway-port: all pass.
model-load's new test runs in Chromium and WebKit, at 420 and 900, in
en, zh, zh-TW, ja and de: Custom… focuses the field, says what the
number means, refuses abc, 0, 10000, 1.5 and -3 with nothing posted,
Escape closes, 150 posts {at:150} and shows Over 150% picked, 2000 by
Enter replaces it, the row and settings don't run sideways, and no
press moves the page more than the row changed height.
- go test ./internal/gui -run Budget: ok. gofmt -l: clean.
Broken by hand: validation turned off (if (false)) went red in every
language; the Custom… entry taken out went red in the old and new
tests; the field without flex:none was squeezed to ~20px and the width
check went red.
Not tried: the real app window (only Playwright's engines), and the
full GUI and Go suites, which run after the push (one suite on mote at
a time).
|
||
|
|
c688211d13 |
gateway: a ChatGPT (Codex) account gets loaded tools where they were loaded, keeping its cache (#4738)
infinitex233 (#4738, Discord): Claude Code -> magpie -> a Codex account, and every ToolSearch load dropped cache_read to 0. loadsInPlace sent the additional_tools item (#2660) only to OpenAI's own API, so for an account the loaded tool went into the top-level tools and the cached prefix broke at the tools. Tried on the real ChatGPT backend first (owner's account, sandbox HOME on mote with a copied auth.json whose refresh_token was replaced, so the live token was never rotated; ~/.codex untouched). A probe client sent Claude Code's shape: ToolSearch with two deferred mcp tools, then the tool_reference result, then the calls, 4 requests per run. - additional_tools item (on, and this commit's default): request 2..4 read 7680-8320 tokens from cache on gpt-5.6-terra, gpt-6-luna and gpt-6-sol; the model called read_a and read_b from the item; no "turned away additional_tools" in the log. - tools top-level (off): request 2 and 3 read 0 from cache (8044 and 8163 tokens in), as the reporter saw. So the backend takes it, and this makes it the default for a ChatGPT account (p.Account.Agent == "codex"). Copilot and other sign-ins stay off: not tried. - loadsInPlace: AdditionalToolsOff wins, then AdditionalTools, then an account is in only if it's Codex's, then OpenAI's API as before. - `magpie provider set <id> additional-tools=on|off|default`: off is new (AdditionalToolsOff, kept through an account's Save by accountSettings and through the GUI editor's save like AdditionalTools). The old "off"/"no" meant default; now they turn it off where the default is on. - The 400/422 fallback that names the item still applies, so a backend that stops taking it costs one retry and then sends tools top-level. - No prompt, instructions or identity line changed. Run (mote, at base |
||
|
|
4c815ac2a5 |
search: searchers picked to follow the one named, tried in their order when it fails (axelburks on Discord)
axelburks asked for more than one searcher, so that when one fails another provider searches. A searcher named in Settings gave way to no other provider before, only to the Search APIs. Automatic already fell back to up to three. - settings: SearcherThen, the searchers after the one named. Entries are trimmed. Blanks, "off", the named one and repeats are dropped. - gateway: when the named searcher fails (the context still live), modelSearch asks each of SearcherThen in order and skips one that can't search now or is the same model. The first that searches answers, and the call is marked searchingInstead, so the Routing row says why the named one didn't search. If all of them fail, their errors go back together, saying "the searchers picked ..., in their order", and webSearch goes on to the Search APIs as before. SearchFailure.Instead names the one that searched in its place. - gui api: searchFailed.instead. A save takes only searchers that Searchers() offers. A save without searcherThen keeps the list, since the page's prefsKeep doesn't send it, and [] clears it. - Settings › Web search (plugins/search/settings.js, outside app.js's budget): an "If it fails" row under a named searcher, with numbered chips and Add. A chip's picker changes the chip or removes it. The row is hidden for Automatic and Off. The failure line names who searched instead, or says the ones after it failed too. The help text says the same in en, zh, zh-TW, ja and de. - docs: gateway-routing's failing searcher, and gui-shell. Tests: - TestPickedSearchersInTheirOrder (gateway): one test where the named searcher answers without searching and one where it fails. A gone entry and one that can't search are skipped, and the third searches once. With no working entry, the error says so and Instead is empty. - TestSearcherThenSaved (settings) and TestSearcherThenFromSettings (gui): what is saved, kept and cleared; refusing an entry that can't search. settings_keep_test sets SearcherThen. - searcher-then.test.cjs: chromium and webkit, en, zh, zh-TW, ja, de, at 560 and 1000 wide. Checks the row's place and words, what Add offers, the posted lists, that the chips fit with no horizontal scroll, that no click moves the page, and both failure lines. Broken by hand: running no fallback turned TestPickedSearchersInTheirOrder red (both subtests: "ds2 searched []"). Not keeping the list on save turned TestSearcherThenFromSettings and the keep test red. Run on mote (mote-run): - At the pre-rebase tree (base |
||
|
|
0b4aa96fd0 |
gateway: a relay whose models are typed in by hand is offered as a searcher (axelburks on Discord)
axelburks added a custom provider on OpenAI's Responses API and ticked "Searches the web by itself", but Settings › Web search's searcher picker didn't offer it. Searchers() and namedSearcher took a provider's models from Available() alone. A relay with no /models list has its models typed in by hand (Exposed) and none available, so it was left out of the picker, while the same row named it among the relays to pick there. searcherModels gives what the provider lists, then the hand-typed ones it doesn't. A relay that lists its models was offered before this already. Tests: - TestSearcherRelayWithoutModelList (gateway): a Responses relay with no /models and a typed model is a searcher and is resolved by name. - TestSearcherPickerOffersResponsesRelay (gui): the relay saved the way the editor saves it is in SearchChoices with its model. Both were red on the old code. Run (mote-run), at this commit alone: go vet of gateway and gui, and go test -run 'Searcher' of gateway and gui: ok. The full checks ran with the next commit; its body has them. Not tried: the reporter's own relay (we don't know whether it lists its models; the reply asks). |
||
|
|
ed0ad52821 |
gui tests: a picker's item is pressed once the list is drawn for good (#4274)
A model picker draws its list again when its first read of
/api/model-speeds answers (readSpeeds, once a minute and after every
load). searcher-pick's click found the Automatic item after a reload,
the list was drawn again under it, and Playwright gave a null box for
the detached item: "Cannot read properties of null (reading 'x')" at
line 319. reader.cjs's pickItem finds the item again each frame until
its box is the same twice, and presses it there; searcher-pick's click
uses it.
Run on mote (mote-run), chromium, searcher-pick "the provider that
searches..." en and zh:
- origin/main
|
||
|
|
e62a1bc515 |
routing: a trail is drawn in its own agent's colour, and agents on screen don't share one (Pkh)
Pkh (Discord, 0.1.2509, Linux) saw trails in another agent's colour, and different agents drawn alike, on the Routing page. Causes, read in routing/client.js: - Wrong colour: render() coloured a lit row by row.rid, the latest staged request that weighed the seat, not by the request actually on it. With Codex answering and ZCode's request staged later, Codex's trail was drawn in ZCode's colour, and the fold, group and flows layers copied it. - Stale colour: --agent was set when a row lit and never cleared, so a reused row or fold wire kept the last agent's colour. The panel's ps-out wires did the same. - Collisions: hueOf gave 15 makers their own colour and hashed the rest into 8 spares. 49 of 59 agent ids fell into those 8. QwenPaw, ZCode, Qwen Code and AstrBot were all #65a30d. Change: - A row's colour is the agent it answers now (trying), else the agent whose request is on its wire (flying), else the request it answered. It is cleared when the row is off. Folds and groups copy it through tint(), which clears too. A ps-out wire clears when its trip ends. - One PALETTE of 12 quiet colours, same lightness and chroma around the wheel, none near --red. HUES is a maker's place in it. hueOf gives each agent the first colour from its place that no other agent has had, and keeps it while the page is open. hues() keeps the agents shown together apart once more than 12 have come. Tests (red on the old client.js): - routing-reused-row-hue: Codex then ZCode on reused rows. Lit and flows colours are each agent's own, and off wires carry no colour. - routing-agents-apart: four agents on screen at least 20 degrees apart in OKLCH hue, and the same colours after a fifth request. - Both run in Chromium and WebKit, in every language, at 1100 and 420/390 widths. - routing-agent-hue-not-red now reads PALETTE. Broken by hand: - Without the removeProperty, routing-reused-row-hue is red. - With by = r.agent, it is red. Run (all on mote, macOS 27): - The whole GUI suite, Chromium and WebKit, at concurrency 6, at base |
||
|
|
f506638690 |
sessions: the Sessions poll makes its rows as the gateway's sessions merge
/api/sessions copied every one of ~17k sessions into MergeExternal's
merged list, and MergeExternal made a set of every native session's
keys again to leave natives out of the gateway's, though
GatewaySessions had already left them out by the same keys. The rows
were then copied from that list.
EachMerged hands each session to the caller in MergeExternal's order
(newest first, a native before an external of the same moment) from
the list as List gives it and the gateway's sessions sorted alone, so
the handler copies each session once, into its row. MergeExternal
keeps its own copy and dedupe for its other callers; both share
externalSessions.
TestEachMergedListsWhatMergeExternalDid: same rows, field for field, as
MergeExternal for a sorted list, an unsorted one (sorted in a copy, the
caller's left as it was) and none; with and without externals; ties;
stops at false. TestEachMergedCopiesNoList: 5000 natives merge in under
a twentieth of the list's bytes. Broken by hand, each red:
EachMerged over MergeExternal's list: 5,437,624 bytes for a
2,480,000-byte list
EachMerged making the native key set again: 394,352 bytes
Measured on mote's build against the real ~17k sessions (sandbox HOME,
APFS clones), 30 polls, against v0.1.2554's build:
heap diff alloc_space 726 MB -> 701 MB (MergeExternal's 107 MB
gone; externalSessions 51 MB left, the
gateway's own sessions)
CPU over 30 polls 4.44s -> 4.24s
/api/sessions median 73ms -> 71ms
Run on mote: go vet ./internal/sessions ./internal/gui ok;
go test ./internal/sessions ok; ./internal/gui red only in
TestSettingsSaveKeepsWhatItDoesNotSend (#4739) and
TestMainWindowCorners (#3949), both red on origin/main
|
||
|
|
994cd4fb68 |
gui: Rex switches to the tab magpie opens, through the app's session.select (#4565, StringKe)
StringKe tried v0.1.2446 on the real Rex app (Rex Beta 0.1.0 (1696)):
the tab opens, but the app keeps showing the tab the user was on. The
new tab shows only in the sidebar, and `open -b` only brings the window
forward. The app's own session.select action, sent to the app client,
does switch to it.
After `rex run` (reused magpie session) or `rex new` (now with --json,
for session_id and initial_windows[0].window_id), openInRex brings Rex
forward and then calls rexSelect. rexSelect reads `rex client list
--json`, takes the client of info.kind "app" whose session_ids hold the
session, else the last app connected, and skips one whose
connection_state is "lost". Then it runs `rex -C <client_id> do
session.select session_id=<id> window_id=<window>`. App actions need
Remote Control on in Rex's settings. With no app, a failed list, a
refused do or no answer within 3s (rexSelectWait), the open still
succeeds, the same way a failed rename is ignored. docs/reference.md's
Rex paragraph says this.
Command shapes come from the real rex CLI, snapshot 0.0.1793420730-
g6d0d9a, on mote with a sandbox HOME and XDG_RUNTIME_DIR: `rex --help`
(-C is a global flag, label or ID), `rex do --help`, `rex client ls
--help`, `rex api describe client.list` (client_id, info.kind
app|cli|agent|other, connection_state connected|lost, session_ids),
`rex new --json` output. With no app connected, `do` without -C exits 3
("no app client is connected"), and -C <unknown> exits 3. A client that
doesn't answer keeps `do` waiting 10s ("did not answer within 10s").
That is why the select runs after open -b and has its own 3s bound.
Tests: TestOpenInRexSelectsTheTab runs a fake rex program (a sh script,
so arguments go through a real exec), with a new session and with
magpie's session reused. It checks that the app attached to the session
is picked over another, that a lost app is never asked, and that no
app, a failing client list, a refused do (exit 1) or a do that never
answers (exec sleep 30, killed at the bound) leave the open a success
within its time. The in-process fakeRex answers client list (no app)
and new --json. TestOpenInRexReal runs these paths against the real rex
server, with no app client.
Ran, through mote-run, on this tree before the rebase onto
|
||
|
|
1e6a27d4f8 |
gui: an icon's image URL typed and saved is fetched, kept and shown again (hoobnn)
hoobnn on Discord #general: a custom provider's icon given by an image URL was neither fetched nor applied, and on editing it again the URL was gone. Cause: the Image URL… box ( |
||
|
|
2af4d8c62d |
claude bridge: tool results another request answered first branch off the run's session (Aisiverto on X)
Aisiverto on X: a Claude Pro account's five hours went from 96% left to
1% in about five messages of a ~900K-token conversation. The usage had
pairs of requests about 100ms apart: one read ~900K from the cache, the
other read ~26K and wrote ~877K.
The cause: Claude Code's fork sub-agents start from their lead's
conversation, each of the lead's calls answered "Fork started", and they
come with the lead's own next turn. One of them goes on in the run that
made the calls. Each other one (and a resend, or one after the run has
delivered) got a new Claude Code told the whole conversation in one
message, a prefix Anthropic's cache had never seen. So it was written
to the cache again, about a fifth of the plan's five hours each time.
Now the run keeps where in its session each call of the client's tools
was written: the uuid on Claude Code's stream-json assistant line
(noteLines). As it parks, it also keeps the conversation those calls
answered. A request no run takes, whose last reply's calls a live run of
the same owner made from the same conversation, goes on in a -p branch:
--resume <session> --fork-session --resume-session-at <uuid>. That is the
conversation as Claude Code sent it to Anthropic, so it reads the
cache, and it is told only the results and the directive after them. The
lead's session file stays the lead's. There is no branch with client
cache marks, in interactive-only mode, or from a rewound, closed or
sessionless run. Then, and if the resume fails, the old path is taken.
The -p reason is "branch", worded in claudemode.js and i18n.js (zh, zh-TW,
ja, de). The subsystem doc's section says so.
Run:
- Claude Code 2.1.316 (real binary, on mote), against a fake Anthropic API and a
fake MCP tool. --resume S --fork-session works while another
process holds S. --resume-session-at <assistant uuid> cuts the copy
there even after the lead went on, and the prefix up to the tool_use
matches the lead's. Calls it answered nothing for get a
synthetic error result.
- TestClaudeForkBranchesOffTheLeadsSession (new): red on the old code
("told it whole"), green with the fix.
- Broken by hand, each red: park() not stamping the conversation the
calls answered; serveSubscription not asking branch().
- On mote, before the rebase onto origin/main
|
||
|
|
7503beee72 |
plugin, settings: a model's load goes past 100% for a vendor that queues (axelburks on Discord)
axelburks, on v0.1.2547: their vendor queues, so a model's load can be
past 100%, even 200%. magpie clamped every load to 100, and Busy models
last allowed 1-99 only.
- host.js reportLoad and plugin.noteLoads keep a load from 0 up. The
floor is still 0, null still clears it, and a sanity cap of 10000
(LOAD_MOST, plugin.LoadMost) keeps an absurd value from reaching the
UI or the trace.
- settings.BusyLoad takes 1 to 9999 (BusyLoadMost-1). The segment
choices stay Off/50/70/80/90, and a value set in settings.json (150)
shows as its own choice, as before.
- The editor's badge reads "180%". It is a badge, not a bar, so nothing
assumed 100 wide; the test checks it stays on one line.
- Docs: site plugins page (en, zh, ja) Values and Routing bullets, and
provider-plugins.md and gateway-routing.md.
Run on mote via mote-run, on origin/main 8d8df0639+ rebased:
- go test ./internal/plugin ./internal/gateway ./internal/settings -run
'ModelLoad|TestBusy' -v: all pass. TestPluginReportsModelLoad has
over:250 kept and huge:1e9 at 10000. TestBusyModelGoesBehind has 180
behind 120 at a threshold of 150, and 10000 refused.
- Broken by hand in a copy, with the old 100 clamps and the 99 limit:
TestPluginReportsModelLoad red ("ModelLoad(over) = 100; want 250"),
TestBusyModelGoesBehind red (150 refused).
- node --test model-load (with Queued 180% in every language, Chromium
and WebKit, 420 and 900, plus Over 150% picked at 420) and i18n-keys:
46/46 pass. go test ./internal/gui -run Budget: ok.
- gofmt -l: empty. GOOS=linux go vet -tags nogui and GOOS=windows go
vet on plugin, settings and gateway: ok.
Not run before the push (owner: push and tag first): go test ./... and
the whole GUI suite. They are queued on mote behind another session's
suite.
|
||
|
|
0516c18ca3 |
gui: writeJSONRows hands the encoder each row by pointer
Every Sessions poll encodes all ~17k rows for their hashes, even when
the page already has the answer. enc.Encode(rows[i]) boxed each row
into an any, a copy allocated per row per poll. &rows[i] encodes the
same bytes (no type in sessionJSON has a pointer-receiver marshaler)
without the copy.
TestJSONRowsNotCopiedEach: a 2000-row poll the page already has makes
at most 200 allocations. Broken by hand (back to rows[i]): red, "made
2022 allocations". TestWriteJSONRowsWritesWhatMarshalDid still checks
the bytes against json.Marshal per row.
Measured on mote's build against the real ~17k sessions (sandbox HOME,
APFS clones), 30 polls, heap diff alloc_space:
writeJSONRows 201 MB -> 98 MB
whole poll 854 MB -> 726 MB
CPU over 30 polls 4.46s -> 4.44s (no change past noise); /api/sessions
median 74ms -> 73ms.
Run on mote: go test -run JSONRows ./internal/gui ok.
Not run: the full suite (one-line change in writeJSONRows, its tests
run).
Then rebased onto
|
||
|
|
788057340b |
library: Magpie Image Recognition in Discover beside Magpie Image and Web Search (matrix0487 on Discord, #4653)
matrix0487 asked on Discord (#feedback) for all three of magpie's own MCP servers, image recognition, image generation and search, in the Library's Discover. Image generation and search were there; image recognition was an address to copy in Settings only (#4653). - `magpie mcp vision` (browsermcp.RunVision) relays stdio to the gateway's /mcp/magpie/vision, as `mcp search` does. analyze_image's relative image path is made one in the agent's folder on the way (imageFrom), since the gateway can't know where the agent runs; an absolute path, ~, a URL or a drive goes as written. - library: magpie-vision is a featured, opt-in server (no agents until picked), any binary's `mcp vision` is one server (serverKey), and it gets the 120s tool timeout (selfTimeout). - Settings › Models › Images: the Image recognition row has Give agents Magpie Image Recognition… / Turn on the Library, none with recognition off or in gateway mode. The three links are one helper, libWay, used by Image generation and Web search too (no budget raised: core 1,533,011 of 1,533,105). - Never a dead tool: Discover lists all three whatever is set up, and one that can't answer yet says why (gateway.OwnUnready, set by /api/library/market/servers as `unready`): a "Not set up yet" badge on its card with the reason as its title, and the reason in its sheet (nothing set up, or turned off in Settings / Plugins). It can still be added; its tools already answer with the same reason until then. - Strings in en, zh, zh-TW, ja, de; docs/subsystems/library.md. Run, all on mote (macOS 27) through mote-run, at this head's tree (rebased on |
||
|
|
8d8df06399 |
plugin, gateway: a plugin reports its models' load, and busy models can go last (axelburks on Discord)
axelburks (Discord #feedback): an in-house vendor queues requests to
its busy models, and the plugin could only put the load in the model's
name, which changed only when magpie re-read the list.
- A provider plugin calls input.magpie.load(provider, {"<model id>":
0-100 | null}) whenever it likes, from its own timer. host.js
(reportLoad) clamps each number to 0-100, null clears a model, every
other value is dropped, at most 1000 a call, and it returns the count
taken. A provider that isn't a string or loads that isn't an object
throws a TypeError. It goes to Go as an unasked {event:"load"}.
- internal/plugin/load.go keeps each by provider and lowercased model
id. ModelLoad answers unknown once a load is older than LoadFresh
(5 minutes), never idle. model@size falls back to its model.
- The provider editor shows it by the model as a grey ctx badge
("87%", titled "87% busy now, as its plugin says").
- Settings > Network and sharing > Busy models last (settings.BusyLoad,
POST /api/settings/busy-load, Off by default, over 50/70/80/90% or
1-99 by hand): restLast puts a model reported over it behind the
ready candidates, ahead of the resting. The trace row has busy:<load>.
At a new turn affine moves a conversation off it (Why "busy",
busyBehind); within a turn it stays. after, readyForNew and leastHeld
skip it. Unknown load, a lone candidate, or all busy: nothing moves.
- Docs: site plugins page (en, zh, ja) "Model load" section and input
table; docs/subsystems provider-plugins.md and gateway-routing.md.
Run, all on mote via mote-run at a42736807's tree rebased on
origin/main
|
||
|
|
9fdef3ea22 |
gui: keep SearchAll through a save of the Settings page (#4514)
TestSettingsSaveKeepsWhatItDoesNotSend is red since SearchAll came in
with
|
||
|
|
e84870f173 |
plugins: an option's words in the window's language, and a filtered model list says so (plugins#590)
anewuser6937 (Discord, plugins#590) saw one model in WorkBuddy's editor
and took the plugin for broken. They had turned on "Free models only"
themselves, but its label and description read in English in the Chinese
window, and nothing by the models said the list was filtered.
A plugin option (auth.options, magpie's own field; OpenCode's AuthHook is
provider/loader/methods and never reads it) may now give `labels`,
`descriptions` and `confirms`, each keyed by the window's language
("zh", "zh-TW", "ja", "de"), beside the plain strings, as a page's
`titles` do. The host keeps only non-empty strings under language names
of 16 or less, 16 languages at most, each capped as the plain one is
(60/300/300). The editor shows the exact language, then its first part
(zh-TW reads zh), else the plain words, in the row, the hint, and the
confirm dialog and its title. `filtersModels: true` says the plugin's
model list leaves models out while the switch is on; while one is on, as
saved, the Models field says under the chips "Only some models are
listed: the plugin option “…” is on." (zh 只列出部分模型:插件选项「…」已开启。,
zh-TW, ja, de too). An older plugin shows what it showed before, and an
older magpie shows a new plugin's plain words with no note.
WorkBuddy 0.2.10 gives "Free models only" in all four languages with
filtersModels (magpie-community/plugins aec58ae, on npm: `npm view
@magpie-community/opencode-workbuddy-auth@0.2.10 --prefer-online` on mote
says 0.2.10, latest), and the mover's min is raised to it so every moved
user gets it. The CLI's `magpie plugin options` stays English, as the CLI is.
The core scripts would have gone 608 bytes over their budget; three of the
provider editor's comments in app.js are cut down instead, no raise
(1,532,865 of 1,533,105).
Run, on mote (mote-run), at this tree:
- node --test plugin-option-words.test.cjs (new): Chromium and WebKit,
1100 and 420 wide, en/zh/zh-TW/ja/de, switch on and off: each
language's label and description, zh-TW falling back to zh and ja/de to
the plain words for a zh-only option, the note exactly once under the
chips in a .hint inside the editor with no sideways scroll, none while
off, the confirm in the language. With app.js put back: 19 of 21 red
in Chromium (only "en off" passes, both widths).
- With plugin-options.test.cjs and i18n-keys.test.cjs, both engines:
68 pass, 0 fail.
- go test ./internal/plugin ./internal/provider ./internal/cli: ok.
TestPluginOptions with host.js put back: red (empty maps, FiltersModels
false). The real WorkBuddy 0.2.10 index.mjs loaded into this host
(a temporary test, not kept): plugin.Providers lists free_only for
workbuddy and workbuddy-ai with all four languages and filtersModels true.
- go test ./internal/gui: TestCoreScriptBudget ok after the cut. Red,
and red the same at origin/main
|
||
|
|
ef8bd98fba |
gui: a scroll down to a view's end with a wheel the page never hears stands
On macOS 13's WebKit the page never hears the wheel, so a scroll at rest waits for a second one the same way before it counts as the reader's, and is put back after 120ms if none comes. A view with less room than one wheel step reaches its end on the first step, and no second scroll can follow, so the reader's step was put back. A scroll down that stops at the end, with the content still the same height, is now the reader's. Code's put-backs this guards against come from a redraw: up, or with the height changed. Found by view-open-wheel at 420px in zh and zh-TW, Chromium: the phone head left Usage's skeleton 23px of room, less than the test's 30px step, and it was red 3 of 3 on this branch. Broken by hand: without this change the case is red 3 of 3 alone (MAGPIE_OPEN_WHEEL_HEARD=unheard, Chromium); with it, green in the run below, and main at |
||
|
|
febef9741f |
gui: a thumb is put under its option on the window's resize, before the ResizeObserver
A phone draws its options at 13px with 11px padding (the first commit of this branch), and desktop at 12px and 10px. When the window crossed the phone width, a thumb kept its old size until thumbFit ran. In Routing at 560 to 1100 in WebKit, the group-names strip's thumb ran 4px past the view, and the view got a sideways scrollbar 10px tall. thumbFit then moved the thumb back, which changed the view's height inside its own callback, and WebKit reported a ResizeObserver loop (routing-held-dot, routing-rule-columns). Found by tagging each ResizeObserver with its creation stack. Then, on the first frame after the resize, I hid the view's descendants one at a time to see which one widened it. Broken by hand: without this change routing-held-dot is red 5 of 5 in WebKit at 560px, and with the phone's option size back at 44px it passes. Run: routing-held-dot, routing-rule-columns and the 14 GUI files that mention the thumb, on mote, both engines: 189 of 189 pass. Budget: the code and its comment were made shorter so the core scripts stay under TestCoreScriptBudget's 1,533,105, which isn't raised. After the rebase, in the 116-file run below: routing-held-dot, routing-rule-columns and segs-glide pass in both engines. |
||
|
|
32bedd44f7 |
gui tests: usage-range picks its days from the phone's menu, where the strip is hidden
At 390px the head hides #period behind #usageRangeMenu (the phone head commit before this). The test opens the menu and picks the range opt (its last item) or a preset (its first), and checks the menu names the days picked. Run: usage-range on mote, both engines, en and zh: 4 of 4 pass. |
||
|
|
4c46141dfe |
gui: a phone's choice of options in Settings shares its row's middle, as in Usage's filters
The 32px strip (the first commit of this branch) sat at the top of a .prefs .val row of 44px fields, 6px above their middle (redact-rule-edit, redact-rule-row). The sess-tools rule now covers .prefs .val too. Run: redact-rule-edit and redact-rule-row on mote, both engines, every language: pass. |
||
|
|
b791973354 |
gui tests: credit-days reads Today from the phone's days menu, where the strip is hidden
The phone head commit (usage: a phone's head is the tabs over one line of days, sum and refresh) put a phone's days behind a menu over a hidden #period, so the 360px test's click on Today waited 5s on a hidden button in every engine and language (10 of 10 red in the whole suite). It now checks that the menu says Today there; a wide window still clicks the strip. On mote: 10 of 10 green. |
||
|
|
6c29beba1e |
gui: on a phone a picker is drawn as tall as the choice beside it, and search shares a line with Export CSV
Requests' "All models" picker was 44px beside a 26px status strip, aligned at the top, and Export CSV sat alone on its own line. A .sess-pick on a phone is now drawn 32px and taken at 44 by its own ::after, like .segs; the strip in the sess-tools row is 32px (28px options) and centred, and the search field and Export CSV share the last line. Run (mote, at this branch's head after the rebase onto |
||
|
|
457cfd7c63 |
usage: a phone's head is the tabs over one line of days, sum and refresh
The owner's pick of three phone designs (B): Usage's tabs run across the
head, and under them one line holds the days as a menu ("7 days ⌄", the
app's own menu, never a <select>), the sum, and the refresh as a dot and
its figure ("● 5s", green while live). The days strips (#period,
#sessRange, #ctxRange) are hidden behind the menu. It follows whichever
the open tab shows, and a pick clicks that strip's option, so each choice
keeps its one handler; Custom opens the range menu from the head. Each
control is drawn about 30px and tapped at 44. A desktop window keeps its
strips. The refresh keeps its own menu and
its reload icon, unlike the mock-up, which had neither.
usage-phone-head.test.cjs checks the layout, the menu and the taps in
every language and both engines at 390 and 320px, and a desktop
window at 1100px.
Run (mote, at this branch's head after the rebase onto
|
||
|
|
f00a849019 |
gui: a phone draws a choice of options 32px tall and takes it at 44
On a phone (body.web at 760px or less, or a coarse pointer to 1024px) a .segs strip was 44px of fat buttons. Its options are now drawn 28px tall in a 32px strip, 13px text with 11px padding, and each takes a tap 44px tall through a transparent ::after, so what is drawn is small and what a finger hits is not. Run (mote, at this branch's head after the rebase onto |
||
|
|
b1fc435407 |
library: Magpie Web Search, magpie's search MCP server in Library › MCP (lutra_fs)
lutra_fs on Discord: magpie's search MCP shows in Settings › Models but not in Library › MCP servers. They were right. The gateway's web search MCP (/mcp/magpie/web-search) was only an address to copy in Settings › Models › Web search. It was never a Library server, so no agent could be given it from the Library, and the Library didn't list it. Change: - `magpie mcp search`: a stdio relay to the gateway's search MCP, made by widening browsermcp's Magpie Browser relay into a bridge with its own path, title and an optional session (search sends none, and has a 5 minute client). It takes no arguments. When magpie isn't running, it says "Magpie Web Search can't be reached: start magpie". - library: Magpie Web Search (magpie-web-search) is a featured, opt-in server beside Magpie Image and Magpie Browser. It is installed with no agents, so the user picks them in its sheet, and it switches per agent like any other row. Its command is the full binary path, and serverKey treats any binary's `mcp search` as the same server. Each agent's tool timeout is at least 120s. - Settings › Models › Web search › MCP server: under the address there is a "Give agents Magpie Web Search…" link that opens its Library sheet, or "Turn on the Library" while the Library is off, as Images does for Magpie Image. Gateway mode has no link. - The sheet's hint says where each search goes and what it costs. All strings are in en, zh, zh-TW, ja and de. - docs/subsystems/library.md names magpie's own servers and the new one. - An agent in WSL gets it through the MCP router, as Magpie Browser does. The image-only WSL side() is unchanged. - The sibling, Image recognition's MCP server, is still in Settings only. That is filed as #4653. Run, at this head (rebased on origin/main |
||
|
|
a6217e83d3 |
plugins: a plugin npm said nothing of offers Install, not Coming soon (zhudabao8433 on Discord)
zhudabao8433 on Discord (#general, 11-01): PowerContext (@magpie-community/gateway-powercontext) could be installed yesterday and today reads 即将上线 again. Cause: PowerContext was never pulled. It is in registry.json since plugins 1e4c8a2 (10-29) and on the dist branch (0.2.0, every dist commit since), and not on npm (E404), so magpie learns its version from the dist branch's ~1.7MB index.json. Coming soon is drawn whenever a listing has an npm answer with no version, and three paths gave one without anything confirming the package is missing: - builds before v0.1.2413 kept a dist read cut off at npmEach (6s) as "not on npm" in plugin-npm.json (ferock, |
||
|
|
445891cf74 |
gui: Insights › Masking keeps to the window's page width, centred, like every other page
refeccd on Discord (#feedback, 11-01): with the window maximised every
page sits in the middle at a fixed width, but Masking (脱敏) runs edge to
edge. The width cap is one rule in app.css that lists the pages by id
(body.window :is(#view-agents, …) { padding: max(16px, 50% - 600px) }).
Masking became a page of the redact plugin (#view-masking, kernel.js)
after that list was written and never joined it. Now it does. The cap
itself is unchanged.
Siblings: every page the sidebar opens (agents, sessions, library,
providers, routing, gateway, usage, masking, plugins) and Settings was
checked against the list; Masking was the only one missing. A community
plugin's page (.view.plugin-page) is a frame the plugin draws and is
left as it is.
The test: page-width.test.cjs no longer keeps its own list of pages. It
reads every page from the sidebar (#nav button[data-view], not a
community plugin's), plus Settings, and requires Masking among them, so
a page added later is held to the same width without the test knowing
it. It now also runs every language at 420px besides en/zh-TW/de at
1920, zh/ja at 2560 and en at 900.
Run (mote, macOS 27, Playwright 1.62.0, Chromium and WebKit):
- page-width.test.cjs on origin/main 6f3dfc282's CSS: red, "masking:
1676 wide at 1920" and "masking: 2316 wide at 2560" in every language,
both engines (12 pass, 12 fail). With the fix: 24 of 24 pass.
- Together, with the fix: page-width, page-width-steady, i18n-keys,
click-scroll and every mask*/masking*/redact*/window-mask/
routing-masking/provider-mask/provider-unmasked/account-mask/
plugin-name-unmasked file: 602 tests, 591 pass, 11 fail. The 11 are
page-width-steady's "opening an agent's details past the window moves
nothing sideways", which fail the same 11 with the file run alone on a
clean origin/main
|
||
|
|
90c02326bb |
gui: an app takes the gateway over from its older copy once idle, and says any other version serving it (matrix0487)
matrix0487 on Discord: after an update, pi said 404 'magpie knows no model "kimi/k3.1-pro" ... add a provider in magpie first'. The app had written pi a model its older gateway didn't know, and updating the gateway fixed it. A magpie that finds another one serving the gateway used to log it and wait for that one to quit (watchGateway took the port only once nothing answered). Only the Gateway page said so. Now (otherServes, gateway_older.go): - An older released copy of the app (it says serves app or tray, and a pid) is this app's predecessor. Once its /v1/magpie/concurrency says nothing is in flight (gateway.ServedBusy; unknown is never idle), the app quits it the way the Gateway page's button does (quitMagpieOnPort: a magpie only, by its program) and serves the gateway. A stream through it runs to its end first. watchGateway looks again every 15s while another serves. At most three times a run; a quit that fails is left to the button. - Any other one (magpie serve or the service, magpie web, a TUI, a newer magpie, a build of its own) is left running. /api/state carries it as gatewayOther, and the Agents page says it above the list with what to do, plus the take-over button for an older one (gatewaySkewLine, in plugins/gateway/client.js so app.js stays under its budget). A dev build of this magpie says nothing. New strings in zh, zh-TW, ja and de. How the reporter's older gateway outlived the update isn't known: they never said whether one ran separately. A failed handover leaves the old app serving for up to 15m, and a magpie serve left running is another source. Both are covered now: the first is replaced, and the second is said. Known gap: a request that starts between the idle read and the quit gets the older app's short drain. A socket handover between two running apps (no gap) is not built. Run on mote at 0f8ea30bb (this change on |
||
|
|
4794767846 |
routing: back on Routing from another page, the page isn't laid out and drawn again whole (#4652)
xisdumpling (dumplings04605 on Discord), Windows, 0.1.2507: with a
history day of 180 to 298 requests picked, coming back to Routing
stalls the page and the sidebar's highlight. Measured first, with
routing-return-cost.test.cjs (250 rows, a picked day, a request's story
open), which counts what the return does, not how long it takes.
Causes found, each fixed and each red by hand when put back:
- The request list was windowed only from 300 rows, so a day of 180 to
298 had every row in the page. Now from 100 (WIN_MIN); the live list
keeps 60, so it is never windowed.
- Out of sight a view is 0 wide. The ResizeObservers in the routing
client (byWidth, the meta width) and context.js's card sizes took that
as narrow, flipped the narrow layouts while away and flipped them back
on return. A 0 width now keeps the layout it had.
- A hidden list re-windowed itself for a 0-high view, so the return
placed rows and ran metaFit again. It keeps its window while hidden.
- resume rebuilt the whole stage on return. sync("back") rebuilds only
when what the stage was built from (route, pin, day, purpose, lang,
the requests and their accounts) changed, and records it after the
rebuild.
- The visibility observer's group reload was not quiet and redrew the
groups. It is quiet now.
- A providers refresh while on Routing redrew the hidden Providers page.
It is read and drawn when Providers opens (providersBehind).
Not a cause: the nav highlight's rAF reading offsetTop only waited on
the busy main thread; it is one small layout now.
Before and after, the "back on Routing" step (Chromium layout metrics
from CDP; class flips and redraws from MutationObservers, both engines):
- mote, macOS: 25 layouts / 34.9ms of layout, 24 class flips, Providers
redrawn 13 nodes, groups 4, stage kept 0 of 3, 250 rows, 7818 nodes
-> 9 layouts / 3.2ms, 0 flips, 0, 0, 3 of 3, 11 rows, 1367 nodes.
- Windows (xiaomi-gpu, win-run): 25 layouts / 146.4ms, 24 flips
-> 9 layouts / 7.1ms, every check passes. WebKit's counts match.
The test asserts no flips, no redraws, the stage kept, under half the
rows in the page and at most 12 layouts; wall time is logged, not
judged. The page looks the same: no CSS or markup change.
Run:
- routing-return-cost: red on origin/main
|
||
|
|
784b66366f |
gui: Settings opens after Codex's row on the Agents page was opened and shut (ysm119)
ysm119 on Discord (v0.1.2519, macOS): opening Settings showed "null is not an object (evaluating '$(row + ".who").title = t(en)')". Cause: an opened agent row borrows its settings rows (AGENT_PREFS, |
||
|
|
fb3942ee67 |
windows: the app's icon fills its square in the taskbar, the tray and Start (dzxx0496)
On Windows 10 magpie's icon looked a size smaller than its neighbours in the taskbar, the tray overflow and Start's "Recently added" (dzxx0496 on Discord, #general). Every Windows icon was the Mac's tile: build/windows/icon-*.png ( |
||
|
|
9162277b91 |
routing: Until used up stays on the next account once the first is used up (dzxx0496)
dzxx0496 on Discord: with free accounts one after another, the first used
up, requests went to the second; when the first renewed they went back to
it ("如果第一个恢复了,它又优先用第一个了"). No routing did what they asked:
In order and Smart both put the first back first.
A new routing, Until used up (drain, 用完再换): requests stay on one seat
until its quota is used up, then go on to the next in the list and stay
there. A seat counts as used up when its known allowance is at 100% or
it was refused for quota or credit (failQuota / failCredit, routes.Drained
called where the rest is recorded, so a failover inside one request moves
the pool too). A rate limit or other failure only passes it over while
it rests, as In order does. Each pool (a provider, a group/<id>) keeps its
own place; routes.Forget clears it.
Offered wherever a routing is picked: the provider editor, a group's row
menu and editor (app menu, no native select), the TUI, `magpie group set
<id> routing=drain` and a provider's routing=drain. Nothing defaults to
it, so no saved setting changes. SpentShareOf is 100 for it, as for In
order. Words in en, zh, zh-TW, ja and de (i18n.js and the routing
plugin's own), docs/subsystems and the site's start page (en, zh, ja).
Tests:
- internal/routes/drain_test.go: stays on the next when the first renews,
through a rate limit, all used up, a seat gone, per pool, Forget,
Drained after a renewal.
- internal/gateway/drain_test.go: a real request path with a fake upstream;
k1 refused for quota, k2 takes over, k1 renews: drain stays on k2,
In order goes back to k1. Red without the Drained hook (request 3 went
to k1). A rate limit comes back to k1; drain is saved on a provider and
a group.
- routing-drain.test.cjs: the Routing page's why and mode line in 5
languages, 1100px and 420px, Chromium and WebKit; red on the old assets
(20 of 20).
- routing-group-strategy, routing-save, builtins: the menu has 11 routings.
Run on mote (macOS) at origin/main
|
||
|
|
72114566bf |
routing: an account's row says when it renews whatever it is doing (dzxx0496)
dzxx0496 on Discord asked for the reset time to stay on ("额度恢复时间能不能
常驻"). On the Routing page's stage a known allowance's row said when it
renews only while idle; answering, answered, kept for last or passed
over, the row's status took its place and the time was gone. It now
follows every such status ("· renews in 5 h 5 min"), once. A resting
row still says when it is back instead, a free model has nothing to
renew, and a status that already says it is not told twice.
routing-renews-stay.test.cjs: a request in flight over three known
accounts, one answering, two passed over; each row says its own renewal
once, in en, zh, zh-TW, ja and de, at 1100px and 420px, in Chromium and
WebKit, with no overflow. routing-behind-why.test.cjs's expectations
now carry the renewal on its answered and kept rows.
routing-renews-stay.test.cjs is 2 of 2 red on the old assets. Its
first row and routing-behind-why's answered row renew in 12 h 5 min:
under 10 h the time shows minutes, and a slow run turned 9 h into
8 h 59 min. With the fixtures' clock held back 2 minutes the old
values were 40 of 64 red, these 64 of 64 green.
Run on mote (macOS) at origin/main
|
||
|
|
4464a304fd |
gui: a model row's image chip is as tall as its other chips (nb5p)
nb5p on Discord: on the Gateway page's model list the image chip at a
row's end stood shorter than the reasoning chip ("低–ultra") and the
context chip ("272K"). The text chips are inline-flex with a 16px line;
the image chip holds only the 11px glyph (display:block), so it was 11px
tall. It now takes the text chips' 16px as its height.
modelInfo() is the one renderer of these chips. Its two callers, the
Gateway's model list and the routing group editor's member rows, share
the selector the fix is on. The provider editor shows images as a
checkbox and the Agents page and pickers show no such chip.
gateway-model-chip-height.test.cjs measures every chip of every row in
en and zh, light and dark, at 900px and 420px, in Chromium and WebKit:
same height, same centre line.
gateway-model-chip-height.test.cjs is red on the old CSS (the image
chip 11px against 16px) and green with it.
Run on mote (macOS) at origin/main
|
||
|
|
54087aa43d |
providers: a key's chips keep their whole text; what ends its row goes under it when it doesn't fit (young02036)
young02036 (Discord #feedback, zh, Windows) had a Remote magpie key row whose models chip「全部模型」was squeezed to「全」. The row also showed the protocol pick and the actions (停用 移除 设为首选). Now only the name and the masked key shrink. Every chip and button keeps its whole text. Switch off/on, Remove and First/Make first are held together in one .key-acts group at the row's right. When they don't fit, the group goes onto its own line, still at the right. A press there now keeps its row open (`held`) through the redraw the press brings, until the pointer moves off the row. Without that, a wrapped row drawn again after a click goes back to one line, slips out from under the pointer, and hides the button that was pressed. key-switch.test caught this at en/ja/de 900px. WebKit gets plain `:hover`/`.held` selectors, not `:is()`/`:not()` lists. Trade-off: in a narrow card, a hovered key row grows by one line. Not changed: account rows, which use the .acc-line/⋯ layout, and the gateway's caller-key rows, which ellipsize on purpose. New test: tests/key-row-chips-fit.test.cjs, 60 cases (2 engines x zh, en, ja, de, zh-TW x 6 widths down to 390px). It checks that no chip or button of a key row is cut, and that the actions stay on one line at the right. Run: - key-row-chips-fit + key-switch, Chromium and WebKit on Linux (WSL magpie-desktop): 40/40 each. key-row-chips-fit on mote: 60/60; on Windows (xiaomi-gpu): 30/30. - Whole GUI suite, WebKit, on mote at this commit (another session's suite ran there too, load 55 to 160): 8663 tests, 8489 pass, 174 fail, in 50 files. Each red file was then run alone at origin/main |
||
|
|
fa4704f060 |
gui: a test bounding allocations skips its bound under -race
Under -race sync.Pool lets a quarter of what is put in it go, so json's encoders and regexp's matchers are made again: four gui tests bounding what a path allocates went red under -race at |
||
|
|
0cc551c862 |
gui: the terminal-update test reads its child process under no race
TestUpdateInATerminalRestartsTheAppWithoutCuttingIt set `child` in the startBeside fake, which the restart runs on a goroutine of its own (restartBeside), while the test read it in eventually2 and its cleanup. Under -race it reported a DATA RACE on every run. The child is now an atomic.Pointer stored after Start, so a reader never sees it half set. TestRestartHandsTheGatewayOver's fake runs on the test's goroutine and has no race. Run on mote at this tree: - gofmt, go vet ./internal/gui, GOOS=linux go vet -tags nogui: ok. - -race -run the test, 3 times: ok, no race. At the base ( |
||
|
|
699ddf1524 |
gateway: a Codex account can spend its credits only after every other account, key and fallback (gokoshiki on Discord)
gokoshiki wants a Codex subscription first, then an OpenAI API key, then the subscription's credits. Until now an account at 100% that holds credits either kept its place and spent them there (on) or was held (off). This adds a third way per account, "last": - settings: CodexCreditsLast []string, empty by default, so a setting saved before it keeps its order. provider.CodexCreditsLast, CodexCreditsMode and SetCodexCreditsMode(user, on|last|off); SetCodexCredits(on) still means "in its place" and clears last. - gateway: candidate.creditsLast is true for such an account once a window for the model is used up and it is going on its credits (a call ChatGPT counts in no window stays in its place). restLast orders ready, then resting, then those, and marks Weighed.CreditsLast. restLast runs over the asides too, so such an account goes behind a provider's reserves (Accounts at once, |
||
|
|
fd70def825 |
gui: a Providers poll sums what it keeps while writing the answer
Each poll of /api/providers encoded the answer for the page and then
encoded the kept last-known list again only to sum it (keepProviders,
encodedSum): 32-34 MB of what forty polls allocated with real accounts.
writeProvidersJSON now returns the encodedSum of keptProviders(s), taken
from the same encoding, as writeStateJSON does for /api/state. A row
kept as it is (no headers, proxy, extra body or account proxies) is
encoded once into the answer and the sum; only a row with those is
encoded again without them. The head and tail of the kept file come
from marshaling it with no rows. A nil row list, or a head that doesn't
match, falls back to the old writeJSON and encodedSum. The other
keepProviders callers (after a save) are unchanged.
Run on mote at this tree:
- gofmt, go vet ./internal/gui, GOOS=windows go vet -tags nogui: ok.
- go test -run 'Providers|Kept' ./internal/gui 3 times alone: ok.
- New TestProvidersWriteSumsWhatIsKept: the sum equals
encodedSum(keptProviders(s)) for bigProviders, rows with each secret
field, gateway calls, moved models, and empty and nil lists. Broken
by hand twice: keepsAllOf always true (secrets summed) and the kept
tail left out of the sum. Red both times.
- go test ./internal/gui: only the known reds,
TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
TestMainWindowCorners (#3949).
- -race -run 'Providers|Kept': TestProvidersWriteGrowsNoBufferItsSize
red, and red the same way at the base (
|
||
|
|
c76bcaea7a |
gui: between reads the heap grows by half of what it holds, not all of it
The window and the app's page, resting on ~60 MB live, poll /api/state,
/api/drift and /api/providers and throw ~10 MB away a round. At Go's
default GOGC of 100 the heap grew to twice what it kept before each
collection, so the footprint stood at 121-135 MB and peaked at 136-138
MB for a ~60 MB heap.
steadyGCStart, run once with the warm-up, sets GOGC to half, or to what
lets the heap grow by 32 MB when that is more (never above 100), and
sets it again for the live heap after each collection, through the
retightenGC hook the tight reads already use. The usage and sessions
reads under a tight GC still set their tenth while they run, and the
steady value comes back after them. A GOGC the user set in the
environment is kept, and nothing is retuned. No memory limit (#2278).
Run (mote, at this tree):
- go test -count=1 ./internal/gui: ok except TestSettingsSaveKeepsWhatItDoesNotSend
(#4514) and TestMainWindowCorners (#3949), the known reds.
- -run 'GC|Steady|Tight' 3 times and once under -race: ok.
- Broken by hand: ignoring GOGC in the environment, TestSteadyGCKeepsTheUsersGOGC
is red ("GOGC=200 set by the user, magpie runs under 50"); with no
retune after a collection, TestSteadyGCRetunesAfterACollection is red
("GOGC after collections = 50, want 100").
- gofmt -l, go vet, GOOS=windows go vet -tags nogui ./internal/gui: clean.
- Real accounts, magpie web in a sandbox HOME, 40 rounds of the three
polls, twice each, alternating, v0.1.2507 against this change:
phys_footprint_peak 136 / 137 MB -> 115 / 116 MB
phys_footprint end 135 / 121 MB -> 96 / 94 MB
CPU of the polls 3.84 / 3.98s -> 4.05 / 4.24s
/api/state and /api/drift byte-identical.
GOGC=50 in the environment gave 107-108 MB at +9% CPU; the 32 MB room
keeps a small heap from collecting that often.
Not run: the desktop window (Wails) and Windows/Linux machines; the
tray app takes the same Handler path. A large usage history between
reads (~280 MB live) now grows by ~140 MB, not ~280, before a
collection; not measured here.
Picked onto
|
||
|
|
ce998057a7 |
gui: a provider row makes each model's provider/model ref once
providerInfoWith built p.ID+"/"+m.ID three times per model (same-as, desktop and price lookups) and again for every agent with a hidden list, per model. Now named makes it once and keeps it beside out.Models for the agents' loop. What the row says is unchanged. Run on mote (macOS), at this tree (with the previous commit): - gofmt clean; go vet ./internal/gui for darwin and windows ok. Linux vet of internal/gui needs cgo for Wails and wasn't run. - go test ./internal/gui: red only on #4514 and #3949, as before. - Real-account sandbox, 40 window polls: providerInfoWith 112.0 -> 104.1 MB; /api/state and drift output byte-identical. Not run: the whole ./... suite. |