Commit Graph
8285 Commits
Author SHA1 Message Date
yetone 6bdeedc6fb gateway: serve DeepSeek's chat page with magpie's models
@yanghonghang asked on X for DeepSeek's open-source web chat page
(deepseek-ai/chat-demo) to run on magpie, with its search and link
reading served by magpie's own. magpie now serves it at
<gateway>/deepseek-chat/, with no setup:

- The page is the v0.1.1 release (MIT, LICENSE kept in the zip),
  embedded and served from memory. Its API origin is rewritten to
  location.origin+"/deepseek-chat", and magpie.js adds a model picker:
  any magpie model answers, sent as the magpie_chat_model cookie.
- On this computer the page needs no key of the user's. Another
  computer types a gateway key, as for every other route.
- POST anthropic/v1/messages maps deepseek_web_search to magpie's
  web_search_20250305 and deepseek_read_url to a read_url tool magpie
  runs itself with fetchPage between rounds. Each round goes through the
  gateway's own Messages route, so routing, keys, limits and usage are
  the same as an agent's.
- Files (images, PDFs, text) are kept in memory until a restart; Word,
  PowerPoint and EPUB are refused with 415. ASR and TTS go to the speech
  models set in magpie.
- Only the page's GET/HEAD static files are keyless (readOnlyRoutes and
  lanGuard's chatPageOpen), served under a strict CSP. Its models, chat,
  files and speech routes need a key from another computer, and a
  read-only key is refused on each (readOnlyRefused).

Docs: docs/subsystems/gateway-routing.md, "DeepSeek's chat page".

Real use: a sandbox magpie (sandbox HOME, port 3486 on mote) served the
page in Chromium; a Claude answer with web search showed citations and
source chips, a DeepSeek link read answered from the page, and the
picker was checked in light and dark.

Run: go test -tags nogui -run 'TestChatPage|TestReadOnlyKeyEveryRoute'
./internal/gateway on mica, ok. Without this change every TestChatPage*
is red (the routes 404), and TestReadOnlyKeyEveryRoute is red with the
chat routes missing from readOnlyRefused.
2026-11-14 23:50:45 +08:00
yetone cd75e3ca80 gateway: a held text block's citations go after its start
With function tools in a request, anthropicTextCalls holds an empty text
block's content_block_start until its first text_delta, in case the text
turns out to be a written call. A cited line streams its citations_delta
before its text, and those went out at once: before the block they
belong to had started. A client that keeps blocks by their start
(DeepSeek's chat page, the Anthropic SDKs) dropped or choked on them, so
web search answers relayed with tools lost every source. Seen live: a
remote magpie's Claude answer had 19 citations_delta with the start
first, and the sandbox's relay put all 19 before it.

Now a delta other than text on the held block lets the start go first.

Run: go test -tags nogui -run 'TestTextCallsCitationAfterItsBlock|TestChatPage'
./internal/gateway on mica, ok. TestTextCallsCitationAfterItsBlock is red
on the old textcalls_anthropic.go (citations_delta before
content_block_start).
2026-11-14 23:50:45 +08:00
yetone 0581197059 usage: a table's account cell has its name above its address
normalcoder_ on X (tweet 2121623100425134513): in Usage > Overview's
table, the account cell put the name and the address side by side, so a
long one was cut. The name is now on the first line and the address, the
key plan it stands in for and shared keys each on a line below it, with
the cell's whole width; a masked page's eye stays on the name's line.

Run (mote): usage-table-acct-lines.test.cjs, chromium + webkit, en zh
zh-TW ja de, 1100 and 420px: 20/20 here, 20/20 red on origin/main
0b8c4bfc3 ("the address is under the name"). With the other two new
files: 60/60.

Not run: the whole GUI suite before the push; the real Linux app.

After the rebase on cfd70c60c, at this tree (mote): go test ./internal/gui -run 'Budget|I18n' ok; the three new files and i18n-keys 64/64.
2026-11-14 23:50:37 +08:00
yetone 47684ef176 usage: a table column is what its windows are of, not their names
normalcoder_ on X: in Usage > Overview's table, Antigravity's
"Gemini · 5 hours / 7 days" landed in the last ("Other") column, since
columns were keyed by window name. That holds for every provider whose
names don't match the column keys.

columnOf keys a pooled window to its pool's column (poolWord, "Claude &
GPT" under Claude) and names the window in the cell; any other window
goes by its span (spanOf: "Weekly", "7 days" and "7d" share a column,
headed by the name most rows use, a number on a tie); a window with no
span goes by its name.

Run (mote, chromium + webkit, en zh zh-TW ja de, 1100 and 420px):
usage-account-subcards.test.cjs 40/40 here, 40/40 red on origin/main
0b8c4bfc3. It covers the previous commit's sub-cards as well. The usage
GUI reds are those named in the previous commit, the same on main.

Not run: the whole GUI suite before the push.
2026-11-14 23:49:02 +08:00
yetone 2a6ab83d8a usage: each account of a provider's card is a card of its own; the ⋯ keeps its room
normalcoder_ on X (v0.1.4079, Usage > Overview): accounts inside a provider
card were told apart by a hairline only, and the card's ⋯ was drawn over
the end of the head ("Show the other accounts in brief" was hidden).

- renderQuotas puts each account of a card with several into a
  .subscription-acct box (a provider's keys, a balance a line, stay
  lines); quotaCardMenu looks through the box for the account's head.
- The head keeps 18px for the ⋯ whether it shows or not; where nothing
  hovers, the ⋯ is always shown.
- Core budgets +57 (app.js) / +81 (core): renderQuotas draws every card,
  so there is no page to move it to.

Run (mote, both engines):
- usage-card-menu-room.test.cjs: 20/20 here; red 20/20 on origin/main
  0b8c4bfc3. usage-account-subcards.test.cjs (next commit) guards the
  sub-cards; red on origin/main too.
- go test ./internal/gui -run Budget: ok.
- ~110 usage/quota/i18n GUI files: every red is the same on origin/main
  0b8c4bfc3 and filed: usage-agents-hide (#3414), usage-cards-hide de 560
  (#6294), usage-fold webkit (#6003, #3415), usage-hidden-way-back (#6295),
  usage-ledger Requests (#5048), usage-range-times (#6499),
  usage-speed-all-models (#5834).
- usage-fold "most on one screen" is red on main (#4790, 12 chromium of
  15 wanted); with the boxes it is 11, one account fewer.

Not run: the whole GUI suite before the push; the real Linux app.
2026-11-14 23:49:01 +08:00
yetone cfd70c60c2 update: the old pill quiet ran through 0.1.4181, not 0.1.4179
Comments and docs only: v0.1.4180 and v0.1.4181 were tagged before 3f09b9ffc landed, so they still hold the pill for 3 days. No code changed; nothing run beyond gofmt -l (clean).
2026-11-14 23:48:04 +08:00
yetone 3f09b9ffc6 update: the header's Update pill shows a waiting update at once; only its x holds it, for 3 days (visamzh, normalcoder_ on X)
visamzh (0.1.4174, 0.1.4176 downloaded, Update button and Automatic
updates on) and normalcoder_ (0.1.4079) saw no Update pill for about two
days. Cause: 36eebea13 (v0.1.3879, 11-12) set /api/update's quiet until
this version had been behind for update.Quiet (3 days), counted from the
first newer version seen and kept per running version. With a release
every few minutes, every update starts that clock over, so on any version
a user updates within 3 days the pill never lit, whether a download was
waiting (ready) or one was found with downloads off (found), on every OS.
The Version row and the tray's Restart to update still offered it.

Now being behind holds nothing: ready, found and available light the
pill at once. Only the pill's x (or right-click) holds it, for
update.Quiet across the releases out meanwhile (Behind.Hushed), which
keeps 36eebea13's answer to "always lit" (the x used to hold only until
the next release, minutes later). An urgent release still lights it
through that. The old notes' "since" is never read as a dismissal.
Settings > Update button says "Hidden for 3 days" whenever the x holds
(it said "Hidden for <v> until a newer version is out" only while that
exact version was latest), and Show again lifts the hold
(update.Unhush, an empty update-skip). The x's label and toast say
3 days instead of "until the next version" (en, zh, zh-TW, ja, de).

Users on 0.1.3879 to 0.1.4179 get it with their next update: Settings >
About > Restart to update, the tray's Restart to update, or quitting.
0.1.4079 still checks, downloads and verifies the newest release: its
updater code (LatestEvery + Stage, sandbox HOME on mica) fetched
0.1.4178, passed download, verify (SHA256SUMS signature, attestation)
and unpack, and stopped only at the Team ID check because the probe
binary is unsigned.

Run (mica/mote, macOS, Go 1.26.8), at this tree:
- go test -count=1 ./internal/update ./internal/gui: ok, before and
  after the rebase onto 0b8c4bfc3 (also i18n-keys, i18n-en-no-cjk, update-quiet, update-hide there: 118/118). go vet darwin, GOOS=linux -tags
  nogui, GOOS=windows: clean. gofmt -l clean.
- Broken by hand (old semantics: first-seen sets the clock, Lit needs it
  past Quiet): TestPillLightsWhenANewerVersionIsOut,
  TestDismissalHoldsForTheQuiet and TestUpdateQuietUntilBehindAWhile
  (ready, found, available: quiet true, want false) red.
- GUI, Chromium + WebKit: update-quiet.test.cjs (en, zh, zh-TW, ja, de;
  panel 420, narrow window 400, window 900; ready and found show the
  pill, quiet hides it and Settings says Hidden for 3 days with Show
  again) and update-hide.test.cjs pass; update-quiet red on the old
  app.js (Settings row). 52 GUI files touching Settings, updates, i18n
  and menus: 882/935; the reds (menu-scroll, settings-hints,
  settings-search, settings-lines-wrap, settings-groups warm-ups) are
  the same 50 at origin/main aa358555f run alone (54 pass / 50 fail
  both), filed as #1550, #5982, #6133, #6353, #6597. plugin-card-update
  webkit was red only under --test-concurrency=3 and passes alone.
Not run: the full go test ./... and the whole GUI suite (mote over its
load, mica running another session's GUI suite); not tried in the real
app with a real download waiting.
2026-11-14 23:47:47 +08:00
yetone 1106a33a89 routing: every account row in Accounts and keys shows all its windows
zwm_vincent on X: with two subscription accounts, Accounts and keys
showed one window per row, 5H on one and 7D on the other, so neither
row said what was left in the other window or when it reset.

A subscription account's row now has one line per window Usage read:
the short name (5h, 7d), a small bar, what is used or left, and when
it resets. Each part's column is as wide as the widest down the list
(in ch, CJK counted double), so the names, bars, values and resets
start at the same place on every row. Where a row is too narrow (the
list in columns at a phone's width, under 215px) the bar is left out
and the reset wraps under, alike on every row. The hover still has
each window in full with the day and time it resets and when it was
read. The single-figure status, the windows line and the bottom bar
are not drawn for such a row; wallets and accounts with no windows
keep their one line.

Tests: routing-account-windows.test.cjs adds a second account whose
binding window is the week and checks both rows show both windows with
their bars (40%/12%), the hover text, every column's left (and the
reset's right) equal across lines and rows, nothing cut, no sideways
scroll; en, zh, zh-TW, ja, de at 1100px and 420px, Chromium and WebKit.
routing-pooled-card and routing-read-allowances read the new lines.

Run at this head, rebased on origin/main aa358555f, on mote:
- The 7 routing GUI files (routing-answer-figures, routing-account-windows,
  routing-pooled-card, routing-read-allowances and the routing files they
  share helpers with): 108/108 ok, Chromium and WebKit, en/zh/zh-TW/ja/de,
  1100px and 420px.
- Both new tests on the old code: 86 fail, 2 pass.
- Every GUI file that loads routing or app.css (313 files): chromium 51
  and webkit 50 reds, each red on origin/main aa358555f too (#5872,
  #5262 zero-priced-free, #6561 text-size webkit, red 3 of 3 on main
  on mica). ctx-route-align was red here only, from a fractional
  min-height; fixed (54px) and green.
- go vet ./internal/gui, go test ./internal/gui: ok (160.8s).
Rebased on origin/main 171fce511 (app.js, i18n.js changed): ctx-route-align,
  i18n-keys, quota-credits and the 4 routing files above, 108/108 ok,
  Chromium and WebKit, on mote.
Broken by hand: the old client.js/routing.css under the new tests (above).
Not run: the whole GUI suite, the Go suite (no Go change), the real app
with a real account's windows (fixtures carry the reporters' figures).
2026-11-14 23:45:23 +08:00
yetone af62d3d646 routing: a try's answer in the caption is figures in fixed places
Puremilk_chun on X: the caption over the Routing stage told an answer
as one sentence ("Codex's own sign-in (gpt-6.1-sol) 以 high 推理强度
用 41 秒 完成回答 · 197.5k token · 35 秒 后出首字 · 40 token/秒 ·
请求缓存命中率 98%"). Its length and line breaks moved with every
value, so the reader had to find each one again.

The caption now lays the answer out as a grid: who answered, its model
and effort on top; under them the duration, tokens, first token, speed
and cache hit rate, each a value over its existing label ("Duration",
"Tokens", "First token", "Speed", "Cache"; no new strings). Five to a
line; three to a line where the stage is 720px or narrower (a byWidth
class, no container query, WebKit #1249). A figure the try doesn't tell
is a dash in its place, so the others keep theirs. The sentence stays
on hover and in the steps list below. The caption's min-height grew so
the next answer doesn't move the page.

Test: routing-answer-figures.test.cjs plays the reporter's request
(41 s, 197.5k, 35 s first token, 40 tok/s, 98%) then a shorter one
with no first token and no cache figure, and checks every part keeps
its x, its line and the caption its height, nothing is cut, the effort
sits on the account's line, no sideways scroll; en, zh, zh-TW, ja, de at
1100px and 420px, Chromium and WebKit.

Run at this head, rebased on origin/main aa358555f, on mote:
- The 7 routing GUI files (routing-answer-figures, routing-account-windows,
  routing-pooled-card, routing-read-allowances and the routing files they
  share helpers with): 108/108 ok, Chromium and WebKit, en/zh/zh-TW/ja/de,
  1100px and 420px.
- Both new tests on the old code: 86 fail, 2 pass.
- Every GUI file that loads routing or app.css (313 files): chromium 51
  and webkit 50 reds, each red on origin/main aa358555f too (#5872,
  #5262 zero-priced-free, #6561 text-size webkit, red 3 of 3 on main
  on mica). ctx-route-align was red here only, from a fractional
  min-height; fixed (54px) and green.
- go vet ./internal/gui, go test ./internal/gui: ok (160.8s).
Rebased on origin/main 171fce511 (app.js, i18n.js changed): ctx-route-align,
  i18n-keys, quota-credits and the 4 routing files above, 108/108 ok,
  Chromium and WebKit, on mote.
Broken by hand: the old client.js/routing.css under the new tests (above).
Not run: the whole GUI suite, the Go suite (no Go change), the real app
with a real account's windows (fixtures carry the reporters' figures).
2026-11-14 23:45:23 +08:00
yetone 171fce511a gateway: Google's suspension of an Antigravity or agy-cli plugin account rests it as restricted (plugins#1148)
googleSuspended read Google's 403 "disabled in this account for violation
of Terms of Service" only for an account whose Agent is antigravity or
gemini, the built-ins. An account of the community Antigravity plugin, or
of agy-cli, has Agent "plugin", so its suspension was an unknown failure:
a minute's rest, doubling to ten, and asked (and refused) again every few
minutes for good. plugins#1148's reporters saw a 403 followed by a dozen
more tries. googleSignIn now also takes a plugin account whose plugin
provider is antigravity or agy-cli; such an account rests two hours as
restricted, and the last one left is answered by magpie without asking
Google, as the built-in's is.

Run (mote, base 0b8c4bfc3): go test -run TestAntigravitySuspended
./internal/gateway ok. Broken by hand: with routing.go from origin/main,
TestAntigravitySuspendedIsGooglesAlone is red on both plugin cases
("other, want restricted"). Another plugin's same words (kiro), another
403 and a 400 from the plugin stay failOther.

Not run: the whole gateway package (mote load 31, mica 111 at the time);
it runs after the push. Not tried with a real suspended account.
Not changed: antigravityTurnedAway, antigravityForeseen and
antigravityRound still check Account.Agent only; filed separately.
2026-11-14 23:42:28 +08:00
yetone 0b8c4bfc34 agent: Claude Code's permission mode is set in magpie and kept (EricChenChannel on X)
The report: "every time I configure settings.json it is overwritten and
reset" for permissions.defaultMode = bypassPermissions.

Cause, reproduced in a sandbox HOME with Claude Code 2.1.316: magpie's
writes to ~/.claude/settings.json are key-level and kept the user's
permissions block. Claude Code itself drops the mode: it ignores
bypassPermissions at launch unless skipDangerousModePermissionPrompt is
true, and its auto-mode nudge and /config write defaultMode over it.

Change:
- agent.Field gets Own: the user's own setting of the agent. Apply does
  not record it, Disconnect neither clears nor restores it, Pick never
  connects the agent for it, magpieValueIn is false for it, and profiles
  (Fields, ApplyFields, InUse) and the WSL copy leave it alone. So the
  mode outlives disconnecting magpie and switching profiles.
- Claude Code's permission_mode field (default, acceptEdits, plan, auto,
  dontAsk, bypassPermissions; "" removes the key) writes
  permissions.defaultMode, and bypassPermissions also writes
  skipDangerousModePermissionPrompt: true so Claude Code honours it.
- GUI: own fields go in agentJSON.own, apart from fields, and
  agentcompact.js draws them in an Advanced fold (collapsed) under the
  agent's settings, with the app menu (no <select>). app.js unchanged.
  Labels in en, zh, zh-TW, ja, de (zh: 高级 › 权限模式 › 跳过权限确认).
- docs/subsystems/agent-wiring.md: Fields and options row.

Run at this tree (base aa358555f, origin/main at commit time), on mote/mica:
- go test ./internal/agent -run 'Permission|Profile' ; ./internal/profile ;
  ./internal/gui -run 'Budget|PermissionMode|AgentOwn|AgentModels': ok
- GUI claude-permission-mode.test.cjs in chromium and webkit, en and zh:
  4/4; i18n-keys, i18n-en-no-cjk: ok
- gofmt -l: clean. go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok

Broken by hand:
- Own: false on the field: TestClaudePermissionModeOutlivesMagpie
  ("disconnecting took the mode to \"\"") and TestProfileLeavesPermissionMode
  ("a profile wrote the permission mode") went red.
- Without the GUI own/fields split, the "not a picker on the row" check in
  claude-permission-mode.test.cjs went red.

Not run yet: the full go test ./... and the full GUI suite. Both machines
had another session's GUI suite running; they run next and their result
goes on the follow-up. Not tried: a real Claude Code session's /config
changing the mode back (Claude Code's own write; this change can't stop it).
2026-11-14 23:11:16 +08:00
yetone aa358555ff LESSONS: 11-14, two sessions fixed TestInfoSaysMCPHub at once
The review loop and another session each wrote the hub pruner fix;
49f49c41c landed and the loop dropped its copy (b24f03965, unpushed).
Docs only; nothing run.
2026-11-14 22:41:55 +08:00
yetone 49f49c41c1 gateway: its end waits for the MCP hub's pruner, which reads MCPHub
keepHubPruned ran on its own goroutine with nothing waiting for it, so
ListenAndServe could return while the pruner was still between ticks or
in Prune. It reads MCPHub, which tests swap with withHub, so a test that
waited for one gateway's end and then swapped the hub raced the old
gateway's pruner: TestInfoSaysMCPHub, ubuntu Race on CI at 3dbbb173e
(write at hub_mcp_test.go:76, previous read at hub_mcp.go:910 from a
ListenAndServe started at handover_test.go:28). The gateway's end now
cancels the pruner's context and waits for it to return, so once
ListenAndServe returns nothing it started still looks at MCPHub. In
the app this adds the wait for a Prune already running at shutdown,
which ends the servers the library no longer gives (the same b.stop
StopHub does).

TestGatewayEndEndsHubPruner holds a Prune mid-call and checks the
gateway's end waits for it.

Run on mica (macOS, Go 1.26.8), at 90efddaba plus this change:
- go test -race -count=3 -run 'TestGatewayEndEndsHubPruner|
  TestInfoSaysMCPHub|TestHandedOver|TestEnding|TestListening'
  ./internal/gateway: ok.
- Broken by hand: with origin/main's gateway.go the new test fails 2 of
  2 ("the gateway ended while its pruner was still in Prune") with a
  DATA RACE report.
- GOOS=linux and GOOS=windows go vet ./internal/gateway: ok.
2026-11-14 22:29:07 +08:00
yetone 90efddabae gui: providers can be picked and removed together (eiyuuzaki2333 on X)
Many API providers added meant removing them one at a time. Select, by
the Providers search box (shown with two or more), puts a box on every
row as Routing's groups and Library's lists have it: a click on a row
picks it rather than open its editor, Shift picks the rows shown
between, and the bar's box picks every row shown. Remove asks once, in
the app's own dialog, with the count and every name, then posts
POST /api/providers/delete {ids}. That runs provider.Delete for each
id, as the editor's Remove does, inside one agent.Reseat, so agents
move once, to where they end up. One it can't remove comes back in
`unremoved` with why, stays picked and is named in the status; the call
is refused only when nothing was removed. Done or Escape ends picking.

The rows, bar and removal are in pvpick.js, imported when Select is
first clicked. The core grows 270 bytes (pvSel, the button's click and
two lines in renderProviders), and coreScriptBudget is raised by that
with the reason. "{name} wasn't removed: {error}" moves from Library's
words into core i18n.js, since core code says it now.

Run (rebased on origin/main e6e0585bd, on mica; mote was over its 18
cores):
- go test -tags nogui ./internal/gui/ ./internal/provider/: ok
  (TestProvidersDeleteSeveral new; TestCoreScriptBudget ok after the raise).
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok; go build: ok.
- GUI, chromium + webkit: provider-bulk-remove (new: en, zh, zh-TW, ja,
  de at 420 and 1100px), provider-remove, provider-find, provider-order,
  providers-off-fold, provider-search, provider-list-off,
  group-bulk-remove, library-pick-remove, i18n-keys, i18n-en-no-cjk: ok.
  found-skill-pick-remove's ja/de 420px subtests are red, and red the
  same at origin/main e6e0585bd in a clean worktree (#5013).
Broken by hand: the handler deleting only ids[:1] turns
TestProvidersDeleteSeveral red ("listed after: [b c d]"); the page
posting only the first id turns provider-bulk-remove red in every
language. Restored, green.
Not run: the full Go suite and the full GUI suite (mote overloaded,
mica running another session's GUI suite); not tried in the real app
with real providers.
2026-11-14 22:18:09 +08:00
yetone e6e0585bd3 antigravity: reword Hermes', OpenCode's, Codex CLI's and pi's identity lines, which Google refuses since 11-14 evening
Since about 18:43 on 11-14 Antigravity answers 429 "Resource has been
exhausted" to a system instruction holding "You are Hermes Agent"
(Hermes' current persona), "You are OpenCode", Codex CLI's "You are a
coding agent running in the Codex CLI" or pi's "a coding assistant
running inside pi", whatever quota is left (@ZhouYimingsjtu,
@Lmohn39 on X). Hermes' earlier persona is still refused as "You're …
created by", so it keeps its "built by". Tried on a real account
(gemini-3-flash), each alone: Codex GPT-6's prompt, Claude Code,
Gemini CLI, Qwen Code, Cline, Kilo, goose, Amp, Droid, Kimi, Aider and
Cursor pass as written.

agTurnedAway gains the four lines; agSaidAs rewords them "You're …" and
"running within pi", the smallest change that passed 5/5 on the real
account (gemini-3-flash: pi 1.5.0's full default prompt, both Hermes
personas, OpenCode's first lines, Codex CLI's prompt; claude-sonnet-4-6:
pi 5/5), through the antigravity plugin's cloak, which has the same
lines (plugins a617ecfd, antigravity 0.1.16, agy-cli 0.1.48,
antigravity-cloak 0.1.9). The refusal's hint names the agent: new
OpenCode, Codex CLI and pi hints, Hermes' covers both personas, word
for word the plugins' and the Routing page's (client.js HINTS, i18n
zh/zh-TW/ja/de).

Run (mica; mote was over its 18 cores):
- go test ./internal/gateway -run 'Antigravity|Cloak|CodeAssist': ok
- go test ./internal/gui: ok
- GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gateway
  ./internal/gui: ok
- node --test i18n-keys, i18n-en-no-cjk, routing-ag-turned-away
  (both engines): 38 pass
- gofmt -l: clean

Broken by hand: with the pi and OpenCode lines out of agTurnedAway,
TestAntigravityCloakRewordsEveryLineItTurnsAway and
TestAntigravityHermesHint go red.

Not run: the full go test ./... (mica had another session's full suite
running, mote over load) and the whole GUI suite; the change is
strings in four tables plus the hint switch.
2026-11-14 21:49:30 +08:00
yetone e0ed2c4d81 gateway: model ids without the provider can be listed alone, in place of provider/model
qQianye on X (v0.1.4094 in Docker, several WorkBuddy accounts): the
client on their computer lists every model as provider/model and they
want those hidden. The advice was the Agents page's model list, but
gateway mode (what the Docker image's web page runs as) has no Agents
page. Settings › Network and sharing › Model ids without the provider
was drawn there already, but only added bare ids beside the prefixed
ones, so the list got longer, not shorter.

The row is now Off / On / Only. Only (settings.BareModelIDsOnly,
POST /api/settings/bare-ids {"on":true,"only":true}) lists each bare id
in place of the first row it stands for (provider.OnlyBare) and leaves
the other rows it stands for out: the found group it reaches
(auto/glm-5.3) and every provider's row of that model it reaches. A row
the bare id doesn't reach (b/vendor/m9, whose bare id names provider
vendor), a held key's row whose bare id isn't listed for it, and other
groups keep their ids, so no model leaves the list. Requests by
provider/model are served as before; only /v1/models changes. Another
magpie's list is unchanged. Claude Code's discovery, which drops a bare
row it wouldn't keep because the full row is there, lists it by its
alias with Only (there is no full row). Off clears Only.

Run, at this commit (base 3dbbb173e, origin/main unchanged at push):
- go test -count=1 -timeout 45m ./... on mica: 101 packages ok, no FAIL
  (log kept whole at mica:~/runs/qq-sb/suite.log). gofmt -l clean;
  go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./... clean.
- GUI (Chromium + WebKit, 420 and 900, all five languages) on mica:
  bare-ids, i18n-keys, i18n-en-no-cjk, gateway-mode, settings-tabs-stick:
  66/66 pass. Not the whole GUI suite: mote was over its load and mica
  holds another session's GUI run.
- Broken by hand: with Only ignored in listModels, TestBareModelIDsOnly
  is red (every provider row listed); with Claude Code's bare rule left
  as before it is red (1 of 5 models listed to discovery).
- Docker-style run on mica: the built binary as `magpie serve
  --web` with the image's env (HOME/XDG under a sandbox, MAGPIE_ADDR,
  MAGPIE_WEB_KEY), two custom providers serving kimi-k3 and glm-5.3; the
  page boots with gateway:true and draws #bareIdsRow. /v1/models:
  Off  auto/kimi-k3 auto/glm-5.3 wb1/kimi-k3 wb1/glm-5.3 wb2/kimi-k3 wb2/glm-5.3
  On   the same, then kimi-k3 glm-5.3
  Only kimi-k3 glm-5.3
  kimi-k3 answered by wb1, wb2/kimi-k3 still by wb2.
Not tried: a real WorkBuddy plugin account, and a client reaching it
through another magpie (whose list never takes bare ids).
2026-11-14 21:05:50 +08:00
yetone 3dbbb173ed gateway: spawn_agent names every model for a Codex an app-server host runs under its own name
@m0eaki on X (magpie 0.1.4159, Codex 0.169.0 through LobeHub's
app-server, /v1/responses): the lead saw only Codex's first five of a
local catalog of 13. `codex app-server` makes the host's
clientInfo.name its originator and the head of its User-Agent (codex-rs
initialize_processor.rs, set_default_originator), so LobeHub's turns say
"lobehub-desktop/0.169.0 (…) (lobehub-desktop; …)", and the gate before
spawnAgentModels took only Codex's own names (fromCodex) or the codex
token.

The class: any host may name Codex's turns after itself (Zed, LobeHub,
other IDEs). Every Responses turn Codex sends, to any provider, carries
x-codex-window-id (and x-codex-turn-metadata): core/src/
responses_metadata.rs compatibility_headers. codexRuns takes those as
Codex's too, beside fromCodex and the codex token, for spawnAgentModels
alone. spawnAgentModels still widens only a body with Codex's own
spawn_agent signature or <model_catalog>, and its added text is the
same neutral line (nothing naming magpie or Codex). spawnChoices at /v1
reads the codex catalog and the key's list, not agentOf, so a host's
lead gets the catalog magpie wrote for Codex. codexForClaudeCode reads
the same headers through codexTurnHeaders now.

codexTiered stays on the old gate (split out of the same if).
Gates that send a request upstream as Codex's own, to a relay that
checks it (codexAsSent, codexNamed's header forwarding, keepTurnAsks),
stay on Codex's own names. The other gates on fromCodex (subagent pick,
resume and follow, hookKind, codexOwnOffMagpie, codexTiered, the events
only Codex reads) are left as they are, filed as #6653.

Test: TestSpawnAgentNamesEveryModelForAnAppServerHost posts at
/v1/responses with the headers Codex 0.169.0 sends under LobeHub
(User-Agent lobehub-desktop/0.169.0 (Mac OS 26.5.0; arm64) unknown
(lobehub-desktop; 2.1.40), originator lobehub-desktop, x-codex-window-id),
a lead on magpie's model, in four shapes (tools, V2 additional_tools,
model_catalog_in_context, tool search; the real 0.162.0 and 0.169.0
fixtures), and checks that the same app name without Codex's turn
headers is left as sent.

Run (on mica, mote's load was 100):
- Broken by hand: the old gate back in place, the four LobeHub
  subtests go red, the four without-headers ones pass. Restored, green.
- gofmt -l clean; go vet ./internal/gateway, GOOS=windows and GOOS=linux
  go vet ./internal/gateway: clean.
- go test ./internal/gateway -run SpawnAgent -count=1: ok.
- go test ./... -count=1 -timeout 45m at base bc9ea912a: every package
  ok (101), internal/gateway 937s, exit 0.
2026-11-14 20:23:28 +08:00
yetone bc9ea912a5 contributors: 11-14 two of ggbdpq's patches needed the review again (#5452, #5197)
From the review of fee33668d, 7a9c40413 and 131037e2b. Docs only; nothing run.
2026-11-14 20:00:56 +08:00
yetone 7a9c40413b gateway: only a PDF goes as a translated file, with a filename (#5452)
Review of the commit before. It wrote a Messages `document` and a
Responses `input_file` for a file of any type. Anthropic's base64
document takes only a PDF, so a .docx or .csv that used to go as the
"[attachment …]" note would now get a 400 for the whole turn, the #934
risk. Both encoders now write the file only for application/pdf with
data. Any other file is still described in the note.

- The Responses input_file carries "filename": "document.pdf" beside
  file_data, as OpenAI's shape has it. Part has no field of its own for
  a file name: Name is a tool's, and is read in many places.
- A Messages document by URL is described in the note, not sent as a
  url source. A file reference from another vendor (Gemini's fileUri is
  an https Files-API link) is not something Anthropic should fetch.
- On the read side, a `document` with a text source carries the
  document's words, so it becomes a text part rather than base64 inline
  data. A base64 source is a file. A url source is a file reference.
  Anything else (a file_id source) is left out, as before.

Run on mica: TestOnlyAPDFGoesAsAFile, TestResponsesFileHasAFilename and
TestAnthropicDocumentTextAndURLSources fail at the commit before (a csv
sent as input_file, no filename, the text source not carried as text)
and pass here. The patch's own tests (pdf_translation_test.go,
image_input_test.go) fail with the product files at origin/main
d987cc7d5 (input_file and document dropped, the Chat file became the
note) and pass here.
Not tried: a real PDF through a ChatGPT API account or Anthropic
upstream.

Batch record (#5205, #5197, #5452), all on mote:
- Full suite (go test -tags nogui -count=1 -timeout 45m ./...) at the
  same four changes on d987cc7d5: every package ok except two.
  internal/cli's TestEveryRouteHasACommandOrIsNamed (POST
  /api/page-away) was fixed on main by 69946f43c. internal/plugin's
  TestGatewayHookSlowRecallUsesConfiguredBudget is #6019.
- Rebased on a63923e3d: go vet -tags nogui ./... on darwin, linux and
  windows ok. internal/gateway, claudetui, cli and plugin all ok.
- Rebased on 8769a5819, the pushed base: vet
  of gateway and claudetui on the three OSes ok, and the gateway
  -run 'Codex|PDF|Document|InputFile|ChatFile|Image|…' tests ok. That
  run was on a mote busy with other sessions' work (load ~120).
- Windows (xiaomi-gpu): see #5205's commit.
2026-11-14 19:46:12 +08:00
ggbdpq fee33668db gateway: a PDF survives translation (#5452)
A PDF reached the model only when the request was relayed as sent; the
moment magpie translated it, the file was lost — the Responses
input_file and the Messages document were dropped whole, and the Chat
file became the placeholder text "[attachment application/pdf]"
(#5452, NemoAir: three paths located line by line; a ChatGPT API
account speaks only Responses and only streams, so a Chat request to it
always translated and its file always became the note, and a
non-streaming Responses request to a stream-only account lost its
input_file while the same request streamed arrived whole).

The parts parse into file parts now — the Responses input_file (a
standalone item, its file_data and filename flat on the item, and a
message block, flat as the OpenAI shape has it or nested as a Chat
client sends) and the Messages document — and the Responses and
Messages encoders write inline data in their own tongue (input_file /
document), where Gemini's inline data already rode. A file only
referenced — a Gemini fileUri on the vendor's storage, or another
host's file id — is still told of: Responses' file_id is OpenAI's own,
Anthropic's url source takes http(s) and not a cloud-storage scheme,
and the Chat encoder keeps telling of the file rather than carrying it,
Chat upstreams' file support being uneven and a 400 there losing the
whole turn (#934). The Claude subscription line renders text to its
CLI, which carries no PDF either way.

Rebased onto the video work (#6135), which reads an input_file of a
video alone and left this face standing: a video rides the video
machinery still, and every other file — a PDF, say — is a file part.

Generated-by: GLM-5.3-Flash (ZCode)

Landed from @ggbdpq's patch on #5452, reported by NemoAir. The commit
after it scopes the change to PDFs.
2026-11-14 19:46:12 +08:00
NightGlowww 131037e2ba gateway: preserve Codex model-list OAuth alongside gateway keys
A managed x-api-key made identifyCaller overwrite Codex's valid ChatGPT
bearer with the internal token. /models then forwarded that token and
returned 401, losing the configured model metadata (#5197).

Keep the bearer privately only for the native model-list GET after key
validation. Restore it on a request copy used by both the model-list
cache and its upstream ask, removing gateway authentication fields.
Key-only requests remain refused; other routes keep normalization.

Verification on Go 1.27.3, macOS arm64, based on 17154e165:
- TestCodexModelsKeepOAuthBesideGatewayKey fails on the unmodified base
  with 401 invalid client sign-in, then passes with this fix.
- Four new test groups pass, including -race -count=20.
- Full nogui suite completed: 84 packages passed, 3 packages failed.
  Existing gateway JSONv2 parity (#3547, including a separate invalid
  UTF-8 sizing difference) and WSL probe (#3680) failures reproduced
  on unmodified base. GUI: core budget (#5139, reproduced on base),
  lane-test isolation (#5150), system-proxy isolation (#2562).
  Plugin git-update tests failed with PATH Bun 1.3.14 on base and patch,
  then passed with bundled Bun 1.4.4. Existing issue patches reviewed;
  separate fixes are not bundled into this OAuth change.
  TestRemoveServerDropsItsIcon skipped: user forbids Playwright setup.
  The full suite is not claimed green.
- gofmt -l and git diff --check are clean.
- macOS, Linux (nogui), Windows: go vet ./... and go build pass.
- Isolated patched Server.Front plus a real OAuth and fresh gateway key:
  GET /models returns 200 and Astra's native 272000/max 872000 entry.
  The explicit 872000 override is checked by the regression fixture.

Tests isolate HOME and pin Go caches. No production replacement or
inference probe; no Linux/Windows runtime or GUI/Playwright run.

Landed from @ggbdpq's verification on #5197. The review dropped the
patch's change to the Codex model-list bullet in gateway-routing.md: it
put back an older text (provider.CodexListed, without CodexListedBeside
and keyListed/GroupStandIns). main's bullet is kept as it is, and only
the new paragraph is added.

Run at this commit's tree on mica: with codex_backend.go and lan.go at
origin/main d987cc7d5 and the new test file kept, all four tests fail
(TestCodexModelsKeepOAuthBesideGatewayKey: 401 "invalid client sign-in";
TestCodexModelsGatewayKeyIsNotOAuth: 200 where a local 401 is wanted;
TestCodexModelsOAuthStillNeedsAnEnabledGatewayKey;
TestCodexModelsCacheUsesClientOAuth). With the change they pass. Full
suite: see the batch's last commit.
Not tried: a real Codex app beside a gateway key.
2026-11-14 19:46:12 +08:00
SkyJiashu a49f3745eb claudetui: use a conpty folder beside the executable before Windows' own ConPTY
Windows 10's conhost (10.0.19041) drops bracketed paste marks, so Claude Code
takes a long message as many pastes and submits only part of it (#5205).
Windows Terminal's conpty.dll with its OpenConsole.exe keeps them. When
<exe dir>/conpty holds both, CreatePseudoConsole and ClosePseudoConsole come
from it; otherwise from kernel32 as before, so nothing changes for anyone who
does not add the folder.

Landed from @ggbdpq's verification on #5205. It's opt-in: without
<exe dir>\conpty\{conpty.dll,OpenConsole.exe}, both calls still come
from kernel32. The red/green evidence is the thread's: two Windows 10
machines (19044, 19045) with Terminal's ConPTY 1.24/1.25 passed 1 to
217 KB pastes intact, and lost them with conhost 10.0.19041.

Run on xiaomi-gpu (Windows 11, no conpty folder, so the kernel32 path):
go vet ./internal/claudetui ok, go build -tags nogui ok, go test
./internal/claudetui: every test passes except
TestShimFirstMessageWaitsForTools, which fails the same way at
origin/main d987cc7d5 (-count=2, "the shim wrote 0 lines of 3 in
30s") and is #4810.
Not tried: Windows 10, and the conpty folder on this machine. Shipping
the pair with magpie so Windows 10 users need no setup is left for a
later change.
2026-11-14 19:46:12 +08:00
yetone 8769a5819a gateway: a rest ends at the time it shows, after the Mac slept (plugins#1126)
A rest's end came from time.Now().Add(d), which carries Go's monotonic
reading, and restOf and Retry-After compared by it. On macOS that clock
stops while the computer sleeps, so a WorkBuddy AI rest to 00:40 still
held at 09:57 the next day: 17h22m past its end, against 17h26m of
sleep in pmset's log over the same span (Xiang-Player's measurements).

onWall drops the monotonic reading. It is applied where magpie keeps a
deadline for minutes to days: the three places a rest's end is set
(restAfterMarked, restSlow, restDrawer), Codex's held refusal, Claude's
quota shelf, a Codex window's reset and a search key's rest. Shorter
waits (a request's patience, ten-minute shuns) are left as they are; a
sleep can only stretch them by their own length.

TestRestsKeepTheWallClock records a rest through the quota and 500
paths, a slow start and a search key, and checks none counts on the
monotonic clock.

Run on mica at this tree: go vet ./internal/gateway (darwin, linux,
windows); go test ./internal/gateway -count=1 -timeout 45m: ok (883s).
Broken by hand: onWall returning t unchanged turns the test red on all
four paths.
Not tried: a real Mac sleeping past a rest; a test can't sleep the
machine.

At the pushed head (rebased on 42cc55701, which adds internal/provider/quota_shown.go): go vet ./internal/gateway ./internal/provider and go test ./internal/gateway -run "Rest|TestOneRequestDoesNotClimbTheBackoff": ok.
2026-11-14 19:44:23 +08:00
yetone 42cc557015 library: an agent's profile id (claude#magpie-desktop) is an agent's id on every route
@AXmake110 on X: on Library > Claude plugins, clicking the chip of a
Claude Code config folder (claude#magpie-desktop) answered
`agent "claude#magpie-desktop": not an agent's id`, so the plugin
couldn't be turned off for it. The page draws a chip for each profile
agent (claude#, hermes#, omp#), and the library already writes skills,
MCP servers and instructions to them (targets.go), but checkAgent took
only name or name@wsl:distro.

checkAgent is the one place an agent id is validated in the library.
It now takes name[#profile][@wsl:distro], the profile a plain file name
like a distro's. That fixes each route through it: plugins/agents
(PluginAgents), an agent's own instructions (SaveInstructions Extra,
setup.go's extras), skills/how (SetSkillHow) and carry.go's import.
The other chip routes (skills, servers, hooks, env, subagents agents)
never called it and already took profile ids. No GUI change.

Run on mica (mote at load ~130):
- TestLibraryTakesAProfilesAgentID (new): with origin/main's
  library.go put back it FAILs at the plugin's off for the profile with
  `agent "claude#magpie-desktop": not an agent's id`; passes with the
  change. It also checks bad ids (claude#, #work, claude#../x,
  claude#a/b, claude#a#b, claude#.x) are still refused.
- gofmt -l internal/library: nothing; go vet ./..., GOOS=linux go vet
  -tags nogui ./..., GOOS=windows go vet ./...: ok.
- go test -tags nogui ./internal/library ./internal/gui -count=1: ok.

Not run: the full go test ./... (mica had another session's gateway
run and GUI suite going), the GUI suite (no GUI file changed), a real
Claude Desktop profile.

Run at base 534b1a334, then rebased onto 1ab2c3984 (tray/usage files only, nothing in internal/library).
2026-11-14 19:41:53 +08:00
yetone 1ab2c39843 tray: the menu bar and panel leave out what Usage's Overview hides (onkashiko on X)
onkashiko on X: a quota hidden in the main window still showed from the
menu bar. 7ea1e6a4b made the tray panel and the TUI leave out Overview-hidden
cards and rows, but two gaps were left:

- The menu bar's cells, its tooltip and Windows' tray figure still showed a
  hidden card and its hidden rows. trayUsageCards now goes through
  trayShown: a cell naming an account takes the card the Overview still
  shows (its balance with its plan hidden), a cell following the account
  in use (`|*`) picks that account among every card as before and is left
  empty while its card is hidden, never moved to another account. Hidden
  rows are left out, a card never left with none. settings.TrayUsages is
  untouched, so the cell comes back with the card.
- POST /api/usage/arrange now wakes the menu bar (onTrayUsage) when
  cardsHidden or windowsHidden is sent, so a hide or unhide reaches it at
  once rather than at the next tick (3 minutes by default).
- The panel hid a card after keyCards had put a key's balance on its plan's
  card, so "Hide its balance from Overview" left the balance on the panel's
  plan card, and a hidden plan took its unhidden balance with it.
  panelPageCut now takes the quotas as read and leaves the hidden out before
  keyCards, as overviewCards does; gone counts a merged card hidden only
  when its plan and balance both are.

The Go hide rule (cardHideKey/usageShown) moved from internal/tui to
internal/provider (ShownQuotas, QuotaCardHidden, QuotaRowsShown,
QuotaHideKey), shared by the TUI and the menu bar. Not changed: Bark's
daily push still warns about a near-limit hidden card (an alert, not a
display). Docs: settings.go comments, docs/subsystems/gui-shell.md.

Run on mica (mote at load 117 on 18 cores), at base ee6352b63:
- go test -count=1 -timeout 45m ./internal/gui ./internal/tui
  ./internal/provider ./internal/settings: all ok.
- go vet of those packages; GOOS=linux go vet -tags nogui and GOOS=windows
  go vet of internal/gui, internal/tui, internal/provider: clean. gofmt -l
  clean.
- GUI (Chromium + WebKit, en/zh/zh-TW/ja/de): panel-hidden-balance (new),
  panel-page-hidden, panel-arrange: 28/28. panel-balance-order,
  usage-rows-hide pass. usage-cards-hide and usage-hidden-way-back are red
  at "de 560" (no sideways scroll), the same 8 on an origin/main
  ee6352b63 copy (#6294, #6295). tray-cell-click "chromium zh/en" is red
  1 run in 3 on origin/main as on this tree (#5215).
Broken by hand: panel-hidden-balance is red on origin/main's assets
(the plan card carries the hidden balance, MiniMax's balance gone);
TestTrayLeavesOutWhatTheOverviewHides is red with trayShown returning
trayPick, TestUsageArrangeWakesTheMenuBar red with the onTrayUsage call
removed.
At the pushed head (rebased on 534b1a334, which adds installdir_windows.go):
GOOS=windows go vet ./internal/gui ./internal/update and go test -run
"TestTray|TestUsageArrange|TestCoreScriptBudget" ./internal/gui: ok.
Not tried: the real menu bar on a Mac or Windows with a real account; no
full go test ./... (a full suite was running on mica).
2026-11-14 19:37:57 +08:00
yetone 534b1a334e lessons: 11-14 two changes pushed before their own suite, at a coordinator's ask
Recorded from the review of 32c830fc1 and 106a24b95. Docs only; nothing run.
2026-11-14 19:29:46 +08:00
yetone 61e2035d39 gui: a Windows start no one can answer is never asked where to install, so the gateway comes up (v0.1.4160-4166 release check)
Every magpie-releases build from v0.1.4160 to v0.1.4169 failed
windows-check (amd64 and arm64) at "Launch magpie": the exe logged
"magpie 0.1.4166 started (app, ...)" and the gateway never answered, so
none of those versions has assets.

Cause: 14807bcf2 made a copy still named as the site's download
(magpie-windows-amd64.exe) a download wherever it is kept, asked about
through the install dialog. The release check starts
dist\magpie-windows-amd64.exe, so update.Settle now put up the task
dialog. The question comes before anything starts in gui.Run, the
gateway included (Install opens the installed copy in this one's place),
and on the runner no one answers it, so the app waited on it forever.

Now askInstallFolder leaves update.AskFolder unset when no one can
answer (unanswerable): CI set, as every CI service sets it (GitHub's
CI=true), or a window station no one sees (a service, a start over
SSH; GetUserObjectInformation UOI_FLAGS without WSF_VISIBLE). Unasked,
a copy kept outside Downloads runs where it is with nothing recorded
(isDownload's existing ask=false rule), and one in Downloads installs
to the default as it did with no dialog. A person's start on their own
desktop is asked as 14807bcf2 has it. The gateway can't start before
the answer instead: Install forwards to the installed copy and this one
quits, so its gateway would have to be handed over first.

Also fixes #6648: TestSettleAsksAboutADownloadKeptElsewhere expected
forwards() true on every OS, but forwarding is Windows' alone (as its
sibling checks at install_test.go:382/452 already say), so it was red
on Linux and macOS since 14807bcf2.

Tests: TestNoInstallQuestionOnCI (Windows: CI=true leaves AskFolder
nil) and TestInstallQuestionNeedsSomeoneToAnswer (any OS).

Run:
- Reproduced on xiaomi-gpu (Windows 11) as the CI step does it: the exe
  built with go-winres's manifest (so the task dialog exists), named
  dist\magpie-windows-amd64.exe, started `app` with CI=true in the
  logged-in console session (session 1, through a schtasks /it task),
  sandbox USERPROFILE/LOCALAPPDATA/APPDATA/TEMP, MAGPIE_ADDR on a port
  of its own, polling /v1/models 30x2s. At ee6352b63: RED, "the gateway
  never answered", nothing after the start line. With this change:
  GREEN, "install: not asking where to install: CI=true", gateway
  answered, still up 5s later, nothing installed.
- Over SSH (session 0) with CI unset: the question is skipped ("no one
  sees this desktop"); the app then exits on WebView2's controller
  there (no desktop), which is that session's, not this change's.
- Broken by hand: askInstallFolder reading another variable ->
  TestNoInstallQuestionOnCI red ("asks where to install with CI=true").
- win-run go test -count=1 -run 'TestNoInstallQuestionOnCI|
  TestInstallQuestionNeedsSomeoneToAnswer|TestInstallWords' -v
  ./internal/gui/: ok.
- wsl-run go test -tags nogui -count=1 ./internal/update/ (magpie-desktop,
  Ubuntu 24.04): ok (#6648's red gone).
- mica-run: gofmt -l internal/ clean; GOOS=windows go vet and GOOS=linux
  go vet -tags nogui ./internal/update/ ./internal/gui/ clean; darwin go
  vet clean.
- win-run go test -count=1 ./internal/update/: ok except
  TestPackagedByDpkg (#4603, open, untouched).
- mica-run go test -count=1 ./internal/update/ (macOS): ok.

Not run before the push: the full suite (mote at load 144) and the
whole ./internal/gui package (running on xiaomi-gpu and mica at push;
the release blocker didn't wait for it). Not tried: a real person's double-click from D:\下载 after this
change (the dialog path itself is unchanged).
2026-11-14 19:28:21 +08:00
yetone ee6352b638 gui: black's dark page is #000000, and a dark colour darkens the page in its hue (CHENGJIAHEGOXIS on X)
CHENGJIAHEGOXIS on X (tweet 2121543612278472704), on the dark theme:
「现在的纯黑……感觉色对不上」 beside Chrome's black, and the darkest navy of
the system's picker 「感觉是有浅灰存在,所以导致深变浅」. Their screenshots:
black's page (2,1,7), Chrome's (0,0,0); navy #191047's page (24,23,29),
card (31,30,36), the grey of Graphite's.

Why (appearance.go ground()):
- the dark grounds went down by the same amount on every channel, so
  app.css's cool grey cast stayed: black's page was #000003, its card
  #08080c, a blue-black next to Chrome's #000000;
- how dark a pick is was its mean channel against the page's. #191047's
  mean (37) is above the page's (27), so a deep navy counted as light
  and only got a breath of hue (0.08): the same grey page as Graphite.

What changes:
- darkness(): a pick's OKLab lightness under 0.4 (Graphite #52525b is
  0.44, every preset 0.51 or more) is how far the dark grounds go
  toward black; 1 for black. #191047 is 0.23, so 0.43.
- as a ground goes down it loses the grey's cool cast by as much, and
  takes more of the pick's hue (0.08 + 0.25 x darkness). Black's page
  is #000000 with neutral steps above it (card #090909); navy's page is
  a near-black navy.
- Graphite, the presets, colours lighter than 0.4 and the light theme
  are unchanged; lifted() (where the ink starts) is unchanged.

Measured (Settings > General zh, dark, 1200px; screenshot pixels, the
same in Chromium and WebKit), before -> after:
- black: page #000003 -> #000000, card #08080c -> #090909
- #191047: page #191821 -> #0c0b17, card #22212a -> #151420
- #130830: page #17161e -> #0b0813, card #201f27 -> #14111c
- Default, Graphite (#1a1a1e / #232327), teal, #7f1d1d: unchanged

Tests:
- TestDarkPickDarkensPage: black's grounds are neutral greys; three
  dark blues draw a darker, blue page with text >= 7:1 and the accent
  >= 4.4:1; Graphite and the presets have darkness 0.
- TestBlackIsBlack: black's page is #000000 exactly.
- appearance-look: black's dark page is rgb(0, 0, 0); #191047 draws a
  dark navy page with Settings' list on its card (dark), and keeps the
  light page's lightness (light). Fixture gains #191047.

Run on mote (load ~22-35 over its 18 cores; mica's disk is full, 116MB
free), at this change on origin/main dbac411b2:
- gofmt -l internal/gui clean; go vet -tags nogui ./internal/gui, the
  same with GOOS=linux, GOOS=windows go vet ./internal/gui: ok.
- go test -tags nogui -count=1 -timeout 45m ./internal/gui: ok (112s).
- Whole GUI suite (node --test internal/gui/tests/*.test.cjs, both
  engines, every language): cut short at 8650 of ~8700 results to push
  (coordinator); 8279 ok, 371 not ok. appearance-look 20/20 here and
  every accent, look and Settings case ok. Reds outside this change
  (accounts, keys, Check in, quick panel shortcut, gateway card, under
  the box's load); api-key-theme (#6444) and omarchy (#6027) are the
  reds named on origin/main by 90ad90646. Not rerun on a base copy.
- Broken by hand: with the old ground(), TestBlackIsBlack and
  TestDarkPickDarkensPage are red (#000003, blue-grey grounds), and
  appearance-look's dark case is red in both engines ("black's page is
  black").

Not tried: the real macOS app, WebView2, WebKitGTK; the full Go suite;
the GUI reds' base comparison.
2026-11-14 19:10:06 +08:00
yetone 106a24b95e library: skills from GitHub and git update by themselves when switched on
0xYaCo on X: "skill 能自动化升级吗?". magpie already checked for skill
updates by itself (every 12h, as the Skills tab opens), but each update
waited for a click on Update. A new switch, Update by themselves, sits
under the Skills list while a skill comes from GitHub or git
(POST /api/library/skills/auto-update; `magpie library skill auto-update
on|off`; library.json's autoUpdateSkills, this computer's own). It is off
by default. When it is on, KeepSkillsCurrent (a gateway.WhileServing loop)
runs AutoUpdateTick 2 minutes after start and then hourly. Every 12h that
runs CheckSkills, then UpdateSomeSkills on the skills found at "update".
So a skill changed here stays in Unupdated with its Update button, one
removed upstream is only marked, and a replaced edited version goes to the
backups, as with an update by hand. Updated names and a new error are
logged.

Run (WSL2 magpie-desktop, Go 1.26.8; mote was at load 167, mica's disk full),
at ab637d3c4 (this change on 14807bcf2):
- TestAutoUpdateSkills (local git repo fixture, no network) ok.
  Broken by hand (switch and due checks removed): FAIL
  "off: ... Updated:[pdf] ... notes "two"". Restored: ok.
- -race -count=5 TestAutoUpdateSkills|TestInstallFromGitRepo: ok
- gofmt -l: clean; go vet -tags nogui ./... ok; GOOS=windows go vet ./...
  ok; go build -tags nogui, GOOS=windows go build ok
- go test -tags nogui -timeout 45m ./... under a temp HOME: every
  package ok except two reds in untouched packages, each also red alone
  at origin/main 659ca3f02: internal/update
  TestSettleAsksAboutADownloadKeptElsewhere (filed #6648) and
  internal/usage TestRequestStateKeptAcrossACatalogFetchedAgain (#6572).
- GUI: skill-auto-update.test.cjs (en, zh, zh-TW, ja, de; 400px wide;
  Chromium and WebKit), i18n-keys, i18n-en-no-cjk, skill-update-feedback
  and skill-update-edited: 36/36 pass.
Not run: the whole GUI suite had started but not finished at push
(pushed at the coordinator's ask), and nothing was run at the rebased head
e0e8f34a7 (its parents touch lessons/update only). No darwin vet: the
cgo-off cross vet fails in gui's traywindows_darwin_test.go on main too.
Not tried with a real GitHub skill in a live magpie.
2026-11-14 19:09:55 +08:00
yetone 32c830fc16 tui: speaks the language picked in Settings, Simplified Chinese first
zaidu259434 on X asked why magpie's CLI/TUI pages don't support Chinese.
The GUI had en/zh/zh-TW/ja/de; the TUI had English only.

- internal/uilang: the language pick the tray already made (the
  setting, else the system's: zh-Hant regions to zh-TW, other zh to zh,
  ja, de) moved out of internal/gui so the TUI asks the same function.
  The tray calls it unchanged; its tests moved with it.
- internal/tui/i18n.go: tr/trf look a string up by its English text in
  a zh table (464 entries), falling back to the English. zh-TW reads
  Simplified for now; ja and de stay English. Terms come from the GUI's
  i18n.js where the same word is there (供应商, 路由, 用量, 会话, 资源库,
  分组, 方案 …).
- Every user-visible string in the TUI goes through tr/trf; widths that
  counted runes (Library's name column, sessions' columns) use
  lipgloss.Width, so 共享指令 is no longer cut to 共….
- Names stay names: agent and model ids, flags, commands, and the field
  labels magpie/ultracode/harness/opus/sonnet/haiku/fable.

TestEveryWordHasZh reads the TUI's source (every tr/trf literal, every
hints label, the tables shown through tr, agent field labels) and fails
on a word with no zh, on a zh format that takes the English one's
arguments badly, and on a zh entry no longer shown.

Not changed: the CLI's own output is still English (#6649).

Run:
- mica (macOS): go vet ./internal/uilang ./internal/gui ./internal/tui;
  go test -count=1 -timeout 45m ./... was still running when this
  was pushed (pushed on the coordinator's ask); its result goes on #6649.
- wsl-run (Linux): go vet + go test ./internal/tui ./internal/uilang ok;
  GOOS=windows go vet ./internal/uilang ./internal/gui ./internal/tui ok;
  GOOS=darwin CGO_ENABLED=0 go vet ./internal/uilang ./internal/tui ok.
- Real TUI (go build -tags nogui) in WSL magpie-desktop, sandbox HOME
  with settings.json {"lang":"zh"}, tmux 150x40: every page (Agents,
  Providers, Routing, Usage, Sessions, Library), the add-provider
  picker, sessions stats, the gateway line and footers read in Chinese.
  The Library row showed 共… before the lipgloss.Width fix, 共享指令 after.
- Broken by hand: an added tr("zzz untranslated") and a zh format with
  its %s dropped each turned TestEveryWordHasZh red.

Not tried: zh-TW, ja and de wording (they fall back as above); the TUI
on Windows' console.
2026-11-14 19:09:43 +08:00
yetone 21f8ef61c4 provider: a complete Qwen AI platform sign-in is taken, and no sign-in error quotes a token (@imthe99galaxy on X)
On v0.1.4159 the Qwen AI platform's sign-in (qwen-token-plan) was
approved, and magpie failed it with "the Qwen AI platform answered in a
form magpie doesn't know: {"Data":{"Status":"complete","Credentials":
{"User":{"Id":"…"},"ExpireTime":"…","AccessToken":"RACv…"…". Two bugs:

1. qianwenWait decoded the device/token reply into a struct.
   encoding/json matches a name whatever its case and fails the whole
   reply on a value of another type (a number Id, an accessToken or user
   field beside AccessToken/User, a BOM), where the QianWen CLI 1.10.0
   (ul and ll in @qianwenai/qianwen-cli's dist/bin/qianwen.js, read from
   the npm tarball) looks up the names it wants and ignores the rest.
   readQianwenReply now reads it as the CLI does: Data.Status ?? status
   ?? authorization_pending; Data.Credentials.AccessToken ??
   credentials.access_token; ExpireTime ?? expire_time; User{Id, Email}
   ?? user{id, email}; by exact name, a value of a type it doesn't expect
   taken as absent. A RefreshToken is ignored, present or not: the CLI
   has no refresh, the user signs in again when the token runs out.
   The reporter's reply was quoted only to its first 300 characters, so
   which field failed it is not known; every type and case mismatch
   that could is covered, and the CLI's other (lowercase) form is read.

2. The error quoted the reply, live access token included, and the user
   posted it publicly. QuotedReply (quoted_reply.go) scrubs a reply
   before it is quoted (redact.ScrubJSON: a field named for a secret
   wholly, a key-shaped value anywhere). The class:
   - volcHead, every Volcengine / Alibaba Cloud / Tencent Cloud / Qwen
     AI platform error that quotes a reply, the Qwen sign-in's and its
     console token mint's ("gave no token") among them;
   - apiError's fallback for a body of no known shape (APIError, every
     upstream refusal and token endpoint that uses it);
   - Copilot Auto's "picked no model" (its reply carries session_token);
   - mcpauth's dynamic client registration failure (may carry a
     client_secret; it was quoted whole and unbounded, now cut at 300);
   - signInFlow.finish, where every built-in and plugin sign-in ends:
     its Error goes through redact.Scrub, so a plugin's or vendor's
     error text quoting a token leaves it there; the Qwen flow's own
     failure likewise.

Tests (internal/provider/qianwen_plan_test.go):
- TestQianwenSignInReadsEveryCompleteForm: the reporter's head with and
  without a RefreshToken, a number Id/ExpireTime, a like-named field of
  another type, the CLI's lowercase form, a BOM. Red on the old code
  (3 forms failed with the reporter's message, the lowercase one never
  ended), green now.
- TestQianwenErrorsQuoteNoToken: unreadable replies' errors, volcHead,
  APIError and QuotedReply never hold the token, and still say the
  words of a plain error (Throttling, RequestId). Red on the old code
  (sign-in errors and 8 quotes held it).
- TestSignInFailureQuotesNoToken: finish's Error. Red with the Scrub
  line taken out by hand, green with it.

Run:
- on magpie-desktop (WSL, mote's load was over 40 to 135) at this tree:
  gofmt -l clean; go vet -tags nogui and GOOS=windows go vet on
  internal/provider and internal/mcpauth ok;
  go test -run 'Qianwen|SignInFailure|SignIn|APIError|Volc|Alibaba|
  Tencent|CopilotAuto' ./internal/provider ./internal/mcpauth: ok.
- Full go test -tags nogui -timeout 45m ./... was started there at this
  tree and was still running at push (pushed on the coordinator's ask);
  its result goes in a follow-up note.

Not tried: a real sign-in to the Qwen AI platform. The owner's browser
has no platform session (it asks for a phone sign-in), so the complete
reply's tail past the reporter's 300 characters was not seen; a live
device/code + device/token poll answered as the fake does
({"Data":{"Status":"authorization_pending"},"RequestId":…,"Success":true}).
darwin go vet: mote's load was over 100 for the whole run; the files
have no darwin-only code, and linux and windows vet are ok.
2026-11-14 19:09:35 +08:00
yetone 7a69f455cb lessons: 11-14 the updater shipped on chosen packages while both run boxes were busy 2026-11-14 18:56:57 +08:00
yetone 39e33f46f7 provider: ZCode's mover min is 0.1.66, which keeps a gift-only account's requests on its free quota (bg5eau on X)
bg5eau saw ZCode's free grant stay unspent while pay-as-you-go was
charged. Two routes in the plugin could do that for an account with no
GLM Coding Plan: a model the Start Plan balance doesn't name was still
sent on the Start Plan, where it is metered, and a plan-list read that
failed sent the key to the coding plan's /api/anthropic host, which bills
a key with no plan pay-as-you-go. 0.1.66 (plugins 87a8cf03) refuses the
first with a 400 that names the models the gift serves, and keeps such
an account on the Start Plan when the plan list doesn't read. It also
carries 0.1.65 (plugins 1dbbc1fb): a -Trial pick with no gift names the
weekend plan ZCode holds unclaimed, which only ZCode's app can claim
behind its captcha (heduian, bg5eau on X). The min makes
keepMovedCurrent update every moved user.

Run: npm view --prefer-online shows 0.1.66; on mote (load ~150; mica's
disk is full), go test -tags nogui -run 'Moved|Mover|Migrat|ZCode'
./internal/provider ok; gofmt clean. Plugin at 87a8cf03: packages/zcode
bun test 271 pass, 0 fail; bun scripts/check.mjs zcode ok; the
unnamed-model test red with the guard off, the stays-on-Start-Plan test
red with the catch change off.
Not tried: a real gift-only account, a real pay-as-you-go charge, a real
weekend plan claim, Windows and Linux, a full go test ./... before the
tag. Which of the two routes bg5eau hit is unknown (no request log).
2026-11-14 18:55:44 +08:00
yetone ed82d8fab1 agent: a plugin's connect is given magpie's decision models as decisionModels
An agent plugin's connect() got only chat models in `models`, and
/v1/models leaves decision models out too, so a plugin had no way to
learn magpie's Jev, Clef or plugin `decides` models, though
/v1/systemone and /v1/decisions answer them (baranwang on X,
tweet 2121551068022915149).

connect's input now has `decisionModels`, apart from `models`:
provider.OfferedDeciders (what /v1/models lists under
X-Magpie-Deciders), then the decision routing groups, each
{ id, name, provider | group: true,
  endpoints: ["/v1/systemone", "/v1/decisions"] }, [] for none.
`models` and /v1/models are unchanged. Docs: reference.md,
agent-wiring.md, site plugins page (en, zh, ja) and llms-full.txt.

Run at 87f358b70's tree rebased on 659ca3f02 (a gateway-only parent; the
plugged tests re-run there: ok), on wsl-run, magpie-desktop; mote was at load 75-150, mica's disk full):
- go test -tags nogui -count=1 ./internal/agent ./internal/agentplug: ok
  (agent 191s)
- go vet (linux), GOOS=windows and GOOS=darwin go vet of both: ok
- site: node --test worker.test.mjs -n llms-full: ok
- gofmt -l: clean
Broken by hand: connect given decisionModels [] makes
TestPluggedConnectSeesDecisionModels red (jev and the group missing).
Not run: the full go test ./... before the tag (another session's full
suite held the WSL box, mote over its load); run after, recorded on
the issue/next commit. No real third-party agent plugin tried with it.
2026-11-14 18:55:12 +08:00
yetone 659ca3f026 gateway: through a Remote magpie the log records the tier the other magpie sent (JackyFill on X)
Codex -> magpie1 -> (Remote magpie) -> magpie2 -> a ChatGPT account, with
Fast on in magpie2 alone: magpie2 sent service_tier priority and logged
the served tier unknown (the ChatGPT backend says "auto"/"default"
whether priority ran or not, servedTierAt). magpie1 only saw that
"default" in the relayed body, from a host that isn't chatgpt.com, and
logged tier_sent "" and tier_served "default".

A try asked by another magpie (magpieAsks) now says on its reply's
header the tier it sent its vendor (X-Magpie-Tier-Sent, "none" for
none) and, when that vendor's "auto"/"default" tell nothing,
X-Magpie-Tier-Unsaid: 1 (stampTier, from holdWriter.writeHeader). The
asking magpie takes them from a Remote magpie's reply alone (tierThere
in heardReply; a vendor's X-Magpie- headers are still never passed) and
records them as the try's tier_sent and an unknown tier_served, in the
usage log and on the route. A chain passes the farthest magpie's on.
docs/subsystems/gateway-routing.md says so.

Run (wsl-run, Linux, at this head): new TestRemoteMagpieTierRecorded
(one server as both magpies, its key's tier fast then standard, the
backend answering auto/default) green; broken by hand: with the four
source files at origin/main it fails with exactly the report, "sent ''
served 'default', want sent 'priority'"; the whole internal/gateway package ok (932s, -timeout 45m) at
5a28b17c6 (on origin/main 943404477); go vet ./internal/gateway for
linux, windows and darwin clean; gofmt clean.
Rebased after onto 9f4e1120f (agent, provider, gui only; no internal/gateway
file) and run again there: the new test, the tier and remote-group tests
and vet of internal/gateway ok.

Not covered: a reply whose headers a keepalive sent before the try
answered carries neither header, and magpie1 keeps its own record.
Not tried: two real computers or a real ChatGPT account; the full
./... suite; the Windows box.
2026-11-14 18:47:33 +08:00
yetone 9f4e1120f3 agent: a Codex not connected is never pointed at magpie for account failover
TylerBai_loveai on X (tweet 2121532671180632290): with several ChatGPT
accounts added in magpie and Codex not connected, Codex's requests went
through magpie anyway; only adding Codex in Agents, then Disconnect,
put it back.

Cause: Sync's `failover` in codex.go wrote
`openai_base_url = "http://127.0.0.1:3425/backend-api/codex"` (stash
codex.failover), or pointed a CC Switch OpenAI mirror's base_url at the
gateway (codex.mirror_failover), for any Codex signed in to ChatGPT with
another of its accounts on (#1385), on every start and Sync, unless the
user had disconnected Codex or turned on "Only switch Codex's sign-in".
The row said not connected while every request went through magpie.

Fix: failover writes nothing any more. A Codex that isn't wired or
using magpie as its provider gets what failover wrote before taken out
by Sync: the marked base URL, or the mirror's base_url. A base URL the
user wrote by hand has no mark and stays (#856). Failover between Codex
accounts comes with connecting Codex. modelOptions no longer counts
failover as through magpie, so a pick of Codex's own model on the
Agents page doesn't go via magpie. codexProxyOK (the proxy probe only
failover waited for) is gone. The CLI's and GUI's switch-only lines,
reference.md and the subsystem pages say failover is for a connected
Codex.

Users already affected: the first Sync after updating (magpie's start)
removes the marked openai_base_url or mirror base_url, and the route
change restarts Codex's app-server; Codex then goes straight to OpenAI
on its own sign-in. A thread opened while it was on magpie keeps its
provider until reopened, as after Disconnect.

Tests:
- TestCodexNotConnectedStaysOffMagpie: two spare accounts on, Codex
  not connected; SyncCatalog, Sync twice and a model pick leave no
  base URL, no model_provider, not Wired/FailingOver/CodexOwnOnly.
- TestCodexFailoverFromBeforeTakenOut: a marked base URL and a marked
  mirror base_url from before are taken out, bytes restored exactly.
- TestCodexSwitchOnlyKeepsCodexOffTheGateway, the CC Switch mirror,
  disconnect-stays and proxy/EndFailover tests reworked to seed the
  old state by hand; TestCodexFailoverHeldWhileProxyDoesNotPassOn
  deleted with codexProxyOK.

Red on the old code (old codex.go + codex_proxy.go, new tests, mote):
TestCodexNotConnectedStaysOffMagpie, TestCodexFailoverFromBeforeTakenOut
and TestCodexSwitchOnlyKeepsCodexOffTheGateway fail with the reporter's
line `openai_base_url = "http://127.0.0.1:3425/backend-api/codex"`;
TestCodexCCSwitchOfficialOpenAIMirror fails with the mirror pointed at
magpie.

Run (mote; mica's disk is full, 100% with other sessions' runs, and
mote's load was ~17-25 of 18):
- At base b592c1fde: go vet ./... (darwin, GOOS=linux, GOOS=windows)
  ok; go test -timeout 45m ./... 98 ok, two reds:
  TestEveryRouteHasACommandOrIsNamed (fixed on main by 69946f43c) and
  TestCoreScriptBudget, mine (+24 bytes) - the GUI string was shortened
  to fit, no raise.
- Rebased on a63923e3d (what main changed since the base: agent, cli,
  gateway, gui, provider, sessions): gofmt -l clean; go test
  ./internal/agent ./internal/cli ./internal/gui ./internal/provider
  ./internal/sessions all ok. Then rebased on 943404477 (GUI tests
  only below run there).
- GUI (chromium + webkit, every language, both widths): switch-only,
  agent-failover, i18n-keys, i18n-en-no-cjk, claude-switch-only,
  panel-switch-accounts: 115 of 116; the red is claude-switch-only
  chromium 1100 en "the page doesn't move" (scrollTop 3), 4 of 12
  alone here, 0 of 9 on origin/main 943404477, on a path this change
  doesn't touch; filed as #6645 with its output. agent-switch-accounts is 20 of 24
  red the same on a fresh origin/main 69946f43c (#5925, Claude Code
  path, untouched here).

Not tried: a real Codex with real ChatGPT accounts across the update
(sandbox HOME tests only), Codex in WSL, Windows.
2026-11-14 18:40:09 +08:00
yetone fc7941ca60 antigravity: Gemini 4's late INVALID_ARGUMENT is asked again, and says it isn't a region block; min 0.1.14 (Lawson0112 on X)
Lawson0112 (v0.1.4152, Windows, Codex) saw every request to
antigravity/gemini-4-hydrogen end "400 · failed, 2 tries" after 20-38s
and asked whether it was a region block. It isn't: Google refuses a
region at once with FAILED_PRECONDITION "User location is not
supported..." (regionWords). A 400 after the model has thought is Gemini
4's late INVALID_ARGUMENT, which Code Assist writes as a bare JSON line
with no "data:" (sse_bare.go). The plugin's quiet retry read only data
lines, so it never ran for the real reply.

Antigravity 0.1.14 (plugins 2596d259) reads the bare line, asks again
as it meant to, and words an INVALID_ARGUMENT that stays as "<model>
turned down a call it built while thinking, asked N times (Google: ...).
Not a region or account refusal". The mover's min goes to 0.1.14 so
every moved user gets it (dist index: 0.1.14 latest, 10:34:14Z).

Run: go test ./internal/provider in WSL (magpie-desktop) at this tree:
ok 125s. gofmt -l clean. mote was at load 150-180 and mica's disk full.
Not tried: Gemini 4 itself; no account here is served it (gemini-4-*
listed -disabled, 404). See the plugins commit for the rest.
2026-11-14 18:34:44 +08:00
yetone 9434044773 update: Restart to update puts in the version already downloaded, with downloads on a click too
sakamotokurome on X: "重启能不能跟更新分开,我本来下载一个新版本了,点击restart,
结果它又跑去下载了". With Settings' "Download updates automatically" off, a
version downloaded on a click (Download update) was not what Restart to
update put in: the click's recheck asked the feed first and, magpie having
released again since, downloaded the newer version whole while the user
waited (keepsStaged kept the one waiting only with downloads automatic,
b05a525a3, or for 5 minutes after a restart's own download, elis_pina).
The same held for the tray's Restart to Update and a click's restart that
waited for the gateway to be idle. It is the same code on macOS, Windows
and Linux (internal/gui/update.go); only the install step differs by OS.

Now a version downloaded and waiting is what every restart goes into, as
it is, however it was downloaded, and the feed isn't asked: keepsStaged is
"ready with something staged". The new version's first check, seconds
after it starts, finds whatever is newer, as with downloads automatic.
The feed is still asked first when nothing is staged (another magpie put
the update in), and a click on Download update (state found) still checks
and downloads the newest, so coeo91's "the click takes the newest, not the
last check's" holds for the download; it no longer replaces a download
already made. The notes dialog's freshen keeps the one waiting in both
modes, so it names the version the restart goes into. restartStaged and
forRestart are gone with the 5-minute rule they served.

Tests (internal/gui, fake feed, sandbox HOME, no network):
- new TestRestartPutsInTheClickedDownload: the reporter's sequence (downloads
  on a click, Download update, 0.1.12 released, Restart): the page's click,
  the tray's, a click's idle wait and the dialog all go into 0.1.11, one
  download, the feed not asked. Red on origin/main dbac411b2: "the page's
  click: {State:ready ... Latest:0.1.12}".
- changed to the new rule: TestRestartClickTakesTheNewest (now the found ->
  Download click takes the newest, then Restart downloads nothing),
  TestRestartWaitsForTheFeed (nothing staged), TestRestartAfterItsDownload
  DoesNotAskAgain (no restart asks), TestUpdateStagedGivesWayToNewer (a
  restart's recheck keeps it; Settings' Check takes the newer),
  TestRestartWhenIdleIntoTheNewest -> TestRestartWhenIdleIntoTheWaiting.
  TestTrayRestartTakesTheNewest is removed: its case is the opposite of
  this fix, and the tray is covered by the new test.

Run at this tree:
- mote (macOS 27): go test ./internal/gui -count=1 (whole package) ok at
  this commit rebased on a63923e3d; the update tests -count=3 ok; go vet ./internal/gui,
  GOOS=linux go vet -tags nogui ./internal/gui, GOOS=windows go vet
  ./internal/gui ok; gofmt -l internal/gui empty.
- xiaomi-gpu (Windows 11, win-run) and magpie-desktop (WSL Ubuntu, wsl-run,
  -tags nogui): the update/restart tests ok.

Not run: the full go test ./... suite (mote was at load 142 with another
session's suite running, mica's disk full). Not tried: a real restart of a
real build into a downloaded update; the restart path after keepsStaged is
unchanged.
2026-11-14 18:23:16 +08:00
yetone 14807bcf20 update: a Windows download kept outside Downloads asks to install too
@XBJNTMs2mDbsvPH on X: on Windows magpie ran from wherever the
downloaded exe was and updated itself in place there, so deleting the
download deleted magpie, and opening copies of different versions left
several Magpie entries in the Start menu.

Cause: update.Settle installed the exe into %LOCALAPPDATA%\Programs\magpie
only when it ran from the known Downloads or Desktop folder or a temp
folder. A browser set to save elsewhere (D:\下载), or a download moved
into a folder of the user's own, never counted, so that copy stayed the
app, updated in place, and each copy opened was an app of its own to
Windows (its own path: taskbar, Start's lists, Open at login,
Magpie.lnk repointed at whichever ran last).

Now an exe still named as the site's download
(magpie-windows-amd64.exe, "… (1).exe", arm64; downloadName) counts as a
download wherever it is, but only through the existing install dialog,
never unasked (no dialog, no install). Installed, it opens the installed
copy as a download in Downloads does, and a newer one replaces it.
Cancel on such a copy is kept in HKCU\Software\magpie NotInstalled (the
exe's path): it runs where it is from then on, is not asked again and
never forwards; another copy is still asked. Cancel in Downloads is not
recorded, as before. forwards() (no magpie.com beside a forwarding
copy) follows the same rule. Uninstall's ForgetInstallDir takes the new
value out with InstallLocation. A renamed copy (D:\Tools\magpie.exe)
is left alone as before. No new UI: the dialog is the one from 49c9491b7.

The shortcut code itself makes only one Magpie.lnk and repoints it; it
was not changed.

Tests: TestSettleAsksAboutADownloadKeptElsewhere and
TestSettleDeclinedElsewhereIsKept (fakes, any OS), TestDeclinedRecord
(real HKCU, a key of its own, Windows). TestSettleLeavesAChosenPlace now
uses a renamed copy and checks nothing is asked.

Run:
- win-run (xiaomi-gpu, Windows 11) go test -count=1 ./internal/update/
  ./internal/uninstall/ ./internal/shortcut/ ./internal/gui/: update,
  uninstall, shortcut ok except TestPackagedByDpkg (#4603, untouched);
  gui red TestGatewayHeldByAContainer and TestLodyImportHandoff (#6068,
  untouched).
- win-run go test -run 'TestSettle|TestDeclinedRecord|TestForward|
  TestNoCompanion|TestInstall' -v ./internal/update/: ok.
- Broken by hand on Windows: the name check off -> both new tests red
  (settle = "" want the installed; declined ""); the decline record
  ignored -> TestSettleDeclinedElsewhereIsKept red ("asked again").
- win-run go vet ./internal/update/ ./internal/uninstall/ ./internal/gui/
  and wsl-run go vet -tags nogui ./internal/update/ ./internal/uninstall/
  (magpie-desktop, covers install_other.go): clean. gofmt -l clean.
- win-run go test -count=1 . (TestAllLazyPatternsCompile and the other
  root guards, the new pattern included): ok.

Not run: the full suite and a darwin vet (mote at load 126-142, mica's
disk full). Not tried: the real app's dialog on an interactive Windows
desktop from a non-Downloads folder (the box's HKCU\Software\magpie and
Start menu are shared with other sessions' magpie there), and the
reporter's duplicate Start entries were not reproduced; which list
showed them is not known.
2026-11-14 18:20:53 +08:00
yetone a63923e3dd lessons: 11-14 a third guard left red by chosen packages (80a315a70, route parity) 2026-11-14 18:11:31 +08:00
yetone dbac411b2e gui: TestRestartedWindowIsDrawn puts the other app in front as the user would
The behind and cover cases start a WinForms window as "the app the user
is in" and wait 20 s for it to hold the foreground. Windows lets it take
the front only while the test's old magpie may give it away, and that
depends on what held the foreground before it: run alone on the Windows
box at d987cc7d5, quiet-behind failed with "old: the other app never
came to the front" after the asked case's window had the front, and in
a whole-package run three other behind/cover cases did. The restart
under test never ran in them.

Now, from a second on, the old process presses F15 (a key nothing
answers) and brings the form to the front, as the user's own press and
click would; input this process sent is what lets it give the
foreground away.

Run on the Windows box, interactive session: the whole test (13 cases)
at d987cc7d5 with this change, 13 of 13 green (1 red without it); at
this tree with the no-attention change below it, 13 of 13 green, twice (4 red
without it: quiet-behind, quiet-behind-max, quiet-cover,
quiet-cover-max, all at the same setup step).
2026-11-14 18:02:33 +08:00
yetone ffb14c8260 gui: a restart by itself asks Windows for no attention (shangyuan0818 on X)
shangyuan0818 on X (Windows, AutoRestart and auto-update on, lightweight
mode off): magpie's window turned up on the taskbar by itself, its
button flashing orange, while they were in another app.

The cause: Wails (v3.0.0-beta.24) activates every window as it makes
it, hidden ones too. The panel's frame change (Frameless, run() in
webview_window_windows.go) and the main window's centring
(CenterWindow) are SetWindowPos calls without SWP_NOACTIVATE. The new
magpie a restart by itself starts runs in the background and may not
take the foreground, and Windows answers that ask by flashing the
window's taskbar button (HSHELL_FLASH) until it is clicked. Where it
may (nobody at the keyboard for a while), a hidden magpie window took
the keyboard from the app in front instead. The main window was then
shown with SW_SHOW, which activates it again, and a minimised one with
SetWindowPlacement(SW_SHOWMINNOACTIVE), which activates it all the
same.

Now a WH_CBT hook on Wails' main thread (noactivate_windows.go, put on
from appWndProc, which every WailsWebviewWindow message passes) turns
down HCBT_ACTIVATE for a magpie window that isn't shown, and for one
being shown quietly: showHere without focus (showQuietly) and
showMinimised. The tray's message-only window and Wails' disabled
main-thread window share the class and are left alone. A window the
user opens is shown and focused as before. Adding SWP_NOACTIVATE to the
moves' WINDOWPOS in WM_WINDOWPOSCHANGING doesn't stop the activation
(tried on the box).

TestRestartBySelfAsksNoAttention (new) plays the restart in a child
process, window and tray modes, another window in front: it records
the shell hook's notes for magpie's windows and the foreground, needs
none of either, the page drawn and visible, then that a user's
ShowMain brings the window to the front.
TestRestartMinimisedComesBackMinimised now makes its app with
windowsOptions(), as the real app does; without them its window kept
the foreground it took at creation and it was red on main and on this
change alike.

Run, on the Windows box (xiaomi-gpu, Windows 11, interactive session):
- TestRestartBySelfAsksNoAttention: red on the old code, green both
  modes with this change, green again at the pushed tree.
- TestRestartMinimisedComesBackMinimised: red on the old code ("the
  window minimised took the foreground"), green with this change,
  restore and draw included.
- TestRestartedWindowIsDrawn (13 cases, the behind/cover cases shown
  quietly under another app): 13 of 13 at the pushed tree, with the
  setup fix in the commit after this one.
- The whole internal/gui package, old code and this change, compared:
  the same reds both sides apart from the two tests above (plugin-page,
  import-row, container and client-cert tests red on the box on main
  as well) and TestRestartedWindowIsDrawn's setup flake, fixed after.
- Broken by hand: the hook not put on, red (window 0x4 activation,
  tray took the foreground); showingQuietly never set, red (window:
  0x4).
Full suite on mica at 31a08ce8c (this change on 8334f1e6e), -timeout
45m: every package ok, internal/gui included, but internal/cli
(TestEveryRouteHasACommandOrIsNamed: 80a315a70's /api/page-away, since
named on main in 69946f43c; internal/cli green with that line) and internal/gateway, whose reds
are mica's disk filling up ("no space left on device", 2261 lines);
gateway doesn't import internal/gui, and it is ok at the pushed tree in
WSL (Ubuntu 24.04, 868s; mote was busy with another suite). go vet ./... (darwin) ok; Windows
vet and test compile on mote, Linux nogui vet on mote and gtk3 vet in
WSL ok at the pushed tree; gofmt clean.

Not tried: the grey, blank window they also saw was not reproduced; the
page was drawn on every activation tried. Linux (gtk_window_present
asks for focus the same way) is #6634. macOS needs no change:
makeKeyAndOrderFront doesn't activate a background app, and
requestUserAttention is called only by Flash, which magpie doesn't use;
not tried on a real Mac.
2026-11-14 18:02:33 +08:00
yetone a71aa25d22 routing: a session's Avg. speed says the wait for the first token is left out, and gives the speed with it counted
@verymoes on X (tweet 2121533934332985393): an opencode session over
the Command Code plugin read "平均速率 142 token/秒" on Routing's
By session row, while CC Switch read ≈77 tok/s for the same 26-27
requests and opencode's footer 76.7 tok/s, and asked whether magpie
counts wrong.

It doesn't; the three divide by different times. magpie's average is
Σ answer tokens over Σ (end − first token) of the timed replies
(decodeOf; for a reply that reasoned, its answer from its first text),
so the wait for the first token is left out. CC Switch's "≈" is its
estimate from the session log's timestamps, which it documents as
counting the wait for the first token (src/components/usage/format.ts,
docs/user-manual 4.4). opencode's footer is one turn, not the session,
and counted from the request until #63321 (11-11) moved it to the first
streamed token, with reasoning tokens added in. With a ~28K-token
prompt each and short agent replies, the wait is about half of a
request's time, which is the gap. Nothing in the measurement is wrong,
so it isn't changed; the tooltip now says what it measures:

- "the time from each reply's first token to its end; the wait for the
  first token, and replies without usable timing, are left out" in
  place of "total decode time; excludes waiting";
- a line with the same timed replies over their whole time, the wait
  and the reasoning counted ("Over each request's whole time ...:
  N tok/s"), the number a tool that times the whole request reads.
In zh, zh-TW, ja and de. The Usage page's speeds and a row's own speed
already say "from its first token to its end".

routing-request-metrics checks the tooltip's wording and its whole-time
number (4,000 tokens over 82 s, 49 tok/s, beside the 133 average) in
en and zh, both engines.

Run on mica at this tree (mote was over its 18 cores):
- node --test, Chromium then WebKit: routing-request-metrics,
  reasoning-speed, routing-burst-speed, routing-speed-first,
  routing-row-floor-speed, routing-sessions, routing-by-key,
  routing-session-title, i18n-keys, gui-ja, gui-de, gui-zh-tw.
  Chromium 191/191; WebKit 101/102, the one red reasoning-speed's
  cut-off fetch (#1350), fixed in the commit before this.
- Broken by hand: the test against the old client.js and i18n.js is red
  in all four (chromium/webkit × en/zh) at "the tooltip says the wait
  for the first token is left out".
No Go code changed. Not tried with the reporter's data: their session
isn't on this machine, and the owner's Command Code account answers
401.
2026-11-14 18:01:16 +08:00
yetone ee4a4c7432 gui tests: reasoning-speed leaves WebKit's cut-off fetch out of its page errors (#1350)
The test goes from Routing to Usage, and WebKit reports the Routing
page's /api/gateway/session-titles fetch that the goto cuts off as a
page error ("... due to access control checks"), though the page
catches it. webkit zh-TW and zh went red that way in 2 of 7 runs on
mica. The filter is the one builtin-places, checkin-account and
checkin-at already use for #1350.

Run on mica: BROWSER=webkit node --test reasoning-speed 4 times, and
both engines once after it (results in the next commit's record).
2026-11-14 18:01:16 +08:00
yetone 683265e867 gateway: spawn_agent names every model in Codex 0.169's Lite and catalog requests
@m0eaki on X (Codex 0.169): spawn_agent listed only Codex's first five
models, though a remote magpie's model could be spawned by its full slug.
In Codex 0.169 a lead on one of OpenAI's own models (the Codex App's
default) sends Lite requests (use_responses_lite), with no top-level
tools: in multi-agent V2 spawn_agent sits in an additional_tools input
item, and with features.model_catalog_in_context the models are in a
<model_catalog> developer message, spawn_agent pointing there. magpie
widened only tools and tool_search_output, so neither was reached.

spawnAgentModels now widens additional_tools like a tool_search_output,
and adds the rest of the catalog to a <model_catalog> listing ahead of
its closing tag, under the same neutral spawnMore line (no magpie, Codex
or count named). The listing is found escaped too (<model_catalog>):
on CodexPath a followed or moved subagent's body goes through withModel,
whose encoder escapes angle brackets, before spawnAgentModels sees it.

Fixtures are real Codex 0.169.0 captures (second request of a turn, sandbox
CODEX_HOME, gpt-5.6-luna): V2 Lite, model_catalog_in_context, Lite with a
tool search, and a plain tool search. TestSpawnAgentNamesEveryModelInCodex0169
posts each at CodexPath with a lead on OpenAI's model, and calls
spawnAgentModels with a lead on magpie's at CodexPath and /v1, the body as
Codex wrote it and as withModel writes it again.

Sibling left alone, filed: #6639 (a Lite request reshaped for a provider
that takes neither Lite's items nor a tool search drops the tools its lead
searched for).

Run:
- Old codex_spawn_models.go: V2 and model_catalog red on all 5 routes
  each (10 subtests); the two tool-search shapes passed before too.
- Broken by hand: hasSpawnCatalog matching only the raw form: the three
  escaped-body model_catalog subtests go red. Restored, green.
- gofmt -l clean. go vet ./internal/gateway and GOOS=windows go vet ./internal/gateway (./... needs Wails' cgo, which the VM lacks), and
  go test ./internal/gateway -count=1 -timeout 45m: vet clean, gateway ok (861s), at base d987cc7d5. Rebased on 69946f43c (gateway: masked_checked_test.go, native.go changed); there vet and -run "Spawn|Codex" ok (187s)
- Ran in the Linux VM (wsl-run): mote was at load 25-27 on 18 cores and
  mica's disk was full (595MB free, 64G shared Go cache), so no full
  ./... suite was run on a Mac. Not tried: a real Codex App session.
2026-11-14 18:00:13 +08:00
yetone 69946f43c4 cli: POST /api/page-away is named as the window's own, so the route parity test is green
80a315a70 added POST /api/page-away, the page saying it went from view
so its Sessions and Usage caches can go. It has no CLI meaning, and
TestEveryRouteHasACommandOrIsNamed was red on main for it. It is now
in notYet as a window route.

Run: go test -run TestEveryRouteHasACommandOrIsNamed ./internal/cli on
mote at origin/main 75f872ef1: red before, ok after.
2026-11-14 17:48:48 +08:00
yetone 81825ed81d agent: fx gets each model's reasoning levels through magpie (@beillusyn on X)
fx through magpie had no effort to pick: magpie wrote its models into
fx's settings without levels, so fx sent no reasoning_effort and every
model ran at its vendor's default.

fx 0.0.17 reads a model's reasoning_efforts in model_metadata (level
name to request fields, listed in /effort and Ctrl+T). magpie now writes
each model's catalog levels there, weakest first, each asked as
{"reasoning_effort": <level>}. Levels fx refuses are left out: auto,
adaptive, default (its word for "none picked"), names outside
[A-Za-z0-9._-]{1,64}, duplicates, and past 16 a model. With no level
picked fx sends none and the vendor's default applies, as before.

fx 0.0.16 refuses an unknown model_metadata key (UnknownField) and with
it the whole settings file, so the levels are written only when fx at
the place says 0.0.17 or later (~/.local/bin/fx, else fx on PATH; a
version not 0.x is the JSON viewer also named fx). An unknown version
gets no levels, and a sync after fx is upgraded writes them. fx's own
effort setting (top level and per workspace) is the user's and stays.

Left alone: fx inside a WSL distro has no version probe, so it gets no
levels (#6636).

Run:
- go test ./internal/agent -run 'TestFx|TestWSL' on mica: ok.
  TestFxEfforts (exact ordered JSON at 0.0.17, the user's effort and
  workspace effort kept, levels gone at 0.0.16 and unknown, back at
  0.0.18), TestFxEffortNames, TestFxVersionIsTheAgents.
- Broken by hand, each red: fxTakesEfforts always true (TestFxEfforts),
  no 0.x check (TestFxVersionIsTheAgents), a sorted map for the levels
  (the order checks).
- Real fx on mica, sandbox HOME, magpie-written settings, a fake chat
  completions server: fx 0.0.17 dev (3c8fab37) --effort high sent
  reasoning_effort high; no effort sent none; --effort xhigh on a model
  without it said so and sent none; --effort none sent "none". fx 0.0.16
  with the levels failed with UnknownField; without them it worked.
  fxVersion read the real binaries as "0.0.17" (takes levels) and
  "0.0.16" (doesn't).
- Full suite on mote (mica out of disk) at d987cc7d5 plus this change,
  -timeout 45m: 98 packages ok, two red. TestNoEagerPackageRegexps
  was this change's package-level regexp, now lazyre.New; after it,
  that test and TestFx/TestWSL ok again at origin/main 75f872ef1.
  TestEveryRouteHasACommandOrIsNamed (POST /api/page-away, from
  80a315a70) is red on main and fixed in the next commit.
- GOOS=linux and GOOS=windows go vet ./internal/agent on mote: ok.
  gofmt -l clean.

Not tried: fx in WSL; a real vendor through the real gateway.
2026-11-14 17:48:48 +08:00
yetone 75f872ef19 sessions: a page gone from view lets the parsed session files go in 30 s, not 3 minutes
v0.1.4150's away timer let the Sessions stats and the Requests chunks go
30 s after the app's page went from view, but a web page open 70 s and
closed still held 92-93 MB 45 and 90 s on. A heap taken 45 s after the
close (liveHeap 57 MB, 15 MB at +180 s) showed why: opening the page
starts the warm-up (warmStart), which parses every session file, and
those parses (decodeCache, the listings, Codex identities: ~40 MB live
for the acctp history) go only by the sessions package's own cacheIdle,
3 minutes after their last read.

forgetAwayPage now also calls sessions.ForgetParses, which is
dropIdleCache without the 3-minute wait (dropCache(0)): it still keeps
the parses while a save isn't on disk, the last failed, or a file is
being parsed, and the next read has them back from sessions.json with
no session file read. It runs only when the stats went too, so a range
being read keeps them.

Test: TestForgetParsesLetsGoAtOnce (red with ForgetParses waiting
cacheIdle, broken by hand).
Measured on mote (pageclose2.sh, acctp, page open 70 s and closed,
footprint-overlay build like the release):
  v0.1.4150 (w90): close 122 MB, +45 s 93, +90 s 90, +180 s 55, +600 s 52
  this (w92):      close 125 MB, +45 s 64, +90 s 61, +180 s 56, +600 s 53
A debug build (w91) logged the away timer firing with no read since,
so the 90 MB left was this cache, not a skipped let-go.

Run: go test ./internal/sessions ./internal/gui ./internal/usage on mote
(ok); GOOS=linux go vet -tags nogui and GOOS=windows go vet of the two
packages (ok).
2026-11-14 17:45:41 +08:00
yetone 3932d01acf provider: ZCode's mover min is 0.1.64, which queues a Start Plan request refused beside the account's others (JJLIN070414 on X)
Two sessions on ZCode's Start Plan showed 429s: an account ZCode serves
one at a time refused the second request (3008), and the plugin handed
it back after its 1s and 2s re-asks. 0.1.64 (plugins 8e19b6a0) narrows
the account's gate and requeues that request until the other ends, as
ZCode's own client queues a capped request. The min makes
keepMovedCurrent update every moved user; it also carries 0.1.62 and
0.1.63 (plugins 3f37b858).

Run: npm view --prefer-online shows 0.1.64; on mica, go test -tags nogui
-run 'Moved|Mover|Migrat|ZCode' ./internal/provider ok; gofmt clean.
Plugin: packages/zcode bun test 262 pass, 0 fail; the three requeue
tests red with the requeue turned off.
Not tried: a full go test ./... before the tag, a real Start Plan
account with two sessions.
2026-11-14 17:39:09 +08:00
yetone b592c1fde1 masking: the page counts each agent's requests looked over, nothing masked in them or not
eiyuuzaki2333 on X: the Gateway page showed Pi's calls, the Masking page
records from dsh alone, and nothing said whether Pi's requests were
masked. They were: a Pi turn goes through the same masking as every
agent's, on each API Pi uses (chat completions, responses, messages),
with no agent or protocol scoping. But a record is made only for a
request masking changed (noteMasked: hits or held values), and the
page's agents came from records alone, so an agent whose requests
carried nothing to mask didn't appear at all, the same as one never
masked.

Now, while masking is on for a request (redactionWantedFor, a key's own
switch included), the gateway counts it under its agent
(maskrec.Checked): looked over, and whether masking changed something,
or sent as written to a model the user set to go unmasked. The counts
hold no text: a small checked-<day>.json beside the day's records,
written over through temp and rename at most every 5 s, read back after
a restart, pruned at 30 days with the records and removed by Clear
records. /api/masking/summary returns them as checked.

Counted where a turn's masking is decided: serve (every routed chat
turn, plugins and groups included), Codex's own sign-in's /responses
turn, and the native API passthroughs (nativeArk, nativeAny). Not
counted: searches, images, video, embeddings, System One's decisions and
Codex's compactions, which are not an agent's turn; they keep their
records as before.

The Masking page's card lists each agent under the flow: "Pi · 128
checked · none to mask · 3 sent as written". A click narrows the list
to it; the agent picker lists checked agents too; and a list with no
records says "128 requests from Pi checked, and none carried anything to
mask" instead of "Nothing masked matches these filters". Strings in zh,
zh-TW, ja and de.

Run (code at this head; first at base c41fa8e47 on mica, then rebased
on origin/main d987cc7d5 on mote):
- c41fa8e47, mica: go test ./internal/maskrec ./internal/gateway
  (-timeout 45m, 986s) ./internal/gui: ok.
- d987cc7d5, mote: go test ./internal/maskrec ./internal/gui: ok;
  go test -run "Checked|Masked|Mask|Codex|Native" ./internal/gateway: ok.
- GUI on mote, Chromium + WebKit: masking-records 124/124 (every
  language at 640px, en at 1100px), i18n-keys 4/4, i18n-en-no-cjk 4/4,
  mask-actions, mask-alert, mask-emails, mask-value-menu, masking-demo,
  masking-demo-unblurred, routing-masking, gateway-key-redact,
  group-redact, redact-route, window-mask: all pass. Screenshots checked
  in WebKit, en 1100 and zh 640.
- GOOS=linux and GOOS=windows go vet ./internal/maskrec ./internal/gateway:
  ok (internal/gui's cross vet stops in wails' cgo, as on main); gofmt -l
  clean.

Broken by hand: without the noteChecked line in serve,
TestPiTurnsCountedAsChecked fails ("three turns with nothing to mask:
{Looked:0}"); without the one in codex_backend.go,
TestCodexOwnSignInKeepsItsMaskingTime fails (Looked 0).

Not tried: a real Pi binary against a built magpie (the test sends Pi's
own headers: magpie's token, User-Agent pi/…, X-Session-Affinity, on
each of its three protocols); the counts across a real restart of the
app (the unit test reads the day's file back after a reset).
2026-11-14 17:38:39 +08:00