Each Providers page asked FileError whether providers.json reads, and
groupsKeeping whether any group unlists models; outside a held request
both parsed the whole file again (6.7MB growslice of 112MB per 40
/api/providers asks on the real-account copy). Both now use the parse
filememo keeps until the file changes (storedFile); FileError falls
back to read() only when that parse fails, so a broken file still says
so with read's own error. Both are read-only uses.
Run: TestFileErrorReadsParsedFileOnce red with the memo path taken out
("parsed the file 3 more times"), green with it; TestFileError* and
the unlist tests on mote.
providersState asked GroupFinder for a group's members once for every
agent on that group, and again for the gateway's group list, and each
ask built every member anew (a Member is 1408 bytes). groupsOnce keeps
what was found for the page's build; the page only reads it.
signInStates ran twice every two minutes all day: once for the app's
notification (WatchSignIns) and once for the gateway's hooks
(tellHooksOfSignIns). Outside a request nothing is held, so each
account's PluginOf built the plugins' list again (plugin.Cached reads
plugins.json and the plugins' auth) and Logins read every login again.
The look now holds the catalog (provider.Hold), as a request does, so
each is built once a look.
/api/providers grew five lists by append, each of large elements:
a group's members (Member, 1408 bytes) in membersFound, the picks a
vendor list lacks (catalog.Model) in providerInfoWith, and the
Providers and Presets lists of providersState. Each is now made once
at its count. membersFound also clones a member's path and builds its
key only after the checks that pass it over, and a group with no
member found still gives nil.
A Codex turn kept on a Responses WebSocket sends only the new items as a
delta, but the row's ↑ was the whole HTTP body magpie built before the
transport ran, so a long conversation read as ~13MB up per turn
(matrix0487 on Discord). overSocket now records what each socket write
carried (wroteSocket) and, when the turn went out on the socket alone,
replaces the HTTP figure with those bytes (sentOnSocket); a turn that fell
back to HTTP keeps the HTTP body and adds any socket write made before the
fallback. errCodexSocketAgain's retry on a new socket counts both writes.
The row remembers that it went over the socket: Record.Socket (json "ws"),
packed as Flags bit 16384 (rowSocket, added to TestRowFlagsApart). The
Requests table's protocol badge says "Responses · WS" and the details'
Protocol line "Responses · WebSocket".
Run on mote at this commit (rebased on origin/main b4a0a2a1a): gofmt -l
clean; GOOS=linux and GOOS=windows go vet of internal/gateway and
internal/usage; go test ./internal/usage ./internal/gui ok; go test
./internal/gateway -run 'Codex|UpBytes|Ledger|Socket' ok; node --test of
every ledger-*, usage-ledger* GUI file and i18n-keys, 502 of 511, both
engines. The reds are filed and untouched by this change: ledger-swipe
webkit (#5223) and usage-ledger's "newest live route needs no
return-to-live button" (#3104, #4078, #4626, #5048).
Broken by hand: without the deferred sentOnSocket,
TestCodexSocketRowCountsWhatTheSocketSent reads 50,360 B for a 253 B
delta; without the Flags set, TestRowKeepsSocket's packed rows lose
Socket.
Not tried: a real Codex Pro account over the socket, and the full suite
(it runs after the tag). There is no "saved by the socket" figure yet,
since PlainBytes isn't packed.
Reported-by: matrix0487 (Discord)
TestEveryRouteHasACommandOrIsNamed was red on this stack: the routes of
/api/memory, /api/memory/distill and /api/memory/dream have no
`magpie` command yet. They are the Library's Memory tab, so they are
listed in notYet as L (stage 3: the library), as the other library
routes are. Agents already reach memory without the GUI through
`magpie mcp memory`.
Run on mote: go test -count=3 -run TestEveryRouteHasACommandOrIsNamed
./internal/cli ok.
00af08e7b (01:08 today) let a renamed routing group still answer to its
old id, through Former. TestGroupSetID still asserted that group/auto-m
finds nothing after `group set auto-m id=m`, so internal/cli has been
red on main since then; it fails at c02a491e8 on a clean checkout.
Bisected on mote from b855cfee9 (ok) to 00af08e7b. The test now asserts
what 00af08e7b intends: the old id finds the renamed group "m", never a
second group of its own.
Run on mote: go test -count=3 -run TestGroupSetID ./internal/cli ok.
Broken by hand (expecting another id): red.
The Memory tab gets a second row under Learn from conversations. It is
off by default. Switched on, the first tidy is due at the next 03:00.
Tidy now runs one at once, and Undo puts the last one back. While
distillation is off, the row has its own model picker; both rows share
one model.
Routes: POST /api/memory/dream {on}, /dream/run and /dream/undo.
GET /api/memory/distill carries "dreaming", so a tidy no longer shows
as conversations being read.
The prompt's stale rule is narrower. On the first real run it set aside
two decisions because "the work is done". Now only a note that later
notes contradict, one past its date, or one about a finished one-off
task is stale; a decision, direction or preference stays.
docs/subsystems/memory.md gets a Dreaming section.
Real run: a sandbox memory.json of 62 real distilled memories, 12 active
and one each user-written and pinned, with auto/claude-haiku-5-5 through
the live gateway.
- Before the prompt change: 12 changes in 48s, 10 merges and 2 set aside.
Both set-aside notes were decisions.
- After: 12 merges in 46s, none set aside. Each merge joins real
duplicates (three ~/.codex/sessions cleanup rules into one, the
TestFlight 1.66/1.68 pair). One went into the fixed memory, whose text
was kept word for word.
- Undo: 25 restored. memory.json's ids and statuses equal the backup
taken before the run, and every merged memory is gone.
Broken by hand, each red:
- Undo not reloading the list: library-memory 22 failed.
- Ignoring DreamSince: TestDreamsOnceANight.
- A plan applied after an error: TestDreamFailureChangesNothing.
- Tidy's fixed guard and Untidy's status check: their memory tests.
Run on mote at this tree:
- go test internal/memory, memdistill, library: ok.
- internal/gui -run 'Distill|Dream|I18n|Budget': ok.
- library-memory.test.cjs: 22/22 in both engines.
- i18n-keys and i18n-en-no-cjk: 4/4 each.
- go vet (darwin), GOOS=linux -tags nogui, GOOS=windows: ok.
Not run yet: the full suite at this head.
370d2fd5f gave the Library plugin its own "no model" string, and
internal/agent's antigravity_test.go says those words too, so i18n-keys'
"a plugin's words are its own" went red. The note now uses the core
"No models", which is already translated.
Run on mote: i18n-keys 4/4, i18n-en-no-cjk 4/4 and library-memory 22/22,
all with the P3 GUI change in the tree too.
Switched on (off by default), once a day from 03:00 local time the
hourly loop shows a model each scope's memories, 120 at a time under
short names, the user's own and pinned ones marked fixed, and asks which
say the same thing and which are no longer true. memory.Tidy merges and
sets aside what it names; candidates distilled from conversations and
left unreviewed for 30 days are set aside too, with no request when
nothing else could change. A request that fails changes nothing: the
error is kept and the tidy is tried on the next tick. What the last tidy
did is kept in distill.json and Undo puts it back once.
The prompt names neither magpie nor a vendor.
Run: mote-run go test -count=1 ./internal/memdistill ./internal/memory: ok.
Broken by hand: applying the plan after a failed request turns
TestDreamFailureChangesNothing red; ignoring when it was switched on
turns TestDreamsOnceANight red.
Not tried yet: a real model (next, with the GUI).
The store side of the nightly tidy (Dreaming). Tidy takes a plan: merges
of memories that say the same thing, memories to set aside, and a date
before which unreviewed distilled candidates are set aside. What the user
wrote or pinned is never rewritten or set aside; merged with others it is
the one kept, word for word, and two of them are never merged. A merge
across scopes or of a memory no longer in use isn't done. Each change is
returned with the states it replaced, and Untidy puts back only what is
still as Tidy left it; a merged memory the user edited since stays.
Run: mote-run go test -count=1 ./internal/memory: ok.
Broken by hand: dropping the user/pinned guard on stale turns
TestTidyNeverChangesTheUsers red; dropping Untidy's "still archived"
check turns TestUntidyKeepsWhatTheUserChanged red (undo: 3).
A real run (Haiku through the live gateway, 10 of this Mac's Claude Code
conversations, magpie's config/cache/state in a sandbox, HOME real)
proposed 38 candidates. The ones without a quote were the assistant's
own standing instructions said back (run heavy commands on mote, no
git add -A, ask before deleting), not anything the user said. Now the
prompt asks for the user's words copied exactly and leaves out what
only the assistant said, and keep drops a proposal whose quote is
missing or isn't in the user's text (letters and digits compared,
case aside).
Same 10 conversations again: 24 candidates, every one quoting the
user, none of the echoes.
Run (mote): go test ./internal/memdistill: ok. Broken by hand: the
check off, TestReadsQuietSessionsOnce red (Added 5, want 3).
The Memory tab gets a row that reads finished conversations into
candidate memories (To review). It is off until switched on; switched
on it reads at once, then hourly (5 minutes after start, then every
hour), through the gateway this process serves under the agent
"memory", with the automatic model unless one is picked through the
app's menu. Read now runs it again; a run that stopped says why.
- memdistill: Keep (the hourly loop) and Running.
- gui: /api/memory/distill (GET, POST {on, model}), /distill/run;
distillComplete posts /v1/messages to the served gateway's handler
with the memory agent's token.
- library client: the row, its poll while a run goes, and the
memories reloaded when it ends; strings in zh, zh-TW, ja, de.
- docs/subsystems/memory.md: a Distillation section.
Run (mote, at this tree):
- go vet ./internal/gui ./internal/memdistill ./internal/memory; GOOS=linux
-tags nogui and GOOS=windows vet of gui and memdistill: clean.
- go test ./internal/gui ./internal/memdistill ./internal/memory
./internal/library: ok.
- node --test internal/gui/tests/library-memory.test.cjs: 22/22, Chromium
and WebKit, 5 languages, 980 and 420.
Broken by hand:
- the memories not reloaded after a run: the GUI test is red waiting
for the proposed memory.
- the token not the memory agent's (earlier): TestDistillCompleteThroughGateway
red on the Trace's agent.
Not tried yet: a real model's run (next), the whole GUI suite (queued
behind the suite lock on mote), the full Go suite.
A model reads an agent's session once it has been quiet for 30 minutes
and writes down what will hold beyond it: a stated preference, a rule
from a correction, a project fact the code doesn't say. Each one waits
in memory as a candidate (To review), with the session, folder and the
user's words it came from; nothing reaches an agent until kept.
- Off until switched on (distill.json); switched on, it looks back 7 days.
- Main sessions only: no subagents, gateway-only or read-only sessions,
none of its own (agent "memory"), and two user turns at least.
- At most 10 sessions a run, the latest first; a session is read again
only once it goes on. A model that fails stops the run and says why;
the sessions not read are read next time.
- The model is sent user and assistant text alone (no thinking, tool
calls or results), cut to 24k characters (start and end), with the
memories already known so they aren't proposed again. Its
instructions name neither the app nor a vendor.
- A distilled memory the user deleted isn't proposed again (2e0058330).
- An unreadable distill.json is never written over, and nothing runs.
Not wired to the gateway or the GUI yet (next commit).
Run: mote-run go test ./internal/memdistill (ok), go vet (ok).
Broken by hand, each red then green restored: the quiet check
(ReadsQuietSessionsOnce), the read-once mark (three tests), the
text-only filter (WhatIsSent), the on switch (OffReadsNothing), skipping
gateway-only/own sessions (ReadsQuietSessionsOnce).
Not tried: a real model; that comes with the wiring.
Distilling sessions (next) will propose candidates. One the user deletes
or archives is remembered by its text (Dismissed, the last 1000), and a
save from a conversation of the same text is skipped. An agent's own save
of that text is still kept. A memory an agent forgot in a scope isn't
proposed again in that scope.
Run: mote-run go test ./internal/memory (ok).
Broken by hand: Remove without dismiss, and Save without the Dismissed
check, each red in TestDismissedNotProposedAgain; restored, green.
Not tried: the distiller itself, which isn't built yet.
A tab after Instructions lists what the agents remember, in use, to
review (what an agent only guessed) and archived, pinned first then
newest; searches it, narrows it by where it applies, and adds, edits,
pins, keeps, archives and deletes memories (Delete asks with a second
click). Kind and scope are picked from the app's menu, never a <select>.
A card on top switches the digest in the ticked agents' instructions on
or off and names those agents, and offers Magpie Memory while it isn't
in the Library.
/api/memory (GET; POST saves the user's own or edits by id),
/api/memory/remove and /api/memory/digest; a change publishes the digest
at once and its reply carries `problem` when that failed.
Words other code also says (Archived, Pin, Keep, the kinds…) are in core
i18n.js; the rest in the library plugin's, in zh, zh-TW, ja and de.
docs/subsystems/memory.md describes the layer.
Run (mote-run):
- node --test internal/gui/tests/library-memory.test.cjs, Chromium and
WebKit, 5 languages, 980 and 420 wide: ok
- whole GUI suite: not run at this commit; it is queued on mote for the stack head (034f249af before the rebase)
- go vet ./internal/gui, GOOS darwin, linux, windows: ok
Broken by hand: the pinned sort read `b.pinned - a.pinned` (NaN for an
unpinned one) and the test was red in every language until `!!`.
Looked at: screenshots en light 980, zh dark 980, en 420.
memory_search, memory_save and memory_forget at /mcp/magpie/memory,
served and guarded as the search server is (serveMCP): another computer
reaches it only while magpie is shared, with a gateway key. A save
through it is active at once, origin agent, kept everywhere, for the
project (the git repository the agent works in, by its remote) or for
the agent alone; without a folder or a client name it says it can't
know rather than guess.
- The Library's market offers it as magpie-memory, run as
`magpie mcp memory` (browsermcp.RunMemory): stdio relayed to the
gateway with the folder it was started in (X-Magpie-Cwd) and the
client name from initialize (X-Magpie-Mcp-Client).
- Behind the MCP router the hub keeps it on this computer (hereOnly)
and passes the caller's roots and client in _meta (wantsCaller), as
it does for magpie's own server.
- OwnMCPPath lists it among magpie's own servers.
- Judged as its sibling servers are: a gateway key's MaxConcurrency
doesn't hold it (a tool call of a turn already held), and a read-only
key is refused (memory_save writes). The first full gateway run was
red on TestKeySlotEveryRoute and TestReadOnlyKeyEveryRoute until the
route was listed.
Run (mote-run):
- go test -tags nogui ./internal/gateway: ok (881.5s)
- go test ./internal/browsermcp ./internal/cli ./internal/memory: ok
- go test ./internal/library: ok (130.9s)
- go vet, GOOS darwin, linux, windows: ok; gofmt -l clean
Broken by hand, each red, then green restored:
- the hub not sending memory its caller (wantsCaller without isMemory):
TestHubTellsMagpieMemoryItsCaller "roots asked false"
- the relay not setting X-Magpie-Cwd: TestMemoryBridgeSendsFolderAndClient
- the gateway ignoring X-Magpie-Cwd: TestMemoryMCPSharedAcrossAgents
(a project fact kept everywhere)
Not tried: a real Claude Code or Codex mounting magpie-memory.
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.
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).
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 (c02a491e8): 9.4MB, of it dshFilesSum 2.1MB
- t19 (this): 7.7MB, dshFilesSum gone from the profile
Test: TestDshFilesSumReadsNoFileWhole (the sum equals the one for files
read whole, a change at the end of a 1.1MB list moves it, and a sum
allocates under 64KB). Broken by hand: with os.ReadFile back it is red,
1149490 bytes a sum for a 1140000-byte list.
Run on mote at this tree (rebased on c02a491e8): go vet ./internal/agent,
gofmt -l clean, go test -timeout 45m ./internal/agent ok (246s).
Not tried: Windows and Linux (os.Open/Read only, no OS-specific code).
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 (0d99261dc): codexLoginIn 3.08MB, codexWho 2.56MB
- t18 (this): codexLoginIn 0.52MB, codexWho gone from the profile
/api/providers ×40 is the same (117.5MB vs 115.4MB, sampling noise).
Tests: TestCodexWhoKeptByBytes (two accounts and a malformed one read
right twice; a second read, also from another slice of the same bytes,
allocates 0 times) and TestAuthMemoBounded. Broken by hand: codexWho
reading past the memo makes the test red (29 allocs, want 0).
Run on mote at this tree: go vet ./internal/provider, gofmt -l clean,
go test -timeout 45m ./internal/provider ./internal/gui: gui ok; provider
ok on 2 of 3 full runs, the third red on
TestCodexAppWorkspaceSwitchReadsEachWorkspace/reclaimed=false/backHome=true
(ws-team's usage never read), which is #5819, filed on main before this
change; alone, -count=20 passes 20 of 20 both on origin/main and here.
Not tried: Windows and Linux (no OS-specific code touched).
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 (803d7747e) in every run,
led-split too wide plus the empty #ledHScroll at the foot; green on
the new in both engines, again at the rebased head with ledger-swipe
and usage-ledger-leave.
- mobile-web 14/14 in both engines with a real git base in the copy,
so the desktop layout matches the base.
- Every GUI file the change can reach (1485 tests, both engines): the
reds are all red on base and filed: mobile-web desktop subtests in a
copy without .git (#5013), phone-connect-menu 420 (#4706),
usage-agents-hide (#2276), usage-computers sync tick in Chromium
(#5224), usage-fold (#3415), usage-ledger Requests (#5048).
ledger-swipe in WebKit flakes on base too (#5223).
- go test -tags nogui ./internal/gui ok (size budgets), also at the
rebased head; gofmt clean; go vet for darwin, linux and windows ok.
Not run: the whole GUI and Go suites. The run was queued over two
hours behind mote's suite.lock and never started; the change touches
no Go code.
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 51bdc985b let a window set
aside keep a cap set on it before, but offered no new one. Routing
already holds at such a window's own cap (WindowCaps.own, allowanceOf),
so only the meter refused.
Now a window set aside with a total (limit > 0) is a button too. Its
menu has no "Account's cap" item, since such a window never counts the
account's cap: "No cap on this window" is first and posts 0, and the
note says it has no cap. A window set aside with no total (Loomy's
永久积分, a bare balance) stays plain: there is no share or spent
amount a cap could read.
app.js pays for itself by five comments cut shorter; no budget raised
(TestCoreScriptBudget ok again at the rebased head, on origin/main
c3f91f449).
Run on mote: node --test window-cap (chromium and webkit, 420 and 1100,
en zh zh-TW ja de): 120 pass; window-cap-pool 40, account-cap 16,
i18n-keys 4 pass. go test ./internal/gui: ok after the last comment cut
(TestCoreScriptBudget 5 bytes over before it, the only red).
Broken by hand: the old guard back, window-cap's new test 20 of 20 red.
Not tried: a real WorkBuddy account with a cap on Credits.
Reported-by: 9won_25273 (Discord)
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 0d99261dc
copy (one {window} too many).
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 0d99261dc copy
(the editor's model chip never shows); not this change.
Broken by hand, each red: no line drawn; the link opening Sign-in pages'
row instead; the MAGPIE_NO_ACCOUNTS wording dropped.
Not tried: the real app window.
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.
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).
b53f4e7c4 kept hostnameOf's answers, but its sibling hostOf (the
host with its port, lowered, which the import and preset checks ask of
every base URL) still ran url.Parse on each poll: net/url.parse was
11MB of 146.6MB allocated over 40 asks of /api/providers on the real
account. Both now read one cache of parsed URLs (hostParts, reset at
512 entries).
Measured on mote with the real account copy (aalloc.sh, 40 asks,
alloc_space delta): 146.6MB (v0.1.3450) -> 128.5MB, -12%; url.parse
11MB -> 3MB (the rest is tencentPlanRegion, minimaxHost and
openCodeGateway). CPU for 30 asks 0.56s -> 0.53s.
Run: go vet ./internal/provider; go test -count=1 -timeout 45m
./internal/provider (ok) on mote. New TestHostOfKept fails with the old
hostOf put back by hand (2 allocations) and checks the port is kept,
the host lowered and an unparsable URL is "". Not tried: Windows and
Linux (no OS-specific code).
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.
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).
b72256b59 met the budget at its base, but a8aeb2cad, landed meanwhile, put
the core 21 bytes over it at the pushed head (1,533,823 > 1,533,802).
One comment in app.js cut to a line (the config reload on return), no raise.
Run on mote: TestCoreScriptBudget ok at this head (red at b72256b59).
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.
b53f4e7c4 built the price memo's key in a 160-byte stack buffer. A
maker price names every maker catalog, which is longer, so on the
real account every maker-price hit still grew the key on the heap:
pricedOnce was 25.5MB of 186.9MB allocated over 40 asks of
/api/providers. The buffer is now 1 KB.
Measured on mote with the real account copy (aalloc.sh, 40 asks,
alloc_space delta): 186.9MB (t13, v0.1.3446) -> 169.8MB (t14), -9%;
213.4MB before v0.1.3446.
Run: go vet ./internal/catalog ./internal/provider; go test -count=1
-timeout 45m ./internal/catalog ./internal/provider (ok, ok) on mote.
New TestMakerPriceKnownAllocatesNothing asks MakerPriced with the real
maker catalog list; with the 160-byte buffer put back by hand it fails
(1 allocation per ask), and it also fails if that list's key outgrows
1 KB. Not tried: Windows and Linux (no OS-specific code).
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).
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)
00af08e7b made a renamed group answer to its old id (Former), so
TestGroupSaveRenames' "auto-gpt-6-astra is back" went red: FindGroup of
the old id now finds the renamed group, as it is meant to. The check is
now that what answers is gpt-6-astra, never a found auto- group back.
Run (mote): go test ./internal/gui ok, ./internal/usage ok; red at
3d49ac069 before this, 00af08e7b's own suite never ran (its log empty).
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 ab3710de3), on mote:
- TestCoreScriptBudget: ok.
- editor-thumbs-batched, i18n-keys and quota-fit-batched: all ok, in both
engines.
- tencent-cloud: the "strip scrolled" test is red 4 of 4, as it is on main
(#4321). It fails before any click, at "the strip scrolls (0px)".
Run on the tree before the last comment trims (base 7e5cebb86):
- The 109 GUI files that touch thumbs, .segs, slide() or segsPlace, plus
i18n-keys: 2,099 tests, 39 red.
- The 7 files with reds were rerun at both the fix and the base. They give
the same reds on both (40 at fix, 39 at base; the extra one is skill-where
webkit, which is red only at base). Each is filed: tencent-cloud #4321,
settings-groups #5828, gateway-mode #3586, s3-sync #2448, skill-where
#5154, and masking-records #5830 (new). The panel-usage reds are the same
32 at fix and base.
Broken by hand, with the new test:
- Old assets: forced layouts 294 → 654 (WebKit), 296 → 656 (Chromium).
- thumbTo reading offsetLeft/offsetTop again: slow reads 650 → 1132
(WebKit), 787 → 1267 (Chromium).
- thumbNow on computed style again: slow reads 290 → 415 and 352 → 456.
Each goes red.
Not tried: the real app with 600 real accounts. The numbers come from the
page under Playwright's WebKit and Chromium with fake accounts. Not tried
in WebKitGTK either; there is no new browser API and no new motion.
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
3d49ac069, whose three commits touch only GUI assets, GUI tests and site):
- gofmt -l internal: clean. go vet of internal/plugin, gateway and
provider for darwin, linux and windows: ok.
- go test -count=1 ./internal/plugin ./internal/gateway: ok (123s, 950s).
- ./internal/provider: crashed in TestCodexAppWorkspaceSwitchReadsEachWorkspace
(concurrent map writes in its fake server, #5800, not this change);
run again with -skip WorkspaceSwitch: ok (130s).
- Red on the old code: with origin/main's host.js both new tests fail
(TestGatewaySignInHook: "magpie.hooks exports no onRequest";
TestRevokedAccountToldToHooksOnce: the hook never heard of it).
- Broken by hand: without the HasGateway gate, the gateway test fails
with "told with no hook".
Not run: the full ./... suite (queued behind ~10 suites on mote's
suite.lock). Not tried: the real app with a real revoked Codex account;
the GUI suite (no GUI file changed).
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.
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 be2d2db5c + this change: usage-24h, usage-range,
usage-phone-head, usage-ledger, usage-ledger-chart,
usage-ledger-open-settled, usage-refresh-flight, credit-days,
tray-totals, usage-head-steady: pass 148, fail 6. The 6 are
usage-ledger's "newest live route needs no return-to-live button"
(en/zh, both engines), which fail the same 6 on be2d2db5c without
this change (#3104). i18n-keys ok; go test -run "Budget|I18n|Script"
./internal/gui ok. No budget raised.
Broken by hand: none beyond the index shifts the old tests caught.
Not tried: the real app with a day of real calls.
Reported-by: mahiro233 (Discord)
7d177985f put the four alert rows under an Alerts heading and hides the
heading and its list as one in gateway mode, not each row. gateway-mode's
agentRows still read each row's own hidden, so it went red in both engines
in the full GUI run ([false,true,true,true,true]). A row now counts as shown
when neither it nor its list and heading are hidden. What the user sees was
right; only the test read the old layout.
Run on mote: gateway-mode.test.cjs 6 of 6.
Broken by hand: with the heading and list left out of the gateway-mode
hide, chromium en and webkit en go red on "agents' rows in gateway mode".
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.
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)
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.
37c247d1f made the least the heap grows by 16 MB. TestSteadyGCRetunes-
AfterACollection waited for GOGC 100, which holds only for a live heap
under the room; a whole internal/gui run leaves ~22 MB, so it waited
for 100 against 72 and was red in the package run (alone it passed,
which is all 37c247d1f ran). It now waits for steadyPercent of the heap
the last collection left.
Run on mote: go test ./internal/gui, ok (red before at warm_gc_test.go:220,
"GOGC after collections = 72, want 100"); -run SteadyGCRetunes -count=3 ok.
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)
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.
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 fc9ce34d8 (each key/account asked on every retry),
green after.
- Broken by hand: held branch off -> every case red (4 extra hits);
last-one rest off -> 1-key cases red, Retry-After lost; codexHeld off ->
1-account Codex cases red.
- mote: go test ./internal/gateway -run 'TestRateLimited|TestAllResting|
TestQuotaHeld|TestGroupSpent|TestCodex|TestRetryAfter|TestHeldLimit'
ok; TestCodexLeavingModelCompactsLocally updated (the used-up account is
now asked once, then held) and ok.
- gofmt -l clean; go vet, GOOS=linux -tags nogui and GOOS=windows go vet
and build ok.
- mote, whole internal/gateway package at the rebased head 46199a6ae
(on 80161247a): ok but for TestStrictAffinityPassesTheErrorOn, which
asserted the bug itself ("resting now, it is still the one asked"). A
strict conversation's account resting till ChatGPT's named reset now
gets its own usage-limit 429 from the rest, with nobody asked; updated,
and with TestRateLimited|TestCodexLeavingModel|TestCodexEveryAccountOut
ok at this head.
- The full ./... suite was queued behind six other sessions' suites on
mote's lock and not run before the push; queued again at this head.
Not tried: a real vendor account limited live (no account was rate
limited to test on); Codex API-key relay is not held (OpenAI's platform
headers are Codex's own to read); plugin providers are held only through
the shared candidate loop; a held Codex passthrough body's
resets_in_seconds is stale by the time elapsed (Retry-After is exact).
TestFolderVarsAreListed has been red on main since ac4af5823 made
gateway/lan.go read LAZYCAT_APP_DOMAIN. It is the domain LazyCat serves
magpie at, not an agent's folder, so it goes in notAnAgent with that
reason; no sandbox needs to clear it.
Run (mote, at this head): go test ./internal/agent -run
TestFolderVarsAreListed -count=1: ok. Red before the change in the full
suite at 7e5cebb86 (agentenv_test.go:124, the message naming
LAZYCAT_APP_DOMAIN).
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.