Commit Graph
8707 Commits
Author SHA1 Message Date
yetone dc507aefd3 gateway: Automatic image recognition and web search stay with the provider that served them
hxy920830 on X added a Claude account only for account switching, and
every agent's image recognition and web search moved onto it: with
Settings › Models › Image recognition and Web search on Automatic, magpie
ranked the picks again on each call, and a Claude account ranks first in
both (seersRanked tier 0, searchRank 0). Adding a provider reassigned
what another provider already served.

- auto_picks.go holds each Automatic slot (Image recognition, Web search,
  Image generation, Video generation) to the provider magpie first picked,
  in auto-picks.json beside providers.json. seersRankedHeld and
  autoSearcherReady put the held provider before every other of its
  readiness; AutoDrawer and AutoVideomaker pick among its models while it
  has one. A default fills only a slot nothing serves: nothing held, or
  the held provider removed, off, or left with no model for it.
- Allowance still comes first for the moment (#1801); the hold stays.
- A model picked in Settings is untouched. The picker already shows the
  pick as "Automatic · <model>", where it can be changed.
- A file that can't be read holds nothing and is not written over.

Users already switched: holds begin once, when the gateway first serves
(seedAutoPicks). It reads the last 30 days of the ledger's Image
description calls (kind vision) and the searcher's Web search calls
(kind web_search, not search API / native rows). A slot a later provider
took over is given back to the provider that served the call just before
the current pick's first, while it can still serve it. A switch older
than 30 days, or one whose earlier provider is gone, is not restored: the
current pick is held and the user picks in Settings › Models. Image and
video generation have no Automatic call in the ledger and are held to
the pick at the seed, nothing restored.

Docs: docs/subsystems/gateway-routing.md, "Automatic picks are held to
the provider that serves them".

Run:
- go test ./internal/gateway -run 'TestAddedProviderTakesNoAutomaticPick|TestAutoPicksSeededFromTheLedger|TestClaudeAccountAddedTakesNoImages' -v: ok (mica)
- GOOS=linux go vet ./internal/gateway, GOOS=windows go vet ./internal/gateway: ok (mica)
- go test -count=1 -timeout 45m ./... (mote, at 589e4ba6d + this change):
  every package ok (internal/gateway 1080s) except seven reds, each
  already filed and each passing alone at this tree on mica:
  capre TestCappedIsSmall (#5975); cli TestHealthcheckFindsTheRunning-
  GatewayWithoutMagpieAddr, TestUpdateRestartsTheGatewayItFindsWithout-
  MagpieAddr, TestUpdateFindsAMagpieThatWroteNoRecord (#6223, #6471:
  something serves on mote's 127.0.0.1:3425); gui TestAppReplacesIts-
  OlderGatewayOnceIdle (#6297), TestLaneLimitRoutes (#5150). The four
  cli and capre tests pass on origin/main 9314999a4 too.
- After the rebase onto origin/main e08dc0fe5 (mica): go test ./internal/gateway -run 'the three|Vision|Searcher|Drawer|Videomaker' ok, GOOS=windows go vet ok.

Broken by hand: heldPick returning "" (the old ranking) turns all three
tests red: AutoVision = "anth/eye" after a provider was added, and
"claude/claude-haiku-5-5" after the Claude account was signed in.
Not tried: the real app with a real Claude account; no GUI file changed,
so the GUI suite was not run.
2026-11-18 20:27:20 +08:00
yetone e08dc0fe58 provider: OpenAI's own API sends Responses turns over the WebSocket by default, only the new input each turn (KawaiiZapic on X)
KawaiiZapic's screenshot showed 6.4 GB up for 799 MB down: every turn
went out whole. What each leg sends, checked in the code:

- Codex on a ChatGPT subscription: the kept upstream socket already
  sends previous_response_id and only the new input (codex_socket*.go).
- A Responses provider with socket=auto/on: the same, but socket was
  off unless someone ticked it, so an OpenAI API key provider sent the
  whole conversation each turn over HTTP.
- A client's own previous_response_id is kept for api.openai.com,
  Azure and Ark (prevKeeps); other relays get the expanded whole turn,
  since they can't be trusted to hold the chain.
- Claude Messages, Chat Completions and Gemini have no incremental
  protocol; those always send whole (prompt caching is what saves there).
- The ↑ counter (upbytes.go) counts each upstream write once; no double
  count found.

Change: a Responses provider at https://api.openai.com with no socket
set now goes over the WebSocket (provider.SocketByDefault, mirroring
codex-rs's create_openai_provider supports_websockets: true). socket=off
is now stored, so unticking it there sticks; elsewhere unticked is still
"". The CLI shows "auto (default)" and takes socket=off|default. The
editor's WebSocket row moved into socketrow.js (imported as the editor
draws), so app.js and the core shrink by 165 bytes and their budgets
drop with them. Caveat: an OpenAI provider saved unticked before this
(socket "") now goes over the socket until it is unticked again; the
docs say so.

Measured (fake api.openai.com over TLS, sandbox HOME, 20 turns of a 4KB
user message each): socket off 20 HTTP posts, 876,345 bytes up;
default 0 posts, 20 socket turns on one handshake, 84,928 bytes up
(Traffic().Up equal to the socket bytes, so no double count).

Run (mica). At this head, rebased on origin/main 589e4ba6d: the go
test -run line below ok (budgets included), gofmt clean,
provider-socket.test.cjs 80/80 and old-webkit's same 2 reds. The rest
ran at the tree rebased on 1bfa8d5a1 (main since touched only plugin
assets and docs outside these files):
- go test -run 'Socket|Budget|OpenAI' ./internal/gui ./internal/provider
  ./internal/cli ./internal/gateway: ok.
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows
  for provider, cli, gateway, gui: ok.
- GUI: provider-socket.test.cjs 80/80 (chromium + webkit, 5 languages,
  2 widths). Every provider-*, i18n-* and old-webkit file in one
  run: 1793 pass, 76 red. Each red file run alone at this tree and at
  origin/main 1bfa8d5a1 is red the same or green at both:
  provider-fetch-again (#5057, #5232), provider-many-keys and
  provider-max-output (#6209), provider-models-rest, provider-picks-stay
  and provider-typed (#6532), provider-proxy (#7100), provider-remove
  (#7101); provider-advanced-fold 50/50, provider-env-paste,
  provider-add-gemini, -gemini, -at-once, -auth-header and -mask pass
  alone (load).
- Full suite, go test -count=1 -timeout 45m ./...: 99 packages ok, 4 red.
  Alone: TestSearchQueueKeepsCodexAlive (gateway) and
  TestWSLStoppedDistroKept (sessions) pass; TestGatewayModeListsNoOwnSessions
  (gui, #7064) and the dirent watch tests (#7031) are red at
  1bfa8d5a1 too.
- old-webkit.test.cjs: 2 reds (guideback.js not in the lazy list,
  Safari 15.0 styles), the same on origin/main 1bfa8d5a1 run alone;
  noted on #6570.

Broken by hand: SocketByDefault returning false turns
TestSocketByDefaultOnOpenAI and TestOpenAIProviderTurnsGoOverWebSocketByDefault
red ("2 HTTP posts, 0 socket turns on 0 handshakes").

Not tried: a real OpenAI API key, and a real Codex binary against an
API-key provider; the fake follows the Responses WebSocket protocol the
existing socket tests use.

Reported-by: KawaiiZapic on X
2026-11-18 20:22:30 +08:00
yetone 9314999a4a ccswitchlink: a ccswitch:// link that still reaches magpie goes to CC Switch, and so does the scheme (asombrado_a on X)
@asombrado_a (X, 2122995130097713493) has CC Switch and magpie both
installed, and a ccswitch://v1/import link opened magpie. magpie claims
magpie:// only since 03314b25a (v0.1.4455), but v0.1.3981 to v0.1.4454
claimed CC Switch's scheme too, and what they registered stays:
- macOS: Launch Services keeps the old Info.plist's ccswitch claim after
  the bundle is rewritten in place (seen on mote below);
- Windows: HKCU\Software\Classes\ccswitch running magpie.exe;
- Linux: magpie-ccswitch.desktop as the x-scheme-handler/ccswitch default.

The owner's call in 03314b25a stands: magpie doesn't read CC Switch's
links. A ccswitch:// link that reaches magpie anyway is now handed on:
- cli.run, before anything is read, moved or started (Windows, Linux:
  `magpie ccswitch://…`), and the Mac's URL event in gui.Run call
  ccswitchlink.Forward;
- macOS: `open -b com.ccswitch.desktop <link>`, then `lsregister -f` on
  magpie's own bundle, which reads its current Info.plist and drops the
  claim;
- Windows: the handler's program when it isn't this magpie, else
  %LOCALAPPDATA%\Programs\CC Switch\cc-switch.exe (where CC Switch's
  per-user MSI installs it); when the handler ran this magpie the key is
  rewritten as that MSI writes it ("URL:com.ccswitch.desktop protocol",
  URL Protocol, DefaultIcon, shell\open\command "exe" "%1");
- Linux: CC Switch's .desktop entry in the XDG data dirs (its first
  start's cc-switch-handler.desktop with %u first, else the package's
  "CC Switch.desktop", whose Exec has no %u, so the link is appended) is
  run, and a default that is magpie-ccswitch.desktop moves to it; magpie's
  entry is removed while it runs this magpie or a gone binary. Any other
  default is left alone.
- No CC Switch: ErrNotInstalled, nothing opened, the claim kept, so
  magpie opens such a link as it does now (it says it reads magpie://
  links only).

Existing users: nothing changes until a ccswitch:// link reaches magpie.
The first one is opened in CC Switch and the claim goes back, so later
links go to CC Switch directly.

CC Switch's facts come from farion1231/cc-switch (tauri.conf.json's
deep-link schemes ["ccswitch"], wix per-user-main.wxs, lib.rs's
register_all) and its v4.0.35 assets: macOS.zip's Info.plist
(com.ccswitch.desktop, CFBundleURLSchemes ccswitch), the portable zip's
cc-switch.exe, the .deb's "CC Switch.desktop" and /usr/bin/cc-switch.

Run (this tree on d74754970, then again where named after a rebase on
589e4ba6d, which touches none of these files):
- mote: go test -count=1 ./internal/ccswitchlink ./internal/cli
  ./internal/gui ok; go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./..., go build ok; gofmt -l empty.
- wsl-run (magpie-desktop) and win-run (xiaomi-gpu): go test -count=1
  -v ./internal/ccswitchlink ok (Windows writes a test key of its own,
  Software\Classes\magpie-test-ccswitch-<pid>, removed after).
- Full suite on mica (go test -count=1 -timeout 45m ./..., on
  d74754970): 101 packages ok; reds, all filed and none in a package this
  touches: internal/dirent's watch tests (#7031; red alone on a fresh
  origin/main 589e4ba6d too), TestGatewayModeListsNoOwnSessions (#7064)
  and TestWSLStoppedDistroKept (#7071), both ok alone on mica.
- After the rebase on 589e4ba6d: go vet ./..., GOOS=linux go vet -tags
  nogui ./..., GOOS=windows go vet ./..., go build, gofmt -l on mote ok;
  ./internal/ccswitchlink and ./internal/gui ok on mote; ./internal/cli
  ok on mica. On mote three cli tests reach the 127.0.0.1:3425 an ssh
  port forward holds there (#6223).
- Real, macOS (mote, in ~/runs, cleaned up with lsregister -u): a test
  bundle registered with the old ccswitch claim kept it 5s after its
  Info.plist was rewritten without it; the built Forward then opened
  the real CC Switch v4.0.35 app and the dump showed the claim gone.
  Without CC Switch registered it returned ErrNotInstalled.
- Real, Linux (magpie-desktop, sandbox HOME and XDG dirs): with
  magpie-ccswitch.desktop as the real xdg-mime default, Forward ran
  cc-switch-handler.desktop's Exec with the link and the default was
  cc-switch-handler.desktop after.
- Broken by hand: no lsregister call (darwin), no xdg-mime default
  (linux) and no handBack (windows) each turned their test red.
- GUI suite: not run; no page, app.js or i18n change.

Not tried: a real CC Switch install on Windows (the box's real HKCU
ccswitch key is left alone; the test uses its own key), and a real
CC Switch .deb or AppImage on Linux (its entry was faked with the
package's own bytes).
2026-11-18 20:07:09 +08:00
yetone 389169f761 gateway: a Qwen Token Plan's TTS, ASR and video models are served on OpenAI's routes
gaubeebangeel on X (tweet 2122991088017477954) asked for every kind of
model Alibaba's Token Plan sells, each on its own DashScope endpoint.
Before this, magpie served the plan's text (Anthropic and chat
completions), its realtime voice (/v1/realtime, realtime.go) and its
Qwen-Image drawing (draw_dashscope.go). The plan's text list lacked
deepseek-v4.1-flash-1017, and nothing served its TTS, ASR or video
models.

- presets: alibabaPlanModels as the four plans' overviews list them on
  11-18 (qwen4-max, qwen4-max-preview, deepseek-v4.1-flash-1017 added).
  PresetDef gains Drawers, Videos, Speakers and Transcribers, Region
  gains Speakers and Transcribers, and the four Token Plans
  (qwen-token-plan, bailian-token-plan, alibaba-token-plan,
  qwencloud-token-plan) name qwen-image-3.0-pro and wan2.7-image(-pro),
  wan3.0-video and happyhorse-1.1-t2v/-i2v/-r2v, qwen-audio-3.0-tts-plus
  and qwen-audio-3.0-asr-flash. PlanSpeakers and PlanTranscribers feed
  PlanRetrieval, so the router knows which provider speaks and
  transcribes.
- /v1/audio/speech (speech_dashscope.go): a plan key's qwen-audio TTS
  model is asked on <root>/api/v1/services/audio/tts/SpeechSynthesizer,
  every field under input as the docs have them. An OpenAI voice name
  becomes the model's own first voice (longanlingxin for -plus,
  longanhuan_v3.6 for -flash), speed goes as rate (0.5 to 2), and
  instructions as instruction. mp3, wav, pcm and opus are served; aac,
  flac and stream_format sse are 400s before DashScope is asked. The
  answer's output.audio.url is fetched (or data decoded) and served with
  the format's type.
- /v1/audio/transcriptions: a plan key's qwen-audio ASR model goes to
  multimodal-generation with the file as an input_audio data URI, its
  format from the file's name or type, and language as language_hints.
  The answer is given back as OpenAI's json, text or verbose_json; srt,
  vtt and translations are 400s. The form's file is read only on this
  path (audioForm.file), so a form passed on as sent is never copied.
- /v1/videos (video_dashscope.go): Wan 3.0 and HappyHorse start at
  video-synthesis with X-DashScope-Async: enable and are polled at
  /api/v1/tasks/<id>. The id carries the model and the key's mark, as
  MiniMax's does. vendorAsk.answer now takes the request's context, so
  the TTS answer's audio URL is fetched under it.

Hosts, paths, fields and voices were checked against Alibaba's docs
(help.aliyun.com model-studio qwen-audio-tts/asr HTTP API and Wan 3.0
video reference, docs.qwencloud.com Token Plan multimodal pages,
platform.qianwenai.com token-plan), not against the tweet. Not tried
against the real API: the owner's magpie has no Token Plan provider.
The tests use a fake DashScope serving the docs' shapes.

Run (on mote via mote-run, tree at 8634c4ad0 plus this diff):
- gofmt -l internal/: nothing.
- go test -count=1 -run 'TokenPlan|DashScope|Speech|Transcri|Video|Plan|Qwen|Qianwen|Alibaba'
  ./internal/gateway ./internal/provider ./internal/gui: ok, ok, ok.
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
  ./..., go build, GOOS=linux go build -tags nogui, GOOS=windows go
  build: all ok.
- go test -count=1 -timeout 45m ./...: 101 packages ok; internal/cli and
  internal/gui red on TestHealthcheckFindsTheRunningGatewayWithoutMagpieAddr,
  TestUpdateRestartsTheGatewayItFindsWithoutMagpieAddr,
  TestUpdateFindsAMagpieThatWroteNoRecord (#6223, #6471) and
  TestLaneLimitRoutes (#5150). mote has an ssh forward listening on
  127.0.0.1:3425, which those tests read. All four are red the same way,
  run alone on mote, at a just-fetched origin/main 589e4ba6d.
- Broken by hand: with the X-DashScope-Async header dropped,
  TestTokenPlanMakesVideos goes red (403 "does not support synchronous
  calls"); with -plus's default voice changed to alloy,
  TestTokenPlanSpeaks goes red.
- GUI: no asset changed, and the .cjs files run app.js on fixtures, so
  none can be reached. The Go GUI API that lists the plans' models ran
  in ./internal/gui above.
- Rebased on origin/main 589e4ba6d (6 commits, none touching these
  files) and run again at this head on mote: gofmt -l nothing; the
  targeted run above ok, ok, ok; vet (darwin, linux nogui, windows) of
  ./internal/gateway ./internal/provider and the three builds ok.
2026-11-18 19:59:27 +08:00
yetone 589e4ba6da agent: OpenCode finds magpie's models itself; opencode.json no longer lists them
chawyehsu on X asked for dynamic model discovery, as
yuhp/opencode-models-discovery does. magpie wrote its whole catalog into
opencode.json's magpie provider. For an OpenCode that loads plugins of
today's shape (1.4.0 and later, 2.0.5 and later; openCodeDiscovers),
the provider now has no "models". magpie writes plugins/magpie-models.js
beside the file (opencode_models.js, marked by its first line). It fills
the provider's models as OpenCode starts, from the gateway's new
/v1/models?format=opencode (opencode2 for OpenCode 2;
gateway/opencode_models.go). That endpoint gives the same entries a sync
would have listed, in magpie's order, never cached, and only the
models of OpenCode's catalog the key asking may use (keyListed).

- OpenCode 1: through its config hook, which runs before it reads
  providers. The user's entries under magpie's provider are laid over
  magpie's, and an id magpie doesn't list stays.
- OpenCode 2: through ctx.model.transform. The config's own entries are
  laid on afterwards by OpenCode. Every entry says variants ([] for
  none), so OpenCode makes up none.
- Gateway not answering (3s timeout): the plugin lists the models magpie
  had when it last wrote it.

Existing users: the first sync on such an OpenCode takes magpie's list
out of the file (modelsLeft). Of each model, only what the user said
differently stays: their own variant, or a limit.output they typed. A
limit or cost they changed stays whole, since OpenCode 1.19.6 refuses
one without its context ("Missing key ...limit.context"). An id magpie
no longer lists goes that once (stash opencode-discover:<path>), as it
did on every sync before; one added after that is the user's and stays.
The user's other keys and providers are untouched. These keep the list
in the file as before: an OpenCode older than those versions, of no
known version, and the forks (mimocode, DevEco, Air). Going back to
such an OpenCode writes the list again and removes the plugin, and so
does taking magpie out. A file at the plugin's path without magpie's
first line is the user's and is never touched.

Run:
- mote-run go vet ./internal/agent ./internal/gateway, also with
  GOOS=linux and GOOS=windows: clean. gofmt -l: clean.
- mote-run go test ./internal/agent -run
  'OpenCode|OpenChamber|Air|DevEco|Mimo': ok (TestOpenCodePluginRuns runs
  the plugin in node against a stubbed gateway, up and down, v1 and v2).
- mote-run go test ./internal/gateway -run 'TestOpenCodeModelsList|Models': ok.
- Broken by hand, each red: no key filter (TestOpenCodeModelsList),
  openCodeDiscovers always false (Finds/ListMoves/DiscoversFrom), the
  delta keeping whole models (ListMoves), and the plugin letting magpie's
  fields win over the user's (PluginRuns).
- Three opencode_v2 tests that check the listed words now pin 2.0.4 and
  1.3.9, which still list.
- Real OpenCode on mote in a sandbox HOME, opencode-ai 1.19.6 and
  @opencode/cli 2.3.2. Config and plugin written by magpie's own code, a
  fake /v1/models serving one extra model:
  - `opencode models` lists the served model with the gateway up, and
    the cached list with it down. Both versions, Bearer key sent.
  - A file moved from 1.3.9/2.0.4 with a user limit.output and a user
    model: `opencode models magpie --verbose` (1.19.6) and
    `opencode api --standalone GET /api/model` (2.3.2) resolve magpie's
    models the same as the old full-list file did. Names, limits,
    variants and the user's edits are identical; 2.3.2 orders a model
    the file names first.
- Full suite: mote-run go test ./... -timeout 45m -count=1 on this change over base 1bfa8d5a1: 103 packages ok, no FAIL.
- Rebased on 7300be4d0 (main touched agents.go and gateway.go): go vet
  darwin/linux/windows of internal/agent and internal/gateway clean;
  go test ./internal/agent ok; ./internal/gateway red only in
  TestSearchQueueKeepsCodexAlive/comments and /cancel at load ~37, the
  idle-bar class of #7090 (commented), 5/5 ok alone at this head.
- Not changed: the forks mimocode, DevEco and Air keep the list; filed as #7055.
Not tried: a WSL distro's OpenCode, and OpenChamber's own UI over the
plugin-filled provider.
2026-11-18 19:47:19 +08:00
yetone d8cc6e29f5 library: CodeRabbit's own MCP server is in the market (niuniu_8964 on X)
niuniu_8964 on X asked for CodeRabbit's and Firecrawl's official MCP
servers in Library › MCP. Firecrawl's was already a featured server
(npx -y firecrawl-mcp with FIRECRAWL_API_KEY, the README's own command);
checked against firecrawl/firecrawl-mcp-server's README and npm (3.40.0),
left as it is.

CodeRabbit's is a remote one: docs.coderabbit.ai/api/mcp gives
https://mcp.coderabbit.ai/ over Streamable HTTP, signed in in the browser
with OAuth (PKCE, dynamic client registration), no API key. It is a
featured remote with SignIn, as Linear's and Notion's are, under the
coderabbitai GitHub org's mark. An EU organization has its own server,
mcp.eu.coderabbit.ai; the description says to edit the address to it.

The scopes: Claude Code and Codex ask only for "connection" unless told
which, which is enough for connection_status alone. magpie's own sign-in
(mcpauth) takes the scope list from the server's 401 challenge, which
names every read and write scope but `review`, and CodeRabbit's consent
page shows each one to approve.

Run:
- mcpauth's discover() against the real https://mcp.coderabbit.ai/ and
  https://mcp.eu.coderabbit.ai/ (a throwaway test, not committed): each
  found its issuer, authorize, token and register endpoints, the
  challenge's scopes and auth method none. No sign-in was finished: no
  CodeRabbit account here.
- firecrawl-mcp 3.40.0 started in a sandbox HOME on mica: initialize and
  tools/list answered, 28 firecrawl_* tools.
- mica, at base d74754970: gofmt -l, go vet ./internal/library,
  go test ./internal/library ok (with the new
  TestCodeRabbitIsItsOwnRemote); go test ./internal/gui red only in
  TestGatewayModeListsNoOwnSessions, the "listing":true search of #7064,
  open and in sessions, which this doesn't touch.
- mote, Chromium and WebKit, en zh zh-TW ja de: market-*.test.cjs (9
  files), library-pi-market, library-discover-jump, gui-de, gui-ja,
  gui-zh-tw, i18n-keys: 227 of 227 ok. They fake the market's API, so
  they show the page still reads it, not this entry.
- Rebased on origin/main 7300be4d0, whose commits since d74754970 touch
  sessions and the gateway only; go test ./internal/library run again at
  the pushed head on mote: gofmt -l empty, go vet and go test ok.

Not tried: a finished CodeRabbit sign-in and a tool call, and an agent
given the server through the MCP router.
2026-11-18 19:36:35 +08:00
yetone 7300be4d01 gateway: find_tools says no tool was found instead of handing over near names
sahuaja3669 on X (tweet 2122928458355319211), on the on-demand router:
it shouldn't pad its answer with tools of a near name that do something
else, and it should say plainly when nothing was found.

Before, find_tools counted any query word found as a substring of a
tool's name or description, stop words and single letters included. "a"
is in nearly every name, so "send an email" against GitHub, filesystem,
Linear, magpie-image and magpie-browser gave five tools in full
(search_code, read_file, write_file, ...) as matches, with nothing saying
they were weak; a query nothing matched did say so.

Now find_tools matches on the query's key words (stop words such as a,
the, to, my left out), each a whole word of the name or description or
the start of one at four letters or more (open/opens, issue/issues; a
non-ASCII word anywhere, as before). A tool is a match only when the
query is its name, or it has two thirds of the key words, one in its
name unless it has them all. When none clears that, the answer says no
tool was found and not to call one that only sounds close, and names
each server with its tool count and up to 8 of its tool names, as what
there is rather than as matches. call_tool's "close to it" for an
unknown name keeps a looser rule (a key word shared with the name,
hubNear), so create_isue still points to create_issue. Cheap and
deterministic: word lists, no model, no index.

The cost: a query in other words than the tool's ("draw an image of a
cat" for generate_image) now finds nothing, and the model reads
generate_image from the server list in the answer, and from find_tools'
description, which already names each server's tools.

Test: TestHubFindNothingClose, on real descriptions from
github-mcp-server, the reference filesystem server, Linear's, and
magpie-image's and magpie-browser's own. Red on the old
hub_ondemand.go: "send an email" matched eight tools or more, five in full.
docs/subsystems/mcp-router.md updated.

Run:
- full go test ./... -count=1 -timeout 45m on mote at 5c32b285d (on
  48fffb60c): every package ok, internal/gateway 1392s.
- full go test ./... -count=1 -timeout 45m on mica at 1acbfcc23 (on
  3e66d25d8), mote over its load: 100 packages ok, three red, none in
  code this touches: internal/dirent's watch tests (red on mica at
  3e66d25d8 alone too, ok on mote; #7031), internal/sessions
  TestWSLStoppedSinceNotOpened (internal/sessions doesn't import
  gateway; red 1 of 4 on mica at 3e66d25d8 alone, ok on mote; filed
  #7089), internal/gateway TestSearchQueueKeepsCodexAlive/progress (ok
  3 of 3 alone; filed #7090).
- at the pushed head 22647c27f (on e199eb9c7): go test ./internal/gateway
  -count=1 -timeout 45m on mica ok (1306s); go vet ./internal/gateway
  for darwin, linux and windows ok; gofmt -l clean.
- rebased onto d2fa7d8d7 to push (four commits: sessions, library, and
  d74754970's system-message placement in gateway, none in the hub);
  there go test ./internal/gateway -run 'Hub|MCP|Search|Message|System'
  ok on mica, go vet ok. 65c9a2e41 there addresses #7089's WSL wait.
Not tried: a real agent driving find_tools against a live router.
2026-11-18 18:58:55 +08:00
yetone d2fa7d8d79 sessions: an Antigravity app conversation shows what was said, not only its title
@yansheng1003 on X: the Sessions page showed an Antigravity 2.0
conversation's title and preview only. HasTranscript left "antigravity"
out, since conversations/<id>.db's step text is encrypted at rest, so
the row had no Show conversation and /api/sessions/transcript said
"this agent's conversations can't be shown".

The app also writes every step in plain text beside the database:
brain/<id>/.system_generated/logs/transcript_full.jsonl in the same
store, in agy CLI's format (user input, planner responses with their
tool_calls, tool results). Antigravity 2.30's language server writes it
in the stable store and in Insiders' (both checked: run in a sandbox
HOME on Windows against a fake model that called read_file).

- transcript.go: antigravity has a transcript; readTranscriptOf reads
  it through agyTranscript (antigravityTranscriptOf), so the viewer,
  TranscriptAt, search, the said index and the Markdown export all get
  it. A conversation with no transcript file is ErrNoTranscript, as
  before.
- antigravity_app.go: antigravityTranscript derives the path from the
  database's (stable, Insiders, a WSL distro's); its size and time are
  folded into the session file's with the -wal's, so a step it adds
  reads the session and the said index again.
- search.go: linesFile is false for antigravity, so the encrypted .db is
  never pre-scanned for the words.
- testdata/antigravity-2.30-tools: that real conversation (db with the
  WAL checkpointed, summary row, brain/ logs).

Tests: TestAntigravityAppTranscript (stable, Insiders, WSL: parts, search
hit and miss, Markdown), TestAntigravityAppNoTranscript,
internal/gui TestSessionAntigravityConversation (/api/sessions marks it,
/api/sessions/transcript gives the five parts).

Run: on mica (mica-run) at base de5fc6700:
- gofmt -l internal/sessions internal/gui: clean.
- go vet ./internal/sessions ./internal/gui, GOOS=linux go vet -tags
  nogui and GOOS=windows go vet on the same, go build .: ok.
- go test -count=1 -timeout 45m ./internal/sessions: ok but for
  TestWSLAgentsGoneListingDrops (load ~48; fixed at its cause in the
  commit before this one); go test ./internal/gui: ok (299s).
- After that fix: go test -run 'WSL|Antigravity|Agy|Gone'
  ./internal/sessions ok; GUI files sessions-talk, -talk-sheet,
  -talk-model, -export, -said, -subagents, -reads, -search, -convert:
  168 of 168 in Chromium and WebKit.
- Old code (de5fc6700 with only the new tests and testdata):
  TestAntigravityAppTranscript red in stable, insiders and wsl ("the
  session isn't marked readable"), TestSessionAntigravityConversation
  red ("listed with no conversation to show ... Transcript:false").
- Windows (win-run on xiaomi-gpu): TestAntigravityAppTranscript (3
  subtests) and TestAntigravityAppNoTranscript pass.
  TestAntigravityAppFolder is red there at the base as well (#5957).
Rebased onto bfddc9cfb, on mote (mote-run) at this tree: gofmt clean,
the three vets and go build ok, go test -count=1 ./internal/sessions
./internal/gui ok (56s, 157s).
Not tried: the real GUI window opening this conversation; the API and
page are covered by the tests above.
2026-11-18 18:55:46 +08:00
yetone 65c9a2e411 sessions: the WSL tests wait for the distro's first listing, however busy the machine
TestWSLAgentsGoneListingDrops went red in a run of internal/sessions on
mica at load ~48: "answered=true: want 7 sessions, got 0". The first
List waits at most wslFirstWait (3s) for the WSL walk, as the Sessions
page should, and on a busy machine the walk outlasts it, so the count
read nothing yet. Every test built on wslDistro counts that first
listing (TestWSLSessionsListed, the Antigravity and Kimi WSL tests), so
wslDistro now gives it a minute; TestWSLFirstWaitIsWaitedOnce still sets
its own 500ms after.

Broken by hand: a 3.5s stall in WSLHomes gave the same red, "got 0",
without this change and passed with it (mica-run, -run
TestWSLAgentsGoneListingDrops). Alone, unstalled, the test passed 5 of
5 on the old and new code.

Run: on mica (mica-run): go test -count=1 -run 'WSL|Antigravity|Agy|Gone'
./internal/sessions ok; gofmt clean. The full internal/sessions run
where it went red is in the next commit's record.
2026-11-18 18:55:46 +08:00
yetone d747549700 gateway: a system message between a call and its result goes after the result (wizcheu on X)
Claude Code puts {role: "system"} messages into messages[]: a turn's
effort (output_config), a steer the user sent while a tool ran, a
deferred tool's tool_addition. One can stand between an assistant's
tool_use and the user message holding its tool_result. DeepSeek counts
it as the next message and refuses the request, 400 "messages.N:
`tool_use` ids were found without `tool_result` blocks immediately
after", and every later request of the conversation carries the same
history (Claude Code: "400 due to tool use concurrency issues").

The relay's mend made it worse. pairedMessages (toolBlocksPaired) read
the system message as the turn after the call: it gave the call a
synthetic result inside the system message, and the real result in the
user message after it became text. A system message can't hold a
tool_result, and withSystemOnTop or withoutTurnEffort then dropped it,
so the call stayed unanswered. pairToolMessages (Chat relays and
builds) did the same: synthetic tool results, then the real ones as
user text.

Now a system or developer message that stands between a call and its
results is held and goes after the results (after the synthetic ones
when none came). The real result stays a result. A body that already
pairs comes back byte for byte. The translated routes were already
safe: responseInstructions turns a mid-conversation system message into
user text, and mergeTurns joins it with the results' message.

Checked against api.deepseek.com/anthropic with a real key on
2026-11-18: a system message (text, empty effort, or string) between
the call and its result gives 400. Magpie's old output gives 400 too.
The same system message after the result gives 200.

Tests: TestSystemMessageBetweenCallAndResult sends the reporter's turn
(thinking, text, tool_use call_00_jdrDF4PKrnFwMUMBRQlr4516) with each
of five system-message shapes between the call and its result. It goes
through /v1/messages to a fake DeepSeek that enforces the same rule.
TestSystemMessageFollowsTheResults covers pairedMessages directly,
including byte for byte when already paired.
TestChatSystemMessageBetweenCallAndResult covers pairToolMessages and
toolPairsOut. All three fail on the old code (all 11 subtests red at
534b85bf9) and pass with the fix.

Run on mote:
- go test ./... -timeout 45m at 1d7f0b3a2 (this change on 534b85bf9):
  103 ok, no FAIL.
- GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./...: ok.
- gofmt -l: clean.
- After rebasing onto bfddc9cfb (which touched internal/gateway),
  go test ./internal/gateway again: ok (964s) at 516f40c43.

Not changed: pairToolItems (Responses). DeepSeek serves no Responses
API.
2026-11-18 18:40:49 +08:00
yetone 8634c4ad08 library: a repository's card counts the skills its sheet lists once the repository is read
bdefdc319's repository card counted the skills skills.sh lists, while
its sheet, once Find skills' probe had read the repository, listed what
the repository holds: mattpocock/skills read 55 on the card and 39 in
the sheet, a number that changed on click.

A repository's read is now kept for the session (repoRead). Once it is
read, the card behind the sheet says the sheet's count at once, keeps
it when drawn again, and takes its Added from the read too; reopened,
the sheet lists the read repository straight away, the skills just
installed greyed, while it is read again. A later read that fails keeps
the one before; one with no SKILL.md drops it.

Run (mote, at origin/main e199eb9c7 + this):
- market-repo.test.cjs: 20 of 20, chromium and WebKit, five languages,
  420px. It now checks the card's count after the read, after the
  install's redraw, and the reopened sheet. With the card counting
  skills.sh's list again by hand, all 5 chromium first cases red.
- Every market-* file and i18n-keys: 132 of 132.
The whole GUI suite runs after the push, with bdefdc319's.
2026-11-18 18:33:34 +08:00
yetone e199eb9c79 codex: the Codex app's picker puts a ChatGPT model its list lacks where the order put it (Wangalan167673 on X)
Wangalan167673's Order tab (Codex's list on the Agents page) had GPT-6.2
Sol and Astra third and fourth, and the Codex app's picker had them last,
"GPT-6.2 Astra · Codex", after every other provider's models.

The app's list (model_catalog_json, gateway.CodexDesktopCatalog) is the
ChatGPT backend's list asked for the app, then magpie's models. A model
of the account's own that the app's list lacks yet (GPT-6.2 beside a list
asked before it came, CodexListedBeside) is handed by magpie's id,
codex/<slug>, which is where the "· Codex" comes from. provider.CodexOrder
mapped an own model of the order only to its bare slug, as the backend
lists it, so the codex/ entry matched nothing in the order and went after
every model the order names. It now maps both the bare slug and the
entry id. Groups and other providers' models were already matched by id.

The Codex app reads the file at its start, so an order changed while it
runs reaches its picker after it is restarted.

TestCodexDesktopCatalogInUsersOrder (gateway) builds the reporter's list:
GPT-6.1 Terra and Sol in the backend's list for the app, GPT-6.2 Sol and
Astra only in the account's own list, three routing groups and four
models of an agy-cli provider, in the reporter's order. Red on the old
code: "got [gpt-6.1-terra gpt-6.1-sol group/code-daily ... agy-cli/
claude-sonnet-5.5 gpt-6.2-sol gpt-6.2-astra]"; green with the fix.

Run on mica at 230feb5b2 (base 1bfa8d5a1): go vet of provider and
gateway for darwin, GOOS=linux -tags nogui and GOOS=windows; go test
-count=1 -timeout 45m ./internal/provider ./internal/gateway
./internal/codexcat, ok. After the rebase onto bfddc9cfb (71b8ab46c
changed gateway): go test -count=1 -run Codex of the three packages, ok;
gofmt -l clean.
Not run before the push: the full suite. mote and mica each had another
session's full suite running; it is queued on mote behind that one and
its result is reported with the release.
Not tried: a real Codex app with this build. No GUI change.
2026-11-18 18:23:25 +08:00
yetone bfddc9cfba routing: DimCode's requests read as DimCode, with its mark, by key too
Yayoi_no_yume on X, a Docker magpie (v0.1.4350): DimCode (dimcode.dev)
on another computer, calling with a gateway key named "Magpie", drew
the Routing page's client node as the cube and "Magpie", and the
request's story said "DimAgent asked for the routing group Step 5
Preview".

Two causes:
- DimCode was no client magpie knew, so usage.AgentOf named it by its
  product name: npm's dimagent 0.5.29 sends "DimAgent/<version>" to a
  provider set to send its identity (resolveDimOAuthIdentityHeaders)
  and "DimCode/<version>" otherwise (read from the published binary).
  A client "dimcode" (DimCode, UA dimagent/dimcode) now names it,
  apart from the Dim alpha magpie starts ("dima"/"dimcode-alpha" stay
  Dim's, by name first). Its icon is dim-color: dimcode.dev's favicon
  (dimagent-favicon.svg, "Official DimAgent mark") is the same artwork.
  Routes and ledger records kept before are named again through
  AgentOf (Route.routedAgain), so old "DimAgent" rows read as DimCode.
- A keyed request's node read the key's name alone (eadc6cdb9, for a
  script's key behind "Python-urllib"). An agent magpie knows now
  reads "agent · key", as Usage's ledger rows already do; a script's
  key keeps the key's name alone. The tooltip names the agent once.
  The tray panel's stage and rows share callerName and read the same.

The icon comes from the embedded assets, which the web (Docker) build
serves the same way; the GUI test checks the image loads.

Run on mote:
- go vet ./internal/agent, GOOS=linux -tags nogui and GOOS=windows:
  ok. go test -count=1 ./internal/agent ./internal/usage: ok (agent 463s, usage 124s)
- TestDimCodeByUserAgent is red with the dimcode entry taken out
  (AgentOf("DimAgent/0.5.29") = "DimAgent").
- GUI, chromium and webkit, every language, 1100 and 420:
  routing-agent-with-key.test.cjs (new), i18n-keys, i18n-en-no-cjk:
  30 of 30 pass. Earlier, on mica, with the same client.js: the 28 other
  files that read callerKey, .rt-src, .ps-name/.ps-ag or .pr-who pass
  but api-key-usage (#7083) and usage-ledger's return-to-live case
  (#5048), both red on origin/main 2416beed6 too.
  routing-agent-with-key is red on the old client.js ('Magpie' for
  'DimCode · Magpie').

Not tried: a real DimCode against a real Docker magpie; the
User-Agents come from the published binary and the reporter's log.
2026-11-18 18:03:16 +08:00
yetone bdefdc3191 library: a repository's skills on skills.sh are one card, opened to install all or a few (Ethereal499 on X)
skills.sh lists a repository's skills one by one, so mattpocock/skills
showed as 55 cards side by side in Library > Skills > Discover. Two or
more listed from one repository are now one card, the repository, where
its first skill comes in the list: its name, how many skills the list
has, their names and their installs summed. magpie's own featured skills
and a repository with one skill listed keep their own cards. Only a
skill's own card asks for its about.

Opened (the card or its Choose...), the sheet shows the list's skills at
once, ticked, and reads the whole repository through Find skills' probe
(library/skills/probe): once it answers, every skill the repository holds
is listed, the list's still ticked, the ones the library has greyed, with
Select all and a filter past 8. Install takes the picked paths in one
skills/install. A repository too big to read whole (#2794) keeps the
list's skills, with the reason, and installs each as its card's Add does
(market/skill). The "in the library" list already groups skills by
repository (skillGroups), so it is unchanged.

Strings in zh, zh-TW, ja and de. No backend change.

Run (mote, at base 54117164c, which has the library plugin and GUI
tests as origin/main 2416beed6 has them):
- market-repo.test.cjs (new): 20 of 20, chromium and WebKit, five
  languages, 420px. With entriesOf's grouping turned off by hand, all
  10 chromium cases red.
- Every market-*, library-*, skill-* and i18n-* file (--test-concurrency=4,
  mote at load 40 to 67 with another session's GUI suite): 2434 of 2494.
  The reds' files, run again at base without this change: library-open-
  again (#6751), skill-fold-all (#6667), skill-group-shared (#6687) and
  skill-manual (#6668) red the same there. skill-where's "the switch
  scrolls nothing" (#5859) was red at base too, 2 of 4 runs interleaved
  with this change's. library-bili-settings (webkit zh-TW timeout) and
  market-have (chromium zh mcp mark, #4620) passed run again with it.
- go test -count=1 -timeout 45m ./internal/gui: ok.
- Real use: library.MarketSkills("mattpocock") in a sandbox HOME lists
  55 from mattpocock/skills and 39 from devcxl/mattpocock-skills-zh, and
  ProbeSkills("mattpocock/skills") reads 39 skills.

Not run: the whole GUI suite (mote had another session's running, mica
at load 63 on 12 cores); it runs after the push. Not tried in the real
app window or on Linux WebKitGTK; no motion was added.
2026-11-18 18:01:37 +08:00
yetone 71b8ab46c1 gateway: Codex's compaction on Open Design goes without empty tools, and its upstream_error is asked again (Mugenrikka on X)
Codex compacting on any Open Design model got 400 "[code=upstream_error]
Provider returned error" from amr-link, while other providers compacted.
Codex's compaction is its one request with "tools": [], and the summary
ask adds tool_choice and parallel_tool_calls beside them (#292). Since
plugins 0.1.13 / 48f976402 the Responses body is relayed to amr-link as
written, and an OpenAI-style validator refuses empty tools and a lone
tool_choice.

- passthrough: a Responses request to Open Design (its plugin, or a
  provider at amr-link.open-design.ai) goes without an empty tools list
  and the tool_choice/parallel_tool_calls beside it (withoutEmptyTools).
  A body that declares a tool is unchanged; every other upstream is sent
  Codex's shape as before.
- codexCompact: amr-link's "[code=upstream_error]" counts as
  upstreamFailed, so a summary still refused is asked as sent, then as
  text, then made locally, never handed to Codex as the 400.
  upstreamFailed is only used by the compaction ladder.

Run (mote; the suite at 54117164c, then rebased on 1bfa8d5a1 and
-run 'OpenDesign|Compact' ./internal/gateway run again there: ok):
- TestOpenDesignCompactionSendsNoEmptyTools and
  TestOpenDesignCompactionRefusedAsksAsText, built from Codex Desktop
  26.1007's real compaction (testdata/codex-26.1007-compaction.json)
  through the fake plugin as opendesign: both red on the old
  gateway.go/codex_backend.go with the reporter's 400, green with them.
- go test -run 'OpenDesign|Compact|LoneToolChoice|ToolsOff' ./internal/gateway ok.
- go test -timeout 45m ./...: every package ok.
- go vet (darwin), GOOS=linux -tags nogui and GOOS=windows vet of
  internal/gateway ok; gofmt -l clean.

Not tried: a real Open Design account (none here). Which of the empty
tools, the lone choices or the history's calls amr-link refuses is not
confirmed; the second change covers whichever it is.
2026-11-18 17:58:02 +08:00
yetone 1bfa8d5a18 gateway: the Codex app's list is asked again when the account lists a model it lacks (ANAGABRIELRLki on X)
OpenAI released GPT-6.2 Astra on 11-17. Beside a ChatGPT sign-in, the
Codex app's picker reads magpie-desktop-models.json
(model_catalog_json). That file is the ChatGPT backend's list,
which magpie keeps in memory (codexDesk) and asked for again only on a
sync, once it was an hour old. ANAGABRIELRLki's app had no GPT-6.2 until
they took the line out. The owner's machine shows the same class: the
account's own list (KeepAccountsListed, fetched 14:36) has gpt-6.1-terra
and gpt-6.1-sol, while the desk file and the gateway's
/backend-api/codex/models, asked as 0.165.0, have neither.

The list is now due (codexDeskDue) when any of these holds:
- it is an hour old (as before);
- it was asked for an older Codex version than magpie asks as now
  (provider.CodexVersionBehind; the backend lists a model only to a
  client new enough for it);
- the sign-in's own list magpie keeps (provider.CodexSignInListed) is
  newer and has a model the kept list doesn't.

A loop on the serving magpie (KeepCodexDeskFresh, every minute, only once
Codex has asked for the list) asks when it is due, and the rewrite reaches
the file through CodexDesktopChanged, as before. A failed ask is still
tried again after codexDeskRetry. Users with the old file get it rewritten
on the first answer after start (no list kept, as before) and from then
on while magpie runs. The Codex app reads the file at its start, so the
app-server restart magpie already offers is still needed to see it.
Inputs are read before codexDesk is held.

Run (mica, at 16e6bee32 on origin/main 48fffb60c): go test ./... -count=1
-timeout 45m: every package ok (gateway 1040s, provider 210s, agent 332s)
but three reds that are red alone on a clean 48fffb60c too:
- internal/dirent's watch tests (#7031);
- internal/gui TestGatewayModeListsNoOwnSessions (#7064: 1 of 6 red on
  main, 3 of 6 here);
- internal/sessions TestCodexPackedDelete, filed as #7082.
Also run: -race on the new and existing TestCodexDesktop* and the
provider's Codex version tests; gofmt -l; go vet (darwin) of gateway and
provider; GOOS=windows go vet ./...; GOOS=linux go vet -tags nogui ./...
After the rebase onto 2416beed6 (which changed gateway and provider): go vet of
both, -race TestCodex* in gateway and Codex* in provider, ok.
TestCodexDesktopCatalogAskedAgainForANewModel and
TestKeepCodexDeskFreshAsksWhenDue are new.
Broken by hand: with codexDeskDue back to the hour alone, the first goes
red ("the sign-in's newer list didn't bring the model: asks 1").
Seen on the owner's machine (read only): the live v0.1.4273 asked as
0.165.0, its desk file and models_cache.json lack gpt-6.1-*, which the
account's saved list has; some of its asks failed (EOF, deadline), which
left the frozen models_cache stand-in until the next sync.
Not tried: a real Codex app beside a ChatGPT sign-in with this build
(the backend refused TLS from this Mac's curl and Python today); the
fallback when the backend can't be reached still uses Codex's frozen
models_cache.json, which can lack a new model.
2026-11-18 17:43:17 +08:00
yetone 2416beed69 sessions: a tab's count is the rows it lists, and a Pi subagent's calls are no row delete can't find (lurx98 on X)
lurx98 on X (tweet 2122972281534402597): on the Sessions page the tabs
said Codex 6 and Pi 8. Codex, opened, said 0 and "no sessions yet"; Pi
said 6 from any other tab. Deleting a row titled "Task: 只读事实核对…"
toasted "no such session".

Two causes, both about one count path and the list disagreeing:

- Codex: agentCounts counted every rollout, while the list drops a
  subagent thread whose parent thread is gone (keptSubagents, 82f09e324:
  Codex App leaves them behind when a thread is deleted). Both now ask
  orphanSubagents; agentCounts reads the identities from the parses kept
  (codexIdentitySnapshot), so a rollout never parsed yet still counts
  until something reads it (Usage, the Codex tab).
- Pi: a pi-subagents scout runs as a Pi of its own and names its own
  session id to the gateway. The lead's row covers it (NativeIDs, its
  subIDs), and a tab not shown skips it, but the shown tab deduplicated
  gateway sessions only by its rows' own ids, so the scout's calls were
  a row of their own, titled by its "Task: …" prompt. Its count (rows)
  went up by those. Delete sent that id to the lead's files (the delete
  handler's NativeIDs path), where no session has it: "no such session".
  The shown tab now skips the same native ids as the counts and delete.

Test: TestSessionTabCountsAreTheirRows (internal/gui), built on the real
pi-subagents fixture (Pi 1.4.0, pi-subagents 0.88.1) with the scout's
calls through the gateway, and Codex App rollouts whose parent thread is
gone. It checks each tab lists the rows it counts, from every tab, and
that each listed Pi row deletes.

Run:
- Old code red: with both files reverted, 5 failures (scout listed as a
  row, codex 4 vs 2, pi 3 vs 2, delete "no such session"). Reverting
  only internal/sessions/manage.go: codex 4 vs 2. Reverting only
  internal/gui/sessions_manage.go: the Pi failures and "no such session".
- At 41b4edf87 (on origin/main 03314b25a), through mote-run: gofmt -l
  clean, go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows
  go vet ./..., go build, then go test ./... -count=1 -timeout 45m: 103
  packages ok, no FAIL (gui 203s, sessions 163s, gateway 1045s).
- Rebased onto 54117164c (gateway files only, none of these): go test
  ./internal/gui ./internal/sessions -count=1 ok again at the pushed head.
- No GUI script changed (client.js untouched), so no GUI suite run.

Not tried: the reporter's own files. The Codex fix needs the rollouts
parsed once (as above); and agents whose rows can be hidden
(GatewayHidden, uninstalled agents' Forget) still count hidden rows on
another tab, which the reporter's agents don't have.
2026-11-18 17:30:43 +08:00
yetone 54117164cd gateway: a Claude account Anthropic turned off moves on and rests as restricted
When Anthropic turns a Claude subscription account off, the request now
goes on to the routing group's next member and the provider's other
accounts, and the account rests as restricted (2h) instead of a short
failure rest. Before, a disabled organization's 400 ended the group at
that account and its next members were never asked (Ramon317317 on X),
and Claude Code's "account is on hold" came back from the bridge as a
502 that rested the account a minute and asked it again.

The words (claudeOffWords, routing.go): "This organization has been
disabled." (400 invalid_request_error or 403), "account is on hold and
can't use Claude Code" (the bridge now answers it as a 403),
"organization has disabled Claude subscription access", "OAuth
authentication is currently not allowed for this organization", and
"account can't receive replies from Claude" (either apostrophe, or
"cannot"). claudeAccountOff scopes them to a Claude subscription account
or a key on api.anthropic.com. A relay's same words are about the
relay's own account behind it, so they stay ordinary failures there, as
on Codex. The extra-usage and Usage Policy refusals are not account
faults and are unchanged. riskRefused keeps the provider's other
accounts in, as for Google's suspension.

Docs: claude-subscription-bridge.md and gateway-routing.md updated.

Run at f357a5e25 (this commit on origin/main f7e0f68ca), on mote:
- new tests (TestClaudeAccountOffMovesToNextAccount,
  TestClaudeOrgDisabledGroupMovesOn, TestClaudeAccountOffScoped):
  51 PASS lines, 0 FAIL.
- Broken by hand: routing.go, fallback.go and claude_subscription.go put
  back to the parent's, with a claudeAccountOff stub returning false so
  the test compiles: all 3 tests fail, 35 FAIL lines (32 subtests), 16
  pass.
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok.
- go test ./... -timeout 45m: every package ok (103 ok lines), rc 0.

Then rebased on origin/main a2d402afe (six commits, internal/gui, site/
and docs/ only) and run again at the pushed head, on mote: gofmt -l
nothing; go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows
go vet ./... ok; go test -count=1 ./internal/gateway ./internal/gui ok.
Rebased again on 1318864d1 (internal/agent, internal/provider,
internal/sessions; none touched here) and run at this head: gofmt and
the three vets as above ok; go test -count=1 ./internal/gateway
./internal/provider ok.
main moved once more (3e66d25d8, 03314b25a: internal/agent, catalog,
gui import links, provider's CC Switch import; none touched here), and
this pushed head was run with gofmt, the three vets ok and the new tests
(51 PASS, 0 FAIL); the gateway package as a whole last ran at 1318864d1.

Not counted: an earlier full run on mica at an older base was voided
because mica's disk filled mid-run (253 "no space left on device"
failures). Its three internal/dirent reds (TestWatchesFromOneMarkProbeOnce,
TestWatchedFolderReadOnlyWhenChanged, TestFileHeldOpenStillSeen) did not
come back in the mote run above. mote's 1-minute load was ~39 on 18 cores
during the run, with no other full suite there.

Not tried: a real disabled or on-hold Claude account; the bodies are
from Claude Code's errors page and users' reports.
2026-11-18 17:09:18 +08:00
yetone 03314b25a4 import: magpie no longer registers CC Switch's ccswitch:// scheme (asombrado_a on X)
889758605 (v0.1.3981, coder_shaun on X asking for one-click import from
relays' CC Switch links) made magpie claim ccswitch:// on every system:
Info.plist on macOS, HKCU\Software\Classes\ccswitch on Windows, and
magpie-ccswitch.desktop on Linux. That scheme is CC Switch's, and magpie
claiming another app's links is not something it should do (asombrado_a
on X: "Magpie为啥要注册 ccswitch://协议的深链").

From this version magpie registers magpie:// only: the ccswitch entry is
out of Info.plist, and the Windows and Linux registration is back to what
it was before 889758605. A start doesn't touch what an older version wrote
(the owner's call); uninstall still takes it out while it is magpie's, as
before. The ccswitch:// parser (importccswitch.go, its test and CC
Switch's example links) goes with it: with nothing registered, no link
reaches it, and ParseImport, ImportLink and `magpie import` take magpie://
links only. The docs' "CC Switch links" paragraph is out in en, zh and ja,
and llms-full.txt and the search indexes are regenerated.

TestRegisterScheme now holds that registration never asks about or claims
x-scheme-handler/ccswitch, and TestImportLink that a ccswitch:// argument
is not taken as an import link.

Run at this commit's tree (rebased on 1318864d1), on mica (mote's load was
38): gofmt clean; go vet darwin, GOOS=windows
(gui, uninstall, provider), GOOS=linux nogui (provider, uninstall);
go test provider, gui, uninstall, cli ok; node --test site/*.test.mjs
135 pass. Linux (wsl-run, magpie-desktop, -tags gtk3), at the tree before the rebase
(the scheme files are the same at this one): provider, uninstall ok; gui ok
except TestClipboardReadBack/copies_after_a_read_back,
which fails the same on origin/main 3ec89c522 (probe segfault, #7073); at this tree TestRegisterScheme*, TestImportLink
and TestImportIsReadOnce ok.
Pushed on 3e66d25d8, which landed after the run and changes internal/agent
only; not run again with it.
Not tried: a real Windows or Linux desktop with an older magpie's
ccswitch registration, which this leaves in place; macOS Launch Services
dropping the scheme once the updated bundle replaces the old one.
2026-11-18 16:52:58 +08:00
yetone 3e66d25d84 agent: OpenCode's limit keeps models.dev's context and input apart
Nepsama1337 on X: magpie 0.1.4414 wrote gpt-6.2-sol into OpenCode's
config as limit {context: 922000, output: 128000}. models.dev gives
{context: 1050000, input: 922000, output: 128000}. magpie's
catalog.Model.Context is the prompt window, so it prefers models.dev's
input, and the opencode shape wrote that number as context and
dropped input.

What OpenCode reads, checked in anomalyco/opencode on dev:
packages/schema/src/config/provider.ts and
packages/core/src/v1/config/provider.ts take limit {context, input,
output}. session/compaction.ts uses min(input, context) when both are
there. OpenCode 1's models.ts (8df09abb1) has input too, and its
compaction uses limit.input || context - output.

catalog keeps the whole window that models.dev pairs with each input
cap (WholeOf, voted the same way as the windows and looked up through
the same renames). The opencode shape now writes {context: whole,
input: prompt window, output} when the catalog gives a wider whole
window, and {context, output} as before otherwise. A user's own
context for a model (Contexts) has no pair, so it stays a plain
context. This shape serves OpenCode 1 and 2, MiMo Code, DevEco, Air
and OpenChamber. OpenCode 2's converter copies limit whole, so input
reaches it too.

Agents with one window field (Crush's context_window, droid, Cline and
the rest) get the prompt window, which is right for them. ZCode and
MiniMax Code also write {context, output}, but their schemas can't be
checked: #7060.

Run:
- TestOpenCodeLimitKeepsContextAndInput is red on the old agents.go
  (relay/gpt-6.2-sol: limit {"context":922000,"output":128000}) and
  green with the fix. It covers the paired model, a model with no
  input cap, a user's own context, and openCodeNative.
- go test -run 'TestOpenCode' ./internal/agent on mote: ok.
- Real OpenCode 1.19.5 on mote, sandbox HOME: `opencode models magpie
  --verbose` lists gpt-6.2-sol with limit {context 1050000, input
  922000, output 128000}.
- Full suite, go test -timeout 45m ./... on Linux (magpie-desktop, at
  48fffb60c plus this change; mote and mica were over their cores):
  every package ok except internal/usage's
  TestRequestStateKeptAcrossACatalogFetchedAgain, red on the old code
  too (#6572). The three GUI-linked packages need -tags gtk3 there:
  . and internal/cli ok; internal/gui's TestClipboardReadBack
  segfaults under WSLg (#7074), the rest ok.
- go vet ./... on Linux (-tags gtk3) and on Windows: ok. gofmt -l:
  clean.

After rebasing onto 1318864d1: internal/agent and internal/catalog ok on Linux.

Not tried: a real OpenCode 2 run (its schema was read from source),
ZCode and MiniMax Code (#7060), and the macOS full suite.
2026-11-18 16:51:14 +08:00
yetone 1318864d1b provider: Factory's mover takes opencode-factory-auth 0.1.48
The factory plugin used one x-session-id for every request of its
process. 0.1.48 gives each conversation its own, and each subagent in
it, as droid opens them. With one shared session, Factory now and then
answered Gemini 4 Argon, Hydrogen and Carbon with 400 "Invalid model ID
in request body" (marovole on X; magpie-community/plugins 63c2ff93).
keepMovedCurrent updates every moved user to it.

npm view @magpie-community/opencode-factory-auth version --prefer-online
gives 0.1.48.

Run (mica): gofmt -l internal/provider is clean; go vet ./internal/provider;
go test -timeout 45m ./internal/provider is ok (148s, at this head after the rebase). The plugin's own
run is in its commit: the plugins suite has 9055 pass and 0 fail, and
the new session test is red on 0.1.47.

Not tried: a real Factory account. None is here, so the refusal was not
reproduced against Factory itself.
2026-11-18 16:41:37 +08:00
yetone 3ec89c5224 codex: the takeover's end waits for the chats on magpie the Codex app has open (milianxinqi on X)
milianxinqi on X, the Codex app: "Model provider mismatch. This chat uses
magpie, but your current provider is OpenAI. Switch to magpie to
continue." ("用的好好的,codex 突然就弹这个了"), with nothing disconnected.

Cause. With the ChatGPT account Codex is signed in to held (out of its
allowance and credits), magpie is Codex's provider (the codex.out
takeover, #540) and new chats start on magpie. When the account has room
again (its window's reset, a switch to another account, or the account
the user keeps Codex on, a5e3972a7), Sync ended the takeover at once:
model_provider out of config.toml, Codex back on OpenAI. The Codex app
keeps the app-server the takeover started (codexAppStep leaves it
running unless Restart the Codex app to follow is on, off by default,
#4550), with its chats loaded and each one's writer lock held, so
bringBack could move none of them and codexRetagOpenThreads never ran
(it runs only before magpie ends the app-server). Every send in an open
chat then met the mismatch, with no step of the user's.

Fix. outStays (agent/codex.go): the takeover's end in Sync, both the
out_own way back and #540's, waits while a Codex holds a chat on magpie
open or wrote to one in the last minute (codexHeldOnMagpie:
sessions.CodexThreadsBusyOnBut, T3 Code's own threads left out, as
codexRetagOpenThreads leaves them), and codexThreadsLater asks for the
Sync that ends it once they are let go; bringBack then moves them onto
OpenAI. Meanwhile magpie serves them on the account, which has room, and
the app on the takeover's app-server shows no account either way. Nothing
waits when the app-server is restarted for the change (Restart the Codex
app to follow on, provider.CodexRestartsApp) or the user turned the
takeover off (Always ChatGPT): that restart moves the open chats first.
The [model_providers.magpie] table already stays after a Disconnect, so
an old thread still opens; a deliberate Disconnect restarts the
app-server (byHand) and retags its chats.

Other paths looked at and left: Disconnect, Unwire, Join and Codex's
account switch go through the same bringBack/retag; RestoreOnQuit (off by
default) runs at quit only; the update restart hands the gateway over on
macOS and Linux and skips it. On Windows a restart runs RestoreOnQuit
when it is on: filed separately.

Tests:
- TestCodexTakeoverWaitsForTheOpenChat (new): takeover, a chat on magpie
  quiet but its lock held, account back: still magpie's provider, the
  chat on magpie, no Sync asked; lock let go: a Sync asked, which ends
  the takeover and moves the chat to openai.
- TestCodexTakeoverEndsAtOnceWhenTheAppFollows (new): with the app
  restarted for the change, nothing waits.
- TestCodexTakeoverThreadComesBackOnceQuiet (nb5p): now the takeover
  stays while the thread is written to, and ends at the later Sync.
Broken by hand: outStays' gate taken out of Sync: the new test and nb5p's
red ("Codex was put on OpenAI under it"), green with it.

Run (mica, mote over its load, at this tree on origin/main 48fffb60c):
- go test -count=1 -timeout 45m ./internal/agent ./internal/sessions
  ./internal/provider: ok (426s, 1917s, 237s).
- go vet of those on darwin, GOOS=windows, GOOS=linux: ok. gofmt -l clean.
- Rebased onto origin/main a2d402afe (provider and sessions changes
  elsewhere): go build ./..., go vet of the three, and the takeover,
  thread-move and retag tests of internal/agent and internal/sessions
  again: ok.

Not tried: the real Codex app through a real reset (needs an account
held then given room); a full ./... run (mica had another session's full
suite and GUI suite running).
2026-11-18 16:33:04 +08:00
yetone a2d402afe0 gui: the Mac's tray panel sits at a menu bar extra's level, so a screenshot tool draws over it (zyh6036 on X)
zyh6036 on X: the menu bar panel stays so far in front that even
WeChat's screenshot can't cover it, so it's hard to take a picture of.

The panel asked for AlwaysOnTop (NSFloatingWindowLevel, 3), but Wails'
SystemTray.PositionWindow sets the window it places to
NSPopUpMenuWindowLevel (101) every time (systemtray_darwin.m), and magpie
places the panel with it on each open and each resize. The live app's
panel read layer 101 in CGWindowList. Nothing in magpie's history chose
101 (git log -S finds only AlwaysOnTop, from the first commit).

placeByIcon now does PositionWindow and then sets NSStatusWindowLevel
(25), the level of the status bar itself: still over normal windows,
floating ones, the Dock (20) and the menu bar (24), and still on every
Space and over full-screen apps (the collection behavior is unchanged,
#2141), but under pop-up menus and anything a screenshot tool puts up at
25 or above. Both PositionWindow calls (togglePanelNow, sizeOpenPanel)
go through it. Other systems: setPanelLevel is a no-op.

What was run (mica, macOS 27, at 48fffb60c + this change; the panel tests again at the rebased head):
- TestPanelJoinsFullScreenSpaces now has a real SystemTray, places the
  panel through placeByIcon and checks the level is
  NSStatusWindowLevel. Broken by hand (setPanelLevel call removed): red,
  "the panel is at level 101". Restored: green.
- A real build in a sandbox HOME (MAGPIE_ADDR 127.0.0.1:3536),
  `magpie panel`, with a tiny AppKit helper: CGWindowList front to back
  read the panel (439x521) at layer 25 over a normal titled window
  (layer 0); a full-screen borderless overlay at NSScreenSaverWindowLevel
  (1000) shown after it was in front of the panel, and so was one at
  NSStatusWindowLevel (25) shown after it, as a screenshot overlay is.
  Before the change the panel was at 101, over the one at 25.
- go test -count=1 -timeout 45m ./internal/gui: ok (714s). An earlier
  run of it had two source guards (panelside_test.go) reading the old
  PositionWindow call, updated here, and TestGatewayModeListsNoOwnSessions
  red under load ("listing":true, the search asked before the list was
  read), green alone: filed as #7064.
- go vet ./internal/gui on darwin, GOOS=windows, and Linux in WSL
  (magpie-desktop, -tags gtk3): ok. gofmt -l: clean.

Not tried: the panel over a real full-screen app. mica's and mote's
screens are locked, and a window there doesn't enter full screen; the
full-screen guarantee is the unchanged collection behavior, which the
same test still checks. WeChat itself: not installed on any test Mac,
so its overlay's level isn't known; if it is below 25 this doesn't
reach it, and the reply asks the reporter to say.
2026-11-18 16:30:23 +08:00
yetone 534b85bf99 gui: an unset Claude Code tier's effort reads "follows session"; a set one says it wins
lightwlh on X: Claude Code's Details shows an effort beside each tier
(Opus, Sonnet, Haiku, Fable) and another under New sessions, and asked
which one wins when they differ. A tier's effort is written into its
model id as <model>:<level> (tierWith in internal/agent/claude.go), and
the gateway asks that model at that level whatever Claude Code asked
(askedAt); the New sessions effort is Claude Code's own (effortLevel /
CLAUDE_CODE_EFFORT_LEVEL), which /effort changes, and reaches only the
tiers with none of their own. The page didn't say so: an unset tier's
effort read "default", like a level of its own.

- An unset tier's effort button reads "follows session" (跟随会话,
  跟隨會話, セッションに従う, wie Sitzung) instead of "default"; its
  title still names the effort Claude Code asks for.
- A set tier's title adds "Used whatever the session's effort or
  /effort is".
- New sessions' effort, while any tier has its own, adds "A tier with an
  effort of its own runs at that one" to its title; both follow a pick
  in the slider at once (the slider's field is a copy, so the check
  reads the picked value).
- No layout change: the same buttons and lines; the subagents' effort
  and the tray panel's tiers' square are unchanged.
- app.js +485 and the core +843 bytes of code, budgets raised with the
  reason: connectPanel and the effort slider draw every agent's Details,
  so there is no page to move it to; the words share one ownSaid.

Run (mote, at this tree rebased on de5fc6700):
- node --test tier-effort, claude-subagent-effort-row, wsl-claude-tiers,
  claude-effort, subagent-effort, panel-effort, agent-tweak-fold,
  i18n-keys, gui-ja, gui-zh-tw, i18n-en-no-cjk: 124 pass 0 fail
  (Chromium and WebKit; tier-effort's narrow 560px case now in all five
  languages, each tier's effort on its model's line, no sideways scroll).
- Broken by hand: tier-effort against origin/main's app.js, 4 of 4 of
  the pick tests red (no "follows session", no wins line).
- go test ./internal/gui: ok (TestCoreScriptBudget red before the raise).
Not run yet: the whole GUI suite (mote and mica each had another
session's full suite running); it runs after the push.
2026-11-18 16:24:12 +08:00
yetone de5fc6700e docs: Claude Code's Code Mode needs a direct Anthropic connection (#7025)
lst016 (#7025) and DylanH_L on X asked for Code Mode through magpie.
Claude Code 2.1.327 decides it in its own start-up check, read in its
bundle: Code Mode is refused with "provider" unless the provider is
firstParty and ANTHROPIC_BASE_URL is unset or its host is exactly
api.anthropic.com (nc()/fd()); then with "credentials" for an
apiKeyHelper or a custom Authorization/X-Api-Key header, "no_flags"
when DISABLE_TELEMETRY, DO_NOT_TRACK or
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC stops the feature-flag
download, and "gate" unless Anthropic's tengu_rustling_blossom flag is
on for the account. Nothing magpie sends or answers can change it: the
base-URL check runs before any request.

So every routed Claude Code (any upstream, a Claude subscription's or an
Anthropic key's model included) starts without it. The subscription
bridge's own runs can't have it either: --tools leaves REPL out, it reads
no user settings, and Code Mode needs an interactive opt-in and restart.
Faking a first-party address would misrepresent the client to Anthropic,
so it isn't done. The docs page says so in en, zh and ja, with the way to
use it: Claude Code on its own model, straight to Anthropic, with
Claude Code's telemetry left on (magpie's switch sets DISABLE_TELEMETRY).

Run:
- real Claude Code 2.1.327 in tmux, sandbox HOME and CLAUDE_CONFIG_DIR,
  ANTHROPIC_BASE_URL=http://127.0.0.1:59998,
  CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1: "Code Mode (experimental) isn't
  available: for now it only works directly with the Anthropic API".
- node docs-index.mjs (search indexes, llms-full.txt, docs-index.sums).
- on mica: node --test site/search.test.mjs site/worker.test.mjs
  site/docker-tags.test.mjs, 50 pass 0 fail; go test ./internal/testenv ok.
Not tried: a direct Code Mode session on a real account (it needs
Anthropic's account gate; nothing in magpie is on that path).
2026-11-18 16:15:36 +08:00
yetone 67f24d7422 usage: every cache hit rate to two decimals, its exact share on hover; a speed's dash says why
shangyuan0818 on X: in Usage › Requests the ranking's model hit rates
had no decimals or one ("98%" beside "99.6%"), the request table mixed
them too, and hovering showed no exact value.

- hitPct gives every hit rate two decimals (98.00%, 99.60%), the same
  in the ranking, the request table and its details, the Cache hit
  rate card, the cache-read tiles, the model and agent rows, Sessions,
  the tray panel, Routing's rows, figures and group averages, and the
  context window's Prompt cache. It still never says 100.00% or 0.00%
  of a prompt not all or none cached (99.99%, 0.01%).
- Each of them has the exact share on hover, in its title (hitTip):
  "9,800 of 10,000 prompt tokens read from the cache: 98%", the share
  to six places with no trailing zeros. One new string, translated in
  zh, zh-TW, ja and de.

ohblue on X: 速度 shows "—" for many 200 requests (491 in, 93 out,
first token 6.3s, total 6.4s), "≥133 token/秒" for others.

- That speed can't honestly be counted: 93 tokens in the 120ms after a
  6.3s wait would read ~775 tok/s, which is a reply written during the
  wait and let go at once (ledHeldShort_). The dash already had its
  reason as a title, but nothing showed it was there. It now has the
  help cursor (the cache column's dash too), the Speed column's head
  says what a speed is on hover, and a request's details say "— " and
  the reason in words, for a reader who can't hover.

Budget: app.js and the core grew by my hitTip, cacheHitTip and the
titles. To stay inside both budgets with no raise, setQuotaRange moved
to plugins/usage/page.js and PLACEHOLDER to plugins/redact/page.js (each
read by that page alone), cacheHitOf and cacheHitTip share cachePrompt,
and hitPct is one expression. Core 1,272,578 of 1,272,581; app.js
1,087,887 of 1,088,248.

Run on mote/mica, this change on origin/main, both engines, every
language, at the widths each file covers:
- usage-hit-exact.test.cjs (new): green. Red with the old hitPct
  ('hit rate 98%') and red with the help cursor and the details' line
  taken out ('pointer' !== 'help').
- 85 GUI files (every test that reads a hit rate, quota range or
  masking, Usage, Routing, i18n-keys, gui-ja/de/zh-tw): 1318 pass, 30
  fail. All 30 are red alike without this change, and all are filed:
  agent-menu-label webkit panel (#6371), zcode-models webkit de
  (#6566), quota-credits (#6807), quota-curve (#6789), usage-fold's
  17 subscriptions (#3415, #6003), usage-ledger (#4078, #3104, #4626),
  usage-ledger-chart (#6790). usage-fold's 'several accounts' went red
  only under the 85-file run and passes alone on this tree (#3415,
  commented).
- go test ./internal/gui on mica: ok (TestCoreScriptBudget included).
- Red alike on a HEAD checkout without this change, already filed:
  usage-ledger "newest live route needs no return-to-live button"
  (#4078, #3104, #4626), usage-ledger-chart "the metric is remembered"
  (#6790).

Not run before the push: the whole GUI suite and go test ./... (both
machines had other sessions' full suites running); they run after it
and their result goes on record. Not tried: Windows WebView2, the
reporters' own ledgers, the real app.
2026-11-18 16:14:52 +08:00
yetone c5cb1c0588 gui: the tray's logo is 16pt, as large as other apps' menu bar icons
qingnianxiaozhe on X: magpie's A\ in the menu bar looked a size smaller
than another app's A\ beside it. magpie fitted each logo to a 14pt box,
so the A\ (about 1.37:1) drew 14x10pt. Claude.app's menu bar template
(TrayIconTemplate@2x.png, 48x48 px) has 32x32 px of ink, a 16pt glyph,
and in the reporter's screenshot the other A\ is 32x22 px against
magpie's 28x20 px at 2x. mpLogo is now 16; the letter in a ring (a logo
that can't be read) grows with it. The two 10pt rows of percentages are
unchanged and still fit the 22pt bar.

Tests: the logo boxes in the tray tests follow the 16pt box (offsets 28
-> 32, 34 -> 38 px at 2x); TestTrayImageLogoSizes now wants 27-33 px of
a 32 px box.

Run on mote (macOS 27.2):
- go test ./internal/gui -run Tray -count=1 -v: ok.
- Broken by hand (mpLogo back to 14): TestTrayImageLogoSizes FAILs
  ("alma spans 24 px of a 32 px box", codex/zcode/workbuddy 26 px) and
  TestTrayImagePlain FAILs ("238 px with logos, 182 without").
- Rendered by the real drawing code (trayImagePNG, 22pt bar at 2x)
  next to Claude.app's own template icon: the A\ is 28 px wide before
  and 32x24 px of ink after, as wide as Claude's 32 px spark; the
  percentages are the same text at the same size. The before/after
  strips are kept outside the repo (tray-toolbar-scratch/before and
  after/strip-{light,dark}.png).
Suite and checks, on mote at aa31e737c8d271455865615fafdf512e09073663 (this commit and its pair, the
tray logo size / the toolbar menu):
- go test -count=1 -timeout 45m ./... in a sandbox HOME, caches pinned:
  exit 0, 103 packages ok, none FAIL (internal/gateway 1633s,
  internal/agent 949s, internal/provider 470s, internal/gui 295s).
- gofmt -l internal/gui: nothing. go vet ./..., GOOS=linux go vet -tags
  nogui ./..., GOOS=windows go vet ./..., go build, GOOS=linux go build
  -tags nogui, GOOS=windows go build: all ok.
- No GUI asset changed, so the Playwright suite wasn't run.
After a rebase onto 42c43c002 (Antigravity sessions, internal/gui
sessions reads; no file in common), at the pushed head:
go vet, GOOS=windows and GOOS=linux -tags nogui go vet of ./internal/gui/...
and go test -count=1 ./internal/gui/...: ok.
Then rebased onto f7e0f68ca (Codex instructions, internal/provider
only), not run again.

Not tried: a screen screenshot of the real menu bar (no Screen
Recording permission over ssh on mote; the image is the one the app
hands NSStatusItem); the reporter's notch Mac, where the bar is 24pt.
2026-11-18 16:08:15 +08:00
yetone add1e75ee3 gui: no Icon and Text menu on a right-click by the traffic lights
AlanWang1027713 on X: a right-click on the main window's title bar, by
the lights, offered "Icon and Text / Icon Only / Text Only". It comes
from the empty NSToolbar that MacTitleBarHiddenInset puts there to
inset the lights; NSThemeFrame's menuForEvent: lists its display modes.
insetLights takes the toolbar away only in the macOS 26 design, so on
macOS 27, with an older SDK and in a right-to-left layout the toolbar,
and its menu, stayed.

quietToolbar turns the menu off where the toolbar stays:
allowsDisplayModeCustomization = NO (macOS 15+), and AppKit's own
_setWantsToolbarContextMenu: NO for macOS 12-14, each looked up with
respondsToSelector, since the SDK that builds magpie may be older than
the system it runs on. Nothing about the title bar's shape changes.

windowshape.Of now reads the menu a right-click 20pt below the top,
120pt in, gets from the window frame (TitlebarMenu), and
TestMainWindowCorners and TestMainWindowRightToLeft fail when the main
window gets one, or when the reference toolbar window doesn't (so the
probe is proven to see it).

Run on mote (macOS 27.2), real makeMain window:
- go test ./internal/gui -run 'TestMainWindowCorners|TestMainWindowRightToLeft'
  -count=1 -v: ok. Each stage logs "title bar menu []" next to the
  reference toolbar window's ["Icon and Text" "Icon Only" "Text Only" "-"]
  (macOS 26 SDK) and ["-"] (macOS 15 SDK). Lights [[26 26] [49 26] [72 26]],
  66pt title bar and 16pt corners with the 26 SDK, [[19 19] [39 19]
  [59 19]] and 38pt with the 15 SDK: the same as without the change.
- Broken by hand (quietToolbar call taken out): both FAIL, "a right-click
  on the title bar gets a menu: ["Icon and Text" "Icon Only" "Text Only"
  "-"]" (26 SDK) and ["-"] (15 SDK).
- A probe app on mote: either switch alone empties the frame's menu.
Suite and checks, on mote at aa31e737c8d271455865615fafdf512e09073663 (this commit and its pair, the
tray logo size / the toolbar menu):
- go test -count=1 -timeout 45m ./... in a sandbox HOME, caches pinned:
  exit 0, 103 packages ok, none FAIL (internal/gateway 1633s,
  internal/agent 949s, internal/provider 470s, internal/gui 295s).
- gofmt -l internal/gui: nothing. go vet ./..., GOOS=linux go vet -tags
  nogui ./..., GOOS=windows go vet ./..., go build, GOOS=linux go build
  -tags nogui, GOOS=windows go build: all ok.
- No GUI asset changed, so the Playwright suite wasn't run.
After a rebase onto 42c43c002 (Antigravity sessions, internal/gui
sessions reads; no file in common), at the pushed head:
go vet, GOOS=windows and GOOS=linux -tags nogui go vet of ./internal/gui/...
and go test -count=1 ./internal/gui/...: ok.
Then rebased onto f7e0f68ca (Codex instructions, internal/provider
only), not run again.

Not tried: a screen screenshot (screencapture over ssh has no Screen
Recording permission on mote; the menu is read from AppKit instead);
macOS 12-14, where only the private selector applies.
2026-11-18 16:08:15 +08:00
yetone f7e0f68ca2 codex: GPT-6.2's instructions go first in the input, where its cache keeps them
From GPT-6.2 on, OpenAI reads a Responses request's top-level
instructions after its input, not before it (prompt caching guide:
"instructions ... appended to the end of the input" for gpt-6.2 and
later), so they sit past the cached prefix and are billed uncached on
every turn. Codex itself sends no top-level instructions: client.rs puts
its base instructions first in the input as a developer message
(BaseInstructionsFragment, codex-rs/core/src/client.rs).

magpie sent Codex's instructions on top for every ChatGPT-account
request that is not Responses Lite: Claude Code, OpenCode, Pi and other
translated agents through a codex account, and Codex CLIs older than
Lite. Measured on a real ChatGPT account, third turn of a growing
conversation: gpt-6.2-sol cached 1,920 of 8,271 input tokens with the
instructions on top, 6,016 with them first in the input; gpt-6-sol
cached 5,632 of 6,843 with them on top (the old order still works
there). Reported on X by Anotiaww (Codex hit rate looked low).

- codexBody: for a GPT-6.2+ model Codex's instructions, and a client's
  own, go first in the input as developer messages, and the request
  carries no instructions field. Older models are unchanged, and Lite
  turns (no instructions at all) are unchanged.
- siwcBody (Sign in with ChatGPT API path): the client's instructions
  go first in the input for GPT-6.2+.
- buildResponses (Chat/Anthropic translated to Responses, any host):
  the system prompt goes first in the input for GPT-6.2+.
- InstructionsAfterInput names the models: gpt-N.M with N.M >= 6.2,
  gpt-7 and later, after a provider prefix; gpt-6, gpt-6.1, gpt-5.x,
  o-series and other vendors' models keep top-level instructions.

The instruction text itself is unchanged; only where it sits moves.

Run (mote, at this tree on origin/main 48fffb60c):
- go test -count=1 -timeout 45m ./...: all 103 packages ok
  (internal/gateway 1602s, internal/provider 463s).
- go vet ./internal/provider ./internal/gateway on darwin, linux and
  windows: ok. gofmt -l: clean.

Broken by hand, then put back: InstructionsAfterInput returning false
turns TestInstructionsAfterInput, TestCodexBodyInstructionsFirstIn-
InputOnGPT62, TestSiwcBodyInstructionsFirstInInputOnGPT62 and
TestResponsesSystemFirstInInputOnGPT62 red.

Not tried: a real Claude Code or OpenCode session through magpie on
gpt-6.2 (the live app lists no gpt-6.2 model here); the cache numbers
above are from direct requests to the ChatGPT backend in both orders.
2026-11-18 16:04:56 +08:00
yetone 42c43c0020 sessions: an agent found after Allow selected is asked about once (Antigravity 2.0)
baysonfox on X: Antigravity 2.0 desktop sessions showed on the Sessions
page only while the app was connected to magpie; agy CLI's always showed.

Cause: not the file reader. Real Antigravity 2.30 (signed out, no model,
sandbox HOME on the Windows box) writes ~/.gemini/antigravity/
conversations/<id>.db, conversation_summaries.db and brain/, and
internal/sessions parses them. The gate is settings.SessionReads:
"Allow selected" (and the Usage readsNote's "Count …") saves all:false,
so an agent installed after that choice is never read and never asked
about again. Gateway-recorded sessions skip the gate, hence "only when
connected".

Fix: /api/sessions/reads marks a found agent `new` when the choice was
made, it isn't read, isn't named in Agents and is on disk (Found(), which
checks every OS's path). The Sessions page shows one quiet card for those
(laterCard): "Show their sessions" names each on, "Keep off" names each
off, so it isn't asked again. No new endpoint; the card posts the
existing sessions/reads.

Tests: TestSessionReadsNewAgent copies the real 2.30 files
(internal/sessions/testdata/antigravity-2.30, sandbox paths only, no
tokens) beside agy-sessions, with agy allowed by name: antigravity is
off and new, nothing listed; after the answer it is not new, settings
keep all:false/agy:true, and its one session is listed only when shown.
TestSessionReadsNewOnlyWhenNamed: not asked, allow all, all with agy off
mark nothing new. sessions-reads.test.cjs: the card, both answers, posts
and no card after reload, Chromium and WebKit, 5 languages, 900/390px.

Run at d7d62d889, on mote, then rebased onto 48fffb60c (app.js and
settings-groups only, no file in common):
- gofmt -l, node --check client.js/i18n.js: clean
- go vet ./internal/gui ./internal/sessions; GOOS=linux -tags nogui and
  GOOS=windows go vet of the same: ok; go build .: ok
- go test -count=1 ./internal/sessions: ok (282s)
- go test -run 'TestSessionReads|TestCoreScript|TestI18n|TestCSS'
  ./internal/gui: ok
- GUI: sessions*.test.cjs (45 files), usage-reads-note,
  gateway-mode-sessions, i18n-keys, window-back-once: 711/711 pass
Broken by hand: New forced false, TestSessionReadsNewAgent red in both
subtests ("want off and new"). An earlier "Allow" button label was red
in i18n-keys (core word, internal/agent/reach.go), hence the label.
Not run: the whole GUI suite and the full go test ./... (mote and mica
were overloaded, mica's disk full). Not tried: a real Antigravity 2.0
on macOS/Linux; Found() paths for those come from the existing reader.
Not changed: the Usage page's readsNote still shows only before the
choice; Found() doesn't look into WSL distros.
2026-11-18 16:04:10 +08:00
yetone 48fffb60c5 gui: the provider editor waits for its Advanced headings before it draws (#7051)
31575f71a grouped the editor's Advanced rows from advgroups.js, imported
as Providers first draws. An editor opened before the import landed drew
its rows ungrouped and moved them under headings a moment later, so a
reader saw the rows jump and settings-groups read either order (red 6 of
14 on origin/main 61c714ed0, both engines, en and zh).

renderProviders now waits for the import (a local file, a few ms) before
it draws an open editor, and groupAdvanced groups in the same draw. A
failed import draws the editor ungrouped rather than not at all.
settings-groups lists Claude's rows in the grouped order.

Run (mote, at this tree):
- settings-groups 3 runs, advanced-headings, provider-prefs,
  settings-search, provider-unsaved-paths, Chromium and WebKit: all pass
  (14, 10, 20, 18, 4).
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS': ok.

Broken by hand, then put back:
- the wait removed and the import held 400ms: settings-groups 6 of 14 red.
- the wait kept and the import held 400ms: settings-groups and
  advanced-headings green.

Not tried: the real app window, the full GUI suite.
2026-11-18 14:56:22 +08:00
yetone 42181fdd27 gui: the Claude provider's run field is named Claude requests, not Claude Code
The Claude provider's editor had a field under Advanced named "Claude
Code", the same name as the agent's own sheet on the Agents page, so
two different places read as one. The field says how magpie sends
requests to Claude (its run row), so it is now "Claude requests": zh
Claude 请求, zh-TW Claude 請求, ja Claude リクエスト, de
Claude-Anfragen. The name was also the only field label left
untranslated. The Agents page's Claude Code is unchanged.

claude-extra-usage-setting checks the field's name in each language.

Run (mica):
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS':
  ok, at this change rebased on 31575f71a.
- claude-extra-usage-setting, provider-prefs, i18n-keys there: 46 of 46.
  settings-groups: 6 of 14 red, the same as origin/main 61c714ed0, where
  31575f71a's Advanced headings land before or after the first draw and
  Claude's rows change order (#7051). Before 31575f71a, at 433814799,
  settings-groups was 14 of 14 with this change, alongside
  claude-lean-prompt-setting, settings-search, gui-de and nav-timeout.
- Rebased again onto 61c714ed0 for the push; not run again there.

Broken by hand, then put back: the old untranslated "Claude Code"
label, claude-extra-usage-setting 20 of 20 red.

Not tried: the real app window, the full GUI suite.
2026-11-18 14:41:21 +08:00
yetone 61c714ed01 sessions: By tokens selects the small sessions, to delete them at once
A user asked for a way to delete every session under 10K or 20K tokens
(yansheng1003 on X). Selecting sessions on the Sessions page now has a
"By tokens" button beside Delete. It opens the app menu (openProtoMenu,
no native select) with 10K, 20K, 50K and 100K, each showing how many of
the sessions on screen it would select. A pick replaces the selection
with the deletable rows on screen (search and filters apply) that used
fewer tokens than that. Tokens are counted with sessTokens, the number
each row shows.

A session that is streaming now (speedOf().live) or was written in the
last minute is never picked. The server already refuses one written in
the last minute (sessions.Delete's ErrActive). Delete is the existing
path: each agent's own delete, gateway-only and forgotten sessions
handled as before, files moved to magpie's trash. The existing
confirmation names how many sessions go and that Trash puts them back.
When the selection is still the By tokens pick, it adds "Each used
fewer than 20K tokens". A selection changed by hand drops that line.

Only the Sessions plugin changes (client.js, i18n.js in en, zh, zh-TW,
ja and de, sessions.css). No server change.

New test: sessions-small-delete.test.cjs, in Chromium and WebKit, every
language, against a faked API. It covers the menu's head and counts,
the pick (running, live, read-only and larger sessions left out, cache
counted as the row counts it), a smaller size replacing the pick, a
search narrowing it, the dialog's size line, Cancel posting nothing,
Delete posting the 4 ids, a 420px bar, and no native select.

Run:
- At the pushed tree (on origin/main 31575f71a), mote: i18n-*, nav-timeout
  and sessions-small-delete: 19 of 19 pass.
- At this tree (c3e0a6bb5, on origin/main 31575f71a), mote, load ~40:
  - sessions-*, i18n-*, proto-menu-overflow, checkbox-look and
    library-sessions-mcp: 661 of 661 pass.
  - go test ./internal/gui -run
    'TestCoreScriptBudget|TestI18n|TestCSS|TestPlugin|TestAsset|TestBudget':
    ok.
- Before the rebase (on 7707ba9ad), mica: the new file 10 of 10, and
  the touched set 670 of 670.
- Whole GUI suite before the rebase (mote, --test-concurrency=4):
  the ssh session dropped about two-thirds through. 934 of 1586 files ran
  (to r*), 11193 ok and 397 not ok in 78 files, and no Sessions file was
  among them. Each red file ran again alone, at this change and at
  origin/main 32a181868, and the same tests failed on both:
  - 5 files: 68 of 82 red on both trees (#6709).
  - The 9 files not in #6709: 16 of 224 red on both trees, flaky WebKit
    subtests (#6807, #4784, #4071, #6038, #4210, #3951, #5109).
    provider-base-as-typed and provider-env-paste are #6038's class and
    were added to it.

Broken by hand, then put back: with the running and live exclusion
removed from smallOf, the chromium en case went red.

Not tried: the remaining 652 GUI files after the drop (both machines
were over their cores with other sessions' suites), and the real app
window with real sessions.
2026-11-18 14:36:31 +08:00
yetone 31575f71a1 gui: the provider editor's Advanced rows sit under four small headings
The provider editor's Advanced held some thirty rows in one run (item
19). They now sit under four small headings, Routing, Models, Limits and
cost, and Connection, each row keeping its order inside its group; a row
the list doesn't name stays with the one before it, and the headings
show only when two groups are used. No page, row or fold moves
elsewhere. advgroups.js is imported when Providers first draws, so it
weighs nothing on the core script, and the editor opens with the
headings already in place.

Not done from item 19: a routing group's strategy stays under the
group's Advanced. The owner folded it there on purpose (9edc6506e,
11-09, "the Add group form was too long"; and for providers on 11-12,
"这些也要折叠在高级里"), and routing-advanced holds the provider side.

New test: advanced-headings, for an account and a key, both engines,
every language: the headings in order, Routing/Stays under Routing,
Context window under Models, Requests at once under Limits and cost,
Proxy under Connection, the heading across the whole row.

Broken by hand: both groupAdvanced(advIn) calls removed,
advanced-headings 10 of 10 red; put back, 10 of 10 green.

Run (mote, Chromium and WebKit, en zh zh-TW ja de):
- before the rebase, 23 GUI files: every one green except
  plugin-provider-options (my bug, fixed in this branch before the push)
  and settings-groups' "warm-ups and check-in in each service's provider
  editor", red the same way at fresh origin/main 98c487d09 (an extra
  "Spend extra usage" row; #6597, commented with the sha).
- rebased on origin/main 98c487d09: advanced-headings,
  plugin-provider-options, i18n-keys, routing-advanced, provider-prefs,
  settings-search, panel-profiles, builtins, chatgpt-usage-why,
  provider-concurrency, websearch-places, library-mcp-hub all green;
  go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS' ok;
  ./internal/library, pii, plugin, provider and access ok; go vet ok.
  No budget raised.

The Codex client row 07d19510f added to the Codex provider's Advanced
sits under Connection, beside User-Agent: which client the requests say
they come from. advanced-headings has a Codex account for it; with the
row left out of the list, 10 of 10 red.

Again at the pushed head, rebased on origin/main 39c5040d7 and 07d19510f
(mote, Chromium and WebKit, every language): advanced-headings,
plugin-provider-options, i18n-keys, routing-advanced, provider-prefs,
settings-search, panel-profiles, builtins, chatgpt-usage-why,
provider-concurrency, websearch-places, library-mcp-hub, codex-client,
codex-client-editor and nav-timeout all green; go test ./internal/gui
-run 'TestCoreScriptBudget|TestI18n|TestCSS' ok; ./internal/library, pii,
plugin, provider, access, ghtoken, davsync and gwmw ok, and the gateway
and agent tests whose strings changed; gofmt -l empty; go vet,
GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./internal/...
clean. (GOOS=linux go vet ./... without nogui stops in Wails' cgo-only
webview_window_linux.go, the same on origin/main 39c5040d7.)

Not tried: the real app window, and Linux/Windows runs (cross-OS go vet
only).
2026-11-18 14:32:44 +08:00
yetone 75cc9f6e26 gui: a plugin's JSON options point to its provider's editor for the switches it declares
A provider plugin's options had two editors: the switches it declares
in its provider's editor, and the raw JSON on the Plugins page. The
provider editor owns the switches; the JSON editor now says so and links
to it ("Its switches are in {name}'s editor"), closing itself as it
goes. Shown only for a signed-in subscription with declared switches.

Own test: plugin-provider-options clicks the link, lands on Providers,
and checks the JSON editor is gone. Its first run was red 12 of 12: the
link cleared the editing state without a redraw, so the editor stayed
in the page; it now redraws like Cancel does.

Broken by hand: the link's click handler removed,
plugin-provider-options 12 of 12 red; put back, 12 of 12 green.

Run (mote, Chromium and WebKit, en zh zh-TW ja de):
- before the rebase, 23 GUI files: every one green except
  plugin-provider-options (my bug, fixed in this branch before the push)
  and settings-groups' "warm-ups and check-in in each service's provider
  editor", red the same way at fresh origin/main 98c487d09 (an extra
  "Spend extra usage" row; #6597, commented with the sha).
- rebased on origin/main 98c487d09: advanced-headings,
  plugin-provider-options, i18n-keys, routing-advanced, provider-prefs,
  settings-search, panel-profiles, builtins, chatgpt-usage-why,
  provider-concurrency, websearch-places, library-mcp-hub all green;
  go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS' ok;
  ./internal/library, pii, plugin, provider and access ok; go vet ok.
  No budget raised.

Again at the pushed head, rebased on origin/main 39c5040d7 and 07d19510f
(mote, Chromium and WebKit, every language): advanced-headings,
plugin-provider-options, i18n-keys, routing-advanced, provider-prefs,
settings-search, panel-profiles, builtins, chatgpt-usage-why,
provider-concurrency, websearch-places, library-mcp-hub, codex-client,
codex-client-editor and nav-timeout all green; go test ./internal/gui
-run 'TestCoreScriptBudget|TestI18n|TestCSS' ok; ./internal/library, pii,
plugin, provider, access, ghtoken, davsync and gwmw ok, and the gateway
and agent tests whose strings changed; gofmt -l empty; go vet,
GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./internal/...
clean. (GOOS=linux go vet ./... without nogui stops in Wails' cgo-only
webview_window_linux.go, the same on origin/main 39c5040d7.)

Not tried: the real app window, and Linux/Windows runs (cross-OS go vet
only).
2026-11-18 14:32:44 +08:00
yetone d13151998c gui: Profiles says what a profile holds, and that providers and routing stay as they are
The Profiles tip didn't say what a profile is. It now says what one
holds, and that switching one leaves providers and routing alone.

Own test: panel-profiles (asserts the tip in every language).

Run (mote, Chromium and WebKit, en zh zh-TW ja de):
- before the rebase, 23 GUI files: every one green except
  plugin-provider-options (my bug, fixed in this branch before the push)
  and settings-groups' "warm-ups and check-in in each service's provider
  editor", red the same way at fresh origin/main 98c487d09 (an extra
  "Spend extra usage" row; #6597, commented with the sha).
- rebased on origin/main 98c487d09: advanced-headings,
  plugin-provider-options, i18n-keys, routing-advanced, provider-prefs,
  settings-search, panel-profiles, builtins, chatgpt-usage-why,
  provider-concurrency, websearch-places, library-mcp-hub all green;
  go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS' ok;
  ./internal/library, pii, plugin, provider and access ok; go vet ok.
  No budget raised.

Again at the pushed head, rebased on origin/main 39c5040d7 and 07d19510f
(mote, Chromium and WebKit, every language): advanced-headings,
plugin-provider-options, i18n-keys, routing-advanced, provider-prefs,
settings-search, panel-profiles, builtins, chatgpt-usage-why,
provider-concurrency, websearch-places, library-mcp-hub, codex-client,
codex-client-editor and nav-timeout all green; go test ./internal/gui
-run 'TestCoreScriptBudget|TestI18n|TestCSS' ok; ./internal/library, pii,
plugin, provider, access, ghtoken, davsync and gwmw ok, and the gateway
and agent tests whose strings changed; gofmt -l empty; go vet,
GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./internal/...
clean. (GOOS=linux go vet ./... without nogui stops in Wails' cgo-only
webview_window_linux.go, the same on origin/main 39c5040d7.)

Not tried: the real app window, and Linux/Windows runs (cross-OS go vet
only).
2026-11-18 14:32:44 +08:00
yetone 6396719517 gui: the provider editor's row is Masking, the word Plugins › Built-in uses
The provider editor said Redaction where the built-in and its page say
Masking (item 18, one word per concept). Privacy stays the Settings
tab's name.

Own test: provider-unmasked.

Run (mote, Chromium and WebKit, en zh zh-TW ja de):
- before the rebase, 23 GUI files: every one green except
  plugin-provider-options (my bug, fixed in this branch before the push)
  and settings-groups' "warm-ups and check-in in each service's provider
  editor", red the same way at fresh origin/main 98c487d09 (an extra
  "Spend extra usage" row; #6597, commented with the sha).
- rebased on origin/main 98c487d09: advanced-headings,
  plugin-provider-options, i18n-keys, routing-advanced, provider-prefs,
  settings-search, panel-profiles, builtins, chatgpt-usage-why,
  provider-concurrency, websearch-places, library-mcp-hub all green;
  go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS' ok;
  ./internal/library, pii, plugin, provider and access ok; go vet ok.
  No budget raised.

Again at the pushed head, rebased on origin/main 39c5040d7 and 07d19510f
(mote, Chromium and WebKit, every language): advanced-headings,
plugin-provider-options, i18n-keys, routing-advanced, provider-prefs,
settings-search, panel-profiles, builtins, chatgpt-usage-why,
provider-concurrency, websearch-places, library-mcp-hub, codex-client,
codex-client-editor and nav-timeout all green; go test ./internal/gui
-run 'TestCoreScriptBudget|TestI18n|TestCSS' ok; ./internal/library, pii,
plugin, provider, access, ghtoken, davsync and gwmw ok, and the gateway
and agent tests whose strings changed; gofmt -l empty; go vet,
GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./internal/...
clean. (GOOS=linux go vet ./... without nogui stops in Wails' cgo-only
webview_window_linux.go, the same on origin/main 39c5040d7.)

Not tried: the real app window, and Linux/Windows runs (cross-OS go vet
only).
2026-11-18 14:32:44 +08:00
yetone d90780c5d4 gateway, gui: a built-in is turned on in Plugins › Built-in, not a Settings › Plugins that isn't there
Errors and notices sent people to "Settings › Plugins" or called a
built-in "the … plugin", where no such page is and the thing is a
built-in (item 18, "Plugin" qualified where it's ambiguous). They now
name Plugins › Built-in and say built-in.

Own tests: builtins, websearch-places; Go: the gateway tests whose
strings changed (TestKeyLimitsOnAndOff, TestSearchOnAndOff,
TestToolsMCP*, TestHubMCPHeldToKeyLimit, TestVisionMCPHeldToKeyLimit),
internal/gui's plugins_own_* tests, davsync, gwbudget, gwmw, provider.

Run (mote, Chromium and WebKit, en zh zh-TW ja de):
- before the rebase, 23 GUI files: every one green except
  plugin-provider-options (my bug, fixed in this branch before the push)
  and settings-groups' "warm-ups and check-in in each service's provider
  editor", red the same way at fresh origin/main 98c487d09 (an extra
  "Spend extra usage" row; #6597, commented with the sha).
- rebased on origin/main 98c487d09: advanced-headings,
  plugin-provider-options, i18n-keys, routing-advanced, provider-prefs,
  settings-search, panel-profiles, builtins, chatgpt-usage-why,
  provider-concurrency, websearch-places, library-mcp-hub all green;
  go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS' ok;
  ./internal/library, pii, plugin, provider and access ok; go vet ok.
  No budget raised.

Again at the pushed head, rebased on origin/main 39c5040d7 and 07d19510f
(mote, Chromium and WebKit, every language): advanced-headings,
plugin-provider-options, i18n-keys, routing-advanced, provider-prefs,
settings-search, panel-profiles, builtins, chatgpt-usage-why,
provider-concurrency, websearch-places, library-mcp-hub, codex-client,
codex-client-editor and nav-timeout all green; go test ./internal/gui
-run 'TestCoreScriptBudget|TestI18n|TestCSS' ok; ./internal/library, pii,
plugin, provider, access, ghtoken, davsync and gwmw ok, and the gateway
and agent tests whose strings changed; gofmt -l empty; go vet,
GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./internal/...
clean. (GOOS=linux go vet ./... without nogui stops in Wails' cgo-only
webview_window_linux.go, the same on origin/main 39c5040d7.)

Not tried: the real app window, and Linux/Windows runs (cross-OS go vet
only).
2026-11-18 14:32:44 +08:00
yetone 87af7281e2 gui: Connected means an agent goes through magpie; the Library's list says Using the library
"Connected" meant two things: an agent routed through magpie, and an
agent that uses the Library's servers and skills (item 18). The second
is now "Using the library"; Connected keeps the first.

Own tests: agent-app-restart, library-mcp-hub.

Run (mote, Chromium and WebKit, en zh zh-TW ja de):
- before the rebase, 23 GUI files: every one green except
  plugin-provider-options (my bug, fixed in this branch before the push)
  and settings-groups' "warm-ups and check-in in each service's provider
  editor", red the same way at fresh origin/main 98c487d09 (an extra
  "Spend extra usage" row; #6597, commented with the sha).
- rebased on origin/main 98c487d09: advanced-headings,
  plugin-provider-options, i18n-keys, routing-advanced, provider-prefs,
  settings-search, panel-profiles, builtins, chatgpt-usage-why,
  provider-concurrency, websearch-places, library-mcp-hub all green;
  go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS' ok;
  ./internal/library, pii, plugin, provider and access ok; go vet ok.
  No budget raised.

Again at the pushed head, rebased on origin/main 39c5040d7 and 07d19510f
(mote, Chromium and WebKit, every language): advanced-headings,
plugin-provider-options, i18n-keys, routing-advanced, provider-prefs,
settings-search, panel-profiles, builtins, chatgpt-usage-why,
provider-concurrency, websearch-places, library-mcp-hub, codex-client,
codex-client-editor and nav-timeout all green; go test ./internal/gui
-run 'TestCoreScriptBudget|TestI18n|TestCSS' ok; ./internal/library, pii,
plugin, provider, access, ghtoken, davsync and gwmw ok, and the gateway
and agent tests whose strings changed; gofmt -l empty; go vet,
GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./internal/...
clean. (GOOS=linux go vet ./... without nogui stops in Wails' cgo-only
webview_window_linux.go, the same on origin/main 39c5040d7.)

Not tried: the real app window, and Linux/Windows runs (cross-OS go vet
only).
2026-11-18 14:32:44 +08:00
yetone 6facdb2461 gui: a provider's limit is Requests at once, as on gateway keys and accounts
The provider editor called it Concurrency while gateway keys and
accounts said Requests at once (item 18). One name now, in every
language; the old key is gone from i18n.js.

Own tests: provider-concurrency, provider-rpm, lane-limit,
gateway-key-concurrency; Go: internal/access.

Run (mote, Chromium and WebKit, en zh zh-TW ja de):
- before the rebase, 23 GUI files: every one green except
  plugin-provider-options (my bug, fixed in this branch before the push)
  and settings-groups' "warm-ups and check-in in each service's provider
  editor", red the same way at fresh origin/main 98c487d09 (an extra
  "Spend extra usage" row; #6597, commented with the sha).
- rebased on origin/main 98c487d09: advanced-headings,
  plugin-provider-options, i18n-keys, routing-advanced, provider-prefs,
  settings-search, panel-profiles, builtins, chatgpt-usage-why,
  provider-concurrency, websearch-places, library-mcp-hub all green;
  go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS' ok;
  ./internal/library, pii, plugin, provider and access ok; go vet ok.
  No budget raised.

Again at the pushed head, rebased on origin/main 39c5040d7 and 07d19510f
(mote, Chromium and WebKit, every language): advanced-headings,
plugin-provider-options, i18n-keys, routing-advanced, provider-prefs,
settings-search, panel-profiles, builtins, chatgpt-usage-why,
provider-concurrency, websearch-places, library-mcp-hub, codex-client,
codex-client-editor and nav-timeout all green; go test ./internal/gui
-run 'TestCoreScriptBudget|TestI18n|TestCSS' ok; ./internal/library, pii,
plugin, provider, access, ghtoken, davsync and gwmw ok, and the gateway
and agent tests whose strings changed; gofmt -l empty; go vet,
GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./internal/...
clean. (GOOS=linux go vet ./... without nogui stops in Wails' cgo-only
webview_window_linux.go, the same on origin/main 39c5040d7.)

Not tried: the real app window, and Linux/Windows runs (cross-OS go vet
only).
2026-11-18 14:32:44 +08:00
yetone 28430c9b90 gui: magpie's own paths are written with ›
A path through magpie's own screens was written with › in some places
and → in others (11-17 scan, item 18). Every one the user reads is now
›: Settings › Network and sharing, Settings › Privacy, Library › MCP
servers, Providers › … › Use it anyway, Settings › Usage, in the GUI and
in the Go errors and notices that reach it, in every language. The GUI
matches errNotAsked by its prefix, so it still finds it.

Left as they are: gateway errors written for agents, AiHubMix's and
Claude Desktop's own menu paths (their apps' words), the image MCP tool
description (it goes to agents), and comments.

Own tests: chatgpt-usage-why, websearch-places, library-mcp-hub,
i18n-keys; Go: internal/library (TestPrivateRepoInstallsWithToken, red
on the first try because skills.go still had →), internal/plugin
(notplugin_test), internal/pii, internal/provider.

Run (mote, Chromium and WebKit, en zh zh-TW ja de):
- before the rebase, 23 GUI files: every one green except
  plugin-provider-options (my bug, fixed in this branch before the push)
  and settings-groups' "warm-ups and check-in in each service's provider
  editor", red the same way at fresh origin/main 98c487d09 (an extra
  "Spend extra usage" row; #6597, commented with the sha).
- rebased on origin/main 98c487d09: advanced-headings,
  plugin-provider-options, i18n-keys, routing-advanced, provider-prefs,
  settings-search, panel-profiles, builtins, chatgpt-usage-why,
  provider-concurrency, websearch-places, library-mcp-hub all green;
  go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS' ok;
  ./internal/library, pii, plugin, provider and access ok; go vet ok.
  No budget raised.

Again at the pushed head, rebased on origin/main 39c5040d7 and 07d19510f
(mote, Chromium and WebKit, every language): advanced-headings,
plugin-provider-options, i18n-keys, routing-advanced, provider-prefs,
settings-search, panel-profiles, builtins, chatgpt-usage-why,
provider-concurrency, websearch-places, library-mcp-hub, codex-client,
codex-client-editor and nav-timeout all green; go test ./internal/gui
-run 'TestCoreScriptBudget|TestI18n|TestCSS' ok; ./internal/library, pii,
plugin, provider, access, ghtoken, davsync and gwmw ok, and the gateway
and agent tests whose strings changed; gofmt -l empty; go vet,
GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./internal/...
clean. (GOOS=linux go vet ./... without nogui stops in Wails' cgo-only
webview_window_linux.go, the same on origin/main 39c5040d7.)

Not tried: the real app window, and Linux/Windows runs (cross-OS go vet
only).
2026-11-18 14:32:44 +08:00
yetone 3b74aaf12c agent: Claude's auto-compact window is held to the 1000000 Claude Code takes
ZeroX2017 on X (0.1.4404): a compaction threshold of 1048576 typed for
Ollama Cloud's 1M DeepSeek went into ~/.claude/settings.json as it was.
Claude Code 2.1.316's settings schema (and Claude Desktop 2.7032's copy
of it in app.asar) takes autoCompactWindow as an int of 100000 to
1000000 and reads a larger one as none, so a new Claude App session ran
that model at the top-level 272K for every model.

Every auto-compact window magpie writes for Claude Code is now held to
1000000 (claudeCompactCap): the per-model modelSettings entries
(claudePlan), the top-level autoCompactWindow, and
CLAUDE_CODE_AUTO_COMPACT_WINDOW. An entry the hold makes equal to what
the model runs at anyway is left out. The threshold in magpie stays as
typed; Codex and Grok Build get it unheld; tune's card still reads the
top-level value back as Long conversations at the typed value
(claudeLongWindow compares against the held value). agent-wiring.md
says so.

Tests: TestClaudeCompactHeldToClaudeMax (Desktop entry, a second sync
rewrites nothing, magpie's threshold unchanged, the variable when
Claude Code is alone, Codex unheld), TestClaudePlanHeldToClaudeMax,
TestClaudeTopCompactHeldToClaudeMax (top-level + tune read-back).

Run:
- Full suite, go test ./... -timeout 45m -count=1 on mote at base
  afabb7f90: exit 0, 103 packages ok, no FAIL/panic/timeout in the
  kept log.
- Rebased on origin/main 07d19510f (11 commits, GUI and
  internal/library only, nothing in internal/agent): go test
  ./internal/agent ./internal/library -count=1 ok on mote;
  GOOS=linux and GOOS=windows go vet ./internal/agent ok; gofmt -l
  clean.
- Broken by hand: claudeCompactCap made a no-op, all three new tests
  red (entry 1048576, top-level 1048576).

Not tried: a real Claude App session with a 1048576 threshold; the
schema bounds were read from Claude Code 2.1.316 and Desktop 2.7032's
bundled source.
2026-11-18 14:32:09 +08:00
yetone 4338147993 gui tests: settings-groups expects Claude's Spend extra usage row (#6597)
d0fb3c008 (11-13) put "Spend extra usage" in Claude's provider editor,
beside the short system prompt, and settings-groups' list of Claude's
rows wasn't brought up to it: 6 of 14 red on main since, both engines,
en and zh. The row is meant to be there, so the test now lists it.

Run (mica, at this tree, origin/main 07d19510f): settings-groups 14 of
14 pass; 6 of 14 red before this change.
2026-11-18 14:30:12 +08:00
yetone 07d19510f6 gui: the Codex client is picked in the Codex provider's Advanced too, which gateway mode reaches
The Codex client (CLI or desktop app, which Codex requests to the
ChatGPT accounts say they come from) could be set only in Agents ›
Codex, which gateway mode doesn't have, so a gateway user couldn't
reach it at all. The Codex provider's editor now has it under Advanced:
the same app menu (codexMenuBtn, split out of codexMenuPick), posted at
once to settings/codex-client like the Agents row, and the button
redraws after a pick. The Agents row is unchanged.

New test: codex-client-editor.test.cjs, the editor's pick in the app
and in gateway mode, every language, Chromium and WebKit.

Run (mica, at this tree, rebased on origin/main 39c5040d7):
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS':
  ok.
- codex-client-editor, codex-client, i18n-keys: 44 of 44 pass.
- nav-timeout (the guard over every GUI file): 1 of 1.
- The 19 GUI files that open these editors and the Agents rows ran
  before the rebase; the seven red files there (account-arrange,
  account-cap, account-refresh-holds, accounts-own-signin,
  agent-details-ready, agent-expand-steady, agent-menu-label) were run
  again at this change and at origin/main 039719491: 44 and 46 red, the
  same tests. Filed: #6010, #6003, #6038, #6369, #6373, #6371, #2935,
  and account-cap's page error as #7046.

Broken by hand, each red, then put back:
- app.js from before this change: codex-client-editor 8 of 8 red (en,
  zh).
- the redraw after a pick removed: 4 of 4 red.

Not tried: the real app window, the full GUI suite.
2026-11-18 14:20:00 +08:00
yetone 39c5040d72 lessons: 11-18 three new GUI files skipped the guard that reads them all 2026-11-18 14:11:59 +08:00
yetone 2acc2660e4 gui tests: three new files give navigation its 60s next to a 5s default
disabled-model-chips (265217bf4), vertex-two-keys (a10ac7bb0) and
provider-unsaved-paths (e5c0c23de) set page.setDefaultTimeout(5000)
without page.setDefaultNavigationTimeout(60000), so nav-timeout.test.cjs
(#4787's guard) failed the cli (linux/amd64, nogui) job: main's Test run
was red at cf20df721 and fefab53d2. Each now sets it, as every other
file does.

Run (mote, at this tree, load ~31):
- node --test internal/gui/tests/nav-timeout.test.cjs: ok. Broken by
  hand, then put back: with vertex-two-keys' old line it fails 1 of 1,
  naming that file.
- node --test on the three files: 38 of 38 pass.
2026-11-18 14:11:25 +08:00
yetone 039719491c gui: Sessions' Settings › names the session terminal too, beside history
The Sessions page's head had one Settings › link, and it went to
Privacy's Agents' session history. The other setting the page uses, the
terminal a session opens in (General's Session terminal), had no way
there from Sessions. Where that row exists (a Mac, or a terminal found
on Windows or Linux), Settings › now opens the app's menu with both,
each noting its tab (Settings › Privacy, Settings › General), and each
opens Settings at its row, lit, with Back to Sessions. Without a
terminal row it goes straight to Privacy as before; gateway mode still
has no link. When the row shows is one rule now
(window.sessionTerminalShows in sessions/settings.js), asked by both.
No new strings; the core is unchanged.

Run (mote, at this tree):
- sessions-to-settings (now also on a Mac: the menu, both items, each
  reaching its row, nothing moved, the menu inside the window at 420),
  sessions-reads, gateway-mode-sessions, settings-search, i18n-keys,
  Chromium and WebKit, every language: 104 of 104 pass.
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS': ok.

Broken by hand, each red, then put back:
- Settings › going straight to Privacy always: sessions-to-settings 20
  of 20 red.
- the terminal item aimed at the history rows: 20 of 20 red.

Not tried: the real app window.
2026-11-18 14:07:19 +08:00
yetone 2957d16e5e gui: every alert row says when notifications won't show, in sight; Bark says it gets them all
The scan's item 9. When the system blocks magpie's notifications, or
can't show them, Settings › Usage's four alerts said so after their
description, but the Masking alert in Settings › Privacy didn't. Both
take the line from one helper now (notifyWarn in app.js), and the
Masking alert appends it as the others do.

On a computer with a pointer that warning was never in sight anyway:
Settings holds a row's explaining line out of sight for the hover card
(app.css, 11-02), and the warning sat inside that line. The comment
there says a warning stays; the rule didn't. A line holding a .warn now
stays in place, so the warning is read without hovering.

Bark gets every notification magpie shows (sendAs → barkPush), even
while the system's are turned off. Its row now says so, in every
language, rather than following a separate set of choices.

New test notify-warn-places.test.cjs: denied and unavailable, the
Masking alert's and the usage alert's warning on screen (wider than the
1px a held line gets, no clip-path), none when nothing is wrong, Bark's
line, nothing past the edge; every language, 900 and 380, both engines.

Run (mote, at this tree; mote at load ~50 and mica at ~160, mote the
lighter):
- notify-warn-places, mask-alert, builtin-places, i18n-keys, bark,
  settings-hints, usage-alert, reset-reminder, turn-done, settings-search,
  settings-search-reach, settings-groups, gui-de, editor-hints,
  privacy-hides-accounts, Chromium and WebKit: reds only these, each red
  on an origin/main 888d4eba5 copy too and filed: bark's "Bark is set…"
  at 900px, the click moves the page 2px (#6543), editor-hints WebKit
  (#6156), settings-groups "warm-ups and check-in" (#6597).
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS':
  ok, no budget raised.

Broken by hand, each red, then put back:
- the :has(> .warn) exemption removed: notify-warn-places 30 of 30 red.
- the Masking alert's warning not appended: 30 of 30 red.
- Bark's line removed from index.html: 30 of 30 red.

Not tried: the real app with notifications turned off in System
Settings, and a real Bark push.
2026-11-18 13:53:15 +08:00
yetone 00d6c8dbfc library: the Plugins page's Give to agents and Hide from agents follow the Library's switch for the plugin's tools
PluginServers called a plugin's tools server on when any agent was
ticked for it, but the Library row's switch is !Hidden. With the server
on in the Library and no agent ticked, the two pages disagreed. The
Library's switch said on, and an app at the MCP router's address had
the tools. The Plugins page said "Tools, hidden from agents" and offered
Give to agents. Now `on` is !Hidden on both pages.

Test: TestPluginToolsHidden checks that with the server on in the
Library and no agent ticked, an app at the router's address lists it and
PluginServers says on. docs/subsystems/plugin-tools.md says what `on` is.

Run (mica, at this tree on 32a181868):
- go test ./internal/library -run 'TestPluginTools|TestPluginServer':
  ok.
- plugin-tools.test.cjs, both engines, in the same 61-pass run as the
  two commits before.

Broken by hand: `On: len(s.Agents) > 0` put back made
TestPluginToolsHidden red ("on in the Library, given to no agent: the
Plugins page says hidden"). Put back.

Not tried: the real app window with a real tools plugin.

Run again after a rebase on 888d4eba5 (mica): the go test guards and ./internal/library ok; library-plugin-parts, library-plugins, agent-disconnect, agent-bulk-visibility, agent-visibility-saving, plugin-tools, i18n-keys, gui-de, gui-ja and gui-zh-tw, both engines: 155 pass, 0 fail.

At the pushed head, on cb1fe6d5d (mica): the go test guards, ./internal/library -run TestPlugin, i18n-keys and agent-disconnect ok.
2026-11-18 13:52:12 +08:00
yetone ab42898d91 gui: Manage agents says that hiding an agent takes it out of the Library's lists too
The note in Manage agents said "Hiding only changes this list". But the
Library leaves a hidden agent out of its chips too (shownAgents in
plugins/library/client.js, #71), and PluginServerOn skips it when giving
a plugin's tools to every agent. What it was already given stays, and
nothing new goes to it. That is the intended behaviour, so the text now
says it: its connection and settings stay as they are, the Library stops
listing it, what it was given stays, and nothing new goes to it. The
note is in en, zh, zh-TW, ja and de, and so is agentsmanager.js' head
comment.

Test: agent-bulk-visibility.test.cjs checks the note's text in each
language, Chromium and WebKit.

Run (mica, at this tree on 32a181868): the same run as the Disconnect
commit before this one. go test ./internal/gui -run
'TestCoreScriptBudget|TestI18n|TestCSS' ok; the eight GUI files, both
engines, 61 pass, 0 fail.

Broken by hand: the old note put back made agent-bulk-visibility red 10
of 10 (both engines, every language). Put back.

Not tried: the real app window.

Run again after a rebase on 888d4eba5 (mica): the go test guards and ./internal/library ok; library-plugin-parts, library-plugins, agent-disconnect, agent-bulk-visibility, agent-visibility-saving, plugin-tools, i18n-keys, gui-de, gui-ja and gui-zh-tw, both engines: 155 pass, 0 fail.

At the pushed head, on cb1fe6d5d (mica): the go test guards, ./internal/library -run TestPlugin, i18n-keys and agent-disconnect ok.
2026-11-18 13:52:12 +08:00