79decfe71a415dcf584dd4e4dce994c5b80cffc1
7126
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
79decfe71a |
library: the agents ticked for instructions are given memory's digest
The agents ticked under Library → Instructions get a "## Memory" part in
their instructions: the global memories, the agent's own, and each
project's under the folders it was seen in (memory.Digest), unless
Instructions.NoMemory. The digest changes only when published, so an
agent's instructions (and the prompt cache on them) change mid-session
only then: at once when the user changes memory (PublishMemory(false),
called by the GUI), and once a day from KeepLinked's loop for what
agents saved meanwhile (PublishMemory(true) -> memory.PublishDue).
PublishDue writes nothing while memory has never held anything, so a
user who never uses memory gets no memory.json.
Run (mote-run, whole worktree, with the rest of the memory layer):
- go test ./internal/memory ./internal/library: ok (library 130.9s)
- go vet ./internal/memory ./internal/library ./internal/gui, GOOS
darwin, linux, windows: ok
- gofmt -l: clean
Broken by hand (mote-run -run TestMemoryDigestInInstructions):
- memoryDigest's NoMemory check removed: red. It first stayed green,
since the test switched NoMemory on with memory.json deleted; the test
now gives memory back and sees the part return before switching it off.
- PublishDue's "nothing kept" guard removed: red ("a due publish with
nothing kept wrote memory.json").
Not tried: a real agent reading the digest in its instructions.
|
||
|
|
4f0c587306 |
memory: a store of what agents learn about the user, shared by every agent
The first part of the memory layer: internal/memory keeps memories in memory.json (lastgood + atomic writes under a file lock; a file that can't be read is unknown and never written over). Each memory has a scope (global, project:<git remote key>, agent:<id>), a kind (profile, preference, rule, reference, fact, procedure, episode), free tags, an origin and a status. Saving the same text in the same scope merges into the memory already there; an agent's save never changes the kind or why of a memory the user wrote or pinned. A project is keyed by its origin remote, so every clone and worktree of a repository shares its memories. Search is word-matched with CJK split into characters and pairs. The digest agents will be given is published on demand (a user's change, or once a day), never at an agent's save, so instructions don't change mid-session; its text names no app or vendor. Nothing uses the package yet: the MCP server, the Library's digest and the GUI come next. Run (on mote): go test -tags nogui ./internal/memory, -race -count=3, TZ=Asia/Shanghai; go vet for darwin, linux, windows; gofmt -l clean. Broken by hand: an agent's save allowed to change a user's memory (TestUsersMemoryNotChangedByAnAgentsSave red) and a digest computed live instead of published (TestDigestChangesOnlyWhenPublished red). |
||
|
|
e369d587c3 |
dsh: a round hashes dsh's files through a buffer, not read whole
dshFilesSum, which says whether anything a dsh round reads changed, read every profile's patch list, the home layer, settings, .env, keys and old config into memory with os.ReadFile only to hash them. Both dsh homes do a round every 30s at rest, and a patch list names every model magpie serves (39KB each in the real account here, two profiles), so each round allocated each file's size again. Now each file is streamed into the maphash through a pooled 32KB buffer (dshSumFile); the sum is the same as for the bytes written at once, so a round after the update still matches the one before. Measured on mote with a copy of the real accounts (acidle.sh, alloc between 60s and 180s at rest, the heap dump's own allocations left out): - t18 ( |
||
|
|
c02a491e87 |
provider: a Codex auth.json is parsed once for its bytes, not on every look
codexWho (email and workspace) and codexLoginIn's user and plan are read
from an auth.json's bytes alone, yet were a JSON parse and a JWT decode on
every call: codexName runs sameLogin over every saved account against each
other, and liveLogin("codex") is asked from four loops at rest
(loginsNow, rememberLogins, heldByCodex, renewLogins). Both now go
through authMemo, a map keyed by the bytes (a hit makes no string and
allocates nothing), emptied at 64 entries so tokens renewed every hour
don't pile up.
Measured on mote with a copy of the real accounts (acidle.sh, alloc
between 60s and 180s at rest):
- t17 (
|
||
|
|
9d4c338a67 |
gui: magpie web on a phone no longer scrolls sideways or keeps a band at its foot (#4943)
precis1onz (iOS Safari, dark, English, Usage) saw the page move sideways
and a dark band stay at the screen's foot.
- Sideways: Usage → Requests' "Split by" row (label and five choices) is
one unwrapped span, 393 to 558px wide at 375 to 430px. It was the only
thing wider than a phone in any view or language. On the phone layout
it now wraps inside the screen (app.css, phone block only).
- The band: the Requests table's stand-in scrollbar (#799) is sticky at
the view's foot, and a touch screen draws no bar in it, so it stood
there as an empty 12px band. ledHScroll now leaves it hidden on
(hover: none) and (pointer: coarse); a finger moves the table itself.
A desktop keeps it as before.
New test, phone-no-sideways.test.cjs: every view (Agents, Sessions,
Providers, Routing, Groups, Gateway, Library, Plugins, Masking, each
Usage tab, Settings' tabs) on an iPhone at 375 in en, zh, zh-TW, ja, de
and at 390 and 430 in en, in Chromium and WebKit, with long ids, emails
and paths; nothing may be wider than the screen and no empty band may
stay sticky at a view's foot. ledger-swipe now expects no bar on a
phone, and that the swipe moves the table.
Run (mote, through mote-run):
- phone-no-sideways: red on the old assets (
|
||
|
|
198c16d0c4 |
gui: a window set aside, counted of a total, takes a new cap of its own
9won on Discord: WorkBuddy's Credits and Extra credits (and the intl build's) could not be given a cap. The plugin sets those two aside (the account stops at "Total credits"), and |
||
|
|
c3f91f4496 |
i18n: de's fixed-amount cap tooltip names {window} as often as English does
40cbdaa7e's German for "{window} has a cap of its own: … used {n} of
{window}, until it renews" said {window} a third time ("bis {window} sich
erneuert"), so gui-de's "de has every zh string, with its placeholders and
tags" has been red on main since. It now says "bis es sich erneuert", as
the percentage cap's German beside it does, and "Klicken" as that one does.
Run on mote (macOS 27): gui-de and i18n-keys 7/7, TestCoreScriptBudget ok.
Red before: the same gui-de test failed on a clean origin/main
|
||
|
|
f2341e232a |
providers: the page says when subscription accounts are off, and leads to the switch
Subscription accounts (account discovery) are turned off in Settings ›
Privacy, and every subscription then stops working, but the Providers
page said nothing of it (the scattered settings audit after netube99 on
X). A line over the list, in the deprecation notices' quiet style, now
says they are off, with Settings › Privacy opening the switch, lit, and
Back to Providers. With MAGPIE_NO_ACCOUNTS set it says so instead. While
they are on there is no line. The core script budget is paid with three
comments cut, no raise.
Run on mote (macOS 27), Chromium and WebKit:
- new providers-discovery-off.test.cjs (every language, 1100 and 420
wide), account-discovery, i18n-keys, settings-back: 76/76.
- TestCoreScriptBudget and the app.js budget: ok.
- every file touching #movable (deprecated-subscriptions,
deprecation-notice, library-chip-fan, plugin-move, plugin-movable-review,
retired-move): green. plugin-move-unserved's "Try again takes the models
unticked" is red 4/4, the same 4 at a clean origin/main
|
||
|
|
0d99261dcc |
sessions: the page leads to Settings › Privacy's session history
Which agents' session history magpie reads is set in Settings › Privacy,
and the Sessions page it is about led there only through its first ask's
words (the scattered settings audit after netube99 on X). Its head now has
a Settings › that opens Privacy at those rows, lit, with Back to Sessions.
Gateway mode reads no agent's history and has no such rows, so no link.
Two things it found on the way:
- Privacy's session-history rows are drawn again when their read comes
back (loadSessionReads), which took the light off a row a link had just
lit; in Chromium it was gone before it showed. The redraw now keeps the
light on the row at the same place.
- The link takes ~70px of the head (en), and eight agents' tabs, which
fit a 1200px page (面条 on Discord), had 34px to spare. The search
now gives way to the tabs, down to its 110px least, before the agent
menu takes them; a narrow window's grid head is as before. The fit
watches the head, not the tabs' box the search's width changes, so no
ResizeObserver loop.
New test sessions-to-settings.test.cjs: the link's words, inside the head,
over nothing, the page fits; it lights Privacy's row; Back returns to
Sessions; none in gateway mode. Every language, Chromium and WebKit, at
1100 and 420 wide. sessions-toolbar now counts the link among the head's
controls that must fit.
Run on mote: every Sessions GUI file (13), gateway-conversations,
gateway-mode-sessions, i18n-keys and settings-back: 192 of 192.
Broken by hand: without the link, sessions-to-settings red; without the
redraw keeping the light, red in Chromium (timeout on the lit row);
without the search giving way, sessions-toolbar red ("a wide window keeps
the one-click agent tabs").
Not tried: the real app window.
|
||
|
|
8016b9fcad |
providers: the page counts the catalog instead of copying it
providersState read provider.Catalog() only for its length and its routing groups, and Catalog copies every listed model's Entry (1.6 KB each): catalogKeeping was 11.5MB of 128.5MB allocated over 40 asks of /api/providers on the real account. provider.CatalogGroups gives the groups (the caller's own copy) and the count Catalog would have, by the same Unlisted and group-unlisting rules, with no model copied. Measured on mote with the real account copy (aalloc.sh, 40 asks, alloc_space delta): 128.5MB (v0.1.3452) -> 115.4MB, -10%; 213.4MB before v0.1.3446. Run: go vet ./internal/provider ./internal/gui; go test -count=1 -timeout 45m ./internal/provider ./internal/gui (ok, ok) on mote. New TestCatalogGroupsIsCatalogs compares it with Catalog with no groups, a group listing alone beside an unlisted provider, and that group off; counting the unlisted models too, by hand, makes it fail in all three. Not tried: Windows and Linux (no OS-specific code). |
||
|
|
8295db7d10 |
providers: hostOf shares hostnameOf's parsed URLs
|
||
|
|
a1f2c37ea8 |
gateway: a key's limit editor says Key limits is off and turns it on
A gateway key's limit is the Key limits built-in's (budget). With it
switched off, the editor under the key's row drew as usual, and Save was
refused with "turn the plugin on" without saying where (the scattered
settings audit after netube99 on X). The editor now has a line, shown
only while budget is off (data-feature-off), saying "Off in Plugins ›
Built-in" with a Turn on that switches it on in place; the line goes and
the editor stays open with its draft.
New test gateway-key-limit-off.test.cjs: off, the line shows inside the
editor with its words and the page fits; Turn on posts {id: budget, on:
true} once and hides it; on, it is hidden. Every language, Chromium and
WebKit, at 1000 and 420 wide.
Run on mote: gateway-key-limit-off 20 of 20; gateway-key-limit,
gateway-key-limits, gateway-key-cycle and i18n-keys 38 of 38.
Broken by hand: without data-feature-off the line shows when on, red;
without Turn on's call the line never goes, red (timeout).
Not tried: the real app window.
|
||
|
|
a09e967f53 |
providers: with no account removed, Hidden makes no account
Hidden read every sign-in (Accounts: Codex, plugins, Claude...) and then kept those the user removed. The Providers page asks it twice a poll (directly and through Excluded), and most users removed none; the real account has none, so ~0.6 MB a poll was made for an empty answer. It now looks at the saved file first and returns nil when nothing in it is hidden. Measured on mote with the real account copy, 40 asks of /api/providers (aalloc.sh, alloc_space delta): 169.8MB (v0.1.3447) -> 146.6MB, -14%. CPU for 30 asks (aeach.sh): 0.65s -> 0.56s. Run: go vet ./internal/provider; go test -count=1 -timeout 45m ./internal/provider ./internal/gui (ok, ok) on mote. New TestHiddenNoneMakesNoAccount fails with the check taken out by hand (254 allocations, its accounts 249) and checks a removed account is still listed. Not tried: Windows and Linux (no OS-specific code). |
||
|
|
e9b8b1c83e |
gui: the core scripts back under their budget after b72256b59
|
||
|
|
b72256b599 |
gui: a Back in the title bar after a link into a setting, and a lit row keeps its corners
The owner (11-10): "点击设置链接跳转到设置页面之后,最好有一个返回按钮来返回到上一页,
类似于浏览器的返回按钮。" A link into a setting (openSettingsAt: the Usage
page's and Routing's Settings ›, the Gateway page's, a provider's, Plugins ›
Built-in's) and Plugins › Built-in's link to a page now leave a chevron
Back in the title bar, before the crumb (beside the sidebar) or after the
brand (the header's tabs), named "Back to {page}". It goes to that page:
the provider that was open, or Settings' tab and search. One step, like
a browser's first; going to another page by hand drops it. fitTop counts
it as the header's lead, so the tabs keep clear of it.
And (the owner, 11-10): "绿色边框的四个圆角会被切掉,这个很丑的". A lit row's
inset ring was square inside the list's rounded clip, so the first and
last rows lost their ring's corners. A lit row is rounded as the list is
inside its border (11px; 10px in the panel, whose lists have no border).
New test settings-back.test.cjs: Usage's Settings › lights the row with
rounded corners, Back shows with its name, fits, overlaps nothing in the
title bar, and goes back; Routing's the same; a page picked by hand drops
Back. Every language, Chromium and WebKit, 1100 and 420 wide.
The core's script budget pays for Back with five long comments in app.js
cut to a line each (Back's own, Built-in's rows, the refresh, its spin's
stop, a growing part's hold), no raise; TestCoreScriptBudget ok on mote.
Run on mote: settings-back, i18n-keys, settings-places, title-bar-tools:
53 of 54; the red is title-bar-tools' known WebKit flake (#2740, #4716),
red 1 run in 3 alone, the same at the base.
Broken by hand: without renderBack in show, settings-back red; without the
11px radius, red with row 0 vs list 11.
Not tried: the real app window.
|
||
|
|
1eebd1ff3c |
providers: a known maker price is answered without garbage too
|
||
|
|
b53f4e7c49 |
providers: a known price and a known hostname are answered without garbage
The Providers list asks the price memo for every model of every provider on each poll, and the hit built its key as a new string each time. The key is now built in a stack buffer and looked up through string(k), which Go doesn't allocate for a map index; it is copied out only when the price is new. hostnameOf parsed every provider's base URL with url.Parse on every poll; the hostname is now kept per URL (reset at 512). Measured on mote with the real account copy (aalloc.sh, 40 asks of /api/providers, alloc_space delta): 213.4MB at origin/main (t12), 186.9MB with this change (t13), -12%. CPU for 30 asks 0.64s -> 0.62s. Run: go vet ./internal/catalog ./internal/provider; go test -count=1 -timeout 45m ./internal/catalog ./internal/provider (ok, ok) on mote. New TestPricedOnceHitAllocatesNothing and TestHostnameOfKept fail on the old code (1 allocation each, broken by hand) and pass with it. Not tried: Windows and Linux (no OS-specific code). |
||
|
|
a8aeb2cad2 |
usage: picked days can start and end at a minute
blrbrzkj on Discord asked to see usage from one time to another, not only whole days. The range menu has a start and an end time under its month (empty is the whole day; 9:30, 0930 and 09:30 all read 09:30). Picked with the days, the period is "2026-10-01T09:30..2026-10-01T18:00"; Enter applies new times to the days already picked. A time that isn't one, or an end not after the start on one day, is marked and asks for nothing. The opt says "Oct 1 09:30 – 18:00". The backend reads either end as a date or a date with its minute (usage.RangeOf, bounds); an untimed end is its next midnight. A timed range of 48 hours or less is drawn by the hour from the first's hour. CSV names drop the colons. Run (mote): node --test usage-range-times (new, chromium + webkit, en + zh), usage-range, i18n-keys, credit-days: 26/26 ok. go test ./internal/usage ./internal/gui ok (TestCoreScriptBudget fits, the periodDays comment cut to pay for its regex); gofmt clean; go vet native, GOOS=windows (usage, gui), GOOS=linux (usage) ok. Broken by hand: a timed end read as its day's midnight turns TestPickedMinutesArePeriod red. The page's own typedTime first clashed with app.js's hhmm and stopped the Usage page mounting; the GUI run caught it. Not tried: the real app with a real ledger; ja/de/zh-TW screens. Reported-by: blrbrzkj (Discord) |
||
|
|
f5a2edfd1c |
gui tests: a found group's old id reaches the group it was renamed to
|
||
|
|
117f56c707 |
gui: a provider editor of many accounts opens without a layout an account (#5310)
With 600 accounts the Claude provider editor took 7.9s to open in WebKit (2.3s in Chromium). Each account's segmented control placed itself, and its thumb, in a microtask of its own: a read after the last control's write, so every control laid the editor out again. The thumb's place was read from offsetLeft/offsetTop, scrollLeft and getComputedStyle. In a long list WebKit answers those by walking every sibling before the element (~0.3ms each at 600 accounts), where getBoundingClientRect, offsetWidth and client/scroll sizes are cheap. - segs() queues its control. One microtask (segsFlush) places every control due and slides them all together, with each container's controls counted once (segsPlace takes a shared map). - slides() reads every thumb's target, then writes them all. thumbsPut puts them all with one reflow. - thumbTo measures with rects (unscaled by offsetWidth) and reads scrollLeft or scrollTop only when the strip overflows. - thumbNow trusts the place it last put (thumbPlaced) unless a glide is running, so it doesn't use computed style. Measured at 600 accounts (time to open the editor, probe on mote): | | WebKit | Chromium | | --- | --- | --- | | before | 7.9s | 2.3s | | after | 1.13s | 0.58s | What's left in WebKit is the editor's own two renders and openModal (~670ms), which this commit doesn't touch. The core scripts stay inside TestCoreScriptBudget: comments were cut to pay for the code, and the budget wasn't raised. New test: editor-thumbs-batched.test.cjs. It opens the editor with 40 and with 160 accounts, in both engines and in en/zh/zh-TW/ja/de. It counts forced layouts and the sibling-walking reads, holds 160 to 40's count +24, and checks every thumb lies under its option within 1px. Run at this head (rebased on |
||
|
|
ab3710de3a |
hooks: onSignIn tells a request hook of an account to sign in again
shannnnnks on X: with several Codex accounts behind the gateway, one is
now and then signed out, and they want the notify plugin to push it.
The magpie that serves the gateway now looks every 2 minutes (first
after 1) at the same sign-in states the desktop alert reads
(provider.WatchSignIns' checkSignIns, so every provider: Claude, Copilot
and plugin accounts that lapsed, and built-ins whose mark says the
sign-in expired or must be done again, Codex's revoked and refused
refreshes among them; accounts in use only). Each account to sign in
again, and each Claude sign-in ending within days, goes to every hooks
file that exports onSignIn, once until the account works again, kept in
signin-hooks.json beside the desktop alert's own file. The event is
{provider, providerName, account, state: "signed-out"|"ending", endsAt?}:
the account is its display label; no token and no vendor reason text.
It is fire-and-forget in the Bun host (gatewayRequest operation
"signIn"), each hook under its own timeout, one that throws doesn't stop
the next. With no hooks file nothing is looked at or marked. A hooks
file may now export onSignIn alone, without onRequest.
Docs: gateway-request-hooks.md (Sign-in notification),
providers-accounts.md, site plugins.html en/zh/ja.
Run on mote at d939dd699 (on origin/main 835439ebf; then rebased on
|
||
|
|
769a625548 |
gateway: its own settings sit under a Settings head, apart from the calls
The owner (11-09): "这两个卡片为什么贴在一起?" The Recent calls list and the gateway's own settings card touched with no gap. The settings card now has a Settings row-head of its own above it (the page's 14px head margin), hidden with the card when the gateway built-in isn't found. Run on mote: gateway-own-settings.test.cjs and i18n-keys.test.cjs, Chromium and WebKit, every language, 1100 and 420 wide: 24 of 24. Broken by hand: with the head and its hide line taken out, 20 of 20 red (the head's text and the gap of at least 10px are checked). Not tried: the real app window; the full GUI suite runs with the next commit. |
||
|
|
3d49ac069e |
usage: a 24 hours period, and the period picked is kept
The Usage page's periods were Today, 7 days, 30 days and All. "Today" starts at midnight, so early in the day it shows almost nothing (mahiro233 on Discord). A "24 hours" period now sits after Today and asks the server for its rolling window, last:24h (#2075), with an hourly chart. Its empty state says "No calls in the last 24 hours." (en, zh, zh-TW, ja, de). The menu bar's credit days count it as 2. The period picked from the list is kept in localStorage and the page opens on it next time. Picked day ranges aren't kept (they go stale), and neither is a period the URL brings (?period=7d from the menu bar). Tests: usage-24h.test.cjs (new; Chromium and WebKit, en and zh, 900px): 24 hours sits after Today and asks for last:24h, its empty note, a reload opens on the kept pick, ?period=7d is not kept. Five usage tests counted the period list by index and were moved one along. Run on mote at |
||
|
|
be2d2db5c3 |
gui tests: gateway mode's hidden alerts are read through their Alerts list
|
||
|
|
446579d05c |
site: verify usemagpie.ai in Bing Webmaster Tools
BingSiteAuth.xml and the msvalidate.01 meta on the home page. Bing's XML check failed to fetch the file (curl as bingbot got 200), so the meta tag verified it. Deployed (7b23789f), live page checked with curl; the sitemap is submitted in Bing. |
||
|
|
835439ebf7 |
gateway: a parallel call sent on an earlier call's index gets one of its own
jiezhengj on Discord: through OpenDesign's chat completions (amr-link,
which turns Responses into Chat itself; deepseek-v4.1-flash, 4 of 25
tries, and the auto group landing there 3 of 44), three parallel calls
streamed as index 0,0,1, the second call's argument fragments at 0 too.
OpenAI's and Vercel's SDKs (and DSH) add fragments up by index, so the
two calls' arguments became `{...}{...}` and the turn ended. opencode-go
on the same model: 0 of 55.
chatTidy, which every Chat SSE reply passes through, now gives a
fragment that names a function under a new id, on an index another call
already has, the next free index, and every later fragment at that
upstream index goes by it; later calls get their own (0,1,2). A
fragment that only carries arguments stays with its index's call
whatever id it has, so an upstream that rotates ids doesn't split a
call. A stream whose calls each have their own index is unchanged
(TestChatTidyGivesCallsAnIndex's indexed case).
Run (mote): go test ./internal/gateway -run TestChatTidy ok; -run
'Chat|Tool|Call|Index|Stream' ok (215s). New
TestChatTidyRenumbersAReusedIndex uses the reporter's frames.
Broken by hand: renumber returning the upstream index turns it red
(5 wrong indexes).
Not tried: a real amr-link stream (no OpenDesign account here); the
full suite runs after the push.
Reported-by: jiezhengj (Discord)
|
||
|
|
4c331696ec |
gui: an overview is summed once per stats and filters
The Sessions page asks /api/sessions/overview on every poll, and each
ask summed every session again (Stats.Overview: days, shapes, tool and
skill use, the top sessions) and encoded it, to the same answer while the
stats stood. The answer is now kept, encoded, by statsForGen's gen (it
moves only when the stats do) and the filters, the last 8 of them; the
Codex top rows' model and effort are added again only when
CodexModelEffort hands back another map (the map itself is held, so a
new one can't take the old one's address).
Measured on mote with the owner's real account copy (network blocked),
30 asks of /api/sessions/overview: 0.92s of CPU on v0.1.3435's tree,
0.24s with this (~31 ms -> ~8 ms an ask).
Run on mote: go vet + go test ./internal/gui, ok. TestOverviewSummed-
OncePerStats is red with the kept answer ignored by hand ("two asks of
the same stats summed 2 times, want 1").
Not tried: the GUI suite; the answer's bytes are json.Marshal plus a
newline, as the Encoder wrote them.
|
||
|
|
822817679f |
gui: the steady GC test waits for the heap's own GOGC, not Go's 100
|
||
|
|
00af08e7b8 |
routing: a renamed group still answers to its old id until a new group takes it
xinvxueyuan on Discord asked that renaming a routing group keep the old group/<id> working (agents and scripts still name it), and that the old id stop working only when a new group takes that id. A Group now keeps Former, the ids it had before RenameGroup, newest last. FindGroup, FindGroupAlso and Resolve (the gateway's known-model check) fall back to the group whose Former has the id (routedGroupOf). A group saved or renamed onto an id drops it from every other group's Former (dropFormer). A save that doesn't send Former keeps the old list. Run (mote): go test ./internal/provider -run 'Rename|Group' ok; go test ./internal/gateway -run TestRoutingGroups ok, with a new check: rename mine->ours, POST group/mine answers 200 through ours. Broken by hand: routedGroupOf without the Former loop turns TestRenamedGroupKeepsItsOldID red; Resolve without the fallback turns TestRoutingGroups red with 404 "knows no model group/mine". Full provider/gateway/gui/agent run and Linux/Windows vet started on mote after push; reds will be filed. Not tried: the GUI showing the old id anywhere (it doesn't list it). Reported-by: xinvxueyuan (Discord) |
||
|
|
37c247d1fc |
gui: the heap grows by a quarter between reads, 16 MB at least
steadyGCStart let a window's heap grow by half of what it holds (32 MB at least) between collections. On a real account's history, ~100 MB live, that rested at a 171 MB footprint with a 200 MB peak. A quarter (16 MB at least) costs the polls nothing measurable and gives the memory back. Measured on mote (macOS 27, M5 Pro) with the owner's real account copy, network blocked, the v0.1.3435 tree: - idle 115s: footprint 171 -> 146 MB, peak 200 -> 166 MB, CPU 0.33s both - 60 busy rounds of state/providers/drift/sessions/overview: CPU 5.12s -> 5.14s, footprint 157 -> 151 MB, peak 177 -> 169 MB Run: go test -run 'Steady|GC|Tight' ./internal/gui on mote, ok; gofmt clean. TestSteadyPercent's cases follow the new numbers. |
||
|
|
803d7747e7 |
gateway: an account rate limited till a time its vendor named is not asked again before it (hsjzg58958 on X)
hsjzg58958 on X: a vendor limited an account for 300 seconds, and magpie asked it again about every half a second as the agent retried, until the vendor flagged two accounts. Cause: a candidate resting on a 429 was still "tried all the same" when it was the last one left (restLast/probeOne), and the last one left was never rested at all, so every client retry went upstream. Codex on its own sign-in is relayed by codexUpstreamOn outside the candidate loop and had no hold at all. Fix: - timedHeld/vendorTimed (fallback.go): when every candidate left rests on a 429 whose time the vendor named (Retry-After, anthropic-ratelimit-*- reset, x-ratelimit-reset-*, resets_in_seconds/resets_at), none is asked; the agent gets 429 with Retry-After = when the first is back. A ChatGPT account out of its allowance is answered as the backend's usage_limit_reached with its x-codex-* windows (Rest.out/outHeader). - The last one left now rests too on such a 429 (vendorSaidWhen); a 429 naming no time rests nobody, as before. - codexHolds (codex_held.go): Codex's own relayed sign-in is held till the vendor's time; its retries are answered locally with the stored body, x-codex-* headers and Retry-After. Lifted by restarted() for quota holds. - Not held: LimitRestOff accounts (the user's setting), auto-reset weeks, rests "there" (answered by the vendor's own hold), Codex's API key. Run: - New TestRateLimitedKeysHeldUntilTheirReset (4 signals x 1 and 2 keys) and TestRateLimitedCodexAccountsHeldUntilTheirReset (3 refusals x 1 and 2 accounts): red at |
||
|
|
7db3478275 |
agent tests: LAZYCAT_APP_DOMAIN is listed as not an agent's folder
TestFolderVarsAreListed has been red on main since |
||
|
|
7e5cebb86c |
usage: a model list fetched again unchanged keeps the usage index
Each account's model list is fetched again on every start and every 45 minutes, and saveLive writes it again with only its "fetched" time moved. Usage keyed the request index (and its file on disk, requests-v1.bin) and the priced summaries on that file's mtime (statKey(catalog.LivePath)), so each such save dropped every chunk: every start, and every refresh while running, read the whole session history again, decoded every call shard and rebuilt every row. catalog.LiveKey names a saved list by a hash of its bytes without the fetch time, made once per parse of the file (readLive's memo). A list saved before Since was kept is dated by its fetch (LiveSince), so its fetch time stays in its key. usage's liveListKey uses it for every provider and Antigravity in readRequestState's meta and in usagePriceCacheKey (the same mtime key, the sibling), and falls back to the stat when the list can't be read. Found by dumping both disk headers on mote: same binary, same sources, and only the providers' hash differed, run to run. Measured on mote, a copy of the owner's real accounts, GUI open, network blocked, the Claude list rewritten as a start's fetch does. Restart of the same build, t10 (main) against t11 (this): CPU in the first ~3 minutes 11.6s -> 2.5s allocated 2.74GB -> 0.81GB sessions.loadCalls 771MB -> gone from the top footprint 174MB -> 175MB The first start after an upgrade that changes usage's code still builds everything once (requestDiskBinary), as before. Tests: TestRequestStateKeptAcrossAListFetchedAgain saves the same list again an hour later and needs readRequestState's meta and usagePriceCacheKey unchanged, and both changed for another list; on the old usage code it is red on both. TestLiveKeyOnlyMovesWithTheList and TestLiveKeyOfAnOldListKeepsItsFetch cover the key itself. Run on mote at this tree: go test ./internal/catalog ./internal/usage ./internal/provider -count=1 ok; go vet ./... ok; GOOS darwin/linux/ windows go vet ./internal/catalog ./internal/usage ok (./... cross-OS stops at wails' cgo files, as on main); gofmt clean. Not run: the full ./... suite before the push (running after), GUI. |
||
|
|
80161247a0 |
gui: the core scripts back under their budget after ecc16fe97
|
||
|
|
e21b401402 |
gui tests: group-editor-fits waits for the fold's label column to settle
The advanced fold takes its label column from edAlign, a ResizeObserver
that sets --ed-lab a frame or two after the editor opens. The test
measured the frame before: "the pattern field spans the models' column"
was red 1 of 3 runs on origin/main
|
||
|
|
c6331b427c |
routing: a group bound to gateway keys is theirs alone (Xerxes754)
Xerxes754 on X asked to bind a routing group to one or two gateway
keys, so other keys neither see nor use it. Before this a key could only
be held to models from its own side (naming group/<id> in its Models);
a key with no limits reached every group, and nothing on a group could
keep it from one.
A group now has Keys (key ids). Set, only those keys, and keys issued
under one of them, may use it:
- groupBarred/groupGiven in key_models.go answer it for every route that
reaches a group: chat, responses, messages, count_tokens, embeddings,
images, video, the decider and the subagent and image MCP paths. Any
other key gets 403 "bound to other gateway keys", naming the group and
the Routing page, and nothing goes upstream.
- /v1/models and /v1/models/{id} leave it out for any other key, a key
held to models that names it included. provider.GroupsBound keeps an
unbound magpie's list as before.
- A keyless request from this computer uses it, as key limits never
hold one; callerGuard now names a loopback request's key when it
sends one, so a key used locally is held too.
- SaveGroup keeps the stored keys when a save doesn't name them (the
CLI, the TUI, the card toggles); an empty list clears them. Ids are
trimmed, deduped and capped. Sharing a group leaves its keys out;
importing over one keeps them.
- GUI: Routing, a group's Edit, row "Gateway keys" (网关密钥) with a
button "Any gateway key" (任意网关密钥) that opens the app menu of the
user's keys (multi-pick); a bound key since deleted shows "key
deleted" (密钥已删除). The row shows once there is a key to bind.
/api/groups lists gatewayKeys (no browser, read-only or issued keys).
zh, zh-TW, ja, de strings.
- Not covered: a bound group nested in another group is reached through
the outer one (documented in gateway-routing.md).
Run (mote unless said), at this head rebased on
|
||
|
|
ecc16fe979 |
usage: the quick panel and the Usage page word unpriced calls alike
The quick panel's Cost said "15 个没有价格" while the Usage page's
said "15 次调用没有已知价格,未计入". Both now say "{n} calls unpriced"
("15 次调用未计价"), as the page's other cost heads already did, with
the whole sentence on hover.
Reported-by: tenacious_eagle on Discord
The Usage page's plugin already had the two count keys; they live in the
core's i18n.js now that the quick panel says them too (i18n-keys: no key
twice, a plugin's words are its own). The Overview calls tile says the
same words, so usage-unpriced-sum's tile wording follows.
Run on mote at origin/main
|
||
|
|
ac4af58230 |
gateway: a LazyCat app is shared at its own domain, and a cgroup v2 container is known
mtoolstec on X runs magpie in LazyCat (懒猫微服) and, with "Share on local network" on, Settings offered http://172.28.3.65:3425: the container's own address, which nothing outside the box reaches, and no hint that it was a container's. LazyCat injects LAZYCAT_APP_DOMAIN (magpie.<box>.heiyu.space) into every container of an app and serves the app there over HTTPS. The magpie-lzcapp package sets MAGPIE_PUBLIC_URL=https://{{.S.AppDomain}} through a manifest template, which only lzcos 1.3.8+ renders; unrendered, url.Parse refuses the "{" host and publicURL() was "" (the log says "ignoring invalid MAGPIE_PUBLIC_URL"). A hand-written manifest may not set it at all. Then ContainerAddrs() needed inContainer(), which knew only Docker's and Podman's marker files and a runtime's name in PID 1's cgroup. Under cgroup v2 with a private cgroup namespace (Docker's default since 20.10) /proc/1/cgroup is "0::/", and a runtime that writes no marker file got past it, so the container's addresses were listed as the computer's. - publicURL() falls back to https://$LAZYCAT_APP_DOMAIN when MAGPIE_PUBLIC_URL is unset or invalid (a DNS name only; lower-cased). Everything built on PublicURL follows: LANURLs, PublicHost (the rebinding Host check), magpie web's links and trusted origin, the image MCP base, the CLI's advertised URL. InContainer() is true there too (updates go through the image). - inContainer() also takes a container's init as PID 1 (magpie itself, as our image starts it; tini, docker-init, dumb-init, catatonit), and a cgroup namespace's root ("0::/") on an overlay root filesystem (/proc/1/mountinfo). Neither alone catches a host: a systemd host is in /init.scope even on a read-only overlay root, and an init without cgroups on ext4/btrfs is not overlay. hostNetwork is unchanged, so a container on the host's network still lists the host's addresses. What the user sees: in LazyCat, "Share on local network" shows https://magpie.<box>.heiyu.space (and the Gateway URL is that domain). In any other cgroup v2 container on a bridge network without a marker file, Settings shows the container hint to set MAGPIE_PUBLIC_URL. Run: - TestInContainer (13 fake roots: systemd host, systemd on overlayroot, cgroup-less init on btrfs, WSL, markers, cgroup v1, kubepods, cgroup v2 on overlay, magpie/docker-init/tini as PID 1) and TestLazyCatPublicURL (LazyCat domain, mixed case, the unrendered template, MAGPIE_PUBLIC_URL winning, bad domains) pass on Linux (wsl-run, magpie-desktop). - Broken by hand: with origin/main's lan.go both tests are red (4 and 4 cases). - Real systems: the WSL2 distro (systemd host, 0::/init.scope) reads inContainer=false. Docker 28.2.2 on xiaomi-gpu, debian:12-slim with /.dockerenv removed (cgroup "0::/", overlay root, PID 1 sh) reads inContainer=true hostNetwork=false; with --init (docker-init) true; with --network host inContainer=true hostNetwork=true, so it still isn't called a container's addresses. - go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., and the darwin/linux nogui/windows builds pass on mote at the first base ( |
||
|
|
fdd38154b8 |
docs: the Usage, Video generation and sign-in links to their settings
gui-shell.md, gateway-routing.md and providers-accounts.md name the links 22c665d6f, |
||
|
|
3b550a99c7 |
providers: a sign-in kept to its link leads to the setting that kept it
With Settings › Privacy › Sign-in pages' "Open sign-in pages in the browser" off, adding an account says "magpie didn't open the sign-in page, as set in Settings" and gave no way to that setting (the scattered settings audit after netube99 on X). That line now ends in a Settings › link that opens Privacy and lights the row. The row stays in Privacy: it is there for max2020's reason, a vendor seeing which browser a user signs in from. app.js's core budget is met by one comment cut beside it, no raise (38 bytes over before the cut). Run (mote, through mote-run, Chromium and WebKit): signin-link-only (every language, both a link-only and an opened sign-in, which has no link), video-gen-pick and i18n-keys, 78 of 78; TestCoreScriptBudget ok after the cut. Broken by hand: no link, signin-link-only red in Chromium. Not tried: a real sign-in in the app; the whole GUI suite runs after the last of these changes. |
||
|
|
cedacf1aea |
settings: Video generation's how-to leads to the Providers page
With no model that makes videos, Settings › Models › Images' Video generation says to right-click a model in its provider's Model settings and mark it a video model, on another page, with no way there (the scattered settings audit after netube99 on X). The line now ends in a Providers › link that opens that page. It is drawn in videogen.js, so the core script doesn't grow. Run (mote, through mote-run, Chromium and WebKit): video-gen-pick (every language it covers, 1100 and 400), signin-link-only and i18n-keys, 78 of 78; TestCoreScriptBudget and the I18n Go tests. Broken by hand: no onclick, video-gen-pick red in Chromium. Not tried: the real app's window; the whole GUI suite runs after the last of these changes. |
||
|
|
8607a7a029 |
library: a skill GitHub's limit left unchecked leads to the token's row
A skill check that ran into GitHub's 60-an-hour limit says "Add a
GitHub token in Settings → Network and sharing", in a status line that
fades and a tag's tooltip, and nothing there went to Settings (the
scattered settings audit after netube99 on X). The Not checked tag is
now a link when the limit was the one without a token: it opens
Settings › Network and sharing and lights the GitHub token's row. A
token's own limit has nothing to add there, so its tag stays plain.
github-token.test.cjs swaps its route between rounds with
unrouteAll({ behavior: "ignoreErrors" }): the click leaves Settings'
lazy files being served, and the old unroute made the next round's
handler fulfil a route already handled.
Run (mote, through mote-run): github-token.test.cjs, Chromium and
WebKit, en and zh, 8 of 8; github-token plus every
library-*.test.cjs before the route fix: 1211 pass, the one red that
route race.
Broken by hand: the tag never a link, 4 of 8 red (each limited case).
Not tried: the real app's window; the whole GUI suite runs after the
last of these changes.
|
||
|
|
fc9ce34d86 |
usage: hashRows reuses its scratch, within sizes its rows exactly
Startup on a copy of the owner's real accounts (mote, GUI, network
blocked, acgui.sh) allocated ~3.5GB, and two usage functions were near
the top of it:
- hashRows built a fresh 32KB byte buffer and shape map for every chunk
it hashed: 510MB of the startup's allocations. It now takes them from
a sync.Pool and clears the map before use. The digest is the same
byte for byte (checked against the old code on the same chunks).
- rowChunk.within appended into a nil slice, growing it step by step
(292MB flat). It now counts the rows in range first, returns nil when
there are none, and makes the slice at that size.
Measured, same real-account copy, t9 (main) against t10 (this):
startup CPU 13.81s -> 9.77s
allocated (3m) 3483MB -> 2768MB (hashRows 510MB -> gone,
within 427MB -> 244MB cumulative)
footprint 179MB -> 175MB
Tests: TestHashRowsReusesItsScratch hashes a chunk again after a bigger
one and must get the same digest, and must allocate under 16KB a call
(min of 5 batches, so other goroutines' allocations don't count). Old
heat_disk.go: red at 32768 bytes a chunk; dropping clear(shapes): red.
TestWithinSizesItsRows needs len = cap = 600 (old code: cap 646).
Run on mote at this tree: go test ./internal/usage -count=1 ok, -race
ok, gofmt clean, go vet darwin/linux/windows ok, gui tests ok earlier.
An earlier usage run went red on a test whose name was lost (the log was
cut by tail); four full runs since are green, and the likely cause, the
first byte check counting other goroutines, is what the min-of-5 fixes.
|
||
|
|
3a5e4b62d0 |
usage: TestRowTokensAndZoneKept compares the zone by name and offset
The test compared got.Time.Location() with its own *time.Location by pointer. rowZones keeps the first zone it sees for a name and offset, so under -count=3 the second run got the first run's location back and the test went red on unchanged code. It now checks the zone's name and offset (IST, +5:30), which is what rowZones promises. Run on mote: go test ./internal/usage -count=1 ok; -run TestRowTokensAndZoneKept -count=3 ok (red on the old test). Broken by hand: writing the row with an "XST" zone turns it red. |
||
|
|
92be1d779b |
usage: the allowances' head opens Settings › Allowances
The Usage page draws the allowances, but how they are shown (used or
left, the menu bar's figures) and their alerts are set in Settings ›
Allowances, and nothing on the page said so (the scattered settings
audit after netube99 on X). The allowances' head now has a Settings ›
link, as the Routing page has, that opens that tab and lights the
Allowance display row (now #quotaLeftRow). Wired in the usage plugin,
so the core script doesn't grow.
Run (mote, through mote-run, Chromium and WebKit, every language, 1100
and 420): settings-places, mobile-web (with an origin/main baseline;
the button is taken out until the baseline has it, as rtToSet is),
account-mask, quota-curve, i18n-keys: 89 of 89, twice. A first run had
one red whose name a tail cut off; the next two runs of the same files
were 89 of 89, so it is unnamed and not seen again.
Broken by hand: no onclick, settings-places 2 of 2 red (no row lit);
no #quotaLeftRow, 1 of 1 red.
At the pushed head (rebased on
|
||
|
|
f37de8cc4e |
provider: the saved Claude accounts' files are listed once per request
claudeCodePrice and claudeModelsOf listed claude-accounts/*/.claude.json with filepath.Glob on every call, and each Claude model's price asks. Building an agent's model list (the window's drift poll rebuilds it each minute, buildClaudeVia and Pi's list) read the folder once per model. The listing is now held while a request holds the catalog (heldOf, 1 s), so a build lists it once; outside a hold it is listed afresh, as before. Measured on mote, real-account copy, GUI page open in Playwright Chromium, network blocked, 115 s CPU profile (acgui.sh), v0.1.3425-era build vs this change: - filepath.Glob: 50 ms -> gone; agent.buildModels 90 ms -> 50 ms - total samples 320 ms -> 290 ms; footprint 197 MB -> 172 MB (one run each) Test: TestClaudeCodeFilesListedOncePerHold saves a folder during a hold and checks the hold's second listing is the first one (same array), and that after the hold the new folder is seen. Broken by hand (the old claudeCodeFiles): red, "listed again within one hold". Run (mote): go test ./internal/provider ./internal/agent ok; go vet native (provider, agent), GOOS=linux and GOOS=windows (provider) ok; gofmt clean. |
||
|
|
623e797fde |
plugin pages: read a day's usage and share a picture they drew
A plugin's page can now read one day's usage and share an image it
drew. This is for the day card (JungleyYeh on X asked for a "daily AI
statement"); the card itself is an optional community plugin,
@magpie-community/page-day-card.
- A page that asks for the "usage:day" read gets that day as
magpie.read("usage:day", {date, tz}): totals, each agent and its
models, the streak and the average active day (usageapi/day.go,
gui/pageday.go). The Plugins page names the read before it is granted.
- magpie.image.copy(png) and magpie.image.save(png, name) share a PNG
of at most 16 MB. In the window they go through
POST /api/plugin-pages/image (pageimage.go): copy puts the picture on
the clipboard (clipimage.go: osascript PNGf on macOS, PowerShell
PNG + Bitmap on Windows, wl-copy or xclip on Linux), and save writes
it to Downloads under a name made safe. In magpie web, the browser
saves or copies the picture itself.
- The window's side, pageshare.js, is imported the first time a page
shares a picture. The core grows by its one call only, paid for by
comments cut, so the budget is not raised.
Tests:
- New: TestDayOf, TestPluginPageReadsADay, TestPluginPageSharesAPicture,
TestPageImageName and TestClipImageCommand. plugin-page.test.cjs
covers the bridge, both engines and a refused SVG.
What was run (mote):
- gofmt, plus go vet on darwin, linux and windows: clean.
- Full go test ./... at the pre-rebase base: 369 packages ok, 3 FAILs.
- TestEveryRouteHasACommandOrIsNamed and TestCoreScriptBudget were
this change's own reds. The new route now has a parity entry, and
the share code moved into lazy pageshare.js with no raise.
- TestGatewayModeStatsNameTheGatewaySessions is #5690, the red in the
first hour of the day (it ran at 00:32).
- GUI suite (affected and plugin files, both engines): 1160 of 1179
passed. Every red is filed and none touches this change:
- i18n-keys "a plugin's words are its own": #5332, #5426, #5482.
- page-width-steady: #5013.
- plugin-card-update in WebKit: #3079.
- plugin-move-unserved "Try again": #4410.
- At this head, after the rebase on
|
||
|
|
bc8b01d603 |
claude: the short system prompt is set in the Claude Code editor, not Settings › Replies
The scattered settings audit after netube99 on X. Short Claude system
prompt and Claude Code's interactive mode changed only Claude
subscription runs, yet sat in Settings › Models › Replies, while the
Claude Code editor already had its own "Claude Code runs as" switch for
the second, whose card said "Switched here or in Settings › Models ›
Replies".
Both rows now go in a claudeRunList in the Claude editor (PROV_PREFS), so
Settings' search still finds them and Open goes to the editor. In the app
the editor's own "runs as" switch is the one shown, and the duplicate
interactive mode row is hidden by CSS; in magpie web as a gateway, where
that switch is disabled, the row shows (the list gets a gw class from
renderReplies: body.gateway-mode is set only on a change, not at boot).
provPrefsField lets Claude's run list through in gateway mode, without
the warm-ups, which are this computer's. The card and the "off" reason
no longer name Settings (zh, zh-TW, ja, de written with them), and the
bridge's subsystem page names the editor.
Run (mote, mote-run, origin/main
|
||
|
|
8f72f95304 |
provider: a group's lookup copies the group found, not every group
FindGroup, FindGroupAlso and GroupFinder built every routing group with groupsIn, which copies each group and its rules, to return one. The window's 15-second /api/drift poll asks GroupFinder for each Pi model on a group (piModelJSON), and the gateway asks once per request on a group. They now read the groups held (sharedGroupsIn, heldFrom while Hold is active) and copy only the group found and each group a member comes through (cloneGroup), so what a caller gets is still its own to change. Measured on mote with the real-account copy, GUI page open in Playwright Chromium, network blocked, 2 minutes (acgui.sh): - piModelJSON allocations: 10.6 MB -> 1.5 MB (v0.1.3420 vs this change) - process CPU 0.39 s vs 0.43 s, footprint 187 vs 197 MB: within the run noise of the once-a-minute catalog rebuilds; the drop is in the profile. Test: TestGroupFoundCopiesItselfAlone changes a found group, its member's Via and EffortMap, and checks FindGroup, GroupFinder and Groups still see the saved ones; then 50 looks must allocate less than 50 copies of every group (100 groups with rules). Broken by hand, each red: - A: sharedGroupsIn -> groupsIn: looks 5384832 B >= copies 4796000 B - B: no cloneGroup of the found group: index out of range (shared slice) - C: no clone of a member's sub-group: "a change to a found group reached the next look" Run (mote): go test ./internal/provider ./internal/agent ok; go test ./internal/gateway -timeout 45m ok; go vet native, GOOS=linux, GOOS=windows ok; gofmt -l clean. Not tried: a gateway request through a group with a real account (the path is the same FindGroup the test covers). |
||
|
|
a6e4cf7635 |
settings: what routing does sits under Models › Routing, and the Routing page opens it
The scattered settings audit after netube99 on X. Ask again after a
refusal, the Retry-After cap and the intent classifier's timeout were
under Models › Replies beside rows about a reply's content, and Busy
models last sat in Network and sharing, far from the routing it changes.
The four are now one Routing section under Models, after Replies, and the
Routing page's header has a Settings › button that opens Settings at that
section with its first row lit. The docs (reference.md, the site's
plugins page in en, zh and ja) name the new place.
Run (mote, mote-run):
- settings-places, retry-after-cap-setting, refusal-retries-setting,
classify-timeout-setting, model-load, i18n-keys and bare-ids, both
engines: all pass.
- mobile-web against origin/main
|