552cdf8071ffd50bed78f6a60df40c5f4e14cfda
4492
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
552cdf8071 |
redact: a value the model spans from the delimiter before it is masked (#3591)
The model's span may start at the token before a value: the `":"` of
a JSON field, a CSV row's comma. A phone number in
{"phone":"+86 139 1234 5678"} came as `":"+86 139 1234 5678`, and in a
CSV row as `,+81 90-1234-5678`, which the PHONE check took for no
number, and it went as written. A name came as `"Wei Zhang"` and was
masked with its quotes, so the JSON lost them. modelSpans now trims
spaces and `"',;:` from both ends of a name's, a phone's, an
address's, an account's and an email's span; a secret's only spaces,
since a password may start or end with a quote.
Found by TestMaskEval: its 3 #3591 phones are no longer Known, and
"both" reads 33/34 masked, 0/40 wrongly (from 30/34).
Run: go test ./internal/redact and ./internal/pii ok; -run
'Mask|Redact|Privacy' ./internal/gui ./internal/gateway ok; go vet
darwin, linux, windows; gofmt -l clean.
Broken by hand: edge = isSpace for every kind: TestModelSpanLeavesDelimiters
red (both phones as written, the name's quotes gone) and TestMaskEval
red on the 3 phones.
Not tried: the full suite (internal/proc's #3567 is red on main), a
real request through the gateway with the model on.
|
||
|
|
033990e642 |
redact: the masking evaluation starts with nothing known
A value Mask masks is known from then on, and masked wherever it is again (known.go), Preview's too. TestMaskEval ran after the tests that masked hunter2pass, rina.k@fastmail.com and the like, so in the package's full run what they masked was masked in its cases too, and the rules' column was not the rules': with one test before it that masked the eval's phones, rules read 19/34 for 16/34. Forget (export_test.go) lets every value go before the cases. 180cfb565's body says 38 cases; there are 39. Run: go test ./internal/redact (TestMaskEval in the full run and alone: 16/34 rules either way) and ./internal/pii ok; go vet darwin, linux, windows; gofmt -l clean. Broken by hand: without Forget and with a test before it that masks the eval's phones, rules read 19/34. |
||
|
|
a30aed0162 |
provider: the WorkBuddy mover tells two accounts of one nickname apart by uid
wakkana on Discord: WorkBuddy accounts with one display name collapse into one, deduped by name (wbWho's nickname, addSideLogin's EqualFold). Where that runs today: WorkBuddy's built-in sign-in is gone, so addSideLogin no longer writes WorkBuddy accounts. A sign-in through the plugin goes to the plugin host, whose settle already keeps two accounts of one name with different uids apart and lets the same uid replace itself (#413, TestPluginSameNameOtherUID, passes at this head). What was left by name is the mover, for accounts not moved yet: - wbLogins dropped WorkBuddy desktop's account when an account magpie signed in had the same nickname, whatever its uid (the generic "one of magpie's stands for the agent's own" rule). Now it stands for it only when the uid matches; one removed in magpie stays out. - renewedSince matched by name, so the desktop's marker read as the other "Me" renewed and the move would never commit. Moving and movedAccount carry the vendor's id (WorkBuddy's uid), matched by it where both have one; the agent's own is never compared; putBack skips by plugin key, not name. Other movers have no id set, so they match by name as before; their built-ins name accounts by email or login. The live addSideLogin callers (Copilot, Google, ChatGPT API) name accounts by login or email too. Sibling plugin: zcode 0.1.29 (plugins 5c9b7a4) now gives a uid, its min is raised in a separate commit. Run on origin/main |
||
|
|
a093e9c3a5 |
claude: a Claude Code run holding over its memory budget is let go after its turn, its session resumed (#3256)
claudeRoom bounded how many Claude Code processes run, not how large each one is. A run is kept for its conversation's next turn, turn after turn, and on a service never restarted one grew for days: a node-MainThread in magpie.service reached 8 GiB RSS on a 31 GiB host and the OOM killer took the machine down (#3256). Now each time a run's reply ends, its process tree's resident memory is read (proc.Tree.RSS: /proc VmRSS on Linux, ps on macOS, the working sets of its job's processes on Windows, so an npm claude.cmd's node counts) and logged with its pid. Over the budget (an eighth of memLimit on Linux, of the computer's memory elsewhere, 1 GiB at least, 4 GiB if unknown), a whole turn's run is not kept idle: its session is shelved and the next turn resumes it in a new Claude Code with --resume, told only the new messages. A run parked on tool calls is let go past 1.5x the budget (no session to shelve there; its results start a new run). Each Claude Code also logs pid and model at start, and run time, how it ended and peak RSS (ru_maxrss) at its end, so an OOM pid can be found in magpie's log. Budget on the reporter's 31 GiB host: 3.9 GiB. Run (worktree at |
||
|
|
59f02d42cb |
provider: the Qoder mover's min is 0.2.37, so a QwenWork personal account's usage shows what is left (plugins#385)
opencode-qoder-auth 0.2.37 (npm view --prefer-online: 0.2.37) reads a QwenWork personal account's account-context quota, whose total and used are null, as a balance of the credits left, with the daily, monthly and long-term pools from /api/v1/adapter/user/wallets, as QwenWorkCN.app 1.2.1's own client reads them. 0.2.36 called every such account "the account reports no credits". Run: go test ./internal/provider -count=1 ok (141.6s); go vet ./internal/provider for darwin, linux and windows; gofmt -l clean. |
||
|
|
180cfb565e |
redact: an evaluation of the masking, with the rules, the model and both
TestMaskEval scores 38 made-up texts of the kinds agents send (prose, code, logs, tool results, JSON, CSV, Chinese) with 34 values to mask and 40 to keep. The cases start from what users reported masked wrongly (#3144, #3143, #3029, #3538, #3577, |
||
|
|
5f17c5a38e |
gui: a request's tool results are orange in its context, not pink
The owner found the context map's colours a little off (10-25, the Routing card). Tool results, often the biggest tile, took the palette's pink, which at the map's 11% tint sinks to a maroon between violet, sky and slate. Of the drafts shown (current, results orange, equal lightness, stronger tint) the owner picked results orange. --k-results is #fdba74 in dark mode and #ea580c in light, deep enough there to stand apart from memory's amber (#f59e0b). Colorblind mode keeps its palette's --c5, as every other part does. Nothing else changes: the tint, edges, text mixes and the other parts' colours. Run (darwin): go test ./internal/gui ok; GUI in chromium and webkit: context-map 22/22, routing-context-fold 24/24, context-window 24/24. Not run: the whole GUI suite; no screenshot of light mode in the app. |
||
|
|
1dfa284840 |
usage: a plugin's row of text alone shows its text, not "· 100% left"
AutoClaw's 积分余额, Cline's balance, Cursor's Auto + Composer note and
the other plugin rows that are only words come to magpie as a window set
aside with a display and nothing counted (used 0, no amount, no limit).
Every surface read that used 0 as a share: the usage card said
"1,234 积分 · 100% left" (or "· 0% used") beside an empty meter, the
panel drew an empty ring, the TUI an empty bar, `magpie accounts` and
`magpie quota` "积分余额 0% (1,234 积分)", and the status line
"积分余额 0%".
provider: QuotaWindow.Text (json "text") marks such a row in
quotaOfPlugin: aside, a display, used/amount/limit all 0. Aside is
required: Cursor's On-demand "$0 / $20" isn't set aside and is a real
0%. QuotaSpan carries it to /api/quotas.
GUI (app.js): quotaText gives the display alone; the account row's
meter, the Usage page's track and the panel's rings leave the row out;
a panel card with only such rows shows their text on its line, as an
Unlimited card does. The tray's menu-bar text already skips aside rows.
TUI quotaCell, the CLI's quotaCell (accounts, quota) and statuslineCard
write the name and the text.
app.js stays under its budget (1,322,289, not raised; now 1,322,275):
to make room, the 8 copies of Math.max(0, Math.min(100, x)) are one
to100(x), and 8 one-line [..].filter(Boolean).join("\n") tooltips are
tipLines(..). Same results; the GUI files below cover those callers.
Readings cached before this release have no text flag and show as
before until the account is read again (a minute's cache, or Refresh).
Run, at this commit's tree (rebased on origin/main
|
||
|
|
99de8e1ad1 |
gui: the warm-up's whole-history reads hold Go to the memory it held when they began (#3493)
A cold build of the request index (after any update that changes
internal/usage) reads every session again and allocates ~1.2 GB to keep
~40 MB more. Even under GOGC 25 the heap overshot its goal into pages it
kept, so a cold start peaked ~70 MB over a warm one. underTightGC now also
sets a soft memory limit at what Go holds of the system's memory when its
read begins (total mapped less released), and puts the old limit back
after. A lower limit the user set is kept, and GOGC off gets none.
Real data, 15.7k sessions (sbpairs: copies of the real cache/config, the
real Claude Code and Codex session folders linked read-only), harness
TestZZWarm running warmSteps under sessions.Warm, phys_footprint_peak,
old =
|
||
|
|
54b198c5c1 |
gui: a plugin's page grows to its README on a spring, not in one jump
A plugin's page (Plugins › Discover) opens with a skeleton for its README, and when the README came in the dialog took its new height in one frame. Now detail()'s fill() measures the dialog, puts the README in, re-centres it (holdModal), and animates height and top together from the old box to the new on SPRING, the curve the dialog opened on (570ms, 1.5% over), clipped while it grows; the README fades in over it. Height and top move on one curve, so the dialog keeps the middle in every frame. The same for the error note when npm or GitHub doesn't answer. Reduced motion: no animation, as before. Budget: the core 1,530,050 -> 1,530,631, the 581 bytes of fill(), the Plugins page's own, no room added. Run at this head (rebased on |
||
|
|
9277c25673 |
masking: under the number, the flow's middle takes the card's width, and sits further from the chart
The owner's screenshot of Insights › 脱敏 with the band stacked: the animation stayed narrow, as each of the flow's three columns kept a third of the card, and it sat 16px under the chart. Under 780px the names now take what they need (fit-content, up to 150px, 120px under 640px) and the middle the rest; the gap is 28px. Measured in Chromium, the middle's width before → after: 760px window 386 → 452, 640px 189 → 365, 560px 162 → 285, 480px 135 → 205. 820px and up (the flow beside the number) is unchanged. Run: screenshots at 760, 640 and 560 in Chromium and WebKit, before and after; GUI masking-records 52/52, privacy-usage-stats 4/4, mask-actions 20/20, i18n-keys 4/4, click-scroll 22/22; privacy-model 23/24 in that run, beside a Go test run, and 24/24 three times alone after it (the failing test's name wasn't kept); go test -tags nogui -run Budget ./internal/gui ok. Not tried: the whole GUI suite; the real Linux app (WebKitGTK). |
||
|
|
3ee37aea64 |
gui: Codex's card has no subagent-model or memories square beside its settings rows
Codex's sheet has "Codex subagent model" and "Codex memories model" as
named rows (renderCodexSubagentModel, renderCodexMemories), just under
the card, and the card also drew a square for each: the same setting
twice (the owner, 10-25, a screenshot of the notebook square beside the
memories row). The squares are no longer drawn for the Codex those rows
read (id "codex", not gateway mode); they are left out of the extras
count and of the extras toggle too. A Codex in WSL, which the rows don't
read, keeps its squares.
Tests: codex-memories and codex-subagent-model run the square on a WSL
Codex and check Codex's own card has none; codex-subagent-model picks
and resets through #codexSubagentModelRow; codex-memories-settings
resets through the row instead of the square.
Run: GUI codex-memories, codex-memories-settings, codex-subagent-model,
codex-subagents-lead, desktop-subagent-model, Chromium and WebKit, every
language and width they have: 82 of 82. Earlier run of these plus
codex-start-model-field, subagent-effort, agent-prefs, agent-tweak-fold,
gateway-mode and mobile-web at concurrency 4: only the expected square
reds plus two page.goto/click timeouts under load (codex-subagents-lead
webkit zh-TW 560, desktop-subagent-model webkit zh 1100), both green in
the 82-of-82 run. After the rebase on origin/main the change was trimmed (one sq helper
for the extras toggle and count) and the budgets raised to its size:
app.js 1,322,537, core 1,530,050, with no room added (TestCoreScriptBudget
ok). Rerun at that tree: codex-memories, codex-memories-settings,
codex-subagent-model, agent-tweak-fold, gateway-mode, 58 of 60; the two
reds are gateway-mode's masking tab, red the same on origin/main
|
||
|
|
9dc7d6eb84 |
usage: a large build's archives are held in a spill file as they are made (#3493)
A cold build (first start, or after an update that changes internal/usage)
kept every chunk's archive on the heap until save had written
requests-v1.bin and swapped them for the file's pages: 31MB for 15.7k
sessions, the largest thing a cold peak held over a warm start's.
Now a build that wants requestDiskLeast or more files written writes each
archive to requests-*.spill as the chunk is made, lets go of the heap copy,
and maps the file once the build is done (unlinked at once). save then
swaps the spill's pages for requests-v1.bin's as before: pagesRank orders
heap < spill < file, and keep and save take the later. A spill that can't
be written or mapped has each of its chunks made again from its source, so
none is left without an archive. Windows maps no file, so nothing changes
there.
Run, real data (15.7k Claude Code + Codex sessions, sandbox HOME, copies of
the call shards, requests-v1.bin removed before each run), the gui warm-up
harness alternating old (
|
||
|
|
e4809a150a |
redact: a key of digits only after 密钥为, token 是, apikey:… is masked; PIN码, 安全码, 授权码 join the names (CyberCaius on Discord)
"密钥为12231241" in Settings → Masking's 试一试 came back "这里没有需要脱敏的
内容". ee715c2e0's key rules (a CJK name for a key or token, or an English
one before 为/為/是/:) asked for letters in the value, so that
"RSA 密钥为 2048 位" stays; an all-digit key went as written. 密码/口令 took
digits already (
|
||
|
|
4b1994ad31 |
agent: AionUi, added through its add-provider link
seven7032 on Discord asked how to connect AionUi to magpie. AionUi
keeps its providers in its own SQLite database
(<userData>/aionui/aionui-backend.db, WAL mode), each key encrypted, so
there is no config file for magpie to write. The one supported way in
is its deeplink. AionUi 2.2.2's main process parses it
(parseDeepLinkUrl), and its renderer opens Settings -> Model with the
add form filled in, which the user confirms:
aionui://add-provider?api_key=magpie-aionui&base_url=<gw>/v1&name=magpie&platform=custom
The AionUi row works the way Cindy's and Lody's do:
- Add magpie opens that link. /api/open allows the aionui://add-provider?
prefix only. `magpie aionui add` opens it from the CLI.
- The key is agentKeyAt("aionui"), so it becomes the LAN key while
sharing is on (added to TestPinnedGatewayKeyForEveryWriter).
- "custom" is AionUi's OpenAI-compatible platform. Its base URLs end in
/v1, as its own OpenAI preset's does.
- Added reads providers.base_url for the gateway's address without
touching the database (sessions.OpenUntouched, from the previous
commit). A database that can't be read is unknown, never "not added".
The last read is kept while the database and its log keep their size
and time, for 15s at most, so the Agents poll doesn't copy a running
AionUi's database every time.
- It is detected by userData/aionui (os.UserConfigDir()/AionUi on every
OS).
- As with Cindy and Lody, the TUI leaves the row out (nothing to pick).
Tests:
- TestAionUiLink: the link's exact bytes.
- TestAionUiLinkParsedAs2_2_2: runs the link through
testdata/aionui/deeplink-2.2.2.js, which is parseDeepLinkUrl copied
byte for byte from 2.2.2's app.asar (out/main/index.js 50995-51021)
plus the renderer's add-provider mapping and the form prefill. The
result is action add-provider, route /settings/model, and the form gets
platform custom, the /v1 base URL and the key.
- TestAionUiHas: a fixture database built from 2.2.2's real providers
schema (taken from the database 2.2.2 made at first start). It covers
none, another gateway, a row present only in the log of a running app,
and a closed app, and checks that AionUi's folder is unchanged each
time.
- TestAionUiUnreadableIsUnknown, TestAionUiStatusRereadsOnChange,
TestAionUiDetect, TestAionUiImportRow (GUI: the row, unknown status,
and /api/open refusing other aionui:// links).
- import-row.test.cjs gains the AionUi row (icon, known status in each
language, the click opens the exact link, and it fits at 420px), in
chromium and webkit across en, zh, zh-TW, ja and de. The same file
now waits for the rows to settle before its alignment check: under
load 105 one run caught Cindy's button mid-resize at 193.4px beside
the picker's 194.4px. The old file passed 3/3 alone, so it is a
timing assumption, not a layout bug.
Run at 18041fc5b (this change on origin/main
|
||
|
|
c26a418d23 |
agent: an import app's status magpie can't read is unknown, not "not added"
Agent.Added now returns (added, known). Cindy's reader turned any
failure (a locked, corrupt or unreadable cindy-local-v1.db) into "Not
added", which told a user who had added magpie that they hadn't. Now
an unreadable database is unknown: /api/agents leaves `added` out and
the row shows the "confirm it there" hint, as it does for Lody. A
stopped WSL distro's app is unknown too, not "not added".
Cindy's database is also read without writing beside it. A mode=ro
open of a WAL database while Cindy was closed made cindy-local-v1.db-wal
and -shm in Cindy's own folder. It now goes through
sessions.OpenUntouched, which is what the Cursor reader already did
(immutable with no log, from a copy with one), moved out of
openCursorStore so both share it.
The CLI's list still offers `magpie cindy add` when the status is
unknown; it never said magpie was missing.
Run: go test ./internal/agent ./internal/sessions ./internal/cli ok;
go test ./internal/gui -run 'Import|Lody|Cindy|Agents' ok.
Broken by hand: Cindy's reader put back on the mode=ro open made
TestCindyHasClosedWALAndUnreadable red ("Cindy's folder changed:
cindy-local-v1.db -> cindy-local-v1.db,cindy-local-v1.db-shm,
cindy-local-v1.db-wal"); api.go ignoring `known` made
TestImportStatusUnreadableIsUnknown red. Both restored, both green.
Not tried: a real Cindy install; the read is tested on fixture
databases only.
|
||
|
|
faa79ea2f5 |
redact: a Unix time the local model takes for a phone is not masked (#3577)
id.null (v0.1.1483) saw a tool result's "timestamp": 1792903687 go as
"timestamp": {{PHONE_c2ukh7gk}}. The PHONE rule needs eleven digits, so
the local model found it; v0.1.1457's check leaves a bare number alone
unless a cue is before it, but cues match inside words, and a log's
"tool_call" (or "telemetry") is "call" (or "tel").
A ten-digit time, or a thirteen-digit one in milliseconds, starting with
1 and nothing else, is now never a phone, cued or not: a North American
area code starts with 2 to 9, and a Chinese mobile is eleven digits.
The loose cues themselves are #3585.
Run: go test ./internal/redact ok; go vet darwin, linux, windows; gofmt
clean. Broken by hand: without the epochNumber check
TestModelPhoneKeepsUnixTime is red with the reporter's line masked.
Not tried: the real model on the reporter's whole tool result (their
screenshot only has the one line); the full Go suite.
|
||
|
|
fc91e58ba4 |
redact: a bare JSON number ("timestamp": 17929036837) is not masked as a phone (id.null on Discord)
The 脱敏 before/after view showed a tool result holding a session file's
JSONL line, and its "timestamp": 17929036837 went as {{PHONE_…}}. The
PHONE rule is 1[3-9]\d{9} bounded by digits, so any 11-digit number
starting 13-19 is a CN mobile wherever it sits. A phone, a card or an ID
number in JSON is a string; a bare number there is a count, an id or a
time.
Now a personal kind's value that is all of a bare JSON number is left,
judged by where it sits and its form, not by the key's name: digits only,
after "key": (an object's value) or inside an array of numbers, with only
, } ] or the text's end after it. It sits beside the decimal check
(noDecimals, now noNumbers), so it holds for what the rules, the model
and values known before find alike. A BANK_CARD (Luhn-valid snowflake)
and an ID_CARD's digits as JSON numbers are left the same way.
Still masked (tested): "phone": "13800138000", ["13800138000"],
phone:13800138000, "call 13800138000, thanks", 我的号码 13800138000,谢谢,
"numbers 13900139000, 13800138000]" (no [ before), a phone inside a JSON
string's text, "card": "4111111111111111", and every case of
TestStandaloneNumbersStillMasked. "phone": 13800138000 as a number is
left too; that is the cost of not going by the key's name.
Run at this head:
- go test ./internal/redact ./internal/pii ./internal/settings
./internal/masking ./internal/otlp ./internal/sessions ./internal/gui
-count=1: ok
- go test ./internal/gateway -run 'CJK|Mask|Redact|Privacy|PII|Secret': ok
- gofmt -l, go vet, GOOS=windows go vet, GOOS=linux go vet -tags nogui
./internal/redact: clean
- Broken by hand: with origin/main's redact.go, TestBareJSONNumberNotMasked
fails 7 cases (the reporter's line, {"n": 13800138000}, a spread-out
object, two arrays, the card and the ID number). The 10- and 13-digit
epochs were not masked before either; they are in the test to stay so.
Not tried: the GUI before/after view in a running magpie, and the full suite.
|
||
|
|
0152f66966 |
provider: a Remote magpie's model list follows the other magpie's, fetched every 10m (6igsteven on Discord)
6igsteven (Discord, 10-24/10-25): GLM-5.3-Trial and GLM-5.3-Flash-Trial are listed on the magpie that runs the ZCode plugin, and not on the magpie that uses it as a Remote magpie. The trial entries come from the ZCode plugin once it reads the account's gift (zcode 0.1.26), and the other magpie's /v1/models lists them as it lists every catalog entry. But a Remote magpie is a provider of keys: its list was fetched when it was added and then only when Fetch models was pressed in its editor (KeepListsFresh asks only providers with a RefreshEvery, FetchNew only accounts). So anything listed there later (the trial models, a new provider, plugin or routing group) never reached this magpie. A Remote magpie with no RefreshEvery now has a 10m schedule (RemoteMagpieEvery, RefreshSchedule), so KeepListsFresh refetches it through the same Refetch as Fetch models. `magpie provider refresh-every <id> off` on a Remote magpie is kept as "off" rather than "" so the user's off isn't read as unset. CLI show/refresh-every print the schedule in force. Other providers are unchanged: no schedule means only when asked. Run: TestRemoteMagpieListFollowsTheOtherMagpie (new) with TestKeepListsFreshFetchesWhatIsDue, TestParseRefreshEvery, TestSaveKeepsTheListsScheduleAndRules: ok, sandbox HOME, Go caches pinned. Broken by hand: RefreshSchedule returning RefreshEvery alone (the old behaviour) fails the new test with "asked [], want [office]"; restored, ok. gofmt -l clean. Then, at this commit: go test ./internal/provider ./internal/cli ok (140s, 58s); go vet ./... on darwin, GOOS=linux -tags nogui and GOOS=windows ok; darwin, linux (nogui) and windows builds ok. Not run: go test ./... - the machine's disk had under 1GB free (other sessions' work) and load ~200, so a full suite would not fit. Not tried: a real two-computer setup with a live ZCode gift. A Remote magpie whose user curated its picks (left a listed model unpicked) still doesn't take new models by itself (withNewlyListed, by design). |
||
|
|
c490165b14 |
gui: a menu of actions keeps no empty tick column, so its items line up with its heading
Sessions' "Continue in" menu (a screenshot from the owner) drew each
agent's logo and name about 21px right of its heading. The menu is a
list of actions with nothing ticked, but the shared menu reserved its
14px tick column anyway. The same happens in Usage's "Count this
client's calls as", Library's "Copy config…" and Routing's "Add a
condition".
app.css now hides .pm-tick in a menu with no ticked item and no
checkbox item. A choice menu (something ticked) and a multi-pick menu
(menuitemcheckbox, where a tick can appear later) keep the column. The
rule is CSS only: an app.js version put the core 209 bytes over its
budget, which is not raised for this.
Run at
|
||
|
|
cbbf3163cb |
usage: a cold build's chunks are of the file's pages once it is written (#3493)
A start that reads requests-v1.bin keeps each chunk's archive in the
file's mapped pages, not on the heap. A start that builds the chunks
(a cold one: no file, or one of another build) kept the archives it
encoded on the heap until the next start, after writing the very same
bytes to the file: 32-40MB for 15.7k sessions, and a resting heap
~50MB over a warm start's.
Once save has written the file, onDisk maps it and makes, for each
chunk whose archive is of the heap, a copy whose archive is the same
bytes of the mapping (checked equal). save swaps it in for the chunk
of the same serial: a read since has copied the chunk with a use of
its own, so the pointer it wrote is gone by then. A read that copied
the chunks before the swap and finishes after it keeps the mapped
archive (keep), or it would put the heap one back. Nothing changes
where no file is mapped (Windows).
diskUnmapped, the tests' hook, is an atomic.Pointer: a mapping's
cleanup reads it on its own goroutine while the next test sets it,
which -race -count=4 caught once the new test let go of mappings.
Run at this tree (
|
||
|
|
359da679db |
redact: 试一试 shows the made-up key when "keep key form" is on, short keys and named keys too
A user turned on 保留密钥格式 (v0.1.1497) and 试一试 still showed
{{SECRET_…}} for "用密钥 sk_abcdefg 部署可以吗". Three gaps:
- Preview wrote every value with tag, which never looked at Shape: a
sibling v0.1.1497 missed. It now makes the same key shapeOf gives a
real request, without storing it.
- shapeOf made up nothing under 16 characters, so sk_abcdefg stayed a
placeholder even on a real request. Now 8 or more, with at least 6
characters made up after the prefix.
- 密钥 OPENAI_API_KEY=sk_… is found with its name (the CJK key rule
takes NAME=value as the value), and '=' isn't a key character, so it
fell back to a placeholder. The name now stays as written and only
the key after it is made up and remembered, so a reply naming the key
alone is put back too.
Run: go test ./internal/redact ./internal/settings, -tags nogui
./internal/gui, ./internal/gateway -run 'Redact|Mask|Shape|Privacy' all
ok; go vet darwin, linux and windows (nogui); gofmt clean.
Broken by hand: Preview back to tag, minShape 16, the minRandom check
removed and splitName turned off each turn TestShapeShortAndPreview,
TestShapeKeepsAName or TestMaskingPreviewKeepsKeyForm red; storing the
whole NAME=value turns TestShapeKeepsAName's Restore red.
Not tried: the GUI suite (no front-end change) and a real model's reply
naming the made-up key; the full Go suite.
|
||
|
|
894ec96036 |
plugins: "More in Plugins" opens Discover, not the tab visited last (outloudvi on Discord)
On Providers, 「插件里还有更多」 / "More in Plugins" opened whichever
Plugins tab was visited last (Built-in, Installed). pluginQuery("")
returned early when the query was already empty, before it set the
tab to Discover. The early return is gone, so an empty query also
switches to Discover; a non-empty one already did.
plugins-more-discover.test.cjs visits Built-in, then Installed, in en
and zh, goes back to Providers and clicks the add sheet's More in
Plugins tile, expecting Discover with its cards and no Built-in list;
then the "look for a plugin" link with a search, expecting Discover
with that search.
Run:
- plugins-more-discover.test.cjs, chromium and webkit: 3 of 3 green.
- 61 GUI files the change can reach (plugin-*, plugins-*, builtins,
deprecat*, add-sheet*, provider-search*, i18n-keys, nav-sub-unroll,
mobile-web, market-have, sidebar-tab-top), both engines: 412 pass,
1 fail each: builtins.test.cjs's sidebar list lacks the masking
tab, red the same with the old plugins.js (#3498).
- go test ./internal/gui/ -count=1 (budgets included): ok but
TestMainWindowCorners/macOS_15_SDK killed at load ~200 (#1936,
#2645); alone it passes.
- At the rebased head (
|
||
|
|
b28e5ffd81 |
gateway: an array with no items goes to Antigravity with items {}, and Google's schema 400 falls through (plugins#375)
gcq909893267 (plugins#375): Claude Desktop's own MCP tools __batch and
__guide declare an array property with no items ("batch":{"type":
"array"}). plainSchema passed it through, and Google turned the whole
turn away: 400 "GenerateContentRequest.tools[0].function_declarations
[17].parameters.properties[batch].items: missing field". The group's
next member was never asked.
- plainSchema (codeassist.go): every node it writes that is type array
with no items gets items {}, which Google takes (the reporter's A/B:
{} and {"type":"string"} both 200). Its walk is the one every nested
place goes through (properties, items, anyOf/oneOf members, allOf,
$ref into $defs/definitions, a type list with null), so the check at
the end of a node covers all of them.
- Siblings: plainSchema is the only Gemini-side schema cleaner. Gemini
CLI's Code Assist and Vertex AI / a custom Gemini API go through the
same buildCodeAssistSent but send parametersJsonSchema, full JSON
Schema, where an array with no items is valid; gemini.go's jsonSchema
is the other direction (a Gemini client's schema read in). Left as
they are.
- Fall-through: a 400 that points at a function declaration's
parameters (function_declarations[N].parameters) is now in
shapeWords, so shapeRefused/retryable read it as the request's shape
on that vendor: the next member is asked once, and the member doesn't
rest (Fail "shape", Rest nil), as OpenCode Go's "schema exceeds the
maximum nesting depth" (#1870). Not resting is right: the account is
fine and the same request fails the same on every Antigravity
account; the reporter's same tools answered 200 on a non-antigravity
member. A declaration's name or the contents are not matched. A
shape refusal still tries the same provider's next account first, as
every shape refusal does now; not changed here.
Tests (antigravity_array_items_test.go), fixtures from the reporter's
literal request and error line:
- TestAntigravityArrayGetsItems: the reproduction through
buildCodeAssist(antigravity); both declarations carry items {}.
- TestPlainSchemaArraysAllHaveItems: nested arrays under each keyword
get items {}, an array with items keeps them, a non-array gets none.
- TestGroupFailsOverGoogleSchema400: a group's first member answering
Google's 400 hands it to the second, Fail shape, no rest; plus a
shapeRefused table (Google's both wordings, the agent-facing wrapped
form; a function name and contents error, and a 500, are not).
Run: go test ./internal/gateway/ -run 'CodeAssist|Codeassist|Gemini|
Schema|Antigravity|Shape|FailsOver|Fallback|Region|Retryable|Refus|
Vertex|Plain|Google' ok (307 tests, 31s); gofmt -l clean; go vet,
GOOS=linux go vet -tags nogui, GOOS=windows go vet on internal/gateway
clean.
Broken by hand: codeassist.go reverted, the first two tests FAIL
(declaration 0 parameters.properties.batch: {"type":"array"}); fallback.go
reverted, TestGroupFailsOverGoogleSchema400 FAILs (a 1, b 0).
Not tried: a real Antigravity account (the reporter's own A/B shows
items {} answers 200); the full go test ./... suite; Gemini CLI and
Vertex AI with an items-less array against the real APIs.
|
||
|
|
67a137744f |
sessions: a call shard is written in frames of 2048 calls (#3493)
writeCalls wrote a shard's whole state as one frame, whatever its
size. The largest Codex session on the test copy (52,500 calls) was one
8MB gob frame, and decoding it allocated ~100MB and held ~70MB at once,
which is most of the gap between a cold warm-up's memory peak and a
warm one's.
A write now splits its patches into frames of framePatches (2048).
Every frame but the last has More set, and each carries Calls, the
file's call count after the write, so loadCalls sizes its slice once.
A file whose last frame has More was cut off mid-write and reads as
nil, the same as a bad CRC. A shard read from a frame over
framePatches (the old format) is written again in frames once, at its
first load (loadKept), so existing caches shrink their peak too.
Run at this tree (
|
||
|
|
3e400b6346 |
gui: the tray's refresh keeps its place in Chinese (#3569)
The tray card's own refresh was appended inside .pq-sub, a nowrap line
with overflow hidden and an ellipsis. In Chinese the deadline line
("重置于 … · 按此速度,预计 … 用完") is longer than the card, so the
ellipsis ate the refresh and its hitbox. English fits, so it was fine
(kekao on Discord, v0.1.1486). The error line had the same fault: an
error past its 2-line clamp clipped its refresh (de, a long ZCode error).
Now each tray line that carries a refresh (deadline, error, Unlimited)
is built by pqLine: the words sit in their own .pq-say span that
shortens with an ellipsis (or clamps to 2 lines for an error), and the
refresh is a flex: none item at their end. Nothing else moves; a closed
refresh is still 0 wide.
Run, at the worktree head on
|
||
|
|
492847818b |
provider: moved ZCode, Cursor, WorkBuddy and Qoder users get the plugins' latest fixes
Mover mins raised to the versions npm has at landing (npm view --prefer-online): zcode 0.1.28 (plugins #369, #379), cursor 0.2.22 (#377), workbuddy/workbuddy-ai 0.1.34 (#337, #378, #346), qoder/qoder-cn 0.2.36 (#323, #378, QwenWork #319). keepMovedCurrent updates every moved user's plugin to them. Run: go test ./internal/provider/ ok (152s); gofmt -l clean. Not tried: a real move or upgrade on a real account; the plugin fixes themselves were reviewed and tested in the plugins repo, not against the vendors' APIs. |
||
|
|
bea9f905d0 |
redact: a key can go as a made-up key of its own form, not a placeholder (Charles Cao on X)
Charles Cao on X (2114238140835844575) asked for a format-preserving
swap: sk_w3axCByTQgK1PxqPhfKTrJOLBqz6sbZv sent as another sk_ key of the
same shape and put back on the way home. With Mask secrets on, a key went
as {{API_KEY_xxxxxxxx}}, which a tool's check of the key's form fails
and a model may remark on.
Settings › Privacy has "Keep a key's form" under Mask secrets (shown only
while secrets are masked; off by default, so nothing changes for anyone
who doesn't turn it on). settings.RedactShape → redact.Options.Shape;
api.go keeps it when a page from before doesn't send it.
How (internal/redact/shape.go):
- Only a secret's kind, 16+ characters, all of [A-Za-z0-9-_.]. Personal
data, the user's words and anything else still go as placeholders. A
made-up key needs no JSON escaping.
- Prefix kept (sk-proj-, sk-ant-api03-, github_pat_, AKIA/ASIA, or up to
4 letters plus - or _), same length, separators in place, and each
other character a random one of the same class. A hex key stays hex
of its case. Random from HMAC(placeholder key, kind+value), so it is
the same every turn and a vendor's prompt cache still matches.
- Kept in values like a placeholder (makeRoom shared with placeholder),
so masking records, Value(), signed-thinking re-masking (the put
closure) and known-value re-masking work unchanged; kindOf reads it.
- restore() puts made-up keys back first, then placeholders.
RestoreJSON no longer returns early when one is in the body;
hasShapes copies nothing while none was made.
- A stream holds an event's end that may start a made-up key
(partialTail → shapeTail), but never one inside a key that has come
whole: a key ending in "s" is also the start of every sk_ key, and
without that its end was held and the key went out unrestored (found
as 1 in ~40 fresh processes; 0 of 150 after).
- apply() leaves a made-up key that came back unrestored alone
(outsideShapes), as it does a placeholder.
Tests: shape_test.go — form kept (the reporter's key, hex, ghp_,
sk-proj-), same fake twice, Restore; off is placeholders; email/short/
odd values not shaped; MaskJSON then RestoreJSON with escaped tool
args; signed thinking re-masked to the same fake; no re-mask of a fake;
a stream split mid-key, after one character, and a key ending as one
starts. GUI: redact-shape.test.cjs (both engines, 5 languages, 1100 and
640px; row under Mask secrets, Off by default, one save with the rest
kept, no scroll, a later save keeps it; no row while secrets are off).
redact-words-any-case now finds Mask personal data by place after the
new row, not by index.
Broken by hand, each red: no restoreShapes (KeepsForm, JSON, Stream),
no shapeTail (Stream), no outsideShapes (JSON), no hasShapes (JSON),
put ignoring Shape (all three), shapeTail without the whole-key bound
(Stream).
Budgets: app.js 1,321,994 → 1,322,289 and the core 1,529,542 →
1,529,837, the row's 295 bytes, Settings' own row, no room added.
Doc: docs/subsystems/gateway-routing.md, a bullet beside the other
masking options.
Run at
|
||
|
|
04439c8592 |
sessions: the warm-up lists the Codex rollouts once for all its reads (#3493)
The warm-up at start ran three reads within about two seconds: the stats of every day, the stats of 30 days and the Requests page. Each listed every Codex rollout again through codexFiles, about 12k lstat()s and ~47 MB allocated a time. codexFiles now keeps its listing while only the warm-up reads (quiet: inside Warm, no page asking) and for 10s at most, the age statsFor's memo already answers with. Each caller gets its own copy. A page asking meanwhile, and every read outside the warm-up, lists fresh, and Warm drops the kept listing when it ends. Measured on the owner's real sessions (sbpairs: Claude Code and Codex history, warm index), the gui warm-up harness inside sessions.Warm, run alternately with the parent |
||
|
|
ee715c2e0e |
redact: a key or token after 密钥, 令牌, 金鑰…, or apikey/token before 为/是/:, is masked (CyberCaius on Discord)
|
||
|
|
b686a8dfec |
sessions: a call shard's frames are read into a buffer kept between shards (#3493)
A cold Requests build (the first start after an update that changed the usage package's source, so the request chunks are made again) reads every call shard, ~15.7k on the real data copy. Each frame was read into a new byte slice and decoded into a new callFrame, so gob made a new Patches and Strings slice for every one. loadCalls now takes a frameBuffer from a pool. gob decodes a slice that has room in place, and leaves a field of the zero value as the field was, so each patch and string of the last frame is cleared before the next is decoded in. Nothing read out points into the buffer: gob copies strings and byte slices, and a patch's call is copied into the file's calls. Measured on the real data copy (sbpairs), warm-up harness TestZZWarm, requests-v1.bin removed before each run so every run is a cold build, three runs each: allocated through step 3 2139/2214/2182 MB -> 2001/2041/2044 MB loadCalls (cum, step 2) 781 MB -> 583 MB peak footprint 374-441 MB -> 371-419 MB, within noise Warm starts unchanged (step 2 ~690 MB either way). Run at this head: go test ./internal/sessions ./internal/usage ok; -race -count=2 of the LoadedCalls, CallCache, Shard and Frame tests ok; GOOS=linux and windows go vet -tags nogui ./internal/sessions ok; gofmt clean. TestLoadedCallsKeepNothingOfTheLastShard reads a shard with tokens, a session and a compaction, then one with none, three times; broken by hand (the patches not cleared) it fails. Not tried: Linux and Windows real-data runs. |
||
|
|
ba301e98e2 |
usage: a page's passes over the chunks decode into buffers kept between them (#3493)
Each pass of a Requests page over every chunk (foldCodexRows, the
response pairs, visibleLocal, matchedBlocks, visit, partsOf, newest,
rowsOf) started a chunkRows with no buffers and grew its rows, strings,
shapes and decode buffer from nothing. A warm start's All page and
Codex's effort after it read the same rows pass after pass, ~30 MB a
pass. chunkRows now takes a rowBuffer from a pool, unpacks into it
(unpackReusing gets a dst chunk too, so the open chunk isn't allocated
each block), and gives it back on release, its strings cleared so no
row text is held.
Measured on the real data copy (sbpairs: 12k Codex rollouts and the
Claude projects), warm-up harness TestZZWarm, each binary run 3 times
in a row and the first run dropped (the chunk file is named by this
package's source, so alternating binaries rebuilds it):
step 2 (QueryPage All) allocated 835 MB -> 666 MB
allocated through step 3 (effort) 994 MB -> 820 MB
unpackReusing in step 2 163 MB -> 34 MB
peak footprint ~240 MB, unchanged
Run at this head (base
|
||
|
|
be7f174677 |
gateway: a key out of a guessed quota is asked again after one refusal, and held a minute (zoecats)
zoecats (Discord #feedback, 10-25): a local aggregator answers 429 insufficient_quota "quota exhausted" for the moment it switches upstreams, and the agent's retry and every request after it were answered by magpie itself, "out of its allowance: not asked again before …", Retry-After 900. v0.1.1488 ( |
||
|
|
714ab8e8bf |
redact: a password after 密码, 密碼, 口令, パスワード or 비밀번호 is masked (CyberCaius on Discord)
"密码:786kih" in Settings → Masking's try box came back "nothing to mask", and so
went to the vendor as written. The password rules only knew English field names
(password = …, as configs have them) and asked for 8+ characters of letters and
digits both, since code calls many things a password. Nothing in code is called
密码, so after a CJK name for a password any value of 4 or more is taken, digits
only too, after :, :, =, 是, は or 는, quoted or not. A sentence's closing stop
stays outside the value.
Left as they were: "请输入密码:", 密码:${DB_PASS}, 密码:****, 忘记密码了怎么办,
修改密码功能, and a value of 3 (密码:abc). English "password: abc12" with a short
value is unchanged; issue filed for it.
Run at this head:
- go test ./internal/redact ./internal/masking ./internal/otlp ./internal/pii
./internal/settings ./internal/sessions -count=1: ok (every package that
imports redact but gateway and gui)
- go test ./internal/gateway -run 'CJK|Mask|Redact|Privacy': ok
- gofmt -l, go vet ./internal/redact: clean
- Broken by hand: with origin/main's redact.go, TestCJKPasswordMasked fails 7
of 7 masked cases; green with the rule.
Not tried: the GUI try box in a running magpie, and the full suite.
|
||
|
|
defbb1a159 |
gateway: a Chat reply's cache read reaches the agent in OpenAI's names (B3TT3R on Discord)
B3TT3R (Discord #feedback, 10-25): DeepSeek Harness on DS-v4.1-Flash showed
"缓存命中 0%" over 1.2M input, and dsh's message usage carried only
inputTokens, outputTokens and totalTokens.
dsh reaches magpie through @deepseek-ai/dsh-llm-pi-ai with api
openai-completions, so its usage comes from pi-ai 1.4.0's parseChunkUsage:
cacheRead = prompt_tokens_details.cached_tokens ?? prompt_cache_hit_tokens
?? cached_tokens ?? 0, and nothing of Anthropic's. dsh's mapUsage drops a
0. magpie's Chat passthrough sent the upstream's usage as it came, so when
a provider told the cache only in another vendor's names (a relay giving
Anthropic's cache_read_input_tokens, or DeepSeek's prompt_cache_hit_tokens
or Moonshot's top-level cached_tokens beside a 0 in prompt_tokens_details)
the gateway counted the hit in its own usage log while the agent saw none.
Now chatTidy (stream) and chatWhole (whole reply) tell such a usage in
OpenAI's names too: prompt_tokens_details.cached_tokens, cache_write_tokens
when a write was told, and prompt_tokens counting both, with total_tokens
moved by the same amount. Every field the upstream sent stays. A usage in
OpenAI's names alone is never decoded (mayMendUsage looks for the other
names first), and one that already agrees comes back byte for byte.
Translated routes (Responses, Messages, Gemini) and plugin replies already
build the usage from cUsage and needed nothing.
Not proven: which provider B3TT3R uses. "DS-v4.1-Flash" is not how magpie
names a dsh model, and DeepSeek's own API sends both names, which pi-ai
already read right through magpie (checked live below). So this fixes the
case where magpie is at fault; if B3TT3R is on DeepSeek's own key the
cause is elsewhere and the reply asks.
Run, at this head (rebased on
|
||
|
|
4dfd88206e |
agent: Lody on Linux is run with its import link, which xdg-open turned away (Atlas on Discord)
Atlas (Discord #help, 10-25, Linux): Lody was running, and adding it
from magpie said "failed to open uri". magpie handed the
lody://provider/import link to xdg-open, as every OS's opener.
Cause, shown with the real Lody 0.108.1 AppImage in an amd64 Ubuntu
24.04 container (Xvfb, no update-desktop-database, as on many
desktops): Lody writes ~/.local/share/applications/ai.lody.desktop.desktop
with MimeType x-scheme-handler/ai.lody.stable and x-scheme-handler/lody,
but runs `xdg-mime default` for ai.lody.stable only. lody:// then rests
on the desktop database cache, which nothing built, so
`xdg-open lody://...` answers "gio: lody://...: Operation not supported"
(rc 4) while ai.lody.stable:// opens. With update-desktop-database run,
both open. The same on GNOME and XFCE with a fake handler at that entry.
Fix: on Linux agent.OpenLody runs what xdg-open would have run, the
Exec line of Lody's own desktop entry (ai.lody.desktop, then
ai.lody.desktop.nightly, then dev.loro.lody.oss; $XDG_DATA_HOME before
$XDG_DATA_DIRS, the first file of a name decides), with %U as the link.
An entry whose program is gone, no entry, or a start that fails falls
back to the opener as before. macOS (Info.plist claims lody:) and
Windows (Lody registers lody itself) are unchanged. The GUI's
/api/open and `magpie lody add` both go through it.
Tests: TestOpenLodyRunsItsDesktopEntry and TestDesktopExec
(internal/agent), TestLodyImportRunsLodyOnLinux (internal/gui, Linux
only). The GUI test is red on the old providers.go in golang:1.26.8
docker ("the link went to xdg-open: lody://..."), green on this one.
TestLodyImportHandoff now sets XDG_DATA_HOME/XDG_DATA_DIRS to its
sandbox, and XDG_DATA_DIRS is in TestFolderVarsAreListed's notAnAgent
(the system's data folders; the first run of internal/agent was red on
it until then).
Not covered, and Lody's to change: magpie on a machine Lody Desktop
reaches as a remote (Atlas's later detail: Lody on their own computer
connected to the host magpie runs on). Lody 0.108.1 imports only into
the desktop's own machine (the renderer writes the configs with
machineId = its local machine and needs __LODY_ELECTRON__), and the
link's payload takes only kind/id/name/auth/endpoints with a loopback
gateway, so no link names another machine. Lody Desktop opened on that
host shares the agent's ~/.lody/machine-id, so the import lands on the
same machine; docs/subsystems/agent-wiring.md says so.
Run:
- real Lody 0.108.1 AppImage in docker: agent.OpenLody reached a
running Lody (its log: "handleDeepLink accepted deep link {protocol
'lody:', host 'provider', pathname '/import'}", "sending deep link to
renderer") and a stopped one ("pending deep link sent to renderer
after did-finish-load"); xdg-open on the same link: rc 4.
- golang:1.26.8 docker, -tags nogui: agent and gui Lody tests ok.
- macOS: HOME=<sandbox> go test -timeout 45m -count=1 ./internal/agent
./internal/gui ./internal/cli: gui ok (124.9s), cli ok (48.6s), agent
FAIL on TestFolderVarsAreListed (XDG_DATA_DIRS, fixed here); agent
again after the fix: ok (213.5s).
- rebased on origin/main
|
||
|
|
c6768f06f6 |
providers: a provider of the user's can be set never to rest for a limit
zoecats (Discord #feedback, 10-25): a local aggregator answers "quota
exhausted" (429 insufficient_quota) for the moment it switches
upstreams, and magpie set its key aside for 30 minutes, answering every
request itself ("out of its allowance: not asked again before …").
A provider the user added now has, under the editor's Advanced fold,
"Set it aside when out of quota or rate limited" (Rests), ticked by
default, with a note. Unticked (provider.LimitRestOff, limitRestOff in
providers.json), restAfterMarked rests nothing, counts no failure and
sinks nothing for a refusal it reads as out of quota, credit or rate
limited, or any 429: by "off", and the next request is sent to it as
usual. restDrawer rests no image model of it either. A 401, a model not
served and a plain failure still rest it. The default is as before. The
editor offers it only to a provider the user added (custom); a Save that
leaves it out keeps it. A checkbox (tick), no native select; strings in
zh, zh-TW, ja and de. app.js's budget (and the core's) are raised by the
576 bytes the row adds, with no room, after the comment was cut.
Run on origin/main
|
||
|
|
67361b54fb |
routing: Try now from the editor reaches the Routing page, and puts a sunk key back
zoecats (Discord #feedback, 10-25, v0.1.1477): a local aggregator answered
"quota exhausted" while it switched upstreams; Try now in the provider's
editor left Routing showing 429 until magpie restarted.
Cause, in three holders:
- The Routing page kept lifts in its own liftedAt, filled only by its own
Try now. A lift from the editor (or anywhere else) never reached it, and
the kept routes' snapshots went on drawing the rest. The trace now
carries every rest lifted (TraceState.Lifted, from restingUntil.lifted,
kept up to longestMonthly), Unrest/UnrestAll/renewed wake the long-poll
(trace.lifted), and the page leaves out a rest, a sunk key and an
Accounts and keys count that a lift came after.
- With Sink on, a rate-limited key stayed at the back of the order until
restart: Unrest never cleared sunk. unsink(key) now does.
- The gate itself: checked on the old binary in a sandbox HOME (single key
over a fake answering 429 insufficient_quota "quota exhausted"). magpie
rests it 30 min and answers later requests itself ("out of its
allowance: not asked again before …"); Try now with the editor's key
lifted that and the next request reached the upstream (200), on
/v1/chat/completions and /v1/messages, streaming and not. So the stuck
state was the display and the sink, not quotaHeld.
Left alone, filed: #3555 (Try now lifts nothing when another magpie
serves the gateway, unrest 400) and #3556 (the held reply's
Retry-After, 900s here, outlives the lift for an agent that honours it).
Run at this change on its first base,
|
||
|
|
1b039a3c72 |
gui: a trackpad's coast after the lift is the reader's scroll, no longer put back (issenn on Discord)
issenn (v0.1.1472, macOS app): a page with a scrollbar wouldn't scroll by
trackpad. It shook fast and snapped back, and only dragging the bar
worked. Seen on Agents.
Cause: the scroll guard puts back any .view scroll that comes outside
a window the reader's own events open. A wheel opened 250ms. When the
fingers lift, WebKit on the Mac plays the coast itself, and the page
hears those scrolls with no wheel for each. Once the last wheel's 250ms
ran out, the guard put back every coast scroll. Each coast step moved
the page and each put-back moved it back, so it shook and came to rest
where the fingers lifted.
Fix: the wheel now starts the same chain a touch fling does (flings,
flingUntil). Each view scroll keeps the next one the reader's until the
coast rests, and a click still ends it (purposeUntil = flingUntil = 0).
A code scroll at rest is still put back. The code and the comment fit
the old app.js size; no budget raised.
Test: view-trackpad-coast.test.cjs, chromium and webkit, en and zh. It
does five trusted wheels, then a 1s coast the page plays each frame
with no wheel. The coast must reach its end, a code scroll at rest is
put back, and a click mid-coast stops the row under the pointer.
- On origin/main's app.js: red 6/6 ("lifted at 40, coast asked 166,
left at 101/105").
- Broken by hand, flingUntil not reset by a click: red 6/6 ("the row
was at 269 after the click, 140 once at rest").
- With the fix: 6/6.
Real WKWebView probe (a Swift app loading the GUI with synthetic
NSEvent scroll phases): with every momentum wheel delivered, old and new
both end at 277. With the wheels after the first 32 kept from the page,
standing in for the coast with no wheel, old ends at 249 and new at
277.
Run:
- click-scroll, view-scrollbar-drag, view-middle-autoscroll and
view-trackpad-coast: 44/44.
- Whole GUI suite (internal/gui/tests/*.test.cjs, chromium and webkit,
every language) through suite-lock: still running at push, no red in
its first 30 minutes; a red it finds gets a follow-up commit and an issue.
- go test -tags nogui -run Budget ./internal/gui: ok, run again after
the rebase.
- No Go changed, so no gofmt or vet.
Not tried: a real trackpad on the mac app. Synthetic NSEvents skip
WebKit's MomentumEventDispatcher, which swallows the system's momentum
and plays its own. That the page gets its coast with no wheel is the
best fit for the report, not something seen on issenn's hardware. Also
not tried: ProMotion 120Hz, and WebKitGTK and WebView2 with a real
touchpad.
|
||
|
|
b5a78fd8b5 |
routing: a group's rules are dragged into order
monkeyin_92 on X: "希望可以上下拖动规则". Rules are checked top first, so
their order matters, and it could only be changed a place at a time from
each rule's ⋯ menu (Move up / Move down).
A rule's number is now its handle, as a model's number is in the same
editor (memberHandle): drag it up or down (the shared dragRows, which
the members, groups and agents use), or focus it and press Alt+↑/↓. The
rules are renumbered at once and the keyboard stays on the moved rule's
handle. The grip beside the number shows only on hover, while dragging,
or from the keyboard; the dragged rule is lifted with a card background
and shadow, no coloured border. Move up and Move down stay under ⋯ and
now go through the same moveRule. Saved as the group's rules in their
new order. "Move rule {n}" in zh, zh-TW, ja and de; the title reuses
"Drag to reorder · Alt+↑/↓ to move".
Run at this head:
- routing-rule-drag.test.cjs (new), chromium and webkit, en, zh, zh-TW,
ja, de: 10 of 10. It checks the handles and their names, the grip hidden
away from the row and shown on hover, a drag of rule 3 above rule 1
with nothing opened by the drag's click, Alt+↓/↑ (past the end too)
with focus kept, ⋯ Move down, the page not moved, and the saved rules'
order with their conditions. Red on the parent (no .rt-rhandle): 10 of
10 in the parent's full run.
- GUI: every routing-*.test.cjs plus i18n-keys, click-scroll and
group-member-drag, both engines: 1321 pass, 55 red, all in files red the
same on origin/main
|
||
|
|
f99d27abc2 |
routing: a rule names several models, tried in order
monkeyin_92 on X: "can a rule take several models? Otherwise one rule
with several models is several rules." A rule now takes more than one
model (Rule.More after Rule.Use; `more` in the group's JSON, use=a,b
typed). They go first in that order: when the first fails or rests the
rule's next takes the request, ahead of the models the later matching
rules name and the group's others.
Every reader of Rule.Use goes through Uses/SetUses/MapUses/Without/Names
in grouprule.go:
- cleanRules: each must be the group's, each named once; a pause names one.
- gateway: ruleFor's turn hold, tool rounds and outgrown turns, compaction
(the rule's first that takes the summary, the others in Small),
ruleMembers/ruleOver/applyRule, nestedRules and ruleLed (the one a
nested group's turn stays on), modelRuled, ruleEffort (useEffort asked
of each), ThenUses (leaves out all of the rule's own). RuleHit.More is
in the trace; Instead from More has Unready false, one from a later
rule Unready true, as before.
- ruledEntry: what the group takes is what every one of them takes.
- provider rename, auto/ refs, groupfast, a member's removal (a rule
goes with its last), ShareGroup and its import (one this magpie hasn't
is left out of the rule).
- CLI `group rule add use=a,b` and its listing; `group models-=` keeps a
rule's other models. The TUI shows them joined and keeps the rule when
one is deleted.
- GUI (plugins/routing): a chip per model, a + for the next one, an ×
on each while there is more than one, a chip picks another in its place
(app menu, no native select); the card's tooltip and the trace's why
("…so c/mini, which the rule names after it, goes first"), nested too;
en, zh, zh-TW, ja, de.
Old data: a rule of one model writes no `more`, so groups saved before
read and save unchanged (TestRuleMoreOnDisk). An older magpie reads `use`
alone: its requests go to the first model, the others are plain group
members in group order; if it saves the group, `more` is dropped.
Tests: TestRuleSeveralModelsInOrder, TestRuleEffortReachesTheRulesNextModel,
TestRuleCompactPassesOverTheRulesSmallModel (gateway); TestCleanRulesSeveralModels,
TestRuleMoreOnDisk, TestRuleWithout, TestParseRuleSeveralModels,
TestThenUsesLeavesOutTheRulesOwn, TestRuledEntrySeveralModels,
TestSharedGroupRuleSeveralModels, TestRuleMoreRenamedAndKept (provider);
TestGroupRuleSeveralModelsCmd (cli); TestGroupTakeOutKeepsARulesOtherModels
(tui); routing-rule-models.test.cjs. Broken by hand: ruleMembers on Use
alone turns the first two gateway tests red.
Run at this head:
- gofmt -l clean; go vet -tags nogui clean with GOOS=linux and GOOS=windows
for provider, gateway, cli, tui.
- go test -tags nogui -timeout 45m: internal/provider, internal/cli,
internal/tui ok; internal/gateway ok (384s); the new gateway tests
again after; internal/gui budgets ok.
- GUI: every routing-*.test.cjs plus i18n-keys, click-scroll and
group-member-drag, chromium and webkit (en, zh, zh-TW, ja, de where the
file has them): 1319 pass, 57 red. routing-rule-models passes in both.
The reds are in files that are red the same on origin/main
|
||
|
|
5b2b3d3f50 |
providers: a switched-off provider says how to turn it on, after a sign-in too
Atlas (Discord) signed in to WorkBuddy AI with `magpie plugin login
workbuddy-ai`, and `magpie providers` then showed "○ switched off" with
nothing saying why or how to undo it. magpie never sets Provider.Off by
itself; only the user's own switch does, and a sign-in rightly keeps it.
So the setting stays as the user left it, and magpie now says how to
change it:
- `magpie plugin login <id>` and `magpie accounts add <id>` (plugin and
built-in paths), finishing for a provider that is switched off, print
"! <Name> is switched off in magpie, so agents aren't given its models
· turn it on: magpie provider on <id>". One that can't be found says
nothing (not known to be off).
- `magpie providers` puts "magpie provider on <id>" in the switched-off
row's last, unpadded column, so the key column keeps its width.
- The TUI's Providers row notes "o switches it on" (its `o` key).
- The GUI row already shows a "Switched off" badge and its own switch,
and the editor says how to switch it on: left alone.
Run, at this tree (base
|
||
|
|
c9c28aa586 |
gui: a gateway key list that can't be read keeps saying so in its card, and one read before stays
Found beside HarriesChen's report: when /api/caller-keys failed,
loadGatewayKeys put the error straight into #gatewayKeys, and the page's
next redraw (renderGatewayKeys from renderGatewayView, the providers'
poll) wiped it, since it returns early while no list was read. A failed
re-read also replaced a list already shown with the error.
gatewayKeysErr now holds why a never-read list failed, and
renderGatewayKeys says it in the list's card (styled like the empty line
by the previous commit). A list read before stays, and the error goes to
the status line. A read that works clears it.
Run:
- gateway-keys-empty.test.cjs: the unreadable case (past a
renderGatewayView redraw) and the read-before case, both engines: green;
with keys.js from main both red (".none" never visible; the 3 keys gone).
All 22+2 of the file green with the change.
- The whole GUI suite was still running at push time (see the previous
commit); not in this record.
Not tried: a real failing gateway (only the fixture's 500).
|
||
|
|
5046e4fc84 |
gui: no gateway key yet is said muted and inset in its card, as Recent calls says none (HarriesChen on Discord)
HarriesChen (#feedback, 10-25), magpie web on an iPhone: under Gateway keys, "No gateway keys yet" was drawn in the body's own text (14px, the foreground colour) flush against the edges of its white card. The `.none` line inside `#gatewayKeys > .accts` had no rule: `.accts` gives its rows padding through `.acc`, and the empty line isn't one. `#gatewayKeys .none` now takes the look of the same page's Recent calls empty line: muted colour, 11.5px, line-height 1.45, inset 13px 14px in the card. The page's other empty lines (Recent calls, Models' "No models match") already had rules and are unchanged. Run: - Reproduced at 390x844, magpie web (bootPrefs web), Chromium and WebKit, light and dark: before, colour rgb(28,28,33) / rgb(237,237,241), 14px, padding 0; after, rgb(133,133,141) / rgb(139,139,148), 11.5px, 13px 14px, equal to #activity .none in each. Screenshots looked at. - New gateway-keys-empty.test.cjs (390px, web, both engines, en, zh, zh-TW, ja, de, light and dark): 20/20 green; with app.css from main 20/20 red (colour, size, inset). fixtures/caller-keys.cjs takes options.keys. - go test -tags nogui ./internal/gui -run 'Budget|Asset|I18n|CSS': ok (no budget raised). - The whole GUI suite (node --test --test-concurrency=2 tests/*.test.cjs, both engines) was started at 687c3645f's tree and was still running when this was pushed (owner: ship at once). Its result is not in this record. Not tried: a real iPhone Safari; the Go suite (only CSS and GUI tests change). |
||
|
|
75e78a5a04 |
tui: quitting hands the gateway to magpie's service on Linux
zaidu259434 on X: "启动codex这些cli连接会失败,AI分析没自动启动magpie的网关".
With magpie installed inside WSL (or on a server over SSH), nothing
opens magpie at login, and XDG autostart doesn't run there. So once
`magpie tui` quit, the agents it had connected asked a gateway that was
gone.
When the terminal quits having served the gateway with an agent
connected, on Linux and where magpie doesn't open at login, keepGateway:
- starts magpie's service (magpie daemon) when it is installed;
- installs it when the user never removed it (daemon.Removed: Uninstall
now leaves a daemon-removed mark, and Install clears it), so it starts
with the system or the login from then on, and says how to remove it;
- otherwise (no systemd, which is WSL's default, or the user removed it)
starts `magpie serve` in its own session, logging to magpie's cache,
and says so. In WSL it also says how to turn systemd on.
macOS, Windows, nothing connected, or magpie opening at login: the same
"gateway stopped" note as before. Docs: gui-shell.
Run:
- TestKeepGatewayAsTheTerminalQuits covers each of those cases, and
TestUninstallRecordsTheUsersNo checks the mark.
- go test -timeout 45m on the four packages, the same run as the
previous commit's: all four ok (gateway 428s, agent 255s, tui 23s, daemon 16s), at
|
||
|
|
a1c1b7053b |
gateway: WSL under NAT reaches the Windows gateway with sharing off
zaidu259434 on X (tweet 2114203077989527990): on Win11, Codex and the
other CLIs in WSL failed to connect to magpie. A distro in NAT
networking (WSL's default) reaches Windows at the address Windows has
on the WSL network (vEthernet (WSL), 172.17.32.1 on the test box), and
magpie wrote that address into the distro's agents. But the gateway
listened on 127.0.0.1 alone unless LAN sharing was on, so every request
from WSL timed out. Turning sharing on wasn't enough either: the WSL
adapter is in Windows' Public profile, and a Private-only allow rule
still keeps WSL out (reproduced on the box).
- gateway: while it listens on loopback alone, on Windows it also
serves at each address on a vEthernet (WSL...) adapter (serveWSL,
looked for again every 10s, since the VM brings its adapter up and
down). A request there counts as this computer's only when it comes
from that network to that address with the WSL key (fromWSL). The key
is `wsl-` plus 48 hex in magpie's folder (wsl-key, 0600), with
`-<agent>` after it optional. The request is then served as a
loopback one with the token (asFromLoopback). Anything else there is
judged as another machine's, so a Docker Desktop container on the
same network gets 403.
- agent: WSL twins at that address get the WSL key (keyAt, agentKeyAt,
ourKey and gatewayKey know it). Whether it answers is asked from
inside the running distro (reachFrom, wslReach: curl, wget or bash's
/dev/tcp), never from Windows, where the listener answers whatever the
firewall keeps out. A distro that can't connect is shown the firewall
rule that lets it in (Profile Any, vEthernet (WSL*), magpie.exe).
- The NAT notices no longer say it answers only while sharing is on (en,
zh, zh-TW, ja, de).
- Docs: gateway-routing (WSL under NAT) and agent-wiring.
Run:
- TestWSLCallerServedWithSharingOff and TestServeWSLListensBesideLoopback
(gateway), and TestWSLAgentsGetTheWSLKey and
TestWSLReachAskedInsideTheDistro (agent). All four were red with the
fix taken out: "403 magpie isn't shared on the local network",
"answers = false", the token given at the WSL address, and no drift.
- go test -timeout 45m ./internal/gateway ./internal/agent ./internal/tui
./internal/daemon: all four ok (gateway 428s, agent 255s, tui 23s, daemon 16s), at
|
||
|
|
15f0d4cdeb |
sessions: a Claude Code session goes on in Codex, and a Codex one in Claude Code
0xPlato on X asked for conversations to carry across agents, at least on
one machine. A session row's Continue in (换 Agent 继续) now offers Codex
for a Claude Code session and Claude Code for a Codex one, when the other
is installed. Picking it converts the session then: a new session in the
target's own store, which its own resume opens. Listing converts nothing.
- Claude Code to Codex: a rollout in CODEX_HOME/sessions/YYYY/MM/DD with
session_meta (model_provider from config.toml now, no
base_instructions, so Codex uses its own), response_items and the
event_msg user/agent messages the TUI shows. Codex indexes it on
resume itself.
- Codex to Claude Code: CLAUDE_CONFIG_DIR/projects/<cwd>/<uuid>.jsonl,
lines chained by parentUuid, assistant model "<synthetic>" so usage
counts no call for them.
- Carried: user and agent text, pasted images, shell calls natively
(Bash and exec_command) with their output, other tools as the agent's
text (name, input, result in fences, cut at 64 KiB). Dropped: thinking,
reasoning, signatures, encrypted content, Claude Code's own and Codex's
context messages. After a compaction only what replaced the history.
- The source is only read. The new file goes through temp, sync, rename
and never over an existing path. Asking again for an unchanged file
gives the same session (memo by path, target, size, mtime).
- POST /api/sessions/carry {agent, id, to, open}: copies the resume line,
or with open (Mac app) opens it in the session terminal. The details
pane's Continue in line converts from its copy button too.
- Read-only and WSL sessions get no offer. Pi, omp, OpenCode, Kimi,
Cursor and the rest are not converted.
Run (worktree at
|
||
|
|
6874095b15 |
gui: the sidebar's gateway line is drawn from boot.js, before the providers' read (#3429, chiperman)
After a refresh the sidebar's gateway line came in about 1.5s late: it
was drawn only by sideGwRead, which waits 1500ms before it reads
/api/providers. chiperman's commit (c1f457a1b) has boot.js carry where
this process's gateway listens, and app.js draw it at once. Ported with
changes:
- api.go puts sideGateway in boot.js only when this process serves the
gateway (served.Load() != nil), with the URL from gateway.URL(), the
one /api/providers reports, and marked boot. Another magpie serving
the port: nothing is sent, and the providers read decides as before.
- app.js starts sideGwAt from boot.js, so the first layoutNav draws it;
chiperman's separate renderSideGwBoot is folded into that. A value
from boot.js is read again at 1500ms like before, so /api/providers
has the last word: served is set before the listen succeeds, so a
listen that failed, or a gateway stopped since, shows "Gateway
stopped" then. Without the re-read the boot line could stay stale.
- app.js is 45 bytes under its budget, which is unchanged.
Not fixed here, and pre-existing on main: Settings' address Apply leaves
the line on the old port until a reload (#3531). Seen in real sandbox
apps on main (3483 -> 3486) and with this change (3481 -> 3485).
Tests: TestBootSaysWhereItsGatewayListens (gui) checks boot.js's
sideGateway for 127.0.0.1:3481 and for 0.0.0.0:3483 shown as 127.0.0.1,
and none when this process doesn't serve. sidebar.test.cjs gets the
line from boot.js before any providers read, and a new subtest: the
boot.js line for 3425 is read again and turns to "Gateway stopped" on
3490 once providers says so, with one read.
Run on origin/main
|
||
|
|
00d44d6928 |
routing: Codex's composer predictions story says their model is picked in Codex's row on the Agents page (#3425, chiperman)
Routing's Kind description for composer_predictions still sent users to Settings › General › Codex composer predictions. That setting moved to Codex's row on the Agents page. chiperman's commit (5e372e168) fixed the Routing text in five languages. It is ported here with their zh, zh-TW and ja; the de wording is mine. Grepping for other texts that still name the old Settings place for a setting that moved into an agent's row found four more, now fixed: - app.js compactField, the provider editor's "Compact at": empty follows Long conversations, now "in their settings on the Agents page (else in Settings)". The field's text is one string now, and the header comment no longer repeats it, so app.js stays inside its budget (unchanged). - gateway sealedWayOut: "Codex subagents on any model" is in Codex's settings on magpie's Agents page, not "magpie's Settings". - gateway codex_titles: "Codex composer predictions are off" and "Codex titles are off" answers name the same place. - cli `magpie model` help text. Each gateway message has a test that fails on the old wording, and the GUI files assert the new place and the absence of the old one. Run on origin/main |
||
|
|
46c4188327 |
gateway: Codex's access_programs goes to OpenAI alone, so OpenCode Go's DeepSeek and GLM answer (#3172)
csic21, HONGs23 and TimWongUp (#3172): a Codex subagent inherits
access_programs {"cyber":"standard"}, magpie relayed it to OpenCode Go,
and Go answered DeepSeek and GLM with 503 "Upstream request failed:
Endpoint is unavailable."; without the field, or with null, 200. Go's
Haiku took it.
Scope: Codex itself sends the field only with a ChatGPT sign-in, or an
API key on its provider named "openai" (codex-rs core/src/
cyber_access_program.rs, for_auth and for_provider; read at openai/codex
970111f6c). It comes to magpie because Codex thinks magpie is OpenAI,
the same reason forVendor takes OpenAI-only parts out (#292). So the
class is "only the upstreams Codex would send it to", not an OpenCode Go
rule: no other vendor has a Cyber program to read, and Go is the one
seen to refuse it. keepsAccessPrograms keeps it for a ChatGPT (Codex)
account, a host ending in openai.com, another magpie (IsRemoteMagpie,
whose own upstream decides) and a codexAsSent relay when Codex sent the
request. Every other Responses upstream, relayed or built (from Chat
too), plugins included, goes without it. A relay that fronts ChatGPT
loses it unless set codex=as-sent, as Codex with a custom provider
would send it none.
- forwardOnce takes it out before the user's extraBody is merged, so an
access_programs the user wrote there still goes (Edward4226's branch
did it after, which would override the user's own value).
- withoutTopMember (from Edward4226's branch, using longBody's spans on
a long body) removes the member, every one of that name, the rest byte
for byte; a body that isn't a valid object goes as it came. A
bytes.Contains check first, so a body without it costs nothing.
- Chat and Messages builds never carried it (now tested).
- Docs: gateway-routing.md, providers-accounts.md, ir.go comment.
Run:
- TestAccessProgramsGoToOpenAIAlone (new; fakes by the gateway client's
RoundTrip, no network): Go DeepSeek/GLM from Codex and from curl, null,
Chat built as Responses, Zen, a relay, codexAsSent with and without
Codex's headers, the user's extraBody, OpenAI (daybreak_blue, null,
from Chat), another magpie, a Chat and a Messages upstream.
TestWithoutTopMember (new). TestCodexAccessProgramsReachBackend,
TestAccessProgramsNullKept, TestCodexAccountTakesExtraBody pass.
- Broken by hand, each red: no strip (9 cases: Go, Zen, relay, extraBody);
IsRemoteMagpie out; openai.com out (3 OpenAI cases); codexAsSent out;
codexAsSent without fromCodex; Codex account out
(TestCodexAccessProgramsReachBackend red); strip moved after extraBody
(the user's value lost).
- gofmt -l clean; go vet -tags nogui ./... for darwin, linux, windows.
- HOME=<scratch> go test -tags nogui -timeout 45m ./internal/gateway/:
ok (414s), at
|