Commit Graph
4237 Commits
Author SHA1 Message Date
yetone e6bed2f063 site: Kimi's partner icon is a 16KB PNG, not the 838KB SVG
Every app downloads a partner's icon on each fetch of the list, and the
official mark's grain texture made the SVG 838KB. It is rendered to
128x128 (rsvg-convert, 16,802 bytes) at a new URL, partner-kimi.png, so
an app holding the earlier icon fetches this one.

Run: node --test in site/ 30/30; looked at the PNG; curl after deploy.
2026-10-23 16:19:24 +08:00
yetone 68fb6b6d82 provider: Command Code's mover min is 0.1.15, DeepSeek's off level (plugins#334)
0.1.15 (plugins 652f06d) offers an off level on DeepSeek V4 Pro, V4
Flash, V4 Flash Vision (exp), V4.1 Flash and V4.1 Flash Fast and sends
it to the Provider API as reasoning_effort "off", Command Code's own
word for it. V4 Flash Fast, Kimi K3 and Go's /alpha/generate are sent no
level for off. keepMovedCurrent brings every moved user up to it.

No other magpie change: a plugin model's variants are its levels
(pluginCatalog), and a plugin model listing none is sent none
(TestPluginThinkingOff), so /v1/models lists none for these models
once the plugin is 0.1.15.

npm view --prefer-online: 0.1.15 at 16:01 CST, before this commit.

Run at da6fd87ed plus this change (origin/main fetched before the
commit; rebased onto it with no conflict):
- gofmt -l internal/provider: clean.
- go vet ./internal/provider (darwin), GOOS=linux -tags nogui,
  GOOS=windows: ok.
- go test -tags nogui -timeout 45m ./internal/provider/...
  ./internal/catalog/... ./internal/gateway/...: ok (provider 98s,
  catalog 3s, gateway 370s), one suite on the machine.

Not tried: no real Command Code account. The plugin's off behaviour
rests on the reporter's measurements.
2026-10-23 16:06:17 +08:00
yetone da6fd87ede site: Kimi's own logo files for the README and the partner icon
The README logos and the Add sheet's partner icon were drawn by hand.
Kimi sent its own: 浅色背景.svg (black KIMI) and 深色背景.svg (white),
118x40 at 1,087,477 bytes each. Coordinates are rounded to two decimals
(838,851 bytes), and the partner icon is the K mark alone, cropped to
viewBox 0 0 40 40 (838,849 bytes, under provider.MaxIcon's 1 MB).

Run: rendered each with qlmanage and compared with the originals by eye;
curl after wrangler deploy (below). An app with the old icon kept picks
the new one up on its next partner fetch.
2026-10-23 15:45:27 +08:00
yetone 19f9a80d90 gui: a partner's editor link names its own page (www.kimi.com), not usemagpie.ai
The feed sends a partner's website through usemagpie.ai/go/<id>/site so
the visit is counted, and the provider editor's "↗" link read its host:
Kimi Code's editor said "usemagpie.ai ↗" where Kimi asked for
"www.kimi.com ↗". The worker now sends the website's own host beside it
as siteHost (partner and region), the app keeps it on the PresetDef and
Region, and the editor's link reads siteHost first, following the region
picked. The click still opens the /go link.

app.js grows 102 bytes; both budgets are raised by exactly that, no room
added.

Run at origin/main be002aca0 (this commit's parent):
- site: node --test worker.test.mjs 20/20 (new siteHost asserts).
- go test ./internal/provider -run 'Partner|Preset' ok; TestPartnersFromTheFeed
  checks siteHost survives the partner leaving the feed and a restart.
- go test ./internal/gui ok (budgets).
- partners.test.cjs 30/30, chromium and webkit, en/zh; red on the old
  label code (read "usemagpie.ai ↗").
- 86-file GUI run (editor header and every file it can reach): 1117/1118;
  the red is sessions-codex-provider chromium zh's nav click at 5s under
  load, 4/4 alone three times, filed as #3360.
- gofmt clean; GOOS=windows go vet ./internal/provider ./internal/gui ok.
Not tried: the live app; it needs this release and the worker deploy.
2026-10-23 15:44:48 +08:00
yetone be002aca05 site: Kimi Code is a partner in the Add sheet and a README sponsor
Kimi took an in-app seat and a README seat. The partner "kimi" (Kimi
Code) has four regions under "Plan": the Kimi Code membership in China
(api.kimi.com/coding, catalog kimi-code-plan-cn, the default) and
globally (api.kimi.ai/coding, kimi-code-plan-global), and Moonshot's pay
as you go in China and globally (catalog moonshotai), with the endpoints
and catalogs of the built-in kimi-code, kimi-code-cn and moonshot
presets, so the plan's handling (keyed on those catalogs and hosts) is
the same. Each region's key page and website is Kimi's aff=magpie link
for it. The tagline is in all five app languages; it is listed in every
language from 10-23, with no end set yet.

README.md links sponsor "kimi" (www.kimi.ai/code), README.zh-CN.md
"kimi-cn" (www.kimi.com/code), with a light and a dark logo. The icon
and logos are drawn from Kimi's mark.

Run: node --test site/*.test.mjs (30 of 30 ok). The served feed
(worker.js served() over partners.js) parsed with partnerFeed and passed
checkPartner and validPartners in a throwaway test in internal/provider:
one partner, the cn region's endpoints as default, every link a /go one.
Not tried: the app's Add sheet with this feed; the editor's link reads
usemagpie.ai, not www.kimi.com, until the app shows a partner's own host.
2026-10-23 15:12:19 +08:00
Yang Yu a1cce7faa1 gateway: the decision model's timeout is a setting (#2934, reyoung)
A routing group's intent classifier (askChat) and System One (askJev)
were each given a fixed 8s. A slow subscription classifier can now be
given longer in Settings > Models > Replies > Intent classifier timeout.
settings.json's classifyTimeout takes 1..60 seconds; 0 or missing keeps
8s. save() refuses below 0 or above 60, and ClassifyWait clamps a value
edited by hand (below 1 gives 8s, above 60 gives 60s). A settings file
that can't be read gives Shared()'s defaults, so 8s, never no timeout.
Both askChat and askJev read it per call. The GUI row is the app's own
segmented control (8, 15, 30, 60, plus a value set by hand), and other
saves carry the value on (prefsKeep, api.go). zh, zh-TW, ja and de
strings; the routing reference and the en, zh, ja docs say it.

Ported from reyoung's classify-timeout-2934 (author kept). On top:
- askJev's defer reworded any error once ctx had expired, so a refusal
  (decideRefused) or an answerError read as the wait ran out lost the
  type askDecideTries rests an account by. Now only errNoAnswer, which
  systemOne returns when postDecide failed with ctx done, is reworded
  to "<provider> gave no answer in <wait>".
- ja intent.html: a stray space in "遅いモデルだと 設定した".
- app.js: the Image generation timeout row and the new row share
  waitRow (~350 bytes less). TestCoreScriptBudget was red (app.js
  1,337,982 > 1,337,000); budgets raised to the exact sizes, app.js
  1,337,633 and core 1,529,393, no room added.

Run (macOS, Go env pinned, sandbox HOME):
- Full go test -tags nogui -timeout 45m ./... at 766cf1cf9: 68 packages
  ok; internal/gui red on TestCoreScriptBudget only, fixed above.
- At ed008ca9f and again after rebasing on 65e80405b: internal/gateway,
  internal/settings, internal/gui ok; gofmt -l clean; go vet (darwin),
  GOOS=linux go vet -tags nogui, GOOS=windows go vet all ok.
- Whole GUI suite at ed008ca9f, chromium and webkit, 4 wide at load
  ~30: 11,930 tests, 52 red, none in the files this change reaches
  (classify-timeout-setting, image-timeout, i18n-keys all pass). The
  red files rerun alone: 44 red in 10 files, the same 44 on origin/main
  65e80405b. All have issues (#2228, #2399, #2150, #2448, #2276, #3091,
  #2549, #2163, #3099, #3104) except library-mcp-health-wsl's ja case,
  filed as #3350.

Broken by hand, each red then restored:
- classifyTimeout fixed at 8: TestClassifierTimeoutSetting and
  TestJevGivenTheClassifierTimeout red.
- askJev fixed at 8: TestJevGivenTheClassifierTimeout red.
- save()'s bound removed: TestClassifyTimeoutKeptAndBounded (-1
  accepted) and TestSettingsClassifyTimeout (61 gives 200) red.
- ClassifyWait's clamp removed: red (600 waits 10m0s).
- api.go's keep removed: TestSettingsClassifyTimeout red.
- prefsKeep's classifyTimeout removed: the GUI test's "sent on with
  other saves" red in chromium and webkit.

Not tried: a real slow classifier or account; Linux and Windows at
run time; the native Linux desktop build; a test that pins the askJev
refusal-at-deadline race (it is timing-only, so no deterministic red
was written for it).
2026-10-23 15:03:08 +08:00
yetone 65e80405b8 gateway: TestPluginToldWhereTheAgentWorks counts a case's tries, not one request (#3347)
Cause: the test said a case's request reached the vendor exactly once.
A lone account whose try fails with a 5xx is asked again after a moment
by design (TestLastOneLeftIsTriedAgain), so one failed first try gives
the vendor two requests and the client a 200. That is what CI hit at
84d902ce2 (run 39906814999, race shard 3): "codex: the vendor got 2
requests". The product sends no duplicate: every request had a try of
its own. Which failure the first try met on CI isn't known, because the
test threw the route away. No gateway log line names it.

Reproduced: the fake vendor answered the codex case's first request
with a 502. The old test failed with the same message, "codex: the vendor
got 2 requests", and the route had try 1 at 502 with again=1 and try 2
at 200. Locally the natural failure never came: -race -count=150 (cpu
1,4), 6 parallel processes x 80, CI's shard 3 three times, and all 4
race shards at once (GOMAXPROCS=2) were all green.

Fix: the requests the case is about are its tries. The test fails when
the vendor got none, or got more requests than the route has tries (a
duplicate), or when a try that answered 200 was tried again. Every
request is checked for the headers the plugin was told and the vendor
never sees. Each retry is logged with its status and error, so the next
CI hit names the failure.
- Broken by hand: an injected 502 now passes and logs "codex: tried
  again after 502 FakeCo: 502 Bad Gateway". An injected duplicate (one
  request counted twice) fails with "codex: the vendor got 2 requests in
  1 tries".

Run at 84d902ce2 plus this change (macOS):
- gofmt -l: clean.
- go vet: darwin, GOOS=linux -tags nogui and GOOS=windows ok.
- go test -tags nogui -race -count=20 -run TestPluginToldWhereTheAgentWorks
  ./internal/gateway: ok.
- go test -tags nogui -timeout 45m ./internal/gateway: ok (358s), log
  kept whole.

After rebasing onto bac5be067 (plugin renewal lock), go vet and the
-race -count=20 run above: ok again. The package run is from before the
rebase.

Not tried: a Linux run, so the first try's CI failure stays unnamed.

Fixes #3347
2026-10-23 14:43:37 +08:00
yetone bac5be0677 plugin: one renewal of a sign-in at a time across magpie processes (plugins #331)
Cause: every magpie process that loads plugins runs a plugin host of its
own (the gateway, a CLI quota or usage command, a host restarting while
the old one finishes), and host.js's renew() kept a sign-in's renewal to
one at a time only inside one host (the in-memory renewing map). Two
hosts that found the same sign-in due each called the plugin's
auth.refresh with the same refresh token. A vendor that spends a refresh
token once (MiniMax, and about ten plugins' vendors: cline, codearts,
qoder, trae, workbuddy, raccoon, nous, kiro, factory) turned the second
away with invalid_grant, the plugin threw signIn "expired", renew() sent
it on without looking at the store again, and host.go -> provider's
notePluginLapse marked the account signed out, though the first host
had already saved a good token.

What changed, in internal/plugin/host.js only, for every plugin:
- renew() takes a lock file of the account's beside the store,
  plugin-auth.json.renew-<sha256(key)[:16]>.lock, holding the holder's
  pid and start time, across the plugin's auth.refresh, and lets it go
  in finally. It is separate from plugin-auth.json.lock, which changeAuth
  holds only for a write and never across an await. A lock whose pid
  is gone (process.kill(pid, 0), EPERM counted alive) is taken over at
  once, one older than 60s by anyone; a live holder is waited for with
  an async backoff (10ms to 500ms), never blocking the host's loop, and
  never past 120s. A lock is removed only while it holds the bytes read.
- Under the lock the sign-in is read again from the file (past
  readAuth's stat cache). Changed since the renewal began (another host
  renewed it, or it was signed out or in again), the renewal ends
  without calling the plugin; no longer due, likewise.
- A refresh that throws while the stored sign-in changed meanwhile (a
  magpie from before this lock spent the token and saved the new one)
  is logged, not reported expired.

Tests (internal/plugin/plugin_renew_race_test.go, fixture
testdata/renewrace): a fake vendor on loopback whose refresh tokens are
single-use.
- TestRenewOnceAcrossHosts: two hosts in two processes (this test binary
  and a child running TestRenewOtherHost) on one sandbox store. The
  first host's exchange is held until the second host is renewing too,
  waited on as state. One exchange, neither host says expired, both
  requests go with the new token, the store has it.
- TestRenewLockOfDeadHostAndRefusal: a lock naming a pid that has ended
  is taken over inside the request's wait and removed; a token the
  vendor never gave still says expired and leaves the account as it
  was; one refused after another magpie saved a new token says nothing
  and the next request goes with that token.

Broken by hand, each red:
- no lock (lockRenew returns at once): TestRenewOnceAcrossHosts red with
  exchanges [r1 r1], the other host said [expired], a request sent
  a-old - the issue's symptom; the dead-pid test red (lock left).
- no re-read under the lock (now = was): exchanges [r1 r1].
- the catch's check removed: "a token another magpie renewed meanwhile
  said expired".
- a dead pid counted alive: the dead-pid test red after its wait.
(Removing only the re-read's "changed" branch stays green: the "no
longer due" check under the lock catches the same case.)

Run at c909ca5e4 (on origin/main 84d902ce2): the new tests and
TestPluginRenewsSignIns -count=3, and -race -count=10 for the new ones;
gofmt -l; go vet ./... on darwin, GOOS=linux -tags nogui, GOOS=windows;
set -o pipefail; go test -tags nogui -timeout 45m ./... tee'd to a
log: all 88 packages pass (69 ok, 19 no test files), none red
(gateway 574s, agent 431s, plugin 265s, provider 246s). origin/main
was still 84d902ce2 at push.

Not tried: a real vendor account racing (MiniMax or another); Windows
and Linux runs of the new tests (process.kill(pid, 0) in Bun on Windows
is expected to work as in Node, not seen); the GUI suite (internal/gui
untouched). Not changed: a plugin that refreshes inside its own loader
(MiniMax's fetch on a 401, or within EARLY_MS) still de-dupes only in
its process; magpie's renewal comes before that window, so it is the
rarer path.

Reported by 1007cordon-ux (plugins #331).
2026-10-23 14:26:43 +08:00
yetone 84d902ce2b provider: Qoder's mover min is 0.2.31 (plugins #330)
0.2.31 sends every call of one prompt's tool loop as one Qoder task: one
request_set_id, business.id and begin_at, with stage start and then
processing, as Qoder.app's client does, instead of a new task per call.
A 265-call DSH task hit "Billing daily count exceeded" (plugins #330).
keepMovedCurrent brings every moved user's plugin up to it.

npm view --prefer-online: @magpie-community/opencode-qoder-auth 0.2.31.
Run at this commit (parent e00fbdbbc): gofmt -l, go vet -tags nogui and
go test -tags nogui ./internal/provider, ok. Full suite not run: one
constant changed.
Not tried: a real Qoder account; whether Qoder's daily count is per task
or per request is unknown.
2026-10-23 13:37:39 +08:00
yetone e00fbdbbc7 usage: times and days follow the viewer's time zone, not the server's (Outvi V, Discord)
Outvi V reads a remote magpie through `magpie web`. The Usage page
bucketed calls by the server's days and hours, so a call at 9:00 in
UTC+8 showed under 1:00.

What changed:
- The Usage page (plugins/usage/page.js) names its browser's IANA zone
  in ?tz= on /api/usage, /api/usage/requests, /api/usage/heatmap, the
  CSV link and the export.
- usage.Zone turns the name into one cached *time.Location per name, so
  a Filter holding it stays a comparable cache key. An empty or unknown
  name, or a zone that keeps this computer's clock, is time.Local, so
  the desktop page, the tray and the TUI see no change and share caches.
- Filter.Zone carries the zone. Today/7d/30d, the chart's hour and day
  buckets and labels, the Day filter and the heatmap's days are all
  read in it (Clock().In(zone)). The summary cache is keyed by period
  and zone, and the request-page cache by the reader's date.
- Shared days from other computers are read with a 2-day margin, not
  1, since two zones can be 26h apart.
- Limit and quota resets are unchanged. The gateway's
  /v1/magpie/usage stays on the computer's zone.

Run at e435b8867 + this change:
- gofmt -l and go vet on internal/usage, internal/usageapi and
  internal/gui: darwin, GOOS=linux -tags nogui, and GOOS=windows. The
  vet ran before the new _test files were added.
- go test ./internal/usage ./internal/usageapi and
  -tags nogui ./internal/gui: ok with TZ=UTC and with
  TZ=Asia/Shanghai.
- New tests:
  - TestUsageReadsTheViewersZone and TestZoneNames (internal/usage).
  - TestUsageRoutesReadTheViewersZone (internal/gui) asks the routes
    with ?tz= naming a zone other than the server's.
  - Each holds usage.Clock and checks the hour label, today's
    membership, the Day filter, the week chart's day label and the
    heatmap's days. With no ?tz=, the server's days are kept.

Broken by hand:
- Clock().In(zone) / Clock().In(f.loc()) back to Clock(): red in both
  zones (Summary, Requests, ledger, heatmap, /api/usage,
  /api/usage/requests, /api/usage/heatmap).
- The Day filter read in time.Local: red under TZ=UTC.
- The summary's and chart's bucketing in time.Local: the week-day label
  check goes red under TZ=UTC. Under TZ=Asia/Shanghai the chosen
  moment falls on one date in both zones, so it can't tell there.
Each was restored after.

Not tried:
- A Playwright GUI test with timezoneId in Chromium and WebKit was
  not written. The GUI suite and usage-stale-answer.test.cjs (which got
  a usageZoneQ stub) were not run: the disk was at ~350 MB free.
- TestCoreScriptBudget was not run again after the change. app.js is
  untouched, and page.js is a plugin page outside the core budget.
- A real remote `magpie web` from another zone, and the Windows box.
- Siblings left alone:
  - The Sessions tab buckets by the server's days and hours in its
    cached rollups, and its "By hour" card labels them with the
    browser's zone name.
  - The Routing history's day files are the server's days.
  These need issues of their own.
2026-10-23 10:54:27 +08:00
yetone a6efe07cd7 davsync: a GitHub backup too large for one request goes up in parts (Zhang-Wei, Discord)
Zhang-Wei (Discord, v0.1.1327) saw every GitHub sync fail with "GitHub
sync: HTTP 422: Sorry, your input was too large to process. Consider
creating the blob in a local clone of the repository and then pushing it
to GitHub." Their exported backup is 50.8 MB; with the library's sync off
it works. 93b87d000 sends a backup as one base64 blob in one POST
/git/blobs, so 50.8 MB is about 68 MB of request body. GitHub documents
100 MB per blob (on read) but no request size for creating one; a 19 MB
file's Contents PUT (about 25 MB of body) did go through.

A backup over 16 MiB (githubPart) now goes up in parts, in the same one
commit: magpie.magpie-backup.parts/1, /2, ... beside it, and at the
backup's own path a short list (format magpie-backup, version 2, split
github-parts, total size, each part's blob SHA and size). The version is
the list's blob SHA, and the list names each part by blob SHA, so one
version pins one whole set. get() reads the list, downloads each part by
that SHA (as large single files already were), checks each part's git
blob SHA and the sizes, and returns the backup whole; a list that doesn't
add up or a part that isn't the one named is an error. A write removes
the parts the list at the head named and the new backup doesn't use, in
the same commit (only paths known to be there, so the tree never names a
missing path). Blobs already sent are kept across a non-fast-forward
retry. The errChanged check at the head, the ref update without force and
the three rebuilds are unchanged. Backups up to 16 MiB stay one file; the
64 MiB total (four parts) stays, the bound the library's skill budget is
sized for. An empty repository's first backup in parts skips the Contents
API and follows the README note commit.

Why parts, not compression: the sealed bundle is uncompressed JSON with
skill files base64 inside, so compressing would shrink it, but that is a
backup format change for every backend and every export, every other
computer would need the new magpie even for WebDAV and S3, and it still
bounds nothing on GitHub's side. Parts keep the format and touch GitHub
only.

Older magpies: the list opens in backup.Open (unchanged since efbe5660b)
as format magpie-backup with no kdf and version 2, so it says "this backup
was made by a newer magpie; update magpie to open it" and stops: not
ErrCorrupt or ErrNotBackup, so no rebuild over it and no replace offered.
A backup in one file, from any magpie, still reads.

Library: nothing found that shouldn't be carried, so no second commit.
readSkills already skips .git and caps skill files at 32 MiB (about
57 MiB sealed). The skills on this machine (~/.claude/skills, 64 skills,
43 MB; ~/.agents/skills) hold no node_modules, __pycache__ or .venv; the
large files are real assets (images). Leaving node_modules out could break
a skill that ships its dependencies. Zhang-Wei's folders weren't seen.

Tests (fixture only, no network): the fixture refuses a blob POST over
24 MiB with GitHub's text, and serves any blob by SHA. New in
github_parts_test.go: TestGitHubSplitBackup (50.8 MB in four parts, one
commit, byte for byte back, errNotModified, stale put errChanged, then
two parts and back to one file with no part left),
TestGitHubOneFileBackupStillReads (old small and 30 MB single files read;
parts replace one), TestGitHubPartsOlderMagpie, TestGitHubPartsDamaged,
TestGitHubPartsBranchMovedMeanwhile, TestGitHubEmptyRepositoryPartsBackup
and TestGitHubSyncLargeLibrary (a ~38 MB instruction text syncs to a
second computer through Now). TestGitHubLargeBackup now uses 15 MB, to
keep covering one blob over the Contents API's limit.
docs/subsystems/sync-backup.md says how parts work and names the tests.

Record, at base origin/main e435b8867 plus this change (Go 1.26.8,
GOMODCACHE/GOCACHE pinned):
- gofmt -l internal/davsync: nothing. go vet ./... (darwin): clean.
  GOOS=linux go vet -tags nogui ./internal/davsync/...,
  GOOS=windows go vet ./internal/davsync/...: clean.
- go test -tags nogui -count=1 ./internal/davsync/... ./internal/settings/...
  ./internal/cli/... ./internal/backup/... ./internal/library/...: all ok
  (davsync 58s, settings 30s, cli 47s, backup 8s, library 127s).

Red on the old github.go (new tests, a shim for the new names): every new
test fails, the split ones with the reporter's 422 text, OlderMagpie with
"not a magpie backup" (the old code wrote the backup as is).

Broken by hand on the new code, each red:
- stale parts kept: TestGitHubSplitBackup
- part SHA not checked: TestGitHubPartsDamaged/a_part_changed
- blobs sent again on retry: PartsBranchMovedMeanwhile/another_file
- version check at the head skipped: SplitBackup, PartsBranchMoved/
  the_backup, and the older Remote, LargeBackup, BranchMoved tests
- no split (threshold at 64 MiB): SplitBackup, OneFileBackupStillReads,
  PartsOlderMagpie, PartsDamaged
- sizes not added up: PartsDamaged/sizes
- list's format "magpie-backup-parts": PartsOlderMagpie
- empty repository tries the Contents API first: EmptyRepositoryPartsBackup
- list's version 1: OlderMagpie still passes, since old Open also stops
  on the missing kdf; version 2 is a second guard, not the only one.

Not tried: the real GitHub API (no test repository here); the 16 MiB part
is chosen under the largest body seen accepted, not a documented limit.
The full go test ./... and internal/gui's tests were not run: the disk had
under 500 MB free. -race not run; no goroutine was added.
2026-10-23 10:35:44 +08:00
yetone e435b88670 usage: nothing under the Requests table's scrollbar at the window's foot
碳碳双键 on Discord #general (10-23, macOS app): on Usage → Requests a
wide table showed a strip of the page under its horizontal scrollbar,
between the bar and the bottom of the window.

Cause: the bar under the table (#ledHScroll, #799) is position: sticky,
bottom: 0 inside the view. A sticky box keeps clear of its scroller's
padding in both engines, so it stood the view's bottom padding (8px in
the window, 4px in the panel, 12px in a phone browser) above the view's
visible bottom, and the table's card and cells showed through the strip
under it. Measured on c4a5e6153 at 600x640: view bottom 612, bar bottom
604, the pixel row above the foot is a table cell, in Chromium and WebKit.

Fix: ledHScroll(), which already runs whenever the bar is shown or the
wrap resizes, sets the bar's bottom to minus its view's computed bottom
padding, so it sits on the view's foot. At the page's end the bar is in
flow under the table and does not move (sticky only shifts it while the
table runs past the foot). No CSS or other layout changes.

Test: ledger-hscroll-foot.test.cjs, Chromium with classic and with
overlay (default --hide-scrollbars) scrollbars and WebKit, zh and en, at
600 and 420 wide: mid-table the bar's bottom is the view's bottom (±0.5px)
and the view's last pixel row is the bar; at the page's end the bar sits
2px under the table. Red on c4a5e6153's page.js, 15 of 15 ("the bar's
bottom is the view's bottom, no gap under it: {"foot":612,"bar":604,...
"under":"where-name"}"), green with the change.

Run at c4a5e6153 + this change (rebased onto ed71fa774, which changes only
routing files; at the pushed head ledger-hscroll-foot, ledger-hscroll and
i18n-keys pass in both engines, 24 of 24):
- GUI, BROWSER=chromium and webkit, concurrency 4, 66 files (usage-*,
  ledger-*, request-archive*, own-requests, i18n-keys, click-scroll,
  old-webkit, gui-zh-tw, gui-ja, gui-de): chromium 477 pass / 16 fail,
  webkit 472 pass / 16 fail. Every red is the same on c4a5e6153's
  page.js (the four files run again with it: 36 pass / 16 fail in each
  engine) and already filed: usage-agents-hide (#2276), usage-fold
  "several accounts" in chromium (#2163), usage-ledger "newest live
  route needs no return-to-live button" (#3104), usage-checkin Qoder tab
  in WebKit (#3091, #2549). ledger-hscroll (#799) passes in both.
- go test -tags nogui -count=1 ./internal/gui/... under a temp HOME: ok.

Not tried: the real macOS app (the reporter's screenshot) and a real
overlay scrollbar in WKWebView; Playwright's WebKit and Chromium's
overlay mode stand in. No full `go test ./...` (JS-only change), no
Linux WebKitGTK or Windows WebView2 run.
2026-10-23 10:15:01 +08:00
yetone ed71fa774d routing: the last request's story shrinks back on a busy gateway too (shensmart on Discord)
shensmart on Discord (a remote magpie, the page in a local browser): the
room under "How the last request was routed" grew with use and, once
stretched, never shrank back.

Cause (internal/gui/assets/plugins/routing/client.js, holdStory): the
story is held at the tallest of the last STORY_HELD requests so the page
doesn't jump between requests (dumplings' jitter, routing-ctx-still), and
0455b9279 made a long one drop out after three. But only a request drawn
while answered was counted. On a busy gateway a request is answered as
the next starts, both come in one trace, and the newest (the one drawn)
is always under way, so nothing new was ever counted and a long story
held the box at its height for good.

What changed: every request drawn live counts, answered or under way, at
the height it has now (the map is renamed done -> told). The anti-jump
hold is kept: a request under way is still held at the answered one
before it, and a sequential agent behaves as before. Once three newer
requests have been told, a long one stops holding the box. No new UI.

Guarded by a new case in internal/gui/tests/routing-story-shrinks.test.cjs:
a request handed on four times, then traces that each carry one request
answered and the next started. en at 1100px and zh at 420px, Chromium
and WebKit. On the old client.js (f81913994) it is 0/4 red: "the box
shrank back with the newest always under way: 247.5 vs 247.5 (min-height
247.5px)" (en), 356.25 vs 356.25 (zh); the original four cases passed.

Run (macOS, NODE_PATH playwright 1.62.0, log kept whole in a file):
- At f81913994 + this change: every internal/gui/tests/routing-*.test.cjs,
  panel-routing*.test.cjs and i18n-keys.test.cjs, both engines:
  1229/1229 pass. go test -count=1 ./internal/gui: ok (83s).
- Rebased on origin/main c4a5e6153 (one provider-only commit, nothing
  under internal/gui), head tree of this commit: routing-story-shrinks,
  routing-ctx-still and i18n-keys again, 29/29 pass.

Not tried: shensmart's own remote magpie and traffic; their version is
unknown, and if it predates v0.1.1326 (0455b9279) the plain "long story
held for good" case is what they saw, which that release already fixes.
No full Go suite (only JS and the gui package changed). Not tried in the
real Linux WebKitGTK app (no motion or new browser API involved).
2026-10-23 10:02:13 +08:00
yetone c4a5e61530 provider: WorkBuddy's mover min is 0.1.30 (plugins #291)
0.1.30 rewords the line tearslee measured WorkBuddy refusing (11128)
in an assistant message, which the 0.1.29 move of the system prompt
can't reach, so a long DeepSeek Harness chat isn't refused for good.
npm view --prefer-online --registry https://registry.npmjs.org says
0.1.30 at landing.

Run at f81913994 plus this change: gofmt; go vet (darwin, linux, windows,
-tags nogui) ./internal/provider; go test -tags nogui ./internal/provider ok.
Not run: the full suite; a one-line min with no code path change.
2026-10-23 09:38:51 +08:00
yetone f81913994a gateway: a Responses Lite compaction's summary request offers no tools, and a reply without a summary says what it held (WuSix on Discord)
WuSix (Discord) got "compaction: codex/gpt-6-astra failed to summarise
this conversation 3 times in a row (last: the model wrote no summary)".

codex/gpt-6-astra's catalog entry is Codex's own (codexcat.ownEntry), and
Codex's entry puts gpt-6 on Responses Lite: its tools go as an
additional_tools input item, none in tools. codexInputAs set "tools": []
for magpie's summary request but left that item in, so the model was
asked for the summary with every Codex tool still offered (tool_choice
auto, which codexBody sets anyway). A reply that is a function_call and
no message is "the model wrote no summary". codexInputAs now leaves the
additional_tools item out when it turns the trigger into the summary
prompt; calls in the history stay as they came.

The 502 and the held message now say what the reply held instead
(answeredWith: "(it answered with function_call shell)", "reasoning",
"nothing"), so the next report says which it was.

Hypothesis, not confirmed on a real reply (see below): the fake backend in
TestCodexLiteCompactionOffersNoTools answers a call whenever any tool is
offered, as an agentic model mid-task may. What the test holds is that
the request offers none.

Run at base 398803e3f (origin/main), in this worktree:
- TestCodexLiteCompactionOffersNoTools red before the fix (502
  "compaction: the model wrote no summary"), green after
- gofmt -l internal/: clean
- go vet ./internal/gateway/, GOOS=linux go vet -tags nogui, GOOS=windows
  go vet: ok
- go test -tags nogui -count=1 -timeout 45m ./internal/gateway/: ok
  (366.6s); only comments and docs changed after it started

Real ChatGPT backend, the owner's Codex sign-in (access token read
from ~/.codex/auth.json, not refreshed), 2026-10-23: the exact body
magpie sends upstream, captured from the gateway with a fake backend
(before and after this change), then POSTed to
chatgpt.com/backend-api/codex/responses with Codex's headers and
X-OpenAI-Internal-Codex-Responses-Lite: true. gpt-6-astra, effort low,
reasoning.context all_turns; a developer prompt, a user ask, a
function_call shell (namespace "functions") and its output, then the
compaction prompt. Three tries each:
  (a) old: additional_tools kept, tool_choice auto  200 x3, message
      (978/1010/1037 chars)
  (b) this change: additional_tools left out        200 x3, message
      (1176/1003/991 chars)
  (c) additional_tools kept, tool_choice none       200 x3, message
      (972/1009/1026 chars)
So the backend takes a Lite request whose history calls the "functions"
namespace with no additional_tools item: the fix doesn't 400. The old
request also summarised on this short history, so the cause of WuSix's
reports isn't reproduced on the real backend; with a long tool-heavy
conversation at a higher effort it may still be, and answeredWith will
say.

Not tried: a long conversation, efforts above low, and WuSix's own
conversation.
2026-10-23 09:20:23 +08:00
yetone 881a275064 gui: release notes' section headings read in the GUI's language for every version (Wei He)
Wei He on Discord: in What's new, past versions' category headings were
Chinese in some releases and English in others.

Cause: the dialog drew each release's markdown headings as written. The
Chinese notes come from magpie-releases' DeepSeek translation, which
keeps the English headings in some releases and translates them in
others, with its own wording each time. Of the 79 releases from v0.1.1241
to v0.1.1320 that usemagpie.ai/api/notes?lang=zh serves, the headings are
"## Improvements" 26 times beside "## 改进" 26, "## Bug Fixes" 26 beside
"## 错误修复" 22 (plus 缺陷修复, Bug 修复), "## Features" 15 beside "功能"
18 and 新功能 1; v0.1.1249 to .1252 have no Chinese at all ("### Changes"),
and .1241 to .1248 say "### 更新". A GUI in ja, de or zh-TW gets the
English notes, headings and all.

Fix: tHeading (in i18n.js, beside tNotice, so app.js stays under its
budget) maps each heading magpie knows, in either language's wording, to
one key (Features, Bug Fixes, Improvements, Changes, Documentation,
Performance Improvements, Security, Provider Changes) and says it through
t(), in zh, zh-TW, ja and de. A heading it doesn't know reads as written.
noteBlocks uses it, so What's new and the update dialog both get it.
The bullet text stays in the language the notes came in; the upstream
cause (the translation prompt not fixing the headings) is in
magpie-releases, not here.

Every heading the site served for those 79 releases, in zh and en, was
put through tHeading by hand: each maps (Install is taken out before).

Run at 398803e3f + this change:
- whats-new, whats-new-failed, i18n-keys, gui-ja, gui-de, gui-zh-tw,
  update-notes-ask: 28/28 ok, Chromium and WebKit.
- update-*.test.cjs, agent-notice-lang, header-relang, dates-gui-lang,
  quota-name-translated: 263/264. The red is quota-name-translated
  "webkit en" (a name 2px past at 440px), red the same at 398803e3f
  without this change, 2 of 2; it is #2228.
- whats-new.test.cjs with tHeading taken out of noteBlocks by hand: red
  in both engines and languages (the zh headings and the 缺陷修复 one).
- go test -tags nogui ./internal/gui -run 'Budget|Asset|I18n|Lang|WhatsNew|Notes'
  ok (app.js 1,336,991 bytes, unchanged); go test ./internal/update ok.
No Go code changed, so no gofmt or vet. Not tried: the real app against
the live site; the full GUI suite.
2026-10-23 09:14:15 +08:00
yetone 398803e3f5 gateway: a model slow to start again and again rests on its account (小八)
小八 on Discord (2026-10-23): a WorkBuddy plugin account answered magpie's
own 504 "no first token in 30s" 58 times on kimi-k3-1 and glm-5.3 (the
vendor's per-model token limit, which it never names, it just stalls).
The group went on each time, then asked the same account first on the
next request: 15 slow starts in 17 minutes in one session.

Cause: gateway.go's hw.slow branch (the group's FirstToken let a member
go) never rested anything, by design ("a long prompt being slow to start
anywhere"), and nothing counted slow starts. So every request waited out
the whole FirstToken on the stalled member before falling back.

Now restSlow (routing.go) counts slow starts per restID (provider,
account or key, model). Once rests nothing, as before. The second in a
row, within slowForget (30m) of the last, rests that model on that
account: 1 minute, doubling each time after, capped by the provider's
RestCapOr(longestRetry), never for a provider whose rest cap is off. An
answer clears the count (servedCandidate). A client-cancelled request
never reaches the slow branch, so it counts nothing. A longer rest
already there is kept. The rest carries Rest.Model, so the Routing page
shows it on that model's rows only. The Routing story of a rested slow
try says so, and the group editor's slow-to-start hint no longer says
"It doesn't rest" (en, zh, zh-TW, ja, de).

Tests: TestSlowStartsRestTheModelOnItsAccount (once: no rest; an answer
in between restarts the count; twice: the model rests on k1 with Key
a#k1/m, Model m, under a minute; k1's whole key and k2/m don't rest; the
next request asks k2/m first; a/n still goes to k1; a third slow start
backs off longer; an answer ends it). TestCanceledSlowStartRestsNothing
(three client cancels during the first-token wait: no rest, no count).
routing-went-on.test.cjs gains a rested slow try in five languages;
group-first-token.test.cjs's i18n list has the new strings.

Broken by hand: restSlow's result ignored in gateway.go -> the first test
red at "twice in a row" (Rest nil); servedCandidate not clearing
routed.slow -> red at "an answer in between starts the count again";
restSlow called in the cancel branch -> the cancel test red at "cancel
2: k1/m wasn't asked (rested?)". All restored, green.

Run at the worktree on base 7aad6a50e: gofmt -l clean; go vet darwin,
GOOS=linux -tags nogui, GOOS=windows: ok. The two new tests -race
-count=3: ok. TestGroupFirstTokenFailsOver, TestNestedGroupFirstToken:
ok. GUI: the 125 routing-*, group-* and i18n-* files, Chromium and
WebKit: 1428 of 1429; the one red, routing-rule-remove de (menu focus
after ArrowUp, the #3094 symptom), passed 20 of 20 alone. Full suite:
set -o pipefail; go test -tags nogui -timeout 45m ./... : 69 packages ok, none failed (gateway 544s, agent 430s, provider 234s).

Not tried: a real WorkBuddy account stalling on its token limit; the
fixture stalls by holding its stream after the role chunk.

Rebased on origin/main ecd983500 (no gateway or routing plugin change in between) and run again there: gofmt, the three go vets, internal/gui (budgets) ok, the four first-token gateway tests ok, i18n-keys, routing-went-on and group-first-token in both engines 43 of 43.
2026-10-23 04:03:39 +08:00
yetone ecd9835005 agent: Claude Code's subagent effort writes nothing without a subagent model (KorenKrita)
KorenKrita on Discord (cause confirmed by them): with Claude Code's
subagent model unset ("Claude Code picks") and a subagent effort set,
claude.go wrote spell(tierWith(main model, effort)) into
env.CLAUDE_CODE_SUBAGENT_MODEL. That pinned every subagent to the main
model, so Claude Code's own pick (the Agent call's model, the subagent's
frontmatter) never ran.

Agent wiring (internal/agent/claude.go):
- With no subagent model, magpie writes no effort, and
  CLAUDE_CODE_SUBAGENT_MODEL stays unset.
- The saved effort is kept, not deleted (the user set it). It lives in
  the stash under claude.subagent_effort, and the subagent effort's Get
  reads "" while there is no model. A model picked later takes it
  ("v/glm:high").
- A value an older magpie wrote that way (the main model at an effort,
  not own, while routed: subagentFollowing) is moved into the stash and
  taken out of the env by writeTiers and by Sync on start.
- subagentOwn no longer counts that value as the user's own model.
- Doc: docs/subsystems/agent-wiring.md, the Claude Code "subagents" entry.

GUI (window, opened Claude Code row):
- The subagent effort moves from its square under the session defaults
  to the right of the Subagents row. It uses the tier rows' markup and
  code (effortBtn in connectPanel, ag-eff), so it lines up with
  Opus/Sonnet/Haiku's effort.
- While the subagent model is unset it shows Default, is disabled, and
  its title says "Set a subagent model first". The new string is in zh,
  zh-TW, ja and de.
- The old square is removed from the opened row. No other layout changes.
- The tray panel's own square is left alone: #3308.

Tests:
- New internal/agent/claude_subagent_effort_test.go
  (TestClaudeSubagentEffortNeedsAModel). On the old code it is red:
    an effort with no subagent model wrote
    CLAUDE_CODE_SUBAGENT_MODEL="v/glm:high"
  With the Sync branch broken by hand it is red at "Sync left an older
  magpie's CLAUDE_CODE_SUBAGENT_MODEL="v/flash:high"". It also checks
  that a set model plus effort still writes "v/glm:low".
- claude_tiereffort_test.go now expects no env for an effort with no
  model.
- New internal/gui/tests/claude-subagent-effort-row.test.cjs (16 cases):
  chromium/webkit x en/zh x 1100/560px x with/without a subagent model.
  It checks:
  - the control sits in the Subagents row at the tier efforts' x and
    height;
  - with no model it is disabled at Default and opens no slider;
  - with a model it posts subagent_effort, with no scroll;
  - the old square is gone.
  It is red against the old app.js ("the old square is still there").
- tier-effort.test.cjs is updated for the moved control.

Run at this tree (parent f985d6bdb):
- go test -count=1 ./internal/gui/ ./internal/agent/ ./internal/provider/:
  ok.
- GUI: claude-subagent-effort-row, tier-effort, i18n-keys,
  subagent-effort, claude-subagents-pick, desktop-subagent-model,
  agent-prefs, agent-tweak-fold, claude-signin and agent-field-names:
  147/147.
- gofmt clean. go vet darwin, linux -tags nogui and windows: ok.

Run at the same change before its last rebase:
- Full Go suite (`go test -count=1 -timeout 45m ./...`, sandbox HOME,
  through the suite lock) at 11b9d671c (on 45593cc1d): every package ok
  but internal/gui's TestCoreScriptBudget. app.js was 1,337,535 bytes,
  over its 1,337,000 budget, after the rebase brought in upstream growth.
  This commit trims its own additions to 1,336,991 (one shared effortBtn,
  shorter comments, a shorter new string) and raises no budget.
  TestCoreScriptBudget now passes.
- Full Go suite at 41737d214 (on 802fb6e61): all 69 packages ok.
- Whole GUI suite at 41737d214 (11,741 tests, 5.8h at load ~250): 48 red,
  none from this change.
  - Red the same on origin/main 45593cc1d, all filed: quota-count-wrap
    and quota-name-translated (#2228), quota-reads (#2150), s3-sync
    (#2448), usage-agents-hide (#2276), usage-checkin (#2549, #3091),
    usage-fold (#2163), usage-ledger (#3104, #3001).
  - Red under load only and green alone: agent-notice-lang (#2960),
    agent-stale-copies (#1949), modal-morph (#3179), plugin-card-update
    (#3079), plugin-github (#3218), and agent-field-names and
    api-key-theme (filed as #3307).
  - Also seen red once under load: codex-subagent-model's fixed 300ms
    wait (#3277).

Not tried:
- a real Claude Code run reading the written settings;
- the Windows box;
- the whole GUI suite again after the string was shortened (only the
  files above were run);
- the tray panel (#3308).
2026-10-23 03:44:55 +08:00
yetone f985d6bdb6 provider: a Max output kept for a model no longer listed doesn't block the editor's Save (#3305, LoKi)
LoKi (#3305, Windows, v0.1.1325, Zen Free plugin 0.1.14): settings.json
held "opencode-zen-free/space-bunny-free": 65536 from when Zen Free
listed it. OutputsOf gives the editor every saved limit, the editor
sends them back as `outputs` on every Save, and SetModelOutputs refused
any positive entry for a model the provider doesn't serve, so each Save
failed with "opencode-zen-free has no model space-bunny-free", with no
model picked too.

SetModelOutputs (models.go) and its sibling SetModelCompacts
(compact.go, the editor's Compact at, same check and same round trip)
now refuse an unserved model only when its value is new or changed: an
entry sent back as it is stored is kept, and the rest of the Save goes
through. The user's value isn't deleted, since they set it and the model
may come back on the next refresh. It still shows in Max output as
model=size, and taking it out there clears it, as before. A newly typed
model the provider doesn't serve, or a changed value for a retired one,
is refused as before. SetModelOutput (the CLI's single set) is unchanged.

Siblings checked: the editor's Context window goes through provider.Save,
which never checks it against the list, so a retired model's window
already saved; Names & levels (modelPrefs) sends only the entries
changed in that editor session (modelPrefsOfDraft), so a retired one
isn't resent.

Run at 45593cc1d (origin/main, unchanged at push) plus this change:
- TestRetiredModelLimitsDontBlockTheEditor (provider; outputs and
  compacts) and TestProviderSaveKeepsRetiredModelOutput (gui, through
  /api/provider/save: the model leaves the list, Select none, a stale
  limit beside a new one, a newly typed "typo" refused, cleared): ok.
- Broken by hand (the `!= n` term dropped from both setters): both red,
  "relay has no model luna" (each subtest) and 400 "relay has no model
  space-bunny-free".
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows: ok.
- go test -tags nogui -timeout 45m ./... (darwin, one suite on the
  machine): every package ok (agent 442s, gateway 794s, gui 178s,
  provider 218s), no FAIL in the log.
Not tried: the reporter's Windows machine or the real Zen Free plugin
(the fix is in a provider-kind-independent settings comparison); no GUI
change, so no Playwright run.
2026-10-23 03:35:27 +08:00
yetone 45593cc1d6 provider: Grok's mover min is 0.2.1, which renews once on a 401 (plugins#324)
plugins 92d5557 (grok 0.2.1, on npm: npm view --prefer-online answers
0.2.1) renews a sign-in once through Grok Build when a request, the
model list or usage gets a 401, and retries once. A renewal that leaves
the same token now says Grok Build couldn't renew it, with the CLI's
last line, not that the sign-in expired; a half-written auth.json is
read again and then falls back to the last good read. Maxwelltoo's
report: 716 failed silent refreshes over a day, each surfaced as
"sign-in has expired; run grok login".

min 0.1.18 -> 0.2.1, so keepMovedCurrent brings every moved user up.
The note drops "a token Grok refuses early reads as expired", which
0.2.1 no longer does.

Run at 79856727f plus this change: go test -tags nogui ./internal/provider/
ok (92s), gofmt clean. Only this string changed, so no full suite.
Not tried: a real Grok Build sign-in on 0.2.1; the plugin's own tests
use a fake CLI.
2026-10-23 03:15:12 +08:00
yetone 79856727f5 gui: Image recognition says where a custom provider's model is marked as seeing (nexnull)
nexnull on Discord: a model of a provider added by its address isn't
offered for Image recognition until something says it takes images, and
nothing said so. /api/settings now has visionNotMarked: the providers
(AddedByAddress, ready) with a model left out of visionModels only
because nothing answered whether it takes images (ImageInput nil); one
its list or the user marked off (ModelImages) isn't counted. Settings ›
Models says under Image recognition "Models of {providers} aren't
listed until marked in their provider's Names & levels › Accepts
images", using the editor's own strings for the section and checkbox
(名称与推理档位 › 支持图片输入 in Chinese). Not shown with Image
recognition off. zh, zh-TW, ja, de.

Run at base 61b92529e plus the two commits before (this tree):
- TestVisionNotMarked (gui, through Handler under a temp HOME): a relay's
  unknown model is named, marked on it is a vision model, marked off it
  isn't named. ok.
- vision-not-marked.test.cjs (new; five languages, 1000 and 360px, both
  engines; fits its row, no side scroll, no stripe; none or Off says
  nothing): 32/32. Named NotMarked, not Unmarked: the Routing plugin's
  own word is Unmarked, and i18n-keys fails a core file that holds it.
- images-missing, i18n-keys: pass.
- Full GUI suite (both engines): 11767 run with the next commit at load
  ~150-250, 62 red in 21 files; those files again at concurrency 2:
  10 red. mobile-web #2658, quota-count-wrap and quota-name-translated
  #2228, s3-sync #2448, usage-agents-hide and usage-fold #2399,
  usage-checkin #2549/#3091, usage-ledger #3104, routing-rule-remove
  #3094/#3096: each red on origin/main 8278fd9b0 too. The tenth,
  provider-levels-scroll, was this change's (below), fixed here; then
  every provider*, name*, model*, vision*, editor*, settings-proxy* and
  i18n* file, both engines: 1228 pass, 0 fail.
- gofmt -l clean; go vet darwin, linux nogui, windows: ok.
- After rebasing the three commits on origin/main 7aad6a50e, at this tree
  (4342276a0, first committed as f4a95e9fa): go test -timeout 45m ./...
  (darwin) every package ok, the run before it caught
  TestSettingsSaveKeepsWhatItDoesNotSend (ProxyCustom, fixed in the
  first commit) and TestCoreScriptBudget (raised in the second); gofmt
  -l clean; go vet darwin, linux nogui, windows ok; every provider*,
  name*, model*, vision*, settings*, editor*, i18n* and images* GUI
  file, both engines: 1420 pass, 0 fail.

Broken by hand, each red, then put back:
- no ImageInput == nil check: TestVisionNotMarked red ("marked false:
  told [My Relay]").
- the line never drawn: vision-not-marked 11 of 16 red in chromium.

Not tried: a real custom provider in the real app; the picker itself
(the line is under the row, not in the menu).
2026-10-23 03:08:08 +08:00
yetone d41670e9db gui: Names & levels says Provider in model names is global, opens Settings at it (joe)
joe on Discord: the provider editor's Names & levels had Off / Not on
names I set / On for "Provider in model names", a setting for every
provider, and it read as this provider's own. This undoes the part of
#868 (Hu9956) that offered the choices there: the editor keeps the line
saying what the agents' lists will show, and adds a short note that the
setting is one for every provider, with a "Change in Settings" button
that opens Settings › General at the row and lights it (the scroll only
on the reader's click, scrollOnPurpose; a search is cleared first). The
button is hidden in gateway mode, where Settings has no such row. A pick
on Settings now redraws every place that says the setting at once
(redrawSuffix), so the editor left open behind Settings follows it.
The line's three parts (what the lists show, the note, the button) are
a line each: WebKit lays the model list out again a scrollbar's width
narrower (466 to 456px) after a level is ticked, and a shared line
wrapped then and moved the list 19px (provider-levels-scroll, webkit).
No <select>, no left-border accent. Strings in zh, zh-TW, ja and de.

app.js's budget goes from 1,335,000 to 1,337,000: main had 371 bytes
left, this change adds ~1.2KB and the next commit ~480 to pages that
are the core's own (the provider editor, Settings), after cutting these
comments down; no room is added beyond the two (TestCoreScriptBudget
red at the pushed head before it). Nothing was moved out to pay for it.

Run at base 61b92529e plus the commit before (this tree):
- name-suffix-where-named (rewritten test 1: no choices in the editor,
  the note, the button opens General at #plainNamesSegs lit and in view,
  a pick there posts once and the editor's line follows): 8/8.
- name-suffix-remote (On and Off saved, the line for each), names-fold,
  name-suffix-saved (editor drawn before the state, stateDelay 600),
  name-suffix-no-names: 10, 8, 60, 28 pass; i18n-keys 3/3.
- Full GUI suite (both engines): 11767 run with the next commit at load
  ~150-250, 62 red in 21 files; those files again at concurrency 2:
  10 red. mobile-web #2658, quota-count-wrap and quota-name-translated
  #2228, s3-sync #2448, usage-agents-hide and usage-fold #2399,
  usage-checkin #2549/#3091, usage-ledger #3104, routing-rule-remove
  #3094/#3096: each red on origin/main 8278fd9b0 too. The tenth,
  provider-levels-scroll, was this change's (below), fixed here; then
  every provider*, name*, model*, vision*, editor*, settings-proxy* and
  i18n* file, both engines: 1228 pass, 0 fail.
- gofmt -l clean; go vet darwin, linux nogui, windows: ok.

Broken by hand, each red, then put back:
- the button opening Settings with no row: where-named red (not lit).
- the three parts sharing a line: provider-levels-scroll red in webkit
  (788 !== 769), 3 of 3; green on origin/main and with this commit.
- no redrawSuffix() after a pick: where-named red in webkit (the
  editor's line kept "My Sol · Relay").

Not tried: the real Wails app (macOS, Linux WebKitGTK).
2026-10-23 02:39:33 +08:00
yetone 7faea508f6 settings: Custom proxy brings back the last address and login (Zane)
Zane on Discord: in Settings' proxy, Off saves "direct" and Auto saves
"", so the Custom address and its user and password were gone the next
time Custom was picked. settings.Save now keeps the last proxy of the
user's own as proxyCustom (set only from Proxy, never from the page; the
POST /api/settings handler copies the saved one over what the page
sends). It is stored as Proxy is: plainly in settings.json, as before,
the same as the proxy itself, nowhere more plainly. KeepOwn keeps it this
computer's own, as Proxy, so sync and restore never carry another
computer's. Custom picked after Off or Auto fills its fields from it;
nothing that reads settings.proxy changes, and Off and Auto still send
requests as they did.

Run at base 61b92529e (this tree):
- go test ./internal/settings ./internal/backup ./internal/davsync
  ./internal/netproxy: ok. TestProxyCustomRemembered (gui, through
  Handler) and TestProxyCustomOwn (settings): ok.
- settings-proxy-remember.test.cjs (new; en, zh, zh-TW, ja, de, chromium
  and webkit): Custom with user "名 a@b" and password "p@ss 密" -> Off ->
  Custom shows the same address and user; the same after a reload and
  after Auto; an unsaved draft is not what comes back; the page never
  posts proxyCustom. 10/10.
- TestSettingsSaveKeepsWhatItDoesNotSend (the guard that every field
  the page doesn't send outlives its save) now sets ProxyCustom; red
  without the api.go line.
- settings-proxy-auth, proxy-test, proxy-own-wording: 54 pass.
- Full GUI suite (make test-ui, both engines) on a copy of this tree:
  11735 tests, 70 red over 23 files at load ~150-260. Run again two at a
  time, 15 of those files pass; the other 8 are red on origin/main
  8278fd9b0 too, run the same way, and are filed: mobile-web (#2658),
  quota-count-wrap and quota-name-translated (#2228), s3-sync (#2448),
  usage-agents-hide and usage-fold (#2399), usage-checkin (#2549, #3091),
  usage-ledger (#3104).
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows: ok.

Broken by hand, each red, then put back:
- no proxyCustom in save(): TestProxyCustomRemembered red.
- no KeepOwn line: TestProxyCustomOwn red.
- no api.go line (page's value taken): the GUI test red.
- renderProxy filling from "" again: the GUI test red in chromium.

Not tried: the real app with a real SOCKS proxy that needs a login;
a sync between two real computers.
2026-10-23 02:39:33 +08:00
yetone 7aad6a50ea provider: a window set for all of a custom provider's models wins over another vendor's guess
MisakaNatsuxun (Discord, 10-23) set a custom OpenAI-compatible provider's
Advanced > Context window to 1M. Routing still showed 200K for
deepseek-v4.1-flash-free, and dsh was told contextWindow 200000.

Cause: WindowOf capped the provider-wide "*" window at ListedWindow(m)
(#2112, 273ab9c23). ListedWindow falls back to catalog.ContextOf, a guess
by model id from any vendor on models.dev. For a relay with no catalog of
its own, opencode's deepseek-v4.1-flash-free (200000) or Anthropic's
claude-sonnet-4-5 (200000) capped the user's 1M. WindowOf feeds Served,
so /v1/models, the Routing picker, the editor's model chips and every
agent config (dsh's contextWindow too) got 200K.

Fix: "*" is capped only by the provider's own word: catalog.Window
(m.Context, set from its live list, its own models.dev catalog or plan
models) and m.MaxContext. #2112's OpenCode Go case still caps, since that
catalog sets m.Context. A per-model entry already won and still does.

Siblings: Max output (replyLimit) already took the user's value over
m.Output and the catalog, on old and new (checked "*"=128000). Anthropic-
and Responses-type custom providers read the same WindowOf and are fixed
with it. Left alone: with no window set, OutputWithin still caps a
user's Max output at the guessed window.

Tests, each red on the old code (ListedWindow put back by hand):
- provider TestProviderWindowSetOverAnotherVendorsGuess: "map[*:1000000]:
  claude-sonnet-4-5 told 200000, want 1000000"
- agent TestDshToldTheWindowSetForACustomProvider (opencode's
  deepseek-v4.1-flash-free fixture, dshRouteConfig and
  dshProviderLines): told contextWindow 200000

Sandbox HOME, fake OpenAI /models on 127.0.0.1:3481, relay "*"=1M:
- old binary: /v1/models relay/deepseek-v4.1-flash-free 200000,
  relay/claude-sonnet-4-5 200000; connecting dsh wrote contextWindow
  200000; no 1M on the Sonnet chip in the editor or the Routing picker.
- new binary (this tree, -tags dev): 1000000 for both, dsh config
  written fresh says contextWindow 1000000 / maxTokens 32000 (ca4a1cde0's
  cap at the model's output); Routing picker "DeepSeek V4.1 Flash Free
  1M"; relay-a (anthropic), relay-r (responses) 1M; relay-lo "*"=128K
  stays 128000.

Not tried: a real relay account, and dsh making a real request.

Run at 62cf0c76d (this tree on origin/main 032d88c13): gofmt -l clean;
go vet darwin, linux -tags nogui, windows clean; go test -tags nogui
-timeout 45m ./... : 69 ok, 19 no test files, no FAIL (agent 336s,
gateway 474s, gui 123s, provider 187s). GUI files in chromium and
webkit: context-picks 10/10, provider-advanced-fold 25/25,
provider-output-picks 2/2, compact-at 4/4, gui-ja 3/3, gui-zh-tw 3/3,
gui-de 3/3, i18n-keys 3/3.
2026-10-23 02:17:01 +08:00
yetone 032d88c132 gui: the Japanese for a WSL distro that isn't running names it once
c2636b7b5 added "magpie can't check it: the agents given it run in WSL
{distro}, which isn't running, and a check doesn't start it". Its ja
named {distro} twice where zh names it once, so gui-ja.test.cjs ("ja has
every zh string, with its placeholders and tags") has been red on
origin/main since then. Run alone at ca4a1cde0: 2 pass, 1 fail, with
['{distro}', '{distro}'] against ['{distro}'].

The ja now reads "magpie はチェックできません: これを使うエージェントが動く
WSL {distro} は起動しておらず、チェックのために起動はしません", one {distro},
the same meaning. Only the ja line changes.

Run at this commit: gui-ja and i18n-keys, 6 of 6 pass. The rest of this
push's record is in its other commits' bodies; this line changes no Go
and no other string.
2026-10-23 01:58:02 +08:00
yetone 4f6498f822 routing, usage: an account renamed in magpie reads by its new name (magpie-community/plugins#310, molvqingtai)
molvqingtai renamed a Kiro (plugin) account from "example@gmail.com (foo)"
to "example@gmail.com (bar)", and the Routing page kept saying "(foo)" on
every request made after. Cause: the Routing page never looked up the
user's name at all. A trace's `who` is the vendor's account name
(Weighed.Who), and plugins/routing/client.js showed it as it was. Usage
records (ProviderAccount) keep the vendor's name the same way, and the
Usage page's Accounts, the request log's Account filter, `magpie usage`,
a gateway key's accounts (AccountNames, /api/caller-keys) and Routing's
"Several accounts" pools (onOf) all showed it raw too. This affected
built-in and plugin providers alike.

Records still keep the vendor's name. It is the key the user's name is
stored under (providers.json AccountNames, in lower case), so it stays
the identity: Routing still groups and ranks by `who`. The name is looked
up when it is shown: provider.AccountShown / AccountShownOf /
AccountRef.Shown in Go, and userShown (accountNameOf over /api/providers'
accountNames) on the Routing page. So requests from before the rename
read by the current name too, and a cleared name goes back to the
vendor's. A key's name and an unnamed account read as before.
Already right before this change: quota cards and the menu bar (Alias),
`magpie accounts`, and the editor's account row.

Record for this push: 13 commits on origin/main ca4a1cde0, head tree
539c84e92. Go 1.26.8, sandbox HOME, GOMODCACHE/GOCACHE pinned. The full Go
run and vet were at tree d6393dfc8, the same Go code as this head: only
app.js comments (cut under the core script budget) and one ja string
changed after it.
- gofmt -l: nothing. go build ./...; go vet ./... (darwin), GOOS=linux
  go vet -tags nogui ./..., GOOS=windows go vet ./...: clean.
- go test -timeout 45m ./..., through tee, one suite on the machine:
  68 packages ok. The one red was internal/gui's
  TestCoreScriptBudget: app.js 1,335,314 > 1,335,000, since main grew
  app.js under the stack. The autoscroll commit's own comments were cut
  (to 1,334,629) rather than the budget raised, and go test -count=1
  ./internal/gui is ok at this head (113s). Packages the run took from
  Go's test cache had the same inputs.
- GUI: the 18 files this stack touches or names, both engines,
  202 of 204 pass (tree 068acf128, this push less the last commit). The
  two reds: gui-ja, red on main since c2636b7b5 and fixed by this push's
  last commit (gui-ja and i18n-keys 6 of 6 there), and usage-fold's
  chromium "several accounts" (#2163, red on main the same way).
- Red on the old code: TestAccountNameOfAPluginAccount, with
  AccountNames put back to a.User, fails with "a gateway key's accounts
  read [fakeco/31****36@qq.com]". The new GUI test
  routing-account-name.test.cjs, with the old client.js, fails with
  "renamed, the account reads by its new name: Kiro example@gmail.com
  (foo) Pro".
- routing-account-name passes, en and zh, both engines. internal/provider,
  internal/usageapi, internal/cli and internal/gateway ok.
- The five usage files this change's first run found red: usage-agents-hide
  (#2276), usage-checkin (#3091), usage-fold (#2163) and usage-ledger
  (#3104) are red alone at the stack and on main the same way.
  usage-overview-fold now passes alone at both.
  The whole GUI suite ran at 1c1fc7183 (this stack's first 12 commits on
  0ddcf28a1): 11713 of 11769 pass. Each of the 21 red files was then run
  alone at the stack and at origin/main 8278fd9b0. Eight are red the same
  way on main: plugin-card-update (#3079), quota-count-wrap and
  quota-name-translated (#2228), s3-sync (#2448), usage-agents-hide
  (#2276), usage-checkin (#3091), usage-fold's chromium "several
  accounts" (#2163), usage-ledger (#3104). The other 13 pass alone on both
  and were red only under that run's load (50 to 335): currency #3101,
  plugin-github #3218, provider-fetch-again #3292, rest-try-now #2564,
  routing-auto-reset #3293, routing-keys-fold #1612, routing-steady #1804,
  routing-wb-restricted #1905, sessions-folder-delete #2218,
  sessions-manage #3294, switch-only #3295, text-size #1866, usage-pack
  #3296.

Not tried: a real Kiro account. The fixture is the reporter's case, with
their names.
2026-10-23 01:58:01 +08:00
yetone cba59b05e1 gui: the middle button's autoscroll scrolls a page instead of twitching (#2767)
#2767 (znbsf, with AvatarGanymede's recording on the Discover page) and
多喝热水 on Discord, on Windows: pressing the wheel and moving the mouse
made a page twitch instead of scrolling, or pulled it back. znbsf's patch
found the same cause.

Chromium and WebView2 give the autoscroll a pointerdown of button 1 and
then no wheel, touch or drag of the reader's. The "where the reader is"
rule put back each of its scrolls as it came, so the page twitched
between where it went and where it was.

What changed (internal/gui/assets/app.js, the click guard):
- From a trusted middle press on a view that can scroll (`panning`),
  that view's scrolls count as the reader's, and what a click held is let
  go. This lasts until the autoscroll ends as Chromium ends it: on the
  next press (seen only as a pointerup with no pointerdown), on a key, on
  blur, or on the lift after the mouse moved more than 15px while held.
- A field the guard brings back into view after putting a scroll back
  must have been focused since the reader last scrolled that view
  (`scrolledFrom`). Before, the button the middle press focused, which
  the autoscroll or the wheel took out of sight, was brought back by the
  next scroll that was put back, and the page jumped to it.
- docs/subsystems/gui-shell.md says both.

Guarded by internal/gui/tests/view-middle-autoscroll.test.cjs: a real
middle press and move in Chromium, en and zh, a scroll by code still put
back after the autoscroll ends, and WebKit (no autoscroll) left as it
was.

Broken by hand:
- app.js put back to its base: Chromium 0/3 ("the autoscroll scrolled
  the page: at 0, passed 0,0,0,…"). WebKit passes, as expected.
- Only the panning line taken out: Chromium 0/3, same message.
- Only the scrolledFrom check taken out: Chromium 0/3 ("after the
  autoscroll: a scroll by code is put back (was 374, asked 1212, at
  126)").

Record for this push: 13 commits on origin/main ca4a1cde0, head tree
539c84e92. Go 1.26.8, sandbox HOME, GOMODCACHE/GOCACHE pinned. The full Go
run and vet were at tree d6393dfc8, the same Go code as this head: only
app.js comments (cut under the core script budget) and one ja string
changed after it.
- gofmt -l: nothing. go build ./...; go vet ./... (darwin), GOOS=linux
  go vet -tags nogui ./..., GOOS=windows go vet ./...: clean.
- go test -timeout 45m ./..., through tee, one suite on the machine:
  68 packages ok. The one red was internal/gui's
  TestCoreScriptBudget: app.js 1,335,314 > 1,335,000, since main grew
  app.js under the stack. The autoscroll commit's own comments were cut
  (to 1,334,629) rather than the budget raised, and go test -count=1
  ./internal/gui is ok at this head (113s). Packages the run took from
  Go's test cache had the same inputs.
- GUI: the 18 files this stack touches or names, both engines,
  202 of 204 pass (tree 068acf128, this push less the last commit). The
  two reds: gui-ja, red on main since c2636b7b5 and fixed by this push's
  last commit (gui-ja and i18n-keys 6 of 6 there), and usage-fold's
  chromium "several accounts" (#2163, red on main the same way).
- view-middle-autoscroll and click-scroll pass, both engines.
- plugin-github's "a click scrolls nothing" (1px) was red under the
  whole run's load and passes alone at the stack and on main (#3218).
  The whole GUI suite ran at 1c1fc7183 (this stack's first 12 commits on
  0ddcf28a1): 11713 of 11769 pass. Each of the 21 red files was then run
  alone at the stack and at origin/main 8278fd9b0. Eight are red the same
  way on main: plugin-card-update (#3079), quota-count-wrap and
  quota-name-translated (#2228), s3-sync (#2448), usage-agents-hide
  (#2276), usage-checkin (#3091), usage-fold's chromium "several
  accounts" (#2163), usage-ledger (#3104). The other 13 pass alone on both
  and were red only under that run's load (50 to 335): currency #3101,
  plugin-github #3218, provider-fetch-again #3292, rest-try-now #2564,
  routing-auto-reset #3293, routing-keys-fold #1612, routing-steady #1804,
  routing-wb-restricted #1905, sessions-folder-delete #2218,
  sessions-manage #3294, switch-only #3295, text-size #1866, usage-pack
  #3296.

Not tried: the real Windows app (WebView2) on the Windows box; only
headless Chromium's autoscroll. Linux WebKitGTK has no middle-button
autoscroll, so it is left as WebKit is.
Not done: znbsf's patch doesn't start this on a middle press on a link
(which opens a tab, not an autoscroll). Here it does start, and lets a
scroll by code in that view stand until the next press or key. Left on
#2767, which stays open for the reporters.
2026-10-23 01:58:01 +08:00
yetone ad2424ade4 usage: a card's account button names the accounts it opens and folds back the ones it opened
WuSix on Discord (#help): three accounts on WorkBuddy, one deleted. The
button read 展开其余 2 个账号 with two accounts left; it opened both, and
收起其余账号 then folded only the second, leaving 展开其余 1 个账号 and the
first one open until its own arrow was clicked.

Cause:
- "其余 2" ("2 more"): each account's full/brief is remembered by
  provider and account (magpie.usageAccounts). An earlier 收起其余账号
  stored the one in sight (the deleted account) as in full and the other
  two as in brief. With it gone, neither left is in full, so every
  account is "the other" and the count was all of them.
- The fold: usageMore's fold was "every one but the one in sight back in
  brief" (usageShown: last answered, else the first). It kept alpha open
  however the accounts stood before the click.

Now:
- The window's button names what it opens: "Show all {n} accounts in
  full" (展开全部 {n} 个账号) when none is in full, as before otherwise.
- The accounts the button opens are remembered (magpie.usageAcctsOpened,
  followed across the window and the tray panel through the storage
  event). Its fold puts those back in brief, and only those; with every
  account opened by it, it reads "Show every account in brief" (收起全部
  账号). With none recorded (all opened by their own arrows, or a
  provider opened before this), it folds every one but the one in sight
  as before.
- An account's own arrow, and a menu bar cell opening an account, take
  that account off the record, so the button leaves what the user opened
  by hand alone. The panel's wording is unchanged.
- zh, zh-TW, ja and de for the two new strings. No layout change.

Test: usage-fold.test.cjs "an account deleted, the button opens and
folds the ones it names", at 420px wide, chromium and webkit, en and zh:
three accounts, open and fold (back to the one in sight), delete one,
reload: both in brief with "all 2"; open both, fold both; an account's
own arrow, then the button opening and folding the other alone.

Record for this push: 13 commits on origin/main ca4a1cde0, head tree
539c84e92. Go 1.26.8, sandbox HOME, GOMODCACHE/GOCACHE pinned. The full Go
run and vet were at tree d6393dfc8, the same Go code as this head: only
app.js comments (cut under the core script budget) and one ja string
changed after it.
- gofmt -l: nothing. go build ./...; go vet ./... (darwin), GOOS=linux
  go vet -tags nogui ./..., GOOS=windows go vet ./...: clean.
- go test -timeout 45m ./..., through tee, one suite on the machine:
  68 packages ok. The one red was internal/gui's
  TestCoreScriptBudget: app.js 1,335,314 > 1,335,000, since main grew
  app.js under the stack. The autoscroll commit's own comments were cut
  (to 1,334,629) rather than the budget raised, and go test -count=1
  ./internal/gui is ok at this head (113s). Packages the run took from
  Go's test cache had the same inputs.
- GUI: the 18 files this stack touches or names, both engines,
  202 of 204 pass (tree 068acf128, this push less the last commit). The
  two reds: gui-ja, red on main since c2636b7b5 and fixed by this push's
  last commit (gui-ja and i18n-keys 6 of 6 there), and usage-fold's
  chromium "several accounts" (#2163, red on main the same way).
- usage-fold's new "an account deleted" test passes in both engines, en
  and zh. Its chromium "several accounts" test is red alone at the stack
  and on main alike ("the view didn't scroll", 184 !== 180): #2163.
- internal/gui ok, the core script budget with it.
  The whole GUI suite ran at 1c1fc7183 (this stack's first 12 commits on
  0ddcf28a1): 11713 of 11769 pass. Each of the 21 red files was then run
  alone at the stack and at origin/main 8278fd9b0. Eight are red the same
  way on main: plugin-card-update (#3079), quota-count-wrap and
  quota-name-translated (#2228), s3-sync (#2448), usage-agents-hide
  (#2276), usage-checkin (#3091), usage-fold's chromium "several
  accounts" (#2163), usage-ledger (#3104). The other 13 pass alone on both
  and were red only under that run's load (50 to 335): currency #3101,
  plugin-github #3218, provider-fetch-again #3292, rest-try-now #2564,
  routing-auto-reset #3293, routing-keys-fold #1612, routing-steady #1804,
  routing-wb-restricted #1905, sessions-folder-delete #2218,
  sessions-manage #3294, switch-only #3295, text-size #1866, usage-pack
  #3296.

Broken by hand:
- app.js and i18n.js at ea6be1592: the new test is red in all four
  (chromium/webkit x en/zh), first at the "all 2" label (got "Show 2
  more accounts in full" / 展开其余 2 个账号 with none in full).
- Only the old fold put back (setUsageAccts(subs, q => q === pick)):
  red in chromium en and zh at line 241, waiting for "all 2" after the
  fold, since alpha stayed open.

Not tried: the real app; the GUI is faked in the tests.
2026-10-23 01:58:01 +08:00
yetone 0455b92792 routing: the last request's story shrinks back after a long one (夜松云 on Discord)
夜松云 on Discord: on the Routing page, live, the "How the last request
was routed" box grew when a request was handed on through many members
and never shrank back.

What changed (internal/gui/assets/plugins/routing/client.js, holdStory):
the box was held at the tallest height seen since the reader began
following live. It is now held at the tallest of the last three answered
requests (STORY_HELD), each kept by its id. So the box still doesn't jump
from one request to the next (dumplings' jitter, routing-ctx-still), and
it shrinks back once three shorter ones have come after a long one. A
ResizeObserver change (a font coming in) measures it again as it is.

Guarded by internal/gui/tests/routing-story-shrinks.test.cjs: a request
handed on four times, then short ones. The box keeps its height for the
next two and shrinks at the third. en at 1100px and zh at 420px, both
engines.

Broken by hand: client.js put back to its base gives 0/6 ("the box shrank
back after the long request: 247.5 vs 247.5 (min-height 247.5px)").

Record for this push: 13 commits on origin/main ca4a1cde0, head tree
539c84e92. Go 1.26.8, sandbox HOME, GOMODCACHE/GOCACHE pinned. The full Go
run and vet were at tree d6393dfc8, the same Go code as this head: only
app.js comments (cut under the core script budget) and one ja string
changed after it.
- gofmt -l: nothing. go build ./...; go vet ./... (darwin), GOOS=linux
  go vet -tags nogui ./..., GOOS=windows go vet ./...: clean.
- go test -timeout 45m ./..., through tee, one suite on the machine:
  68 packages ok. The one red was internal/gui's
  TestCoreScriptBudget: app.js 1,335,314 > 1,335,000, since main grew
  app.js under the stack. The autoscroll commit's own comments were cut
  (to 1,334,629) rather than the budget raised, and go test -count=1
  ./internal/gui is ok at this head (113s). Packages the run took from
  Go's test cache had the same inputs.
- GUI: the 18 files this stack touches or names, both engines,
  202 of 204 pass (tree 068acf128, this push less the last commit). The
  two reds: gui-ja, red on main since c2636b7b5 and fixed by this push's
  last commit (gui-ja and i18n-keys 6 of 6 there), and usage-fold's
  chromium "several accounts" (#2163, red on main the same way).
- routing-story-shrinks and routing-ctx-still pass, both engines.
- routing-auto-reset, routing-keys-fold, routing-steady and
  routing-wb-restricted were red in the whole run under load and pass
  alone at the stack and on main.
  The whole GUI suite ran at 1c1fc7183 (this stack's first 12 commits on
  0ddcf28a1): 11713 of 11769 pass. Each of the 21 red files was then run
  alone at the stack and at origin/main 8278fd9b0. Eight are red the same
  way on main: plugin-card-update (#3079), quota-count-wrap and
  quota-name-translated (#2228), s3-sync (#2448), usage-agents-hide
  (#2276), usage-checkin (#3091), usage-fold's chromium "several
  accounts" (#2163), usage-ledger (#3104). The other 13 pass alone on both
  and were red only under that run's load (50 to 335): currency #3101,
  plugin-github #3218, provider-fetch-again #3292, rest-try-now #2564,
  routing-auto-reset #3293, routing-keys-fold #1612, routing-steady #1804,
  routing-wb-restricted #1905, sessions-folder-delete #2218,
  sessions-manage #3294, switch-only #3295, text-size #1866, usage-pack
  #3296.

Not tried: the real app with a live failover chain; only the faked API.
2026-10-23 01:58:01 +08:00
yetone f050818f71 usage: every request on the Requests tab says its speed, or why it has none (夜松云 on Discord)
夜松云 on Discord: the Requests tab's Speed column was blank for some rows
and not others, with nothing saying why.

What changed (internal/gui/assets/plugins/usage/page.js, i18n.js):
- A gateway call with no speed of its own now tells the least it wrote at,
  as a "≥" floor, the way a session file's call already did: one that
  reasoned with no first text recorded (a tool call after hidden
  reasoning) its answer tokens over the time after its first token,
  unless the content came in a burst; else one not streamed or not timed,
  its output over its whole time, by the same 1,000-token rule. The
  tooltip says which floor it is and why it is only a floor. The
  request's detail sheet (the other caller of ledFloorSpeed) shows the
  same floor. The period's speed KPI is unchanged: it never counts a
  gateway floor.
- A dash that is left always has a tooltip saying why (ledNoSpeed_):
  failed, no duration, no output, not streamed / no first token, all
  reasoning, too little after the first token, or let go in one burst.
- Eight new strings with zh, zh-TW, ja and de.
- reasoning-speed and usage-session-speed now expect the floor on the
  rows that showed a dash before (reasoning then tool calls only: ≥100;
  not streamed: ≥500).

Guarded by internal/gui/tests/usage-speed-every-row.test.cjs (rows shaped
as real usage.jsonl gateway rows, en and zh, both engines).

Broken by hand:
- page.js put back to its base: usage-speed-every-row 0/6 pass ("row 2's
  dash says why").
- Only the gateway floors off (ledFloor_ returns null for a gateway row):
  0/3 in Chromium.

Record for this push: 13 commits on origin/main ca4a1cde0, head tree
539c84e92. Go 1.26.8, sandbox HOME, GOMODCACHE/GOCACHE pinned. The full Go
run and vet were at tree d6393dfc8, the same Go code as this head: only
app.js comments (cut under the core script budget) and one ja string
changed after it.
- gofmt -l: nothing. go build ./...; go vet ./... (darwin), GOOS=linux
  go vet -tags nogui ./..., GOOS=windows go vet ./...: clean.
- go test -timeout 45m ./..., through tee, one suite on the machine:
  68 packages ok. The one red was internal/gui's
  TestCoreScriptBudget: app.js 1,335,314 > 1,335,000, since main grew
  app.js under the stack. The autoscroll commit's own comments were cut
  (to 1,334,629) rather than the budget raised, and go test -count=1
  ./internal/gui is ok at this head (113s). Packages the run took from
  Go's test cache had the same inputs.
- GUI: the 18 files this stack touches or names, both engines,
  202 of 204 pass (tree 068acf128, this push less the last commit). The
  two reds: gui-ja, red on main since c2636b7b5 and fixed by this push's
  last commit (gui-ja and i18n-keys 6 of 6 there), and usage-fold's
  chromium "several accounts" (#2163, red on main the same way).
- usage-speed-every-row, reasoning-speed and usage-session-speed pass,
  both engines; i18n-keys and gui-zh-tw/ja/de too.
- The Requests tab's other file, usage-ledger, is red alone on main the
  same way (#3104, the return-to-live button).
  The whole GUI suite ran at 1c1fc7183 (this stack's first 12 commits on
  0ddcf28a1): 11713 of 11769 pass. Each of the 21 red files was then run
  alone at the stack and at origin/main 8278fd9b0. Eight are red the same
  way on main: plugin-card-update (#3079), quota-count-wrap and
  quota-name-translated (#2228), s3-sync (#2448), usage-agents-hide
  (#2276), usage-checkin (#3091), usage-fold's chromium "several
  accounts" (#2163), usage-ledger (#3104). The other 13 pass alone on both
  and were red only under that run's load (50 to 335): currency #3101,
  plugin-github #3218, provider-fetch-again #3292, rest-try-now #2564,
  routing-auto-reset #3293, routing-keys-fold #1612, routing-steady #1804,
  routing-wb-restricted #1905, sessions-folder-delete #2218,
  sessions-manage #3294, switch-only #3295, text-size #1866, usage-pack
  #3296.

Not tried: the real app against a real usage.jsonl with such rows; only
the faked API in the tests.
2026-10-23 01:58:01 +08:00
yetone c417b1f4e3 library: a skill removed from its source is said so, and every such skill goes in one click, asked first
スライム on Discord (#help, 10-22): taste-skills took some of its skills
out, Update all reported each of them as a failure, and the only way
out was to delete them one by one.

An update or a check that reads the source whole and finds the skill's
folder (or its SKILL.md) gone now calls it removed upstream, not a
failure. GitHub tarballs and other git repositories both work this way.
- UpdateSkill returns *GoneError.
- UpdateSkills and UpdateSomeSkills list it in Result.Gone, not
  Unupdated.
- A check gives status "gone".
- Each marks Skill.Gone. The mark is cleared when a check or an update
  finds the skill there again.
- A fetch that failed, a skill left out of a fetch as too big, and a
  folder that can't be read stay unknown, never gone (goneFrom).

Nothing is deleted by itself. RemoveGoneSkills takes the named skills
out, or every marked one when none are named, through RemoveSkills, so
the folders go to the backups. A skill found in its source again is
kept and said so.
- GUI: a "Removed upstream" tag replaces Update available and the
  update icon. Update all says gone skills apart from failures. "Clean
  up N" sits in the group heading, or in the bar when there is one
  group, and opens a sheet naming each skill. One changed here carries
  "Changed here". Strings are in en, zh, zh-TW, ja and de.
- CLI: `magpie library skill rm --gone [--yes]` asks at a terminal and
  refuses without --yes otherwise. It names the ones changed here.
  update and status print the hint.
- TUI: the row says "removed from <repo> · d takes it out".
- API: POST /api/library/skills/remove-gone {names}.
- Docs: the Skill updates row and Verification in
  docs/subsystems/library.md.

Record for this push: 13 commits on origin/main ca4a1cde0, head tree
539c84e92. Go 1.26.8, sandbox HOME, GOMODCACHE/GOCACHE pinned. The full Go
run and vet were at tree d6393dfc8, the same Go code as this head: only
app.js comments (cut under the core script budget) and one ja string
changed after it.
- gofmt -l: nothing. go build ./...; go vet ./... (darwin), GOOS=linux
  go vet -tags nogui ./..., GOOS=windows go vet ./...: clean.
- go test -timeout 45m ./..., through tee, one suite on the machine:
  68 packages ok. The one red was internal/gui's
  TestCoreScriptBudget: app.js 1,335,314 > 1,335,000, since main grew
  app.js under the stack. The autoscroll commit's own comments were cut
  (to 1,334,629) rather than the budget raised, and go test -count=1
  ./internal/gui is ok at this head (113s). Packages the run took from
  Go's test cache had the same inputs.
- GUI: the 18 files this stack touches or names, both engines,
  202 of 204 pass (tree 068acf128, this push less the last commit). The
  two reds: gui-ja, red on main since c2636b7b5 and fixed by this push's
  last commit (gui-ja and i18n-keys 6 of 6 there), and usage-fold's
  chromium "several accounts" (#2163, red on main the same way).
- skill-gone passes, chromium and webkit, en and zh, 860 and 400px.
- internal/library, internal/cli and internal/tui ok, the Gone tests and
  TestLibrarySkillRm among them.
- The rebase onto main met c2636b7b5's Verification line in library.md;
  both sides' tests are kept in it.
  The whole GUI suite ran at 1c1fc7183 (this stack's first 12 commits on
  0ddcf28a1): 11713 of 11769 pass. Each of the 21 red files was then run
  alone at the stack and at origin/main 8278fd9b0. Eight are red the same
  way on main: plugin-card-update (#3079), quota-count-wrap and
  quota-name-translated (#2228), s3-sync (#2448), usage-agents-hide
  (#2276), usage-checkin (#3091), usage-fold's chromium "several
  accounts" (#2163), usage-ledger (#3104). The other 13 pass alone on both
  and were red only under that run's load (50 to 335): currency #3101,
  plugin-github #3218, provider-fetch-again #3292, rest-try-now #2564,
  routing-auto-reset #3293, routing-keys-fold #1612, routing-steady #1804,
  routing-wb-restricted #1905, sessions-folder-delete #2218,
  sessions-manage #3294, switch-only #3295, text-size #1866, usage-pack
  #3296.

Broken by hand, each red, then restored:
- prepare not returning GoneError
- apply not clearing Gone
- leftOutAt ignored
- every Stat error read as absent
- the git check not saying gone
- RemoveGoneSkills taking a skill that isn't marked

Not tried:
- the real taste-skills repo over the network
- the Windows box
- a skill CC Switch installed (Origin, adopt path), which still reports
  as a failure
- a GitHub check with a known commit, which keeps an existing gone
  mark but only marks gone after an update
2026-10-23 01:58:00 +08:00
yetone 75df6f4891 library: the git skill tests run again, with the machine's git found before the sandbox
Every test that builds a git repository (gitRepo in skillgit_test.go)
looked git up with exec.LookPath after sandbox() had replaced PATH, found
none and skipped with "git isn't installed". TestInstallFromGitRepo and
the rest of the kind-git tests were skipped on every machine and on CI.
realGit is now looked up once at package init, before any sandbox.

gitRemoved is a fixture helper the next commit's test uses: as a file's
body in a commit, it removes that path from the repository.

Record for this push: 13 commits on origin/main ca4a1cde0, head tree
539c84e92. Go 1.26.8, sandbox HOME, GOMODCACHE/GOCACHE pinned. The full Go
run and vet were at tree d6393dfc8, the same Go code as this head: only
app.js comments (cut under the core script budget) and one ja string
changed after it.
- gofmt -l: nothing. go build ./...; go vet ./... (darwin), GOOS=linux
  go vet -tags nogui ./..., GOOS=windows go vet ./...: clean.
- go test -timeout 45m ./..., through tee, one suite on the machine:
  68 packages ok. The one red was internal/gui's
  TestCoreScriptBudget: app.js 1,335,314 > 1,335,000, since main grew
  app.js under the stack. The autoscroll commit's own comments were cut
  (to 1,334,629) rather than the budget raised, and go test -count=1
  ./internal/gui is ok at this head (113s). Packages the run took from
  Go's test cache had the same inputs.
- GUI: the 18 files this stack touches or names, both engines,
  202 of 204 pass (tree 068acf128, this push less the last commit). The
  two reds: gui-ja, red on main since c2636b7b5 and fixed by this push's
  last commit (gui-ja and i18n-keys 6 of 6 there), and usage-fold's
  chromium "several accounts" (#2163, red on main the same way).
- internal/library ok; go test -run 'Git' -v ./internal/library runs
  every git test with none skipped.
  The whole GUI suite ran at 1c1fc7183 (this stack's first 12 commits on
  0ddcf28a1): 11713 of 11769 pass. Each of the 21 red files was then run
  alone at the stack and at origin/main 8278fd9b0. Eight are red the same
  way on main: plugin-card-update (#3079), quota-count-wrap and
  quota-name-translated (#2228), s3-sync (#2448), usage-agents-hide
  (#2276), usage-checkin (#3091), usage-fold's chromium "several
  accounts" (#2163), usage-ledger (#3104). The other 13 pass alone on both
  and were red only under that run's load (50 to 335): currency #3101,
  plugin-github #3218, provider-fetch-again #3292, rest-try-now #2564,
  routing-auto-reset #3293, routing-keys-fold #1612, routing-steady #1804,
  routing-wb-restricted #1905, sessions-folder-delete #2218,
  sessions-manage #3294, switch-only #3295, text-size #1866, usage-pack
  #3296.

Not tried: the Windows box (Git for Windows on PATH is found the same
way).
2026-10-23 01:58:00 +08:00
yetone 60fff9a7e5 sessions: Droid's sessions can be deleted from the Sessions page (zachzhao1984 on Discord)
zachzhao1984 on Discord: some agents' sessions can't be deleted on the
Sessions page. Droid was one of them.

What changed (internal/sessions/manage.go): "droid" is Deletable. A
Droid session goes to the trash whole: its transcript, its
.settings.json beside it, and a subagent's two files. Nothing of another
session goes with it, and Restore puts them all back. A session written
to just now is left alone (ErrActive), as for every other agent. The
package comment now also says why OpenCode, ZCode, Grok Build, Kimi Code
and Claude Desktop (Cowork) sessions stay list-only.

Guarded by internal/sessions/droid_manage_test.go
(TestDroidDeleteRestore).

Broken by hand:
- "droid" taken out of Deletable: FAIL "droid not deletable".
- The .settings.json no longer added to the session's paths: FAIL "a
  session just written: <nil>". The settings file isn't counted as the
  session's, so a write to it no longer holds the delete back.

Record for this push: 13 commits on origin/main ca4a1cde0, head tree
539c84e92. Go 1.26.8, sandbox HOME, GOMODCACHE/GOCACHE pinned. The full Go
run and vet were at tree d6393dfc8, the same Go code as this head: only
app.js comments (cut under the core script budget) and one ja string
changed after it.
- gofmt -l: nothing. go build ./...; go vet ./... (darwin), GOOS=linux
  go vet -tags nogui ./..., GOOS=windows go vet ./...: clean.
- go test -timeout 45m ./..., through tee, one suite on the machine:
  68 packages ok. The one red was internal/gui's
  TestCoreScriptBudget: app.js 1,335,314 > 1,335,000, since main grew
  app.js under the stack. The autoscroll commit's own comments were cut
  (to 1,334,629) rather than the budget raised, and go test -count=1
  ./internal/gui is ok at this head (113s). Packages the run took from
  Go's test cache had the same inputs.
- GUI: the 18 files this stack touches or names, both engines,
  202 of 204 pass (tree 068acf128, this push less the last commit). The
  two reds: gui-ja, red on main since c2636b7b5 and fixed by this push's
  last commit (gui-ja and i18n-keys 6 of 6 there), and usage-fold's
  chromium "several accounts" (#2163, red on main the same way).
- internal/sessions ok, TestDroidDeleteRestore with it.
- sessions-manage and sessions-folder-delete, red in the whole run under
  load, pass alone at the stack and on main (#3294, #2218).
  The whole GUI suite ran at 1c1fc7183 (this stack's first 12 commits on
  0ddcf28a1): 11713 of 11769 pass. Each of the 21 red files was then run
  alone at the stack and at origin/main 8278fd9b0. Eight are red the same
  way on main: plugin-card-update (#3079), quota-count-wrap and
  quota-name-translated (#2228), s3-sync (#2448), usage-agents-hide
  (#2276), usage-checkin (#3091), usage-fold's chromium "several
  accounts" (#2163), usage-ledger (#3104). The other 13 pass alone on both
  and were red only under that run's load (50 to 335): currency #3101,
  plugin-github #3218, provider-fetch-again #3292, rest-try-now #2564,
  routing-auto-reset #3293, routing-keys-fold #1612, routing-steady #1804,
  routing-wb-restricted #1905, sessions-folder-delete #2218,
  sessions-manage #3294, switch-only #3295, text-size #1866, usage-pack
  #3296.

Not tried: deleting a real Droid session and then opening Droid. No
sessions are in this machine's ~/.factory. The installed droid 0.231.0
binary names no sessions index (grep for session(s)-index, sessionIndex,
session(s)_index found nothing), so nothing is known to be left pointing
at a deleted session. Not tried on Windows or WSL.
2026-10-23 01:58:00 +08:00
yetone 93b87d0004 davsync: a GitHub backup too large for the Contents API goes up as a blob (Zhang-Wei, Discord)
Zhang-Wei (Discord, v0.1.1318, 102 skills) saw every sync fail with
"GitHub sync: HTTP 422: Sorry, the file is too large to be processed"
on magpie/magpie.magpie-backup; the last backup that went up was about
19 MB. The Contents API's PUT refuses files well under the 100 MB a blob
can hold.

A repository with commits is now written through the Git Data API:
the ref's head, the file's version at that head (it must still be the one
sync read, or errChanged), a base64 blob, a tree on the head's tree, a
commit with the head as its parent, and a ref update without force. Still
one commit per write or removal, and the version is the blob SHA as
before. A ref update that is not a fast-forward is built again on the new
head (the blob is kept), up to three times, then errChanged; if the new
head changed the backup it is errChanged at once, so another computer's
backup goes through the normal merge. A branch deleted meanwhile is an
error, not created. Usage files and their removal take the same path.

An empty repository has no head to build on, so its first write still
goes through the Contents API (one commit, unchanged). If that is refused
as too large (422 "too large" or 413), a short README.md in magpie's
folder makes the first commit and the backup follows as the second.

Reading was already right for large files: the object media type gives
encoding "none" over 1 MB and bytes() downloads by blob SHA; the new
test covers it at 21 MB.

The fixture now serves the Git Data API (blobs, commits, trees, a
fast-forward-only ref update) and refuses a Contents PUT over
contentsLimit with GitHub's 422 text. docs/subsystems/sync-backup.md says
how writes go and names the new tests.

Record for this push: 13 commits on origin/main ca4a1cde0, head tree
539c84e92. Go 1.26.8, sandbox HOME, GOMODCACHE/GOCACHE pinned. The full Go
run and vet were at tree d6393dfc8, the same Go code as this head: only
app.js comments (cut under the core script budget) and one ja string
changed after it.
- gofmt -l: nothing. go build ./...; go vet ./... (darwin), GOOS=linux
  go vet -tags nogui ./..., GOOS=windows go vet ./...: clean.
- go test -timeout 45m ./..., through tee, one suite on the machine:
  68 packages ok. The one red was internal/gui's
  TestCoreScriptBudget: app.js 1,335,314 > 1,335,000, since main grew
  app.js under the stack. The autoscroll commit's own comments were cut
  (to 1,334,629) rather than the budget raised, and go test -count=1
  ./internal/gui is ok at this head (113s). Packages the run took from
  Go's test cache had the same inputs.
- GUI: the 18 files this stack touches or names, both engines,
  202 of 204 pass (tree 068acf128, this push less the last commit). The
  two reds: gui-ja, red on main since c2636b7b5 and fixed by this push's
  last commit (gui-ja and i18n-keys 6 of 6 there), and usage-fold's
  chromium "several accounts" (#2163, red on main the same way).
- internal/davsync and internal/cli ok, the GitHub large-backup tests and
  TestGitHubCmd among them.
- s3-sync.test.cjs (WebKit en) is red alone on main too: #2448, the
  header over the form's tick. This commit doesn't touch the GUI.
  The whole GUI suite ran at 1c1fc7183 (this stack's first 12 commits on
  0ddcf28a1): 11713 of 11769 pass. Each of the 21 red files was then run
  alone at the stack and at origin/main 8278fd9b0. Eight are red the same
  way on main: plugin-card-update (#3079), quota-count-wrap and
  quota-name-translated (#2228), s3-sync (#2448), usage-agents-hide
  (#2276), usage-checkin (#3091), usage-fold's chromium "several
  accounts" (#2163), usage-ledger (#3104). The other 13 pass alone on both
  and were red only under that run's load (50 to 335): currency #3101,
  plugin-github #3218, provider-fetch-again #3292, rest-try-now #2564,
  routing-auto-reset #3293, routing-keys-fold #1612, routing-steady #1804,
  routing-wb-restricted #1905, sessions-folder-delete #2218,
  sessions-manage #3294, switch-only #3295, text-size #1866, usage-pack
  #3296.

Red on the old github.go (the new tests with the old code):
TestGitHubLargeBackup and TestGitHubEmptyRepositoryLargeBackup fail with
"HTTP 422: Sorry, the file is too large to be processed", TestGitHubRemote
too at its 1.26 MB put, and TestGitHubBranchMovedMeanwhile's three
subtests fail.

Broken by hand on the new code, each red:
- version check at the head skipped: TestGitHubRemote, LargeBackup's
  stale put, BranchMovedMeanwhile/the_backup
- no rebuild on a non-fast-forward: BranchMovedMeanwhile/another_file
  and /the_backup
- large read by base64 only: TestGitHubRemote, TestGitHubLargeBackup
- no README initialization: TestGitHubEmptyRepositoryLargeBackup (409)

Not tried against the real
GitHub API: the fixture follows GitHub's documented Git Data API, and
GitHub's exact Contents API size limit is not documented.
2026-10-23 01:58:00 +08:00
yetone fb23bca5c9 update: the Mac relaunch tries open again while it fails
molvqingtai's system log (Discord): v0.1.1314 updated itself at 00:43:49,
the old process exited 0, and ~160ms later `open` of the bundle failed
with -600 (procNotFound): LaunchServices still sent to the process that
had exited (the screen was locked). runAfterExit ran open once, nothing
looked at its status, and magpie stayed closed until a manual launch at
09:45.

Relaunch now runs relaunchCommand: the same open, tried again after
pauses of 0.5 1 1 2 2 3 4 seconds (13.5s, 8 tries) while it exits
non-zero, and not again once it succeeds. The detached own-session
shell (#2362) is unchanged. The new instance is not confirmed running
beyond open's exit 0.

Sibling, not changed: RelaunchBinary (Windows, Linux) starts the new
binary itself while this one is still up, with no open after exit; on
Windows with the old binary moved aside, startChecked already waits 20s
for the new one to say it is up and puts the old back otherwise. ayu's
"restart to update needs several clicks" is not this shape (candidates:
the install held by another program, or the busy-gateway wait) and needs
its own look.

Tests (internal/update/relaunch_retry_test.go): a fake `open` first on
PATH refuses its first tries with the -600 text.
- TestRelaunchOpenTriedAgain: relaunchCommand after a gone pid opens on
  the third try. Old code: FAIL "open was tried 1 times and the new
  version never opened" (30.04s).
- TestRelaunchOpenGivesUp: a refusing open ends after len(waits)+1 tries;
  one that works on the second is not run again. Broken by hand (no
  `&& exit 0`): FAIL "open tried 4 times, want 2".
- TestOpenWaitsTotal: waits add to 10-15s. Broken (0.5 1): FAIL "waits
  add to 1.5s".
Real open: the same loop with /usr/bin/open on a scratch .app that
appeared after 2s failed 3 times ("does not exist", exit 1) and opened
it on the 4th, the app got --args tray.

Record for this push: 13 commits on origin/main ca4a1cde0, head tree
539c84e92. Go 1.26.8, sandbox HOME, GOMODCACHE/GOCACHE pinned. The full Go
run and vet were at tree d6393dfc8, the same Go code as this head: only
app.js comments (cut under the core script budget) and one ja string
changed after it.
- gofmt -l: nothing. go build ./...; go vet ./... (darwin), GOOS=linux
  go vet -tags nogui ./..., GOOS=windows go vet ./...: clean.
- go test -timeout 45m ./..., through tee, one suite on the machine:
  68 packages ok. The one red was internal/gui's
  TestCoreScriptBudget: app.js 1,335,314 > 1,335,000, since main grew
  app.js under the stack. The autoscroll commit's own comments were cut
  (to 1,334,629) rather than the budget raised, and go test -count=1
  ./internal/gui is ok at this head (113s). Packages the run took from
  Go's test cache had the same inputs.
- GUI: the 18 files this stack touches or names, both engines,
  202 of 204 pass (tree 068acf128, this push less the last commit). The
  two reds: gui-ja, red on main since c2636b7b5 and fixed by this push's
  last commit (gui-ja and i18n-keys 6 of 6 there), and usage-fold's
  chromium "several accounts" (#2163, red on main the same way).
- internal/update ok, with TestRelaunchOpenTriedAgain, TestRelaunchOpenGivesUp
  and TestOpenWaitsTotal. GOOS=linux and windows builds are covered by vet.
  The whole GUI suite ran at 1c1fc7183 (this stack's first 12 commits on
  0ddcf28a1): 11713 of 11769 pass. Each of the 21 red files was then run
  alone at the stack and at origin/main 8278fd9b0. Eight are red the same
  way on main: plugin-card-update (#3079), quota-count-wrap and
  quota-name-translated (#2228), s3-sync (#2448), usage-agents-hide
  (#2276), usage-checkin (#3091), usage-fold's chromium "several
  accounts" (#2163), usage-ledger (#3104). The other 13 pass alone on both
  and were red only under that run's load (50 to 335): currency #3101,
  plugin-github #3218, provider-fetch-again #3292, rest-try-now #2564,
  routing-auto-reset #3293, routing-keys-fold #1612, routing-steady #1804,
  routing-wb-restricted #1905, sessions-folder-delete #2218,
  sessions-manage #3294, switch-only #3295, text-size #1866, usage-pack
  #3296.

Not tried: a real update on a real Mac, or a real -600 from
LaunchServices; nothing on Windows.
2026-10-23 01:58:00 +08:00
yetone f5149a5332 gateway: Claude Code is given a schema without its root $schema (#3036)
Codex's title requests carry zod's draft 2020-12 schema, with
"$schema": "https://json-schema.org/draft/2020-12/schema" at the root.
magpie passed it to `claude --json-schema` as it came. Claude Code exited
with "--json-schema is not a valid JSON Schema: no schema with key or ref
...", and the client got a 502 that was asked three times.

What Claude Code rejects. 2.1.307 checks --json-schema with Ajv 8's default
class, which is draft-07: new Ajv({allErrors, validateFormats:false,
multipleOfPrecision:6}), then validateSchema and compile, in strict mode.
I ran Ajv 8.20.0 with those options:
- A root $schema for 2020-12, 2019-09 or draft-04 is refused (no schema
  with key or ref).
- Keywords only a later draft has (prefixItems, unevaluatedProperties,
  $anchor, $dynamicAnchor, dependentRequired) are refused (strict mode:
  unknown keyword).
- A draft-07 $schema, $id, $defs, definitions, $comment, and a nested
  $schema or $id all pass.
The real claude 2.1.307 agrees. I ran it in a sandbox HOME, with a fake
`security` on PATH so the Keychain was never touched. The 2020-12 schema
exits 1 with the reporter's exact words. The same schema with $id, and
one without $schema, both get past the check.

The fix. cliSchema drops only the root $schema and keeps everything else
as it came. A schema with no root $schema goes byte for byte. Later-draft
keywords are not rewritten. A schema that uses them is refused, and is now
answered as below.

No more retries. A schema Claude Code refuses is refused the same way on
every try and every account. When its stderr says "--json-schema is not
a valid JSON Schema" (or "is not valid JSON" / "must be a JSON object"),
the run now ends in a 400 with Claude Code's words from the flag on. It
is not retried, the saved-session restart is skipped, and no account
rests. The 400 holds both when Claude Code exits before it takes its
input (cliSchemaRefused from endedBefore) and when it exits after it took
the input (schemaEnded, emitted as a 400 KError before the segment
closes). Before, the second case was an empty 200 for a whole reply, or
a 502 "ended without an answer" for a stream. Any other exit is handled
as before.

Siblings, left as they are:
- anthropic.go's output_config.format goes to the Anthropic API, which
  takes a 2020-12 $schema; Claude Code's own tool schemas in
  testdata/context/claude-code.json carry one.
- codeassist.go's responseJsonSchema (Gemini, Antigravity) is not passed
  through plainSchema. Not tried against the real API; no report of it
  refusing $schema.
- format.go's chat()/responses() go to OpenAI unchanged.
- MCP tool input schemas go to Claude Code's MCP, not this check.
- No other CLI is given --json-schema.

Tests (internal/gateway/claude_cli_schema_test.go). A fake claude does
what Ajv does: it fails on a 2020-12 root $schema or on prefixItems, in
2.1.307's words.
- TestClaudeCodeTakesCodexTitleSchema sends the reporter's title schema
  through a Responses request. It checks for a 200 with the title, and that
  the schema reached the CLI minus only its $schema.
- TestCLISchemaKeepsTheRest checks that $id, $defs and a nested $schema
  are kept, and that a schema without $schema, non-JSON and `true` pass
  byte for byte.
- TestClaudeSchemaRefusedIsAskedOnce/{whole,stream} sends a prefixItems
  schema with two Claude accounts. It checks for a 400 in Claude Code's
  words, one run, and no account rested.

Broken by hand:
- cliSchema returning raw: the first two tests go red.
- No 400 for a refusal: both subtests go red (an empty 200 and a 502).
- No late-exit emit only: both subtests go red.

Record for this push: 13 commits on origin/main ca4a1cde0, head tree
539c84e92. Go 1.26.8, sandbox HOME, GOMODCACHE/GOCACHE pinned. The full Go
run and vet were at tree d6393dfc8, the same Go code as this head: only
app.js comments (cut under the core script budget) and one ja string
changed after it.
- gofmt -l: nothing. go build ./...; go vet ./... (darwin), GOOS=linux
  go vet -tags nogui ./..., GOOS=windows go vet ./...: clean.
- go test -timeout 45m ./..., through tee, one suite on the machine:
  68 packages ok. The one red was internal/gui's
  TestCoreScriptBudget: app.js 1,335,314 > 1,335,000, since main grew
  app.js under the stack. The autoscroll commit's own comments were cut
  (to 1,334,629) rather than the budget raised, and go test -count=1
  ./internal/gui is ok at this head (113s). Packages the run took from
  Go's test cache had the same inputs.
- GUI: the 18 files this stack touches or names, both engines,
  202 of 204 pass (tree 068acf128, this push less the last commit). The
  two reds: gui-ja, red on main since c2636b7b5 and fixed by this push's
  last commit (gui-ja and i18n-keys 6 of 6 there), and usage-fold's
  chromium "several accounts" (#2163, red on main the same way).
- internal/gateway ok in that run, with claude_cli_schema_test.go's three
  tests.
- No GUI change here.
  The whole GUI suite ran at 1c1fc7183 (this stack's first 12 commits on
  0ddcf28a1): 11713 of 11769 pass. Each of the 21 red files was then run
  alone at the stack and at origin/main 8278fd9b0. Eight are red the same
  way on main: plugin-card-update (#3079), quota-count-wrap and
  quota-name-translated (#2228), s3-sync (#2448), usage-agents-hide
  (#2276), usage-checkin (#3091), usage-fold's chromium "several
  accounts" (#2163), usage-ledger (#3104). The other 13 pass alone on both
  and were red only under that run's load (50 to 335): currency #3101,
  plugin-github #3218, provider-fetch-again #3292, rest-try-now #2564,
  routing-auto-reset #3293, routing-keys-fold #1612, routing-steady #1804,
  routing-wb-restricted #1905, sessions-folder-delete #2218,
  sessions-manage #3294, switch-only #3295, text-size #1866, usage-pack
  #3296.
2026-10-23 01:58:00 +08:00
yetone efd4770015 agent: a reasoning effort picked in VS Code's Copilot Chat survives magpie's sync (chim3744 on Discord)
chim3744 (magpie 0.1.1318) picked "max" for a magpie model in Copilot
Chat's model picker, and requests went out at "low".

Cause: VS Code 1.142 keeps that pick inside the provider group, as
settings["<model id>"].reasoningEffort (languageModels.ts
setModelConfiguration). magpie's setGroup built its group with
vscodeGroupJSON, which has no settings key, compared the whole object
with sameJSON, and edit.SetJSONItem replaced the whole group. Every Sync
(catalog.Changed on start, a vendor list fetch, a provider edit) and
every magpie model pick in VS Code wiped the pick, and Copilot Chat fell
back to the model's first level ("low" of [low, high, max]).

Fix: vscodeGroupKept lays magpie's group over the one in the file with
mergeTheirs, as theirsKept does for the other agents (#2030). Every key
magpie doesn't write stays: settings, and anything else VS Code or the
user puts there, such as an apiKey reference. The models list stays
magpie's whole, so a model gone from the catalog still leaves it. The
settings of a model magpie no longer lists are kept, since they are the
user's values. When nothing magpie owns changed, the compare is a no-op
and the file is not written. This covers VS Code, VS Code Insiders and
VSCodium (customendpoint and customoai), every profile, since all go
through setGroup. agent-wiring.md lists what is kept.

Siblings checked:
- chatLanguageModels.json is written only by vscode.go. Cursor
  (cursorlocal.go) writes nothing of Cursor's. magpie writes no
  language-model groups for Windsurf, Trae or Kiro IDE.
- Every other syncJSON caller in internal/agent already merges through
  theirsKept, piBlockKept, openCodeKept, mothxBlockKept, qoderKept or
  t3Merged (2eee900dc, #2030's siblings). That covers Pi, Crush, Ante,
  Aside, MothX, StepCode, OpenCode, Qoder, Cline, Command Code, Pencil
  and T3 Code. The exception is Zed's available_models. That is
  magpie's model list, an array, and Zed keeps the model the user picked
  in agent.default_model, outside it.

Test: TestVSCodeKeepsThePickedEffort. It writes the group as VS Code
does after a pick (settings for a listed model and for one no longer
listed), then runs a Sync with nothing changed (the file must stay byte
for byte), a Sync after the catalog gained a model, a magpie model pick,
and a Sync after a model went (the list shrinks and both settings stay).
With the fix broken by hand (want = v, the old whole rewrite) it fails:
"vscode_test.go:550: a sync with nothing changed: the picked effort is
"", want max". With the fix restored it passes.

Record for this push: 13 commits on origin/main ca4a1cde0, head tree
539c84e92. Go 1.26.8, sandbox HOME, GOMODCACHE/GOCACHE pinned. The full Go
run and vet were at tree d6393dfc8, the same Go code as this head: only
app.js comments (cut under the core script budget) and one ja string
changed after it.
- gofmt -l: nothing. go build ./...; go vet ./... (darwin), GOOS=linux
  go vet -tags nogui ./..., GOOS=windows go vet ./...: clean.
- go test -timeout 45m ./..., through tee, one suite on the machine:
  68 packages ok. The one red was internal/gui's
  TestCoreScriptBudget: app.js 1,335,314 > 1,335,000, since main grew
  app.js under the stack. The autoscroll commit's own comments were cut
  (to 1,334,629) rather than the budget raised, and go test -count=1
  ./internal/gui is ok at this head (113s). Packages the run took from
  Go's test cache had the same inputs.
- GUI: the 18 files this stack touches or names, both engines,
  202 of 204 pass (tree 068acf128, this push less the last commit). The
  two reds: gui-ja, red on main since c2636b7b5 and fixed by this push's
  last commit (gui-ja and i18n-keys 6 of 6 there), and usage-fold's
  chromium "several accounts" (#2163, red on main the same way).
- internal/agent ok in that run, TestVSCodeKeepsThePickedEffort with it.
- No GUI file reaches this change; the GUI suite's reds below are none of
  its.
  The whole GUI suite ran at 1c1fc7183 (this stack's first 12 commits on
  0ddcf28a1): 11713 of 11769 pass. Each of the 21 red files was then run
  alone at the stack and at origin/main 8278fd9b0. Eight are red the same
  way on main: plugin-card-update (#3079), quota-count-wrap and
  quota-name-translated (#2228), s3-sync (#2448), usage-agents-hide
  (#2276), usage-checkin (#3091), usage-fold's chromium "several
  accounts" (#2163), usage-ledger (#3104). The other 13 pass alone on both
  and were red only under that run's load (50 to 335): currency #3101,
  plugin-github #3218, provider-fetch-again #3292, rest-try-now #2564,
  routing-auto-reset #3293, routing-keys-fold #1612, routing-steady #1804,
  routing-wb-restricted #1905, sessions-folder-delete #2218,
  sessions-manage #3294, switch-only #3295, text-size #1866, usage-pack
  #3296.

Not tried: real VS Code/Copilot Chat.
2026-10-23 01:58:00 +08:00
yetone ca4a1cde0d dsh: maxTokens leaves dsh half its window, or a quarter for output where that is more (#3298 item 3)
822f2b304 (#2823) held the maxTokens magpie lists for dsh to a quarter
of the window, because dsh reserves it, plus 65536 of headroom, before
it compacts (compaction-basic's resolveCompactSpec: threshold = min(0.8W,
W - maxTokens - 65536)). On a large window the quarter cut more than
compaction needs: DeepSeek's own deepseek-flash, 1000000/393216, was
listed at 250000, though all 393216 leaves dsh 541248 (54%).

Now the cap is max(W/4, W/2 - 65536): the output may take what leaves
dsh half the window to compact in, or a quarter of the window where that
is more (every window under 262144, where there is no half to spare
beside the headroom). A Max output the user set is still written as set
(outputOr), and contextWindow and /v1/models don't change.

dsh 0.2.0-rc.2's own resolveCompactSpec, run on the installed
compaction-basic over each figure (threshold tokens):

| window / output | vendor | quarter (main) | now |
| 524288 / 524288 | no message budget | 131072 -> 327680 | 196608 -> 262144 |
| 500000 / 393216 (#2823) | 41248 | 125000 -> 309464 | 184464 -> 250000 |
| 131072 / 65536 | no pressure budget | 32768 -> 32768 | 32768 -> 32768 |
| 1000000 / 393216 | 541248 | 250000 -> 684464 | 393216 -> 541248 |
| 400000 / 128000 | 206464 | 100000 -> 234464 | 128000 -> 206464 |
| 200000 / 393216 | no message budget | 50000 -> 84464 | 50000 -> 84464 |
| 128000 / 393216 | no message budget | 32000 -> 30464 | 32000 -> 30464 |

#2823's case stays fixed: 250000 is half its 500000 window (its
reporter's own plan A), against 41248 before 822f2b304; it is lower than
the quarter's 309464, which is the trade. The 128K and 200K windows
#3298 names don't change: any output above the quarter there takes it
straight out of what dsh compacts at, and a user who wants more sets Max
output.

Tests: TestDshOutputLeavesCompactionRoom's table takes the new figures
and adds DeepSeek's 1000000/393216 (393216), 200000 and 128000 windows;
its check now holds dsh's threshold at half the window where the window
has one, never under what a quarter leaves. TestDshModelLimits'
400000/128000 is now 128000; TestMaxTokensWithinContextWindow's dsh
figure follows the formula (its windows are all under 262144). Broken by
hand: the quarter alone (main) is red on 4 cases ("maxTokens 250000;
want ... 393216"), W/2 - 65536 alone on 3 (131072 gets 1), no cap
(pre-#2823) on #2823's own cases (524288/524288, 524288/1048576,
500000/393216, 131072/65536) and the 200K and 128K windows. docs/subsystems/agent-wiring.md says the new rule.

Run at 5adad1877 (this commit on top of item 4's): gofmt -l (nothing),
go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
./... (all clean), go build for darwin, linux (nogui) and windows (ok),
and go test -tags nogui -timeout 45m ./...: all 69 packages ok, exit 0
(gateway 505s, agent 401s, provider 197s).

Not tried: a real DSH session against a 1M DeepSeek model through
magpie; the thresholds above come from dsh's resolveCompactSpec run
directly. Windows under ~87K (64000/384000 -> 16000) still leave dsh no
pressure budget, on main too; that needs a policy of its own and isn't
changed here.
2026-10-23 01:20:37 +08:00
yetone e2543575a9 gateway: DeepSeek's own Anthropic endpoint is asked its effort in output_config (#3298 item 4)
DSH on magpie's magpie-anthropic route asks by thinking.budget_tokens
(pi-ai's anthropic-messages default). DeepSeek's Anthropic endpoint
ignores the budget, so every level ran at DeepSeek's default, high.
effortInOutputConfig matched only GLM-5.2/5.3 and MiniMax-M3.1-Flash.

What DeepSeek documents (read 2026-10-23):
- https://api-docs.deepseek.com/guides/anthropic_api, "Simple Fields":
  thinking "Supported (budget_tokens is ignored)"; output_config "Only
  effort is supported".
- https://api-docs.deepseek.com/guides/thinking_mode, "Thinking Mode
  Toggle and Effort Control": the Anthropic format's effort control is
  {"output_config": {"effort": "low/high/max"}}; minimal maps to low,
  medium and xhigh to high, ultra to max.

Change: outputEffortAt(host, model) is effortInOutputConfig or the
upstream host being api.deepseek.com. Both places that used the regex
take it: the Messages passthrough (serve) and the translated Messages
body (anthropicBody, which now gets the host from build). On the
passthrough, a model whose levels magpie doesn't know is fitted to
DeepSeek's low/high/max, so a 32000 budget asks max rather than xhigh
(which DeepSeek reads as high). Another host serving a DeepSeek model
(a relay) is not covered by those docs and goes as before, and so does
every other vendor's model.

Tests: TestDeepSeekAnthropicEffortInOutputConfig goes through the
server stack with the upstream dialled to a fake at api.deepseek.com:
budgets 4096/10000/32000 ask low/high/max, the budget still goes as
sent; deepseek-flash on a relay host and kimi-k2.5 on api.moonshot.ai
get no output_config. TestTranslatedDeepSeekAnthropicEffort does the
same for build(). Broken by hand: with the host clause removed, 5 cases
red ("output_config.effort \"\", want \"low\"" ...); with the rule widened
to any model naming deepseek or kimi and the level fit removed, 7 cases
red (relay and kimi got "xhigh"/"max", budget 32000 got "xhigh", 10000
"medium").

Run at 5adad1877 (this commit plus the next, item 3; same tree as both
pushed): gofmt -l (nothing), go vet ./..., GOOS=linux go vet -tags
nogui ./..., GOOS=windows go vet ./... (all clean), go build for
darwin, linux (nogui) and windows (ok), and go test -tags nogui
-timeout 45m ./...: all 69 packages ok, exit 0 (gateway 505s, agent
401s, provider 197s).

Not tried: a real DeepSeek key against api.deepseek.com/anthropic, and a
real DSH session on the magpie-anthropic route; the budget bodies in the
test are shaped like pi-ai's, not captured from it. output_config.format
(a JSON schema), which DeepSeek's page says it doesn't support, is
unchanged.
2026-10-23 01:20:37 +08:00
yetone c2636b7b5b library: an MCP command given to agents in WSL is checked in their distro
loong on Discord, Windows host with agents in WSL: a stdio server whose
command is a WSL program (`node /home/loong/tools/xxx.js`), given only to
WSL agents, showed "exited (1) … Node.js v24.9.0" on the Library's MCP
page. The check started it on Windows, where his agents never do; a
sibling written as `wsl -d Ubuntu … node …` checked fine.

What changed:
- checkSides (mcp_check_wsl.go) reads each agent id's `@wsl:<distro>`.
  No WSL agent, not Windows, a Windows path for the command
  (windowsPath: magpie's own image server, `C:/x/npx.cmd`) or Settings'
  Detect agents in WSL off: this computer, as before. Otherwise each
  distro is a side, after this computer when an agent here has it too.
- In a distro the command is found as the agents' shell finds it
  (new wslrun.In: the same login-then-interactive probe Find uses, so
  nvm's node is found; cached for findAge) and started through
  wslrun.Tool.Command, the existing `wsl.exe -d D --exec /usr/bin/env
  PATH=… MAGPIE_WSL_RUN=… <path> args` path, so no new quoting. Its
  env goes over WSLENV (Tool.Env); its Cancel stops the run inside the
  distro.
- A distro that isn't running is never started for a check: Why
  "wsldown", naming it, painted as not checked (ring), like novar.
  Beside a side that was checked it is left out.
- Mixed: each side in turn, the first failure ends it. ServerHealth
  gains Checked (where it started, "" for this computer); the row says
  " · WSL Ubuntu" / " · Windows" on a failure, the tooltip "Failed in" /
  "Checked in". New strings in zh, zh-TW, ja, de.
- healthKey (Go and client.js) includes the sides, so agents moving into
  WSL is a check anew.
- docs/subsystems/library.md says all this.

Tests:
- TestCheckWSLOnlyServerInItsDistro: ok in Ubuntu with the exact wsl.exe
  argv; a stopped Arch is wsldown with no probe and no run; a command
  the distro lacks is notfound there.
- TestCheckWindowsServerHere: a Windows-only server checked here, WSL
  never asked; Windows-path commands stay here.
- TestCheckMixedServerEachSide: ok in both; WSL exit named Ubuntu's;
  Windows failure stops before WSL; stopped distro = checked here only;
  healthKey differs when agents move into WSL.
  All force wslrun.On and fake wsl.exe (Run) and the distro run
  (wslCommand runs this test binary as the fake server).
- library-mcp-health-wsl.test.cjs: chromium + webkit, en/zh/zh-TW/ja/de.

Broken by hand, each red:
- checkSides always this computer: WSLOnly and Mixed red.
- windowsPath exemption removed: WindowsServerHere red.
- mixed drops this computer: Mixed red.
- healthKey without sides: Mixed red.
- stopped distro reported as a failure: WSLOnly and Mixed red.
- client.js without the " · <place>" on a failure: the GUI test 12 of 12 red.

Run:
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows ok.
- GUI: the 94 library-*/mcp-*/i18n-* files, both engines: 780 of 783;
  library-loading (webkit) and library-pick-remove (chromium zh-TW) red at
  --test-concurrency=4, load ~45, pass alone 3 of 3; filed #3300, #3299.
- Full suite at 3831de1a3 (base 1d1c5cf9c), go test -tags nogui -timeout 45m ./..., alone on the machine: every package ok, no FAIL (library 334s, gateway 515s, agent 394s).

Not tried:
- A real Windows + WSL run: the Windows box (10.0.0.132) didn't answer
  ssh. The argv is magpie's existing WSL launch path, unchanged.
- In a distro the command's cwd is what wsl.exe gives it (the Windows
  home under /mnt/c), not the Linux home an agent starts in.
- A Windows program reached from WSL by interop (npx.cmd under /mnt/c)
  given to WSL agents is skipped by the probe and can show notfound.
- A command the probe can't take as a plain name (spaces, quotes): an
  absolute path runs with the default PATH, anything else is notfound.
- A stopped distro beside an ok Windows side isn't shown on the row.
2026-10-23 01:00:44 +08:00
yetone 1d1c5cf9c8 provider: the Qoder mover's min is 0.2.30, Qoder CN's check-in with its own device identity (#2911)
@magpie-community/opencode-qoder-auth 0.2.30 (magpie-community/plugins
929a8b3) sends Qoder CN's campaign and check-in requests the device
identity from Qoder CN's own runtime-info (environment 0, as Qoder CN
desktop 0.4.9 and qoderclicn do) when Qoder CN desktop or CLI is
installed, and says to install it when nothing is offered without one.
npm view --prefer-online showed 0.2.30 before this change.

Run at 6e32942a2 plus this change: gofmt -l internal/ clean; go vet
./... for darwin, linux -tags nogui and windows ok; set -o pipefail;
go test -tags nogui -timeout 45m ./... (tee'd to a log, no other Go
suite running): 69 packages ok, no FAIL.

Not tried: the plugin with a real Qoder CN account (none available).
2026-10-23 00:48:44 +08:00
yetoneandCartethyiaQwQ 6e32942a24 gateway: a safety refusal that also says the model is retired retires nothing (#3274, CartethyiaQwQ)
CartethyiaQwQ (#3274) found one more way a safety refusal punished a
provider: serve's retirement check runs on any failed try, and
modelRetired accepts a 400 whose body says the model "is retired", so a
cyber_policy refusal whose message also said so took the model out of
the provider's lists (retired.json) until an answer brought it back.
No real refusal seen so far says it; a boundary case.

- serve: a try settled as a refusal (hw.refused) retires nothing. By
  then its body is magpie's note "safety filter: cyber_policy — <the
  vendor's message>", text, so policyRefusal can't tell it there.
- modelRetired: a body that is the safety filter's error object
  (policyRefusal) is never a retirement, for its other callers too
  (modelRefused, which rests the model, and retryable).

The note cuts the vendor's message at 300 characters, so the test's
refusal is short enough to keep the retirement words in it, as a real
one would.

Tests: TestRefusalSayingRetiredRetiresNothing (an OpenAI-compatible
provider answering a 400 cyber_policy refusal saying "The model m1 is
retired." retires nothing; the same words under model_deprecated still
retire), and TestRetiredWords gets three cases.

Broken by hand: without the serve guard, TestRefusalSayingRetiredRetiresNothing
is red ("retired true, want false"); without the modelRetired guard,
TestRetiredWords is red on both refusal cases. A Codex account's
refusal never reached Retire on main, so it was tried only through the
OpenAI-compatible path.

Full suite at 91f777e93 (base 8278fd9b0, origin/main at push): go test
-tags nogui -timeout 45m ./... — 69 packages ok, none failed
(internal/gateway 566.8s). gofmt clean; vet darwin, linux nogui, windows.

Co-authored-by: CartethyiaQwQ <CartethyiaQwQ@users.noreply.github.com>
2026-10-23 00:18:58 +08:00
yetoneandskygunner 8278fd9b0c gateway: Volcengine Ark's monthly 429 rests the key until the reset it writes (+0800 CST), not 15 minutes (#3251 CNife, #3276 wyx1818)
Ark's 429 for a used-up month says "You have exceeded the monthly usage
quota. It will reset at 2026-10-25 23:59:59 +0800 CST." with no
Retry-After. resetsWhen read an offset only after UTC or GMT, so nothing
read it, the key rested quotaRest and was asked again every 15 minutes
until the month turned. Two more limits stood behind that one: a written
reset over 7 days off (longestWritten) isn't read, and a quota rest is
held to 8 days (longestQuota), so wyx1818's reset 9 days off would still
have fallen to the 15-minute loop.

- resetsWhen also reads the time as Go prints one (Ark's): four offset
  digits, a space and the zone's name in capitals, then punctuation or
  重置. The offset is read, the name isn't (CST is more than one zone).
  The UTC/GMT form is unchanged; a bare offset with no zone's name, or
  "+08:00" without UTC, isn't read, as Ark doesn't send them.
- monthlyWords (monthly, 月度, 每月, 本月): a refusal that says its
  allowance is a month's has its written reset believed up to
  longestMonthly (35 days) instead of the week (longestSaid). That covers
  Zhipu's 1310 "Weekly/Monthly Limit Exhausted" too (resetsZhipu), the
  sibling held to the same week.
- In failQuota the 8-day cap is lifted to 35 days only when the rest
  came from the vendor's own reset ("resets") and the refusal is a
  month's. A window read full, a Retry-After and the user's own quota
  rest are held to 8 days as before.

Ported from skygunner's branch skygunner:fix/volcengine-resets (e6c2b6fb,
posted on both issues). Taken: the monthly trust window, longestMonthly,
monthlyWords, the reporters' bodies as fixtures and the shape of
TestMonthlyWrittenResetRestsTheMonth. Changed:
- its regex made UTC|GMT optional and took any 2 to 5 letters,
  case-insensitively, after any offset, for every vendor, so "reset at
  <date> +8 now." would read. Scoped here to Go's layout, the zone's
  name matched case-sensitively.
- it lifted the cap to 35 days whenever the body said monthly, whatever
  the rest came from (a window read full, the user's own rest); here
  only for the vendor's written reset.
- its resetsZhipu kept the week; here it shares longestSaid.
vincenty on Discord: no link to another fix is on either issue
(skygunner's commit is authored as "vincent").

Not changed: Ark's plan windows read by its AccessKey (volcPlanQuotas)
still reach only the usage card, not routing (layer 2 of #3251: the
quota is the account's, not one inference key's, and a provider has one
plan, #2849). #3251 stays open for it.

Tests (fixtures: #3251's and #3276's bodies byte for byte, #3276's as
its pretty-printed JSON):
- TestResetsWritten: ark (3 days), ark 9 days off, ark escaped, 35 days
  read and 36 not, past, cut after the offset / in the offset / before
  the full stop, without the zone, +9900, Ark's form without "monthly"
  9 days off (0: the week holds), WorkBuddy's en 9 days off (0: another
  vendor unchanged), "retry after … +0800 CST." (0). Every existing
  WorkBuddy and UTC/GMT case passes unchanged.
- TestResetsZhipu: 1310 9 days off read, 36 days not; 1308 over a week
  off still 0.
- TestMonthlyWrittenResetRestsTheMonth (new): Ark's 429 3d7h and 9d12h
  off reads failQuota and rests by "resets" till then, raw and as the
  agent's error with keepRetry's note; the same body without "monthly"
  rests quotaRest; a month's refusal with no time on an account whose
  window reads full 20 days off rests 8 days by "window".

Broken by hand, in the worktree:
- old routing.go with the new tests: TestResetsWritten (ark: 0s, want
  79h7m59s; 9 days, escaped, 35 days), TestMonthlyWrittenResetRestsTheMonth
  (79h0m0s off: rests 14m59.99s by quota) and TestResetsZhipu (1310, 9
  days off: 0s) red.
- cap not lifted: 228h0m0s off rests 191h59m59s by resets, red.
- longestSaid always the week: ark 9 days / 35 days and Zhipu 1310 red.
- zone's name made optional: "ark without the zone" reads 79h7m59s, red.
- skygunner's cap (any monthly body): window 20 days off rests 479h59m,
  want 192h, red.
Each restored, green.

Run at 268c1d34c (this change on origin/main 95be6bb75, unchanged at
push): gofmt -l prints nothing; go vet ./..., GOOS=linux go vet -tags
nogui ./..., GOOS=windows go vet ./... clean; go build, GOOS=linux go
build -tags nogui, GOOS=windows go build pass. set -o pipefail; go test
-tags nogui -timeout 45m ./... (no other suite on the machine): 69 ok,
no FAIL in the log (internal/gateway ok 571s).

Not tried: a real Ark key (none here), so not against the live API; the
bodies are the reporters' curl output. Not run: the GUI suite (no GUI
change).

Co-authored-by: skygunner <84759+skygunner@users.noreply.github.com>
2026-10-22 23:47:12 +08:00
yetone 95be6bb75f gui tests: usage-alert reaches the currency row before clicking it
Since 46176fc14 (v0.1.1320) settings rows are ~12px taller, and the
test's own wheel loop stopped once the currency row's top was 60px down,
which left it under the window's foot at times: Playwright's click then
scrolled to it, and "the currency click moved nothing" read 240 for 180
under load (full GUI run at load ~150; base 2 of 2 green). It now
reach()es the row, as the alert clicks above it already do.

Run: usage-alert.test.cjs (chromium + webkit, every language) 9 of 9
green after the change at load 90-180, 1 red before it of 3.
Not changed: side-effort's chromium de 420 moved 1px once in the full
run; alone 3 of 3 green on this tree, not reproduced.
2026-10-22 23:09:25 +08:00
yetoneand卡提希娅可爱捏 efb7cb11d4 gateway: a safety refusal said in a stream is a refusal for a client answered whole too, and rests nobody (#3274, CartethyiaQwQ)
CartethyiaQwQ (#3274): Codex's "safety filter: cyber_policy" refusal
(the Daybreak note) set healthy accounts aside; two such turns benched a
five-account pool for about 17 minutes.

Cause: the HTTP 400 cyber_policy is already a refusal (policyRefusal reads
its code: next account asked, nobody rests), and so is one said in a
stream relayed as a stream. A Codex account is always streamed upstream,
so a stream:false Responses, Chat or Messages request is answered from
that stream whole. There, a response.failed or error event whose error
has a code (cyber_policy) but no invalid_request_error type got no status
from the decoder, and the whole path answered it 502 api_error: retried
on the same account, then every account asked, each one but the last
resting by backoff. A refusal after a few words went to the client as a
finished 200 turn, and the failure after it rested the account.

Fix, at the decoders and the whole path:
- filterRefused (fallback.go): a stream error event refusedCode reads as
  the safety filter's gets status 400 and Said {"error":{type
  invalid_request_error, code}}. Used by every decoder that set
  Code: refusedCode -- Responses (both error sites, after requestRefused),
  Chat, Anthropic and carriedError.
- The whole path (gateway.go) answers a reply the filter cut part way as
  the refusal, not its words so far, and notes it in refusedHeader, since
  Anthropic's error shape drops the code that settle reads.
- restAfterMarked: a 400 whose error object policyRefusal reads as a
  refusal rests nobody and counts no failure (By "off", Why refused), as
  the ZDR refusal does, for any route that reaches it.
- docs/subsystems/gateway-routing.md says so.

Review of the submitted patch (dc6c695db, not taken as is): it matched
`safety filter|cyber_policy|Daybreak access` anywhere in a 400's words,
so a 400 that echoes the user's prompt in its message skipped the rest
too; its fixture was magpie's own refusedError text, which restAfter is
never handed for a 400; and it gated on status 400, while the path that
rested (above) answered 502, so it would not have stopped the rests.
Its restAfter unit tests' shape is kept in TestRestAfterPolicyRefusal.

Run at 21f7f9df2 (origin/main then) plus this change, unless said:
- New TestStreamRefusalAnsweredWholeRestsNobody: {response.failed, error
  event, refusal after text} x {Responses, Chat, Messages answered whole}
  x {next answers, nobody left}; fixture is the reporter's quoted message
  without magpie's 300-char cut. Asserts the client gets 200 from the
  next account or a 400 naming cyber_policy, every try failRefused with
  no Rest, nothing resting.
- New TestRestAfterPolicyRefusal: cyber_policy 400 rests nobody and
  counts 0 failures; a plain 400, and two 400s echoing the reporter's
  words in the message (code string_above_max_length / code null) still
  rest by backoff.
- Red on the old code: all 18 TestStreamRefusalAnsweredWholeRestsNobody
  subtests and TestRestAfterPolicyRefusal/cyber_policy. Broken by hand,
  each went red: filterRefused returning no status (all 18); the
  part-way clause dropped (6 "after some text"); refusedHeader not set
  (6 Messages subtests).
- A scratch matrix before the fix (also streamed Responses/Chat/Messages
  and Codex's own path, HTTP 400 and response.failed): only the whole
  routes rested; the streamed ones and the HTTP 400 already passed.
- gofmt -l clean; go vet ./... (darwin), GOOS=linux and GOOS=windows
  go vet -tags nogui ./... clean.
- go test -race -timeout 45m ./internal/gateway/: FAIL on two tests
  this change doesn't reach, each ok alone with -race -count=3 and
  filed: TestPluginStreamLongActiveReader (client deadline after 36MB,
  #3286) and TestQuietKeptAliveOnlySoLong (0 keepalives in a 3s pause,
  #3287). Load was 180-280 from other sessions' GUI runs.
- Rebased on ba1dc7f97: gofmt, go vet ./internal/gateway/ and the two
  new tests again: ok.
- go test -timeout 45m ./... at ba1dc7f97 plus this change: ok, 69
  packages, no FAIL (internal/gateway 783s).

Not tried: a real Codex account. Whether the ChatGPT backend sends
cyber_policy as an HTTP 400 or inside a 200 stream, and with or without
an error type, isn't known from the issue; every shape is covered by
tests, not by a live refusal.

Co-authored-by: 卡提希娅可爱捏 <134358478+CartethyiaQwQ@users.noreply.github.com>
2026-10-22 22:53:47 +08:00
yetone ba1dc7f975 tests: a decoder test counts its cheapest read, so another goroutine's allocations don't fail it (#3283)
TestPackedScanKeepsItsDecoder went red on macOS CI at 3a213e1dc, a
CSS-only commit: 665,955 bytes against a 512 KiB bar. allocated()
averaged runtime.MemStats.TotalAlloc over its calls, and TotalAlloc
counts every goroutine in the process, so another test's leftover work
was billed to the scan. It now returns the least any one call
allocated. A decoder made anew costs its window on every call (about
3 MiB for a packed rollout), so the least still shows it; work that
overlaps one call no longer does. TestDshFramesKeepTheirDecoder shares
the helper and gets the same fix.

Run at 8c68b6802 (origin/main), internal/sessions only (test-only change):
- Injected noise (a goroutine allocating 256 KiB every 8 ms): old
  helper red 3 of 4 runs, new helper green 4 of 4. Two forced
  runtime.GC() calls between scans leave the old helper green, so the
  pool being emptied is not the cause.
- Broken by hand: openLines making a new decoder each read turns
  TestPackedScanKeepsItsDecoder red (3,330,376 bytes); frameDecoders.New
  in place of Get turns TestDshFramesKeepTheirDecoder red (165,512).
- go test ./internal/sessions/ ok; the two tests -count=10 ok; gofmt
  clean; vet darwin, linux (-tags nogui), windows ok.

Not run: the full suite. Nothing outside this test file changes.
2026-10-22 22:03:16 +08:00
yetone 8c68b6802a gui: time to first token reads 首字耗时 in Chinese, not 首响 (Outvi V)
Outvi V on Discord: "首响 2.7 秒" makes a reader stop and decode it.
The rest of the GUI already says 首字 for the first token (首字平均,
厂商首字等待, 没有首字时间), so 首响 was the odd one out. The label
(First token, TTFT) now reads 首字耗时 / 首字耗時 beside 耗时, the
Routing step reads "{ms} 后出首字", and the other mentions say 首字. zh
and zh-TW both; ja, de and en are unchanged.

routing-request-metrics checked that 首字 was gone from Routing's steps;
that guarded a since-removed "first text in {ms}" string (4c5a30dc0),
which nothing translates any more. It now checks that 首响 is gone.

Run at origin/main 3a213e1dc plus this change: routing-request-metrics,
routing-burst-speed, routing-columns, usage-ledger, usage-ledger-detail,
usage-ledger-ttft, usage-speed and i18n-keys in chromium and webkit:
67 pass, 6 fail. All 6 are usage-ledger's "newest live route needs no
return-to-live button" (en and zh, both engines), which fails the same
way at 3a213e1dc without this change (#3104).
2026-10-22 21:51:29 +08:00
yetone cf1498f506 tests: the middleware tests start fresh, so a rest another test left on "a" no longer skips it (#3273)
TestMiddlewareOnProviderPerTry (e44b9aef3) set XDG_CONFIG_HOME and
XDG_CACHE_HOME itself instead of calling the package's fresh(t), so it
kept the process-wide rest map. In CI run 39773996813 (240f3eb4c,
macos-latest, Race shard 2 of 5) TestReplyNamesMember ran a few tests
before it, and its last subtest's 529 left provider "a" resting: group
G went straight to b and "a" was never asked (sent map["b":"asked"]).
The test's own 500 rests "a" the same way, so -count=2 failed alone.

Both middleware tests now call fresh(t), which clears rests, affinity,
routing memory and the rest as the package's other tests do.
TestMiddlewareThroughGateway had the same hand-made setup (provider
"fake", used by 71 other tests). The upstream handlers' writes to
`sent` are under a mutex now; the race detector hadn't reported them.

The class: every Test that saves a group and neither calls fresh(t),
noRests or a helper that does was listed (11). The others have one
member, ids no other test rests, or reset in a helper two levels down
(jevved -> ruled -> fresh).

Reproduced by injection, at ef6f3749d (old test):
  go test -race -run 'TestReplyNamesMember$|TestMiddlewareOnProviderPerTry$' ./internal/gateway/
    FAIL: middleware_test.go:152: sent map["b":"asked"] (twice)
  go test -race -count=3 -run 'TestMiddlewareOnProviderPerTry$' -> runs 2 and 3 FAIL
With this change, at ef6f3749d + this diff:
  the same pair: ok
  go test -race -count=20 -shuffle=on -run 'TestMiddleware|TestReplyNamesMember$' ./internal/gateway/: ok (202s)
  gofmt -l clean; go vet ./internal/gateway/ for darwin, linux (-tags nogui), windows: ok
  go test -race -timeout 45m ./internal/gateway/ (at ef6f3749d + this diff): ok (2287s)
  go test -timeout 45m ./... at d9a54a90c (this diff rebased on 21f7f9df2),
    no other full suite on the machine: exit 0, 69 packages ok, no FAIL
    (internal/gateway ok 853s); log kept whole and grepped for FAIL/panic
  Pushed rebased on 3a213e1dc, which changes routing.css and a GUI test
  only (no Go file) since d9a54a90c's run.

Not tried: the shuffle seed of the -count=20 run wasn't recorded (no -v).
No other package was changed.
2026-10-22 21:45:17 +08:00
yetone 3a213e1dc1 routing: a waiting row's dot keeps its whole glow (#2553, dumplings)
The Routing request row's target cell (.rt-req .to) clips with
overflow:hidden, and the waiting dot's 6px glow sat flush against its
left edge, so the glow was cut on the left (and a pixel above and
below). The cell now has 6px of padding on its left and 1px above and
below, given back with a negative margin, so the glow fits inside the
clip and nothing in the row moves.

Run at 226551d0d (worktree base), GUI only (CSS change):
- New routing-wait-dot.test.cjs (chromium + webkit, en + zh, 1100 and
  420 wide): the dot has at least 6px of room left, above and below
  inside .to's padding box, and moves < 0.5px when the row starts
  waiting. Red on the old CSS ("left room 0"), green with the fix.
- wait-dot + routing-columns: 12/12 pass. A first attempt with only
  left padding broke routing-columns' alignment; this version doesn't.
- Every routing-*.test.cjs plus phone-rows and click-scroll: 262 pass,
  2 red under load ~240: routing-day-window.test.cjs:106 (chromium ja
  420, filed #3278) and routing-flood.test.cjs:97 (chromium en, #2215).
  Those two files alone pass 42/42 twice on the fix and twice on the
  old CSS, so neither is this change.

Not tried: the real Linux app (WebKitGTK); no motion or new API here.
2026-10-22 21:30:04 +08:00
yetoneandLoKi 21f7f9df23 checkin: the Qoder plugins' check-in is asked again within the day, as the built-in's was (#2696)
The native Qoder and Qoder CN plugin check-in (pluginCheckinProvider) built
its checkiner without recheck, while the built-in qoderCheckiner set it.
So an inactive or done result was kept for the whole Beijing day, and a
press of "Check in now" was answered from that record too. Qoder CN's
campaign runs 10:00 to 09:59 the next day (mufanmu), so an early read
describes yesterday's campaign and said nothing about today's.

What changed:
- provider: pluginRechecks(id) is true for "qoder" and "qoder-cn" only,
  and sets recheck on their checkiner. A press asks at once. The loop asks
  again after wbCheckinEvery (30m) for inactive and done. Every other
  plugin stays settled for the day.
- GUI (checkinRow): a Qoder account (built-in or plugin) whose check-in
  found no campaign today keeps "Check in now". A press reports "Check-in
  status refreshed" instead of "Checked in", since it may still find
  none. The unused "Checked in" key is replaced in all four languages.
- docs/subsystems/provider-plugins.md names the exception and the tests.

Taken from LoKi's (lokic7123-star) patch on the issue: the recheck on the
Qoder plugin ids, the Check in now button for an inactive Qoder card, and
the neutral press status. Their GUI test was adapted into
qoder-checkin-recheck.test.cjs.
Left out, as the earlier review asked: the blanket 30-minute message, the
UTC timestamps and the client-computed next check. Also left out: the
"Already checked in today" wording and the "· credit" display. That is
not this bug, and the TUI and CLI would need the same change.

Run:
- Red on the old code:
  - All 8 subtests of TestPluginCheckinQoderRechecksCampaigns
    ({qoder,qoder-cn} x {inactive,done} x {loop,press}) fail without
    the fix.
  - Forcing recheck on for every plugin turns
    TestPluginCheckinOthersSettledForTheDay red.
  - qoder-checkin-recheck.test.cjs is red on the origin/main assets (no
    .ci-now on the card).
- At 91bb01e65 (base 9572a3576):
  - Full suite: set -o pipefail; go test -timeout 45m ./... |
    tee. EXIT=0, 68 packages ok, run alone on the machine.
  - qoder-checkin-recheck.test.cjs passes 20/20: chromium and webkit,
    en/zh/zh-TW/ja/de, 900 and 440px.
  - 76 GUI files reachable from the change were run: check-in files,
    gui-*, i18n-keys and tray-usages. Reds:
    - login-import, chromium en/zh: red on main too (#1307).
    - quota-reads webkit de 360: red on main too (#2150, commented
      with its c.toFixed page error).
    - usage-checkin webkit en/zh, Qoder tab: red on main too (#2549).
    - update-wait chromium en and usage-alert webkit en: red only
      under load, pass alone (#3275).
- At this tree, rebased on 87d703c5c (b91bcf260, library only, came
  after). The 8 new main commits since
  9572a3576 bring app.js, i18n.js and provider plugin changes; none of
  them touches check-in code.
  - gofmt -l: clean.
  - go vet ./...: clean on darwin, linux (-tags nogui) and windows.
  - go test ./internal/provider/ ./internal/gui/ ./internal/plugin/
    ./internal/cli/: all ok. internal/gui includes TestCoreScriptBudget.
  - GUI, both engines: qoder-checkin-recheck, i18n-keys,
    plugin-checkin, checkin-account, account-models and
    plugin-keyless-signin pass 119/119.

Not tried:
- No real Qoder or Qoder CN account, and no campaign that opens
  mid-day.
- The full GUI suite: another session's full GUI run held the machine,
  so 76 files were run instead.
- Linux and Windows at runtime.

Reported by mufanmu and LoKi; patch by LoKi.

Co-authored-by: LoKi <317300729+lokic7123-star@users.noreply.github.com>
2026-10-22 21:18:13 +08:00