Commit Graph
4966 Commits
Author SHA1 Message Date
yetone aca0f0d8a1 guard: a long text's windows are read at once, one a core (niuniu_8964 on X)
码妞 on X: on a 4-core server in the Docker image, with AstrLink Guard,
Claude Code's requests sat at 脱敏中 for minutes, load 1.78. Guard read a
long text's 510-token windows one after another, and split only each
window's matmuls and attention over GOMAXPROCS-1 goroutines; the layer
norms, biases, GELU and quantizing between them ran on one core. A
2-CPU container got one thread for all of it.

Find now reads every window's logits first, min(GOMAXPROCS, windows) at
once, each with GOMAXPROCS/that many goroutines of its own, then merges
them in window order as before, so what it finds is the same. A window's
procs are passed down (logits, encode, matmul, attention, parallel) in
place of the package's threads. CoreML (a Mac) still reads one window at
a time.

Measured on magpie-desktop (WSL, Ryzen AI Max+ 395), 69,495 bytes of
docs, 22,488 tokens, ~59 windows:
  GOMAXPROCS=4: 23.86s before, 17.90s now
  GOMAXPROCS=2: 48.8s before, 30.50s now
  GOMAXPROCS=1: 50.0s before, 57.0s now (the same code path; noise)

Run:
- wsl-run with MAGPIE_GUARD_DIR at the pinned model (rev 7216b6a3):
  TestWindowsAtOnceReadAsOneByOne (new: 200 synthetic contact lines, over
  4 windows, read at GOMAXPROCS 1 and 4, spans DeepEqual), TestModelFinds,
  TestKernelsMatchGo, TestTokenizerMatchesHF, TestDecodeBIO: ok.
- mote-run: go vet ./internal/pii/..., GOOS=linux and GOOS=windows go vet
  of it, go test -race ./internal/pii/..., go test ./internal/pii/...
  ./internal/redact/...: ok.
- win-run go test ./internal/pii/guard: ok.

Broken by hand: swapping the first two windows' logits after the wait
made the new test red ("windows at once found 800 spans, one by one
800": the same count, different spans).

Not tried: the reporter's own server, or a real Claude Code request
through the Docker image; TestCoreMLMatchesGo (needs the model on a
Mac) was only compiled. The full suite wasn't run: nothing outside
internal/pii/guard calls what changed but Find.
2026-10-28 17:15:16 +08:00
yetone eb6d1d8d97 redact: a colour or an ordinary word is no personal name (黄绿色, 关键词)
hh05928822 on X after v0.1.1850: names were found in ordinary Chinese,
"黄绿色" the worst, with 边••, 应••, 关••, 尚• in the screenshot.
wangjunxiao128: "关键词" taken for a name.

Both ways a Chinese name is found (the model's PERSON spans in
modelSpans, and the cue rules in zhNameSpans) now go through one check,
zhWordNotName: a span that is an ordinary word is no name, unless a role
before it or a title after it says a person is meant (客户方圆, 江山老师).
A word is (zhWordShaped):
- a colour: Han colour characters alone, or anything ending in 色
  (黄绿色, 红色, 金黄色, 浅蓝色);
- a two-character word starting with a surname, from zhWords or the new
  zhDict (边界, 应该, 尚可, 关心);
- such a word with a noun ending after it (关键词, 关键字, 应用层,
  毛利率, 时间戳, 文件名).
zhDict is zhdict.txt, embedded: ~1,550 two-character words from jieba
v0.42.1's dict.txt (MIT, in THIRD_PARTY_NOTICES), the first character a
surname, frequency >= 100, tag not nr/nrt/nrfg, and a list left out by
hand (陆游, 关露, 欧阳, 司徒...) in its header. The surname list keeps
黄, 关, 边: they are real surnames, so 黄晓明, 关羽 and 毛利兰 are still
masked. modelTakes' own zhWords check moved into the shared one.

Run on mote at 761e0e010 + this change:
- go test -timeout 45m ./internal/redact/... ./internal/pii/...
  ./internal/masking/... ./internal/maskrec/...: all ok
- go test -run TestNotices . : ok
- go test -run "Mask|Redact|Privacy|Person|Name|Known" ./internal/gateway: ok
- gofmt -l internal/redact: clean
- GOOS=linux and GOOS=windows go vet of redact, pii, masking: ok

Broken by hand, each red:
- zhWordNotName returning false (at 761e0e010 too):
  TestChineseWordsAreNoNames, TestModelWordsAreNoNames,
  TestModelNamesBesideWords.
- The colour rule, zhDict and the noun-ending rule each turned off:
  TestModelWordsAreNoNames and TestModelNamesBesideWords.
- The role/title exception removed: TestModelNamesBesideWords.
- The old model.go and zhname.go with the new tests: both new tests red
  (the cue rules alone masked 请黄绿, 发给黄绿, 张伟和黄绿).

The real AstrLink Guard model on mote (MAGPIE_GUARD_DIR) found 黄晓明,
关羽, 张飞, 毛利兰 and 工藤新一 with this change, and flagged none of
long agent-style prompts with 黄绿色, 关键词, 边界线, 边距, 应用层, 尚可,
on the old code or the new.

Not tried: the reporters' own texts (not in the reports), so their
exact false positive was not reproduced with the real model; Privacy
Filter; the GUI. 高峰期 is still masked: jieba tags 高峰 as a name.
2026-10-28 17:01:49 +08:00
yetone c30e2a6452 gateway: Claude Desktop's connection check asks no group classifier
CyberCaius on Discord, after v0.1.1847: with Desktop's default a routing
group, the first connection check as Desktop starts ends in 499 and the
second passes; with a model as the default it never does.

The check ({"max_tokens":1,"messages":[{"role":"user","content":"."}]})
is not streamed, and Desktop gives it 10 seconds as it starts
(AbortSignal.timeout(1e4) in its app.asar 2.7032, one retry when it is
"unreachable"; 8 seconds from Test connection). Through a group with
intent rules or Effort auto, magpie first asked the group's classifier
what "." is, up to the Classifier timeout (8s by default), then sent the
check on. A cold or slow classifier plus the member's answer is past 10
seconds, and Desktop cancels it (499). The second check doesn't wait:
the classifier failed and rests for 30s, or its verdict for "." is kept.
A model never classifies, so it never waits.

The check is no user's turn, so it now asks no classifier (as a
classifier's own call doesn't) and goes by the group's order. The rule's
trace says why. A user's turn from Desktop is still classified.

Measured (a fake classifier, group with one intent rule, Desktop's check
twice, on mote): before, a classifier slow past its timeout gave 8.01s
then 8ms; one taking 3s gave 3.02s then 9ms. After: 19ms and 9ms, 7ms
and 9ms, the classifier asked 0 times. Ruled out on the way: key-member
groups vs a model show no first-vs-second difference (instant, 3s slow,
429 and 503 on the first call); the held-stream keepalive (15s) is not
reached, the check isn't streamed.

Run: TestClaudeDesktopProbeAsksNoClassifier (new) with
TestClaudeDesktopProbe*, TestDesktopProbe, TestIntent* and
TestClassifier*; go test ./internal/gateway; gofmt -l; go vet for
darwin, linux and windows.
Broken by hand: the old condition (RouterAgent only) back, the new test
is red ("the check asked the classifier 1 times", asked of ".").
Not tried: a real Claude Desktop start against a group with a real
classifier; the allowance first read (provider.Allowances, up to 3s once
after magpie starts) is left as it is, as a model's check pays it too.
2026-10-28 16:59:50 +08:00
yetone 6aa04f6e6a provider: a keyless relay on the user's own network imports and saves, as one on 127.0.0.1 does
iSnow_999 on X: their company's internal Codex relay is at
http://<LAN IP>:8080; imported from CC Switch, Codex couldn't reach it
through magpie. A CC Switch Codex entry with no key (requires_openai_auth
= false, auth {}) at a LAN address was listed as "it has no API key"
and left out, and the same provider couldn't be saved by hand ("needs an
API key"), while the same server at 127.0.0.1 was taken keyless.

keyOptional now also takes a host on the user's own network, read from
the URL alone (ownNetwork, no lookup since Ready asks often): a private,
link-local, loopback or carrier-grade NAT (Tailscale) address, or a
.local name, as netproxy's onLAN sends around a proxy. A keyless address
on the internet still needs its key. Every importer (CC Switch, Alma,
Codex, OpenCode) goes through imported(), and the editor, CLI and TUI
through Save, so the one rule covers them.

Ruled out against the code and on mote, sandbox HOME, fake relay on
mote's LAN address 10.0.0.116 at a free port, `magpie serve --web` built
from this tree, import through POST /api/importapps:
- a CC Switch Codex entry at http://10.0.0.116:<port>/v1 with a key
  imports with port, path, key and Responses kept, and /v1/responses
  through the gateway reaches the relay (Bearer sk-corp); with
  HTTP_PROXY/HTTPS_PROXY/ALL_PROXY at a dead 127.0.0.1:9 too (onLAN);
- a request with Codex's User-Agent, originator and
  x-codex-turn-metadata reaches the relay with them (sub2api's
  codex_cli_only gate reads these; port 8080 is sub2api's default).
After the fix, the same run with a keyless entry: imported, served, the
relay sees no Authorization header.

Tests: TestKeylessRelayOnOwnNetwork (import of a keyless LAN entry,
Save + Ready at 192.168/10/172.16/100.64/.local/[fd00::] addresses, a
keyless internet address still refused) is red on the old provider.go
and green now.
Run on mote at ae0327945 plus this change: go test ./internal/provider ./internal/tui
./internal/netproxy ok (98s, 10s, 4s); the full ./... suite was not run.
gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./..., GOOS=linux go build -tags nogui and
GOOS=windows go build ok.
Not tried: the reporter's own relay and config (not given); a host
with no dot (http://relay:8080) is still refused by the import's URL
check, which this change leaves alone: filed as #4028.
2026-10-28 16:59:10 +08:00
yetoneandJoeyWu-tech 761e0e0105 gui: a Settings option pressed through two redraws clicks its newest self (#3922)
Browser access draws twice per renderSettings: once at once, and once
more when its /api/web-page answer comes. When that answer landed
between the release and the click segs' pointerup sets off, the option
the release found was gone by the click and nothing was sent, which
segs-press-redraw's sweep saw on Network's web-page list. The click now
goes to the control's newest self (same segsWho, same option), found
again whether or not a draw came since; dragged off or gone still picks
nothing.

From Coffemon's patch on #3922 (JoeyWu-tech, fix/3922-segs-newest,
c1b5575af and e8c831736): the test's new redrawn-twice case, reveal()
waiting for each wheel's scroll to land, and the README entry, taken as
is. The app.js change is his, shorter: his kept b when still there and
looked up the newest self otherwise (+298 bytes); the lookup finds b
itself when b is still there, so it is used alone (+129 bytes). Main's
core had 18 bytes of room left when this landed; TestCoreScriptBudget
is green and no budget is raised.

What was run (mote, Playwright 1.62.0, Chromium and WebKit, en, zh, ja,
de, 900 and 440px):
- The new test on main's app.js: 22 of 42 red, both engines.
- With this change: 42 of 42.
- Broken by hand (the newest self's option taken as [0], not p.i):
  Chromium 17 red.
- go test -run TestCoreScriptBudget ./internal/gui: ok.

Not tried: the real app's webview, or a loaded Mac.

Co-authored-by: JoeyWu-tech <joey110551567@gmail.com>
2026-10-28 16:58:22 +08:00
yetone ae03279458 masking: the local model is on by default; the rules mask alone until it is downloaded
The owner's plan (10-28, after the xuanwo/_kaichen reports under the
masking demo): with AstrLink Guard picked, the Chinese-name heuristic
is off and only nicknames like 小王/老李 stay a rule; with Privacy Filter
it is as before; every format rule stays; the model is on by default,
masks with the rules alone until its download finishes, and no longer
answers 503 for it.

- masking.ModelWanted(st): on when the user turned it on, off when the
  user turned it off (new RedactModelOff, set by SetRedactModel(false),
  remove, and cancelling the default's own download), on when the
  default's download finished (RedactModelAuto). A settings file from
  before this, with a model name picked or files on disk and the model
  off, reads as the user's off: magpie's default doesn't override it.
- Until the picked model is installed, requests are masked by the rules
  alone and fetch starts its download (one try per model per hour,
  never under testing.Testing(), nothing where the model can't run).
  When it finishes, settings.UseDefaultRedactModel records the default
  (it refuses when the user has set anything) and the model warms.
- model(..., strict): a model that fails holds requests back (503)
  only when the user turned it on; under the default the rules mask
  alone. The Privacy page says which ("…the rules mask requests alone"
  in en, zh, zh-TW, ja, de; /api/privacy-model has `chosen`).
- redact.Options.NamesByModel (AstrLink Guard picked): zhNameSpans
  keeps only zhNick candidates (小/老 + a surname).
- KeepOwn and POST /api/settings keep both new fields.
- Docs: gateway-routing.md, site masking docs (en, zh, ja).

Run (mote, Go 1.26.8):
- gofmt clean; go vet of masking, settings, redact, gui; GOOS=linux go
  vet of masking, settings, redact; GOOS=windows go vet of the four.
  (GOOS=linux vet of internal/gui needs cgo, as on main.)
- go test -count=1 -timeout 45m ./... at base 7fd77a944: every package
  ok except internal/gui. Its reds: TestCoreScriptBudget (+64 bytes,
  fixed by dropping a comment, budget not raised), TestPrivacyModelPick
  and TestSettingsSaveKeepsWhatItDoesNotSend (updated for the new
  default and fields), TestMainWindowCorners (#3949, red on origin/main
  e8c7dddcb too), and three AppKit tests killed at 20-30s under load
  just before mote rebooted, which pass in the rerun.
- Rerun at base 6bec526f7: internal/gui (only #3949 red), masking,
  settings, redact ok. GUI node tests privacy-model, masking-records,
  masking-demo, routing-masking, i18n-keys, gui-zh-tw, gui-ja, gui-de:
  Chromium 199/199, WebKit 106/106.
- At the pushed base 9e33962c0: TestCoreScriptBudget, TestSettingsSave*,
  TestPrivacyModel* ok; i18n-keys and privacy-model 68/68 in both
  engines.
- At the pushed base 7fcf642ee (masking in the request archive):
  -run 'Mask|Redact|Archive|Privacy' in masking, gateway, redact ok.

Broken by hand, each red: the nick filter off
(TestChineseNamesByModelOnlyNicks), ModelWanted needing RedactModel
(TestModelOnByDefault), strict ignored (TestDefaultModelFailingIsTheRules,
TestNoModelYetMasksByTheRules).

Not tried: a real default download in a sandbox HOME (the tests fake the
model). Known limit: a user who turned the model on before model picks
existed and then deleted it has no name or files left, so reads as new
and gets the default on.
2026-10-28 16:55:24 +08:00
yetone a1f06bd780 gui: a browser tab offers the fonts of the computer it runs on (Norcleeh)
Norcleeh (Discord #general): magpie in Docker, used through the web GUI,
Settings' font menu doesn't list the fonts he installed on his own
computer; the app does. Cause, confirmed in the code: a tab's list is
/api/fonts, the server's families (none in a nogui build such as Docker)
plus commonFamilies, filtered by what the browser draws. A family that
is only on the browser's computer was never offered, and a choice the
server doesn't list was dropped by desktopFonts.available.

Now (webfonts.js, which only a browser tab loads; the app's windows are
unchanged):
- Where the Local Font Access API is (Chromium on https or localhost),
  the press that opens a family menu calls queryLocalFonts() once a
  page, and at load when the local-fonts permission is already given.
  The families join the list with their real styles ("SemiBold
  Condensed Italic" -> weight 600, 75%, italic).
- Elsewhere (Safari, Firefox, a plain-http LAN address, a refused
  permission) the menu's search says "Search or type a font name…" and
  offers Use "name" for a family the list lacks, enabled when the canvas
  probe says this browser draws it, greyed with "This browser can't find
  this font" when not; Enter takes it.
- A chosen family the server doesn't list stays in the tab's list on
  later loads while the browser draws it, so it keeps being applied.
- The app's menu (openProtoMenu), never a <select>. Strings in zh,
  zh-TW, ja and de. docs/subsystems/gui-shell.md says so.
Budget: no raise. here() moved out of fonts.js into webfonts.js, which
isn't a core script: loadFonts import()s it in a tab only (the page has
no CSP). The core is 106 bytes smaller than origin/main's.

Run (mote-run). At this head on e8c7dddcb: gofmt, go build ./... and
-tags nogui, go test -run 'Font|Budget|Boot|Asset' ./internal/gui
./internal/fonts ok; fonts, i18n-keys, web-page, settings-general,
inner-scroll-contain 114/114. Earlier, on 6af83172d (with a <script>
loader in place of the import):
- fonts, font-cascade, win-fonts, i18n-keys, settings-* (10 files),
  text-size, web-page, web-app-standalone, mobile-web, gui-de, gui-ja,
  gui-zh-tw, menu-scroll, omarchy, proto-menu-overflow: 311 tests
  before the rebase, 300 ok. Red: mobile-web's 8 "desktop
  matches origin/main" subtests (they read origin/main through git, and
  a mote-run copy has no .git), and settings-lines-wrap webkit zh 440px
  (a Models tab press timing out at 8s under load). At the rebased
  head: fonts, i18n-keys, settings-general, web-page,
  settings-lines-wrap: fonts' WebKit half and a lines-wrap zh-TW press
  timed out at mote load ~210 (the box then rebooted); rerun at load
  ~14, fonts WebKit 21/21 and settings-lines-wrap 20/20, the rest of the
  first run ok. The 8s press is filed as #4026.
- New tests in fonts.test.cjs, Chromium and WebKit, en and zh, 1000px
  and 440px: "a browser tab lists the fonts of the computer it runs on"
  (queryLocalFonts stubbed: not asked before the press, asked once in
  it, families and real styles offered, applied, no settings POST) and
  "a browser tab takes a typed font when the API is missing/refused".
  All 16 red on origin/main's assets (MAGPIE_FONT_ASSETS): this
  computer's families not offered, the search not taking a name.
- Broken by hand: merge() without the tab's own chosen families: the
  typed tests go red at "kept across a reload, though the server lists
  no such font" in all 8 cases.
- go build ./... and -tags nogui, gofmt -l, GOOS=linux go vet -tags
  nogui ./internal/gui, GOOS=windows go vet ./internal/gui ok; go test
  -tags nogui -run 'Font|Budget|Boot|Asset' ./internal/gui
  ./internal/fonts ok.
- Real use on mote: a nogui `magpie web` in a sandbox HOME (server list
  57 common families). Chromium with local-fonts granted: 204 families,
  185 only on this Mac; Baskerville picked, drawn, kept across a reload.
  WebKit (no API): typed Didot, offered and taken, kept across a reload.

Not tried: Chromium's real permission prompt (Playwright grants it),
Firefox, a browser on another computer than magpie's, a Docker image
run, the full Go suite (no Go change).
2026-10-28 16:55:01 +08:00
yetone 7fcf642eed gateway: the request archive doesn't put an unmasked route back on masking (#3973)
wangbinyq (#3973, Discord #feedback): after v0.1.1840, with the request
archive on, a request to a provider set to go unmasked was still masked
whole before it was sent. ea53eb126 skipped masking only when
bodiesKeptAway() was false (internal/gateway/redact.go:272, called at
gateway.go:1947), and that was true whenever archiveDest() was on, or an
observer wanted bodies, so the archive put the masking pass back on
every request's way, the masked copy kept only for the archive.

Now an unmasked route is never masked on its way, whatever is on:
- The archive keeps the request as it went, as the log and recent calls
  do. Its secrets are taken out by redact.ScrubJSON in the background
  upload, as every archived body's are; the reply half was already as
  the local model wrote it.
- An observer that wants bodies (OTLP export, a JS plugin's) is handed
  them masked as before, masked once when withBodies first hands them
  over after a try (Call.maskIn, laterMasked), not before the send.
- bodiesKeptAway and serve's masked/plain swap are gone. count_tokens,
  embeddings, Jev and web search never read the archive switch.

docs/subsystems/gateway-routing.md says so.

Run on mote at this tree (rebased onto 6bec526f7):
- gofmt -l internal: none. GOOS=linux/windows go vet -tags nogui
  ./internal/gateway: ok (before the rebase, no gateway change since
  but upstream's own).
- go test -tags nogui -count=1 -timeout 45m ./...: 76 ok, no FAIL.
  (A run at the older base had TestPluginStreamsPastTheBudgetWait red,
  red alone too there; fixed upstream in 7fd77a944, green at this head.)
- Rebased again onto 9e33962c0 before the push (26 files, none in
  internal/gateway): go build -tags nogui ./... ok, and
  TestUnmaskedRouteIsNotMasked, TestArchive*, TestObserver*,
  TestPromptText* ok at the pushed head.
- TestUnmaskedRouteIsNotMasked gains "the request archive is on" and
  "the archive is on, unset", and checks what the observer and the
  bucket get.
- Broken by hand: with origin/main's gateway.go, redact.go and
  capture.go, "the request archive is on" is red ("masked 1 times,
  want masking false") and the observer case red (log masked).

Not run: a real magpie serve with the archive on against a local model
(ea53eb126's sandbox benchmark covers the archive-off case); a real S3
bucket; the GUI suite (no GUI file changed).
2026-10-28 16:53:54 +08:00
vincent e23ddddd5b gateway: xAI's null-required walk goes through a schema's arrays too (#3392, kongkongklng)
The fourth round of #3392: after the null-required fix the reporter's
claude calls still 400ed the same '/required: null is not of type
"array"'. dropNullRequired walked a schema's objects but not its
arrays — a null under a union's anyOf branch or a tuple items survived
the shaping and reached xAI as before. The walk now takes arrays too;
a real array of names stays as it came.

Run on mote. At this head, rebased on origin/main 6bec526f7: go test
-tags nogui -count=1 -timeout 45m ./internal/gateway ./internal/agent ok
(661s, 337s); gofmt clean; go vet -tags nogui ./internal/gateway
./internal/agent clean, and ./internal/gateway on linux and windows
clean. Pushed on origin/main 9e33962c0, whose four newer commits touch
neither package (GUI, notices, settings). Before the first rebase, on
a57c95513: -run
"Custom|XAI|Xai|Grok|Compact" ok and the whole gateway package ok
(546s). With the regex addition taken out and xaiBody returning early,
TestCustomToolRefusalWordings, TestXAITakesCodexsSealedReasoningBack,
TestXAILearnsCustomToolsThenTakesTheReplay, TestXAIFoldsClaudesSystemTurn
and TestXAITakesANullRequiredToolSchema go red. Not tried: the real xAI
API (no key here).

From skygunner's branch fix/issue-batch-1024pm; kongkongklng confirmed it on 10-25.
2026-10-28 16:52:55 +08:00
vincent aba11fc4de gateway: xAI's own API takes no null required in a tool's schema (#3392, kongkongklng)
The third round of #3392, after the reporter merged the system-turn fix:
codex went through, but every Claude call still 400ed — xAI answers
'Invalid request content: Schema validation failed: [standard_violation]
/required: null is not of type "array"'. A tool's schema said
"required": null where none were (Claude Code's own tools, an MCP
server's among them; Anthropic's API takes the null, xAI validates each
schema as a JSON Schema). The relay forwarded it as sent.

The key now goes wherever a tool schema leaves magpie for api.x.ai —
input_schema (Anthropic), parameters (Responses) and function's
parameters (the translated path), at the schema's root or nested; a real
array of names stays as it came, and a body with no null required keeps
its bytes.

Replayed on a fake xAI by the reporter's wording: the claude call with a
root and a nested null required goes through, Bash's real array and the
schemas' contents beside them as they were; with the shaper off, both
new tests go red. Full nogui gateway package: the four reds
(TestClaudeClientCacheAbsentUnchanged, TestCodexFittedImagesPastTheBudget,
TestMarshalRawIsEncodingJSON, FuzzMarshalRaw) match a clean-baseline run
of the same branch in the same session; a fifth clean-baseline red
(TestHandedOverGatewayFinishesItsStream, the known flake) passed here.
gofmt / go vet clean, linux/windows/darwin nogui builds pass. Not tried
against the real xAI API: no key here.

From skygunner's branch fix/issue-batch-1024pm; kongkongklng confirmed it on 10-25.
2026-10-28 16:52:55 +08:00
vincent d8938d2f00 gateway: xAI's own API takes neither a sealed item's null content nor a system turn in messages (#3392, kongkongklng)
The follow-up to 8ecab590, after the reporter merged it: the first Codex
turn through an xAI key went through and every one after it 400ed "Could
not decode the compaction blob. Ensure it is unmodified from the compact
response." — Codex hands the sealed reasoning item back with "content":
null beside its encrypted_content, which xAI's backend can't read. The
Grok subscription's plugin already drops that null (grokShaped), but the
xai preset shapes nothing, and the custom-tool refusal had only now let
a second turn reach the API. And every Claude call 400ed "Invalid request
content: Invalid message role.": Claude Code sends a system turn
mid-conversation (Anthropic made them GA), a role xAI's Messages takes
only as the top-level system.

xaiBody (api.x.ai, shaped in passthrough and on the built body in
forwardTranslated alike — a custom-tool refusal puts a Codex request on
the translated path from the next turn on) drops a reasoning item's null
content and folds each system turn into the top-level system, its text
and blocks as they came. Nothing is learned: xAI takes neither at all.

TestXAITakesCodexsSealedReasoningBack, TestXAILearnsCustomToolsThenTakesTheReplay
and TestXAIFoldsClaudesSystemTurn replay the reporter's session on a fake
api.x.ai and are red with the shaping off; the wording comes from the
report. gofmt clean, go vet and the builds (native, linux nogui, windows)
clean; go test -tags nogui ./... in a sandbox HOME: 66 packages ok, the
same 7 test failures as the clean branch head baselined the same session
(TestWriteAtomicReadOnlyHardLink, TestClaudeClientCacheAbsentUnchanged,
TestCodexFittedImagesPastTheBudget, TestMarshalRawIsEncodingJSON,
FuzzMarshalRaw, TestPluginSOCKSProxy, TestProgram). Not tried against the
real xAI API: no key here.

From skygunner's branch fix/issue-batch-1024pm; kongkongklng confirmed it on 10-25.
2026-10-28 16:52:55 +08:00
vincentand321sssrt-bit b630304322 gateway: an upstream naming the type an unknown variant custom turns custom tools to functions (#3392, kongkongklng)
xAI's Responses API answers a custom tool with 422 "Failed to deserialize
the JSON body into the target type: tools[N].type: unknown variant `custom`,
expected one of …" — Rust's own wording of a type it doesn't know, which
customToolRefusal didn't match, so the request wasn't offered again with
its custom tools as functions (the #2656 path) and Codex saw the 422.

customToolRefusal now also takes "unknown variant `custom`". The refusal
is tested with the reporter's wording, bare and in an error body, and a
variant that isn't the custom type itself stays no refusal.

Verified: go test ./internal/gateway -run Custom -count=1 (21 tests, green;
the two new wordings red without the fix). gofmt, go vet clean.

This is the #2656 path (321sssrt-bit) meeting a new wording.

From skygunner's branch fix/issue-batch-1024pm; kongkongklng confirmed it on 10-25.

Co-authored-by: 321sssrt-bit <298505031+321sssrt-bit@users.noreply.github.com>
2026-10-28 16:52:55 +08:00
yetone 9e33962c05 gui: Settings has Reduce motion, stilling magpie as the system's does (#3813)
CupOfBread asked for a switch that turns magpie's motion off to save
resources on the desktop, and linull24 saw the Routing page keep a
phone's browser busy. magpie already stills its animations under the
system's Reduce Motion: 46 @media (prefers-reduced-motion: reduce)
rules across app.css and the plugins' styles, and calm() in the
scripts. Settings -> General now has "Reduce motion" (Off / On) that
does the same without the system setting.

- settings.json keeps reduceMotion; boot.js passes it; a POST that
  leaves it out keeps it, as the other prefs.
- theme.js's holdStill(on) sets data-motion="reduce" on <html> and sets
  the media of every stylesheet rule written for reduced motion to
  "all" (and back when turned off), so the same rules apply and no CSS
  is written twice. layout.js calls it before the first paint when the
  saved setting is on; applyPrefs calls it on a change.
- calm() is true when data-motion is reduce too, so the scripts'
  motion (Routing's stage, Library, Usage) holds still with it.
- routing.css: the reduced-motion rule for the live dot was
  .rt-livedot, which lost to .rt-livedot.on's animation; it is now
  .rt-livedot.on, so the dot stands still with either setting.

Measured on mote (Chromium 390x844, 4x CPU throttle, live Routing
traffic, CDP Performance over 10s, two runs each): main-thread task time
0.18 and 0.22 s/s with it off, 0.090 and 0.085 s/s on; style recalc
0.021/0.025 off, 0.008/0.011 on.

Tests: reduce-motion.test.cjs (new, both engines): saved on, the
reduced-motion rules apply from the start (a probe's live dot has no
animation, calm() is true); Off restores them and posts false; On again
posts true. TestSettingsReduceMotion: off by default, kept by a POST
that leaves it out, cleared by false, in settings.json and boot.js.
The Settings row is in settings-general's list of rows.

Run on mote at this head (rebased on e8c7dddcb): go test -run
"TestCoreScriptBudget|TestAppScriptBudget|TestSettings|TestBoot|TestI18n"
./internal/gui ./internal/settings: ok (the core budget not raised);
GOOS=linux, windows and darwin go vet -tags nogui of both: clean.
reduce-motion, settings-general, i18n-keys, routing-live-calm,
codex-descriptions, codex-predictions, codex-titles and old-webkit:
61 pass, 1 fail, the Safari 15.0 styles check below.
gofmt -l: clean.

Not tried: the real Linux (WebKitGTK) and Windows (WebView2) apps; the
setting changes only which existing CSS rules apply. old-webkit's
"Safari 15.0" check is red on origin/main from c490165b1's :has() in
.proto-menu (#4020), not from this change.
2026-10-28 16:50:16 +08:00
yetone ceaebd6b0b gui: Codex's descriptions, predictions and titles pickers are one function
renderCodexDescriptions, renderCodexPredictions and renderCodexTitles
were the same 20 lines three times, differing only in the setting's key,
the button's label, the Off note and the API path. They now call one
codexSidePick(s, key, aria, none, path). Each picker builds the same
button, options and request as before, in the same #<key>Pick slot.

It takes about 1.5KB out of the core scripts, room that the next commit
(#3813's Reduce motion) needs under TestCoreScriptBudget, which stays
where it is.

Run on mote at the tree of this and the next commit (before the rebase
onto origin/main; rerun after it is in the next commit's body):
codex-descriptions, codex-predictions and codex-titles in every engine
and language they cover, with reduce-motion, settings-general, i18n-keys
and routing-live-calm: 56 pass, 0 fail. go test -run
"TestCoreScriptBudget|TestAppScriptBudget|TestSettings|TestBoot|TestI18n"
./internal/gui ./internal/settings: ok. An earlier run of the same files
on a mote at load 30 to 56 timed the browsers out at 180s (webkit zh
passed there in 128s); the rerun after mote restarted passed whole.
2026-10-28 16:47:07 +08:00
yetone e8c7dddcb4 notices: the release carries the third-party licence notices
The owner asked for the licence notices in the release package (moejs
alpha.11 compiles Intl's data in, which carries its own notices).
THIRD_PARTY_NOTICES is embedded in the binary (main.go, //go:embed) and
handed to internal/notices; `magpie licenses` prints it, GET /api/notices
serves it, and Settings › About has an Open-source licenses row that
opens it in a dialog, in every language. `make app` copies the file into
the .app's Resources too. The core's scripts are 1,527,245 bytes, their
budget raised to it with no room added; app.js stays under its own.

Run at this head (rebased on origin/main):
- win-run (Windows 11): go vet -tags nogui . ./internal/notices
  ./internal/cli; go test TestNoticesFollowMoejs (.), ./internal/cli,
  TestCoreScriptBudget (./internal/gui): ok.
- wsl-run (Ubuntu 24.04): go vet -tags nogui ./..., go build -tags
  nogui: ok.
Run at the pre-rebase head 14e2d13fb, on mote (macOS):
- gofmt; make app's copy byte-identical to the file; `magpie licenses`
  output equal to the file; GOOS=linux/windows vet and build;
  go test . ./internal/cli: ok. ./internal/gui: only
  TestMainWindowCorners red, the same on origin/main (#3949).
- about-notices.test.cjs: chromium and webkit, en zh zh-TW ja de, 1100
  and 420px: all ok.
Broken by hand: TestNoticesFollowMoejs red with the embedded file cut.
Not run: the GUI suite at this head. The rebase met main's cancelAsk
helper where showNotices sat, and the dialog's Done now uses it (the
same stopPropagation + closeConfirmAsk). The whole GUI suite at
14e2d13fb was cut off when mote went down at load ~50: the files it
reached outside About had reds, most of them 180s browser-launch
timeouts, the rest passing in other languages or the other engine; they
are run again once mote is back, and any that stay red are filed.
2026-10-28 16:40:03 +08:00
yetone 1d7ca4c6b7 gui: every scroller in every stylesheet is held to keep the wheel; Safari 15 too
碳碳双键 (ysm119, Discord): a list scrolled to its top or foot by the
wheel went on to scroll the page, "in many places". d74ef5e04 (v0.1.1839)
already marks every box that scrolls and overflows between the pointer and
its .view (`holds`, app.js) and gives it overscroll-behavior-y: contain by
one rule in app.css. This makes that a guard and closes the one engine gap:

- inner-scroll-contain.test.cjs gains a test that reads every rule in every
  stylesheet under assets (app.css, plugins.css, context.css, omarchy.css
  and plugins/*/*.css; any not linked is added) that sets overflow or
  overflow-y to auto/scroll, builds a box from each selector (each compound
  an element; body classes put on body; @media rules tried at a size they
  hold for), fills it past its height, points at it, and requires
  overscroll-behavior-y: contain. 39 scrollers hold; .view is the one left
  to chain. A failure names the file and selector.
- compat.js: Safari 15 (macOS 12's WebKit until Safari is updated, #220)
  has no overscroll-behavior, so there a wheel over a .holds box already at
  its end in the wheel's direction is cancelled. Only where
  CSS.supports("overscroll-behavior-y", "contain") is false; Chromium,
  Safari 16+ and WebKitGTK 2.52.6 (probed on the Linux VM: true) never
  register it. There the Mac's bounce at the box's end is lost.
- app.js: the six "notice or ok" status lines share saidOk, to make room
  for compat.js under TestCoreScriptBudget (core 1,526,424 of 1,526,556 at the rebased head);
  no budget raised.

Run (mote, Playwright 1.62, Chromium and WebKit):
- inner-scroll-contain: the new guard and the Safari-15 test 4/4 alone;
  in the scroll batch 7/8, the one red a Chromium launch timeout (180s).
- Scroll batch (inner-scroll-contain, routing-scroll-end, click-scroll,
  view-wheel-*, menu-scroll, context-scroll-end, provider-levels-scroll,
  heatmap-scrollbar, ledger-hscroll*, old-webkit, view-trackpad-coast):
  195/209. Reds: 9 browser-launch timeouts (mote at load 30-60 with
  ~40 other test runners), old-webkit's ":has() in app.css" from
  c490165b1 on main (#4020, not this change), view-trackpad-coast
  chromium en ("the coast must ask for more than the 250ms": 6),
  view-wheel-unheard webkit 1 subtest, menu-scroll settings de 420px
  click timeout. None of those paths registers anything new in a modern
  engine; a rerun was cut off when mote dropped off the network.
- Agent batch (agent-connect/-disconnect/-leave-magpie/-notice-lang/
  -app-restart/-connect-no-models/-connect-all-hidden/-tweak-fold,
  claude-effort, tier-effort, subagent-effort, fast-ultra,
  hidden-agent-cleared, show-unset-agent, claude-signin, i18n-keys,
  panel-routing, routing-sessions, view-middle-autoscroll): every red
  but two a browser-launch timeout; agent-connect-all-hidden webkit zh
  and ja a click timeout under the same load.
- go test -tags nogui -count=1 ./internal/gui ok (budgets); gofmt -l clean.
Broken by hand: the :where(.holds) rule and the compat.js fallback
removed: the guard red for 25 scrollers per engine, the Safari-15 test
red in both. Fallback alone removed: only the Safari-15 test red. A rule
`.sess-new-list { max-height: 300px; overflow-y: auto; overscroll-behavior:
auto }` added to sessions.css: the guard red naming it, in both engines.
Not run: the full GUI suite; the agent batch's and scroll batch's
launch-timeout reds again (mote went down mid-rerun).
Not tried: a real Safari 15.0 WKWebView (the engine's lack is faked),
WebKitGTK and WebView2 in the app, a trackpad's momentum in the app,
plugin pages in their sandboxed frames (a plugin's own scroller is
the plugin's).
2026-10-28 16:36:28 +08:00
yetoneandJoeyWu-tech 6bec526f7a gui: a key's rename saves once on Enter and never on Escape (#3944)
A provider's key name was edited in an input whose Escape drew the
editor again and whose blur saved. Chromium blurs the input as that
redraw takes it out, so Escape after typing saved the typed name, and
Enter, or Enter twice before the save answered, sent keys/rename twice.
The account rename already guarded this with a once flag. Both now go
through one helper, renameIn: Enter saves a changed name, Escape keeps
it, and whichever comes first ends it, so the blur that follows does
nothing. Taking the two copies into one makes app.js 93 bytes smaller;
no budget is raised.

From Coffemon's patch on #3944 (JoeyWu-tech, joey/fix/3944): the test
key-rename-once.test.cjs and its README entry taken as is. The app.js
change differs: the patch copied the account rename's guard into the
key rename; this shares it instead, to keep core script inside its
budget.

What was run (mote, Playwright 1.62.0, Chromium and WebKit, en and zh):
- origin/main f02d92c7b: key-rename-once 8 of 16 red (Chromium's
  Escape after typing, Enter, Enter twice; WebKit's Enter twice).
- With this change: key-rename-once 16 of 16, account-arrange 2/2,
  account-alias 20/20, api-key-usage 4/4, api-key-theme 6/6,
  key-copy 8/8.
- Broken by hand (the once guard in renameIn taken out):
  key-rename-once 8 of 16 red; account-alias hung and was stopped.
- TestCoreScriptBudget green.

Not reproduced on mote: the issue's replaceChildren page error on an
unchanged Escape and account-arrange's red; both passed on main here.
Not tried: the real desktop app's webview.

Co-authored-by: JoeyWu-tech <joey110551567@gmail.com>
2026-10-28 16:27:00 +08:00
yetoneandJoeyWu-tech 8c983ee7b2 gui tests: four update-* files leave WebKit's ResizeObserver notice out of page errors (#3942)
update-download-percent, update-hide, update-notes-ask and update-wait
counted every page error, and WebKit's "ResizeObserver loop completed
with undelivered notifications" (a layout that outran its observers,
no fault of the page) turned them red under load. They now leave that
one notice out, with the same filter update-release-page and eleven
other files use; any other page error still fails them.

Patch from Coffemon (JoeyWu-tech) on #3942, c5033248, reviewed line by
line and taken as is. Test only.

What was run (mote, Playwright 1.62.0, WebKit, at origin/main
f02d92c7b):
- origin/main's four files and these, each alone, twice: all green on
  both (download-percent 3, hide 9, notes-ask 6, wait 11). mote didn't
  show the notice alone, so the red wasn't reproduced here; Coffemon's
  record has it red in every WebKit run on Linux under load (Playwright
  1.58.2), the notice 18 to 20 times a run.
- A loaded try (six runs of main's four files at once, load ~115 from
  other sessions too) hung past 30 minutes and was killed, so it says
  nothing either way.

Not tried: a loaded WebKit run that finishes, on mote.

Co-authored-by: JoeyWu-tech <joey110551567@gmail.com>
2026-10-28 16:27:00 +08:00
yetoneandJoeyWu-tech 63aca1802e gui: PenguinHarness's logo is a tile, and the app's own icons are no logos (#3858)
icon-tile was red on main: PenguinHarness's logo (3fd7e1698) is solid
to its edges but app.css's tile rule didn't name it, so it was drawn a
size bigger than a line logo beside it. It now has its alphabetical
place in the rule. The test also measured apple-touch-icon.png and
icon-512.png, the app's own icons that manifest.json lists for a
phone's home screen, which no .ic ever draws; it now leaves
manifest.json's icons out.

Patch from Coffemon (JoeyWu-tech) on #3858, 70707eed, reviewed line by
line and taken as is.

What was run (mote, Playwright 1.62.0, at origin/main f02d92c7b):
- origin/main: icon-tile red ("apple-touch-icon is solid to its edges
  but not in app.css's tile rule").
- This change: icon-tile 3 runs, 3 of 3 each; mono-icon-redraw 5,
  models-add-and-icons 4 and agent-grip 10, all pass.
- Broken by hand: penguin-color out of the rule: red, "penguin-color is
  solid to its edges but not in app.css's tile rule"; the manifest
  filter out is main's red above.

Not tried: looked at by eye with PenguinHarness installed.

Co-authored-by: JoeyWu-tech <joey110551567@gmail.com>
2026-10-28 16:27:00 +08:00
yetoneandJoeyWu-tech 84ada9dc80 gui tests: phone-web's tap scrolls by code once, as view-wheel-unheard does (#3876)
phone-web's "a tap's click is no flick" scrolled by code 40px a frame
for five frames after the click. Since a6d7e02c three scrolls put back
the same way with nothing redrawn are the reader's run, given back by
design, so the last three stood and the page read 591 for 711 in both
engines. a6d7e02c moved view-wheel-unheard's case to one scroll by code
for the same reason; phone-web now does the same (200px at once).

Patch from Coffemon (JoeyWu-tech) on #3876, 916064d0, reviewed line by
line and taken as is. Test only.

What was run (mote, Playwright 1.62.0, at origin/main f02d92c7b):
- origin/main: phone-web red in Chromium and WebKit, "591 !== 711".
- This change: 3 runs each engine, 3 of 3 every run.
- Broken by hand: the click no longer ending the lifted finger's window
  (purposeUntil = flingUntil = 0 made purposeUntil = 0): red in both
  engines, "511 !== 711", so the case still guards a tap's click.

Not tried: a real phone.

Co-authored-by: JoeyWu-tech <joey110551567@gmail.com>
2026-10-28 16:27:00 +08:00
yetoneandJoeyWu-tech 03a8d981ea gui tests: quota-refresh-order runs again, with seven more orders (#3679)
09c0a844 (#3160) gave the quota loader and quotaRefresh three names
quota-refresh-order's VM sandbox didn't have: the top-level quotasKept,
the page's mode, and a refresh button's classList.toggle. Every case
threw "quotasKept is not defined" before testing any order, 9 of 9
red since. The sandbox now has them, and the nine cases are unchanged.

Seven cases are added for orders the loader's comments promise that
hand edits to app.js passed unseen: the tray panel keeping the merged
reading it shows (magpie.panelQuotas), Refresh now behind a read on
its way, reads serialized, a newer card's marker kept after a read
lands, a renamed reply's replaced cards kept out, a background read
taking the asked one, and one card's reply leaving another's marker.
The README lists the file among the VM tests.

Patch from Coffemon (JoeyWu-tech) on #3679, 5ac2b9f7 (five commits,
squashed here into one), reviewed line by line and taken as is; the
README hunk applied to today's README.

What was run (mote, Node 22, no browser needed; at origin/main
f02d92c7b):
- origin/main: quota-refresh-order 0 of 9, each ReferenceError.
- This change: quota-refresh-order, usage-stale-answer and
  providers-fetching-retry 38 of 38.
- Broken by hand through MAGPIE_APP_JS: keepRefreshedQuotas skipped
  (the reply taken as it came): 10 of 16 red (1, 2, 6, 8, 9, 10, 13 to
  16); the panel saving the reply from before the merge: case 10 red,
  the other 15 green.

Not run: the Go checks (no Go file), the browser suite (no browser
test reads this file).

Co-authored-by: JoeyWu-tech <joey110551567@gmail.com>
2026-10-28 16:27:00 +08:00
yetone 67c8f562cd codex: a subagent named a model goes on it with "Same as the lead" (mengxiao on Discord)
mengxiao left Codex's subagent model at "Same as the lead" in magpie,
asked the lead for a subagent on GPT-6.1 Terra, and magpie put the
subagent on the lead's model anyway. The cause was codexFollowTo
(internal/gateway/codex_follow.go): on the ChatGPT-sign-in path, a
collab_spawn request asking for one of Codex's bare models, with nothing
set in magpie or [agents] default_subagent_model, was moved onto the
model the conversation's own turns go on (a1174674d, cybercaius).

Codex starts a spawn that names no model on its lead's model (codex-rs
core/src/agent/child_config.rs: build_agent_spawn_config sets the
child's model to the step's slug; apply_requested_spawn_agent_model_
overrides takes spawn_agent's model, else default_subagent_model; a
role's config can set one too). So under a lead on a magpie model, a
bare model in a subagent's request was always named by the lead, the
config or a role: the user's or the lead's pick. The GUI already says
"Same as the lead" means "the lead's model, or another the lead picks".

- codexFollowTo now handles memory calls only; a subagent is moved only
  by the model set for Codex's subagents in magpie (codexSubagentPick,
  unchanged). codex_backend.go no longer builds a pick from it.
- Dead code out: codexSessionOf, codexLeads.of, and CodexSideSet's
  "subagent" case (its doc moved onto servedSession).
- docs/subsystems/gateway-routing.md says a subagent never follows.
- Sibling checked: Claude Code writes no CLAUDE_CODE_SUBAGENT_MODEL
  while following the main model, and Claude Code takes the Agent call's
  model first; Claude Desktop's pick acts only when a model is set.
  Neither overrides a named model under "same as lead".
- Who relied on a1174674d (a lead's own pick of a Codex model following
  the session): pick the session's model as Codex's subagent model in
  magpie, which puts every subagent on it.

Ran (mote, -tags nogui -count=1, this change on 7fd77a944; rebased after onto a57c95513, which adds only docs, LESSONS and GUI test files):
- TestCodexSubagentKeepsTheModelItWasNamed on the old code (b01193ef9
  with only the new test): FAIL, "ChatGPT was asked for []".
- go test -run 'TestCodex(Subagent|Side|Memor|AppSide|Title|Prediction)'
  ./internal/gateway ./internal/agent: ok.
- go vet (darwin nogui, GOOS=linux, GOOS=windows) on internal/gateway
  and internal/agent: ok. gofmt -l: clean.
Not run: the full go test ./... suite (started on mote, not waited on);
staticcheck (not installed on mote); a real Codex spawn_agent with a
ChatGPT sign-in and a lead on a magpie model.
2026-10-28 16:16:02 +08:00
yetone a57c95513c LESSONS: a run record is written once the run has ended; a red assertion hides every one after it (10-28)
ca9b5048e recorded a GUI run still going and missed the 20 reds it caused in routing-model-rest (fixed in a8098a886). #3410's first red press hid c888ef272's zone change from its fixture for three days (7b007e986). Docs only; nothing run.
2026-10-28 16:15:00 +08:00
yetone a8098a8862 gui tests: reach wheels the page over a point no inner box takes, and the routing editor is pressed once its motion has stopped (#3408, #3409)
Three Routing GUI files were red on main, bisected on mote from
b0b076421:

- routing-model-rest, 20 of 20 red since ca9b5048e (#3764). Its steps
  box now scrolls in 200px, and reader.cjs's reach sent every wheel at
  the view's centre, which sat on that box: the box scrolled, the view
  never moved, and reach gave up ("control did not come clear into
  sight", target y=1048 in a view of 826). Since d74ef5e04 an inner box
  at its end keeps the wheel too, so the pointer over any overflowing
  list stalls reach for good. wheeled now moves the pointer, before each
  wheel, to a point of the view with no box of its own that scrolls
  under it (d74ef5e04 did this by hand for routing-scroll-end alone).
- routing-intent-entry (#3408) and routing-manual (#3409), red since
  91b0be836: a group opening into its editor moves its height and parts
  for ~700ms, and the tests measured where to wheel and press while it
  moved. reader.cjs has a settled(page) now: two frames, then no running
  finite animation; both files wait on it before they measure.
  routing-pause and routing-rule-effort had the same cause (7b007e986).

Run on mote (Playwright 1.62, Chromium and WebKit), one file at a time:
- at the pushed head (rebased on dfb73a04e): routing-model-rest,
  routing-intent-entry, routing-manual, routing-scroll-end,
  inner-scroll-contain, click-scroll: 116/116.
- old code: routing-model-rest 20/20 red at f25871cdd; intent-entry
  and manual red in the bisect from 91b0be836 on.
- broken by hand: the first settled waited on the animations only,
  with no two frames first; routing-manual stayed red in WebKit
  ("element is not stable", then outside the viewport): WebKit lists an
  animation a click started a frame later.
- every GUI file that uses reach or wheelTo (89 files, before the
  rebase and before settled): 1580/1615. The 35 reds are in six files,
  and the same six are red on untouched f25871cdd run one at a time
  (118/150 there): mobile-web (#3952, it needs a .git that mote-run's
  copy hasn't, commented there), usage-ledger (#3104), routing-manual
  (#3409, fixed here), routing-rule-remove (#3094, #3096),
  routing-rules-line (#3593), segs-press-redraw (#3922). rule-remove
  and rules-line don't load reader.cjs.
- a run of the three files under load ~94 had two browsers not launch
  in 180s; routing-model-rest alone again: 20/20.

Not run: the whole GUI suite at the pushed head.
2026-10-28 16:14:28 +08:00
yetone dfbd37eafc docs: a reporter's fix branch, patch or fixtures are credited in the commit
321sssrt-bit's analysis, fixtures and fix branch went into #3418, #1981
and #2033 with no co-author line. Now: a reporter's fork branch is merged
with their commits as authored, anything else we use from them gets
Co-authored-by, and a plain report is named in the body.

Docs only; nothing reads this file's text.
2026-10-28 16:13:31 +08:00
yetoneandJoeyWu-tech 7fd77a9445 gateway tests: the 192 streams' dials stay within macOS's listen queue (#3946)
TestPluginStreamsPastTheBudgetWait (#3890) dialed all 192 connections
to its httptest gateway at once. macOS queues at most 128 for a
listener (kern.ipc.somaxconn) and resets the rest, so the test's own
client got "connection reset by peer" and the vendor saw fewer than
192 requests. A dial now holds one of 64 places until the gateway
accepts it (ConnState StateNew) or the dial fails; the 192 streams
still go out and stay open together, and every assertion is as it was.

Patch from Coffemon (JoeyWu-tech) on #3946, 862c6e54, reviewed line by
line. Changed: giving a place back never blocks (select with default),
on the accept side too. The accept runs in the server's accept loop
under httptest's lock, so a blocking receive there could hang the
listener and gw.Close if a connection were ever accepted without a
place (a dial that failed after its handshake).

What was run (mote, macOS, go1.26.8, at origin/main f02d92c7b):
- origin/main, -count=6 -run '^TestPluginStreamsPastTheBudgetWait$':
  red ("dial tcp ...: connect: connection reset by peer", "the vendor
  saw 156 requests, want 192").
- This change: -count=10 ok; -race -count=5 ok.
- Again at origin/main b01193ef9: red 4 of 6 ("the vendor saw 164
  requests, want 192"); with this change -count=10 ok, go vet
  ./internal/gateway/ clean, gofmt -l empty.
- Broken by hand: beginStream refusing at once when the 128 windows
  are taken, as begin does: red 2 of 2 (81 "502 ... too many plugin
  calls are in flight", every route's 502 try), so the test still
  guards #3890's wait.

Not tried: the Windows box; the full suite (test-only change in one
file, run in its package).

Co-authored-by: JoeyWu-tech <joey110551567@gmail.com>
2026-10-28 16:06:07 +08:00
yetone 189db9ba5b redact: ids, digests and 毛利 go as written; the slider reaches known values; a user name goes as a made-up name
Reports on X under the masking demo (10-28):

_kaichen: "hash类型也会被过滤…长int,假如以1为开头的…会被当作电话被mask;
"毛利低"也会被当作人名被mask。即使把匹配拉到 0.95,也是一样行为".

- Hex digests: 16 to 31 hex digits in one case, with letters and digits
  both (a cache key, a short commit), are ids now (digestShaped in
  ids.go), like UUIDs and 32+ hex. The rules' SECRET keeps one only under
  a credential's field or a CJK/prose key with no field word (密钥为…);
  the model's SECRET is dropped under a field named for something else
  (cache_key, commit, object, blob, file, content, revision, partition,
  shard, bucket, dedup, lookup, row, sort) and on a JSON object's key
  (nameOfField). A bare `key` after api/access/secret/private/signing/
  license is still a credential (keyPhrase). The IBAN case kept its mask
  through the letter/digit minimums.
- 11-digit 1x numbers (phone.go, phoneAt): a phone with +86/86, as the
  value of a field whose name says phone (phone, mobile, tel, cell,
  contact, 手机, 电话, `number`), or in prose with no id word right
  before it (order, id, no., #, 订单号, 编号, 单号, 流水号…). Under
  order_id/uid, after 订单号, or with a letter or digit against it, it
  goes as written. PHONE and BANK_CARD are bounded by alnum, not digits,
  in the rule and in known values.
- 毛利: zhWords gained 毛利, 毛重, 毛坯, 毛巾, 毛衣, so 毛利低 (a margin)
  is no surname+name. The model still finds 毛利兰 (Guard). 毛利小五郎
  (indekkusu141209) is masked by neither model nor the rules now.
- The slider: a value masked once was masked again as known whatever the
  threshold. Each value now remembers the highest score it was found
  with (rules count as sure, ruleFound), and knownSpans skips one under
  Options.MinScore, which masking sets from pii.Threshold.

eerttreeeert: with mimo-v2.6-flash the home folder went as
C:\Users\{{USERNAME_…}}; the model took it for a temp folder and set out
to delete it. With the user name switch on, it now goes as a made-up name
of 8 lowercase letters (HMAC of the name, same every turn, standIn in
shape.go), restored in replies and tool calls like any placeholder;
Preview shows the same name.

Docs: docs/subsystems/gateway-routing.md masking bullets, and the site's
masking page (en, zh, ja) on mobile ids and the user name.

Run (mote, at this tree on base 6af83172d; rebased onto b01193ef9, which
changes nothing in redact, masking or pii, and redact, masking and
pii/... run again ok at the pushed head):
- gofmt -l clean; go vet ./... and GOOS=darwin/linux/windows go vet of
  redact, masking, pii: ok.
- go test -count=1 -timeout 45m redact, masking, pii/..., gateway, otlp,
  sessions, settings: all ok but internal/gateway's
  TestPluginStreamsPastTheBudgetWait (connection reset by peer, 183 of
  192), red the same alone at fresh origin/main b01193ef9 (169 of 192);
  #3946, commented.
- Real models on mote (AstrLink Guard and Privacy Filter, cached): the
  reporter's hashes, ids and every 毛利低 sentence kept; a prose phone
  masked; 毛利兰是谁 masked by Guard; 毛利小五郎姓什么 kept by both.

Broken by hand, each red: phoneAt off; the phone bound back to digits;
digestShaped off; "cache" out of the field list; nameOfField off; the
model's field check off; 毛利 out of zhWords; the slider check out of
knownSpans; standIn off.

Not tried: a real mimo-v2.6-flash session with the made-up name; the
Windows box; the GUI suite (no GUI file changed). 毛利小五郎 stays
unmasked by rules and both models, said in the doc.
2026-10-28 16:05:19 +08:00
yetone b01193ef97 provider: Cursor's plugin min is 0.2.29, whose HTTP/1.1 Run sends blobs 16 at once
ysm119 on Discord: Cursor 30 s+ to first token, 1-4 min a turn. 0.2.28's
16-at-once BidiAppends reached only the plugin's stateless fallback;
every real request goes through its native session, which still sent
each history message's blob one round trip at a time when the Run fell
back to HTTP/1.1 (a proxy or network that blocks h2). 0.2.29 (plugins
8f81a8a) sends them 16 at a time there too.

Real Cursor account, sandbox HOME, plugin driven directly, h2 forced to
fail: a 30-step agent history went from 37-39 s to first token to
4.4-9.1 s; 100 steps from 117-130 s to 9.0-13.2 s, answers correct.
Over HTTP/2 nothing changed and nothing was slow (2.9-7.3 s).

Run: gofmt -l clean; go test -tags nogui ./internal/provider/ on mote,
ok. npm view --prefer-online shows 0.2.29 as latest.
Not tried: a sandbox magpie installing 0.2.29 through the mover; the
reporter's network, so whether he is on HTTP/1.1 is not confirmed.
2026-10-28 16:03:46 +08:00
yetone f95121dd05 README: sponsors in two rows of three, each logo in an equal slot
Six logos wrapped onto a row of five and a lone AIGoCode. Now a <br>
after the third, and every logo is width=144 height=36 so the columns
line up (SVGs keep their ratio inside the box). AIGoCode's PNG is
640x170, which would stretch at 4:1, so the READMEs use a copy padded
to 680x170 (light and dark); the home page keeps the original.

Run: mote-run node --test site/*.test.mjs, 45/45 pass. Rendered the
rows in headless Chrome on a dark background and checked the columns line up.
Not tried: GitHub's own render (it goes live with the push).
2026-10-28 16:02:07 +08:00
yetone dfb73a04ef site, README: AIGoCode's dark logo in dark mode
AIGoCode sent the logo on a navy background; the navy is taken out to
transparency (colours un-blended at the edges) and the logo is placed in
the light PNG's 640x170 box, so the card doesn't move between themes.
Checked by eye over a dark and a white background.
Ran: node --test site/*.test.mjs on mote, 45/45 pass.
2026-10-28 15:52:01 +08:00
yetone 18b17a50b9 site: AIGoCode's card takes the copy AIGoCode sent
The en and zh text is theirs word for word; ja and de are translated
from it.
Ran: node --test site/*.test.mjs on mote, 45/45 pass.
2026-10-28 15:50:39 +08:00
yetone 3b2794cadd provider: a relay's 403 in markup says its words, not a bare "403 Forbidden"
maralica (Discord #help) sent WorkBuddy through a custom Chat relay,
"magpie-grok", that serves only some agents' clients, and WorkBuddy was
told only "magpie-grok: 403 Forbidden". apiError dropped any body that
starts with "<" and isn't a whole web page (a page's fragment such as
"<h1>Forbidden</h1><p>…</p>", an XML error), and WebPage said a page
with no <title> as "a web page, not an API reply" alone, so a relay's
reason in either never reached the agent.

Now such markup is said by its words (provider.MarkupText: scripts,
styles, comments and declarations out, tags out, entities read,
whitespace folded, 300 runes), and a page with no title by its words
(120 runes, as a title). Markup with no words still says the status
alone. JSON, plain text and empty bodies read as before. Every APIError
caller and WebPage's (Unsaid, errorSaid, vendorMessage, vendorSaid) get
it.

Checked on the way, unchanged: the relay is asked for "grok-4.7" by
model "magpie-grok/grok-4.7" and by a group of it, never a magpie-named
id; with "Send the agent's own User-Agent" on, it gets WorkBuddy's
User-Agent as sent, and none of the agent's X-Agent-*, Acp-Connection-Id
or Traceparent headers (only Codex's and Claude Code's own identity
headers are passed on to a relay).

Tests: TestChatRelayRefusalSaysWhy (custom Chat provider, WorkBuddy's
User-Agent, by provider/model and by group, streaming: the model and
User-Agent the relay got, and the message for plain text, JSON, an
untitled page, a fragment, XML and an empty body); TestAPIErrorShapes
updated (untitled page, script-only page, XML, a bare XML tag).

Broken by hand: MarkupText made to return "": TestAPIErrorShapes red,
and TestChatRelayRefusalSaysWhy red in untitled page, fragment and xml
(said "magpie-grok: 403 Forbidden", the reporter's words). Restored,
green.

Run (mote, go1.26.8, tree at origin/main ee6f8866f plus this change):
go test -run 'TestAPIError|TestChatRelayRefusalSaysWhy|
TestRelayRefusalSaysWhatItWas|Unsaid|WebPage|EdgeBlocked|NotAnAPIReply'
./internal/provider ./internal/gateway: ok. A probe (not kept) of
chat/responses/messages, streaming and not, with ten 403 bodies: every
JSON and plain-text reason already reached the agent.

Not run: the full suite (go test ./..., and the whole provider and
gateway packages), shipped before it at the coordinator's word; the reporter's relay itself (its reply body is not known; no
network in tests); the GUI (no GUI file changed); Windows/Linux runs
(no OS-specific code).
2026-10-28 15:46:26 +08:00
yetone ee6f8866f3 gateway: Claude Desktop's connection check goes to its default model
CyberCaius on Discord, v0.1.1838, after restarting Claude Desktop: as it
starts and from Test connection (Configure third-party inference ->
Gateway), Desktop said "Gateway rejected model
magpie-0958175816.anthropic.claude-haiku-5-5[1m] (HTTP 400)", the body
"AnyRouter: bad response status code 400". His default model in Desktop
is his routing group 天翼云; Routing showed leee/claude-haiku-5-5 sent to
AnyRouter gpt-6.1-sol.

Why 02a328d86 (v0.1.1821) didn't cover it: it routed the check as a
title is, to desktopPicked, the model the last session's tool turn ran
on, kept on disk across restarts. At start and in Desktop's settings no
session is running, so that was a days-old AnyRouter session's model,
not the model he chose. Desktop names the check's model itself (YT in
its app.asar 2.7032: the shortest /v1/models id with haiku in it, here
leee's haiku), and its own settings call the first listed model the
default ("the default model (the first listed model)",
resolveDefaultSessionModel). And AnyRouter 400'd the check because a
max_tokens of 1 reaches the GPT model below OpenAI's floor of 16; the
relay passes on no floor, so tokenFloor had nothing to ask again at
(02a328d86's test faked OpenAI's own wording, which a relay hides).

Now desktopProbe (Desktop's exact body: max_tokens 1, one user message
".", no system or tools) goes to desktopDefault, the first model listed
to Desktop (its order on the Agents page), so his 天翼云 group gets it
with zero config. The check is asked for 16 tokens upstream
(desktopProbeTokens); Desktop reads only whether it is answered. Titles
still go to the session's model.

Tests: TestClaudeDesktopProbeToSessionModel becomes
TestClaudeDesktopProbeToDefaultModel, with the literal id
magpie-0958175816.anthropic.claude-haiku-5-5[1m] (leee/claude-haiku-5-5's
alias), a session turn on anyrouter/gpt-6.1-sol first, 天翼云 as a group
listed first, and a relay that answers fewer than 16 tokens with
AnyRouter's opaque 400. The check reaches 天翼云 (leee and the relay get
nothing); with the relay's model listed first it is answered there in
one call. TestDesktopProbe is back.

Run (mote, at this tree):
- go test -tags nogui ./internal/gateway/ -run 'Desktop|Title|CacheKey|
  TooFew|TokenFloor|Alias|Science': ok
- Not run to the end: the whole internal/gateway package (started on
  mote, still running when this was pushed as asked) and the full suite.
- go vet ./internal/gateway/ (darwin, GOOS=linux, GOOS=windows), go
  build ./...: ok; gofmt -l: clean

Broken by hand: the probe branch taken out of desktopTurn -> red "probe
went to leee () or the relay (1 calls), not Desktop's default 天翼云";
the 16-token room turned off -> red with his exact error, 400 "AnyRouter:
bad response status code 400".

No GUI file is reached. Not tried: a real AnyRouter account or a real
Claude Desktop (read from its 2.7032 app.asar). A user whose first
listed model is not the one they mean by default gets the check there:
it is Desktop's own definition.
2026-10-28 15:32:20 +08:00
yetone 6af83172d3 gui: the masking demo shows no video where WebKitGTK can't play one (avk458 on X)
On Omarchy (Arch + Hyprland) without gst-plugins-good, opening Masking's
"How masking works" aborted WebKitWebProcess about 3s later: WebKitGTK
2.52.6 gives every <video>, muted ones too, an autoaudiosink, which lives
in libgstautodetect.so ("no such element factory autoaudiosink", then a
SIGABRT). The window was left frozen on its last frame ("一点就崩溃再点
magpie就卡死了").

Cause: b90e81da1's noVideo was only in GET /api/settings. The page's
state.settings comes from /api/state, which never carried it, so a demo
opened before Settings was visited set the webm src. The GUI fixture put
noVideo into /api/state's settings and hid it.

Now boot.js says noVideo (app only, not a browser tab) before the page
paints, and demo.js reads window.bootPrefs.noVideo; the poster shows
instead. Also, for BoyC338's memory question: folded, or with the page
left, the video lets go of its source (removeAttribute src + load), so
no decoder or buffer is held; opened again it goes on from where it was.

Run:
- mote: GUI masking-demo, masking-records, i18n-keys in Chromium and
  WebKit: 116 pass, 0 fail.
- mote: go test -run 'TestBootSaysNoVideo|TestBoot|TestSettings|
  TestFontSettingsAPIAndBoot|Budget' ./internal/gui ok; gofmt -l none;
  vet for darwin, GOOS=windows, GOOS=linux -tags nogui ok.
- WSL magpie-desktop: go test -tags gtk3 -run 'TestBootSaysNoVideo|
  TestGstAutodetect|TestWebkitDefaults|TestSettings' ./internal/gui ok.
- Real app on omarchy, v0.1.1840 release: Masking > demo row aborted
  WebKitWebProcess (coredump 07:10:10 UTC), window frozen. Built this
  tree with make release-linux in WSL and ran it there: demo opens with
  the poster and animates, fold/reopen, Agents and back to Masking all
  respond; no coredump, no autoaudiosink line, both web processes alive.
These ran at base ea53eb126; rebased onto 05ed578bd (redact/gateway
changes, none in internal/gui) and the budgets run again before push.

Broken by hand:
- demo.js reading state.settings?.noVideo: the poster test is red in
  both engines.
- hold() commented out: the folded test is red in WebKit.
- boot flag removed: TestBootSaysNoVideo is red.

Not tried: a Linux system with gst-plugins-good (the video path there
is unchanged); arm64 Linux. Recovering a window whose web process died
(web-process-terminated) is not handled by magpie or Wails; not in this
commit.
2026-10-28 15:25:53 +08:00
yetone 05ed578bdc gateway: a large body whose h2 ping was lost goes again unpinged (#3909)
yxd-ym, on a 2-10KB/s uplink: every large turn to a Google upstream
(Antigravity, Vertex, AI Studio) failed with "http2: client connection
lost" after 35-45s while its body was still uploading, and the group's
failover uploaded the same ~680KB again to every member. A small turn on
the same uplink was answered in 14s.

Cause (skygunner's diagnosis): the vendor transport's HTTP/2 health check
(netproxy.HTTP2Health, #2843) pings a connection with no frame received
for 20s and drops it when no answer comes in 10s. The ping is written
behind the body's own DATA, so on a slow uplink its answer can only come
after the last byte, and the check closed a working connection.

skygunner's branch (8eaf63866) sent every body of 64KB or more, or of no
stated length, to a transport without the ping. That is most agent
traffic, and it takes #2843's protection away from it: a silent
connection whose kernel takes a body that fits the send buffer then
waits the 10-minute header wait (TestLargeBodyOnSilentConnectionIsSentAgain
below hangs to its 10s bound on that branch).

The change keeps the ping on every request by default. A large body
(uploading) whose try fails with Go's lost-ping error (lostPing,
closeForLostPing's "http2: client connection lost") is sent once more,
through GetBody (provider.SetBody keeps it until LetGo), through
uploadTransport: a new connection, no ping, given up on when a write
moves no bytes for a minute (WriteByteTimeout); the response header wait
still ends a vendor that never answers. For 30 minutes after (slowFor,
drawsApart.slow, per transport), large bodies go there at once, so a slow
uplink loses one try per half hour, not one per turn. A connection that
really was dead costs nothing more: the retry dials a new one either way.
Small bodies and drawings are unchanged.

Co-authored-by: vincent <vincent@users.noreply.github.com>
Reported-by: yxd-ym

What was run, on mote at origin/main ea53eb126 + this:
- gofmt -l internal/gateway: nothing. go vet ./internal/gateway/
  ./internal/netproxy/, and GOOS=linux / GOOS=windows go vet
  ./internal/gateway/: nothing.
- TestUploadStillUnderwayIsNotCutByHealthPing (skygunner's: 262212 bytes
  paced at 64KB/s, ping after 200ms, dropped 300ms later),
  TestSlowUplinkSkipsTheLostTry (new: the first large body reaches the
  vendor twice, the second once, body given through provider.SetBody),
  TestLargeBodyOnSilentConnectionIsSentAgain (new: 128KB body after the
  path went silent is answered on a second connection),
  TestSilentHTTP2ConnectionIsDropped, TestGroupMovesOnFromSilentHTTP2Connection:
  -race -count=5 all PASS (80s); -count=3 without -race PASS.
- Broken by hand:
  - skygunner's transport alone: TestSlowUplinkSkipsTheLostTry FAIL ("saw
    1 tries of the first body, want 2"), TestLargeBodyOnSilentConnection
    IsSentAgain FAIL (context deadline exceeded at 10.01s).
  - the retry removed: TestUploadStillUnderwayIsNotCutByHealthPing FAIL
    in 0.57s ("http2: client connection lost", vendor "client
    disconnected"), TestLargeBodyOnSilentConnectionIsSentAgain FAIL
    (client connection lost).
- go test ./internal/gateway/ ./internal/netproxy/ ./internal/provider/
  -count=1 -timeout 45m: ok
  (gateway 546s, netproxy 3.7s, provider 118s).

Rebased onto f02d92c7b (no change to these files but a doc line
elsewhere in gateway-routing.md): gofmt, go vet (darwin, linux,
windows) ./internal/gateway/, and the five tests above with
TestPromptText* and *Unmasked* -count=2: ok (32s).

Not tried: the reporter's uplink and a real Google upstream; the path is
a paced local one.
2026-10-28 15:22:31 +08:00
yetone f02d92c7be redact: a file's lines, a path, a skill and a name in code after token: are no secret
Three reports on X (10-28), each a value the SECRET rule took (Insights >
Masking: 机密, 规则). The rule takes a name with token, secret, password
or api_key in it, then : or =, then 8 characters or more with a letter and
a digit. Prompts and code have that shape where nothing is secret:

- AlpsNowX: L643-669. was masked, in two requests. A file whose name has
  one of those words, then :L643-669. (internal/auth/token.go:L643-669.)
  read as a field token.go and its value, and once masked the lines went
  as {{SECRET_…}} wherever they came again (by known). Now a name that is
  a source file's (.go, .ts, .py, .md, .json …, not .txt/.env/.key) or a
  path's last part is no field, and a line or range (L643, L643-669,
  L12-L40, 643:12) is no value. Siblings: token.go:643-669 and #L643-L669
  were never masked (no letter / no colon); file.go:L12-40 was, and isn't.
- binary4cat: function names masked. access_token = get_access_token_v2,
  max_tokens=max_tokens_v3, secret: env.SECRET_V2, refreshToken2;,
  fn(token=token_v2), secretKey:=base64Encode(raw) all masked the name.
  A value written as code writes a name (lower-case start, or _ or .
  between words) of two words or more, one of them token/secret/password/
  key/credential, is a name now; a value starting with = is Go's :=.
- AkinoNya: folders and skills with a random string replaced. Found two
  routes: a path after such a name (PRIVATE_KEY_PATH=~/.ssh/id_ed25519,
  token_dir=/private/tmp/claude-501/x7k2p9q1-skill,
  GOOGLE_APPLICATION_CREDENTIALS=/Users/…/legacy_credentials/x7k2p9q1/…,
  私钥 ~/.ssh/…), and Claude Code's plugin:skill when the plugin's name
  has one of the words (design-tokens:generate-v2, secret-scan:
  audit-x7k2p9q1). A path from ~/, ./, ../ or a root folder (/Users,
  /tmp, /private …) with no + or = goes as written, in the CJK key rules
  too; slug:slug with no space is a skill. The ~1100 real folder and skill
  names on this machine (~/.claude, ~/.codex, $TMPDIR, Claude's
  claude-501 dirs) in five contexts masked nothing before or after, so
  the reporter's exact names are not reproduced.

Still masked (TestSecretsBesideLinesAndNames): password=hunter2pass9,
API_KEY=AbC123dEf456GhI789, token=t0k3nValue2, Passw0rd123, password123,
SuperSecret2024 (PascalCase stays a password), token: Lk8x9QmP2vR4,
secret.txt:hunter2pass9, x-api-key:k9x2mp4qr7st1vw3 and :ab12cd34ef56,
Password=Abc12345; in a connection string, 密钥为12231241, 私钥 ab12…,
django-insecure-…; vendorchecks and the existing code tests unchanged.

Run (mote): go vet ./internal/redact for darwin, linux, windows; go test
-count=1 ./internal/redact ./internal/masking ./internal/pii/...
./internal/otlp ./internal/sessions ./internal/settings ./internal/gateway
at base ea53eb126: all ok (gateway 551s). After the rebase onto
bc3ddc661 (zhname): vet (3 OSes) and redact, masking ok. gofmt -l clean.
Broken by hand: the two SECRET rules back on notCode and keyAt without
the path check: 28 of the new tests' cases red (every reported shape),
the still-masked test green.

Not tried: the full ./... suite (mote at load ~50 with two other full
suites); the reporters' own prompts; the local-model path, unchanged.
Tradeoff: a password written as code writes a name (myPassword1,
MY_SECRET_2) now goes as written.
2026-10-28 15:16:59 +08:00
yetone f79817f572 gateway: tests that a mixed, fallback or stood-in route is masked (#3973)
ea53eb126 stopped masking a request whose route ends only at providers
set to go unmasked. Its test covers a lone provider, an observer and an
unknown model. These cover the routes that may reach a vendor:

- TestUnredactedRouteNotScanned: a group of only unmasked members is not
  masked; an unmasked provider with a vendor fallback, or in a group
  with a vendor, is masked once, for chat and count_tokens.
- TestUnredactedFailoverToVendorMasked: the unmasked provider answers
  500 and the request fails over to the vendor (its fallback, or the
  group's next member). Neither try gets the key, and the reply has it
  back.
- TestUnredactedAskedButSentElsewhereMasked: Claude Code asks for an id
  the unmasked provider serves, and its tier stands in a vendor's model.
  The vendor gets it masked and the reply has the value back.

Test-only; no code changes.

Run on mote at this tree (origin/main ea53eb126 plus this file):
- gofmt -l internal/gateway: none. go vet -tags nogui ./internal/gateway
  for darwin, linux and windows: ok.
- go test -tags nogui -count=1 -timeout 45m ./internal/gateway on mote at ea53eb126: ok (558s); linux and windows vet ok
- The new tests with TestUnmaskedRouteIsNotMasked and
  TestLocalUnredacted*, -count=3: ok.
- Broken by hand on ea53eb126: unredactedRoute ignoring a provider's
  fallbacks and every group member past the first makes "falls back to
  a vendor", "a group with a vendor" and both failover cases red (the
  vendor was sent the key). Deciding sentWhole from the model as asked,
  before stand-ins, makes TestUnredactedAskedButSentElsewhereMasked red
  ("the vendor was sent the value").

Rebased on bc3ddc661 (a gateway compaction change); at that head the new
tests with TestUnmasked*, TestLocalUnredacted* and the Compact tests: ok.

Not tried: the full ./... suite, since mote was already running another
session's; this adds one test file to internal/gateway.
2026-10-28 15:16:18 +08:00
yetone bc3ddc661a redact: 文案 and words like it are no Chinese names (zeewell on X)
zeewell on X: tasks kept going wrong because 文案 was masked as a name,
so they turned names (and birthdays) off. 文 is a surname, and zhName
took a cue around 文案 that says nothing about a person. Probing words
that start with a surname (文档, 方案, 关键, 项目, 成本, 段落, 颜色, 查询,
时区, 简历, 林间, …, ~130 of them) in the places a prompt has 文案, about
110 were masked, through two cues:

- 一下 before it (改一下文案, 检查一下文案,) counted as "a person comes
  next". 一下 follows any verb, so it now counts only after one that asks
  a person (zhAskVerbs: 问, 找, 联系, 通知, 提醒, 回复, …): 问一下张伟
  still is one, 改一下文案 is not.
- At a sentence's start, a word after it that any subject takes (已经,
  明天, 今天, 昨天, 他, 她, 提交, 负责, 回复) counted alone: 文案已经改好了,
  文案明天给你, 文案他们说. Those (zhAnyAfter) now count only with a
  person's cue before (客户张伟已经到了). 说明, 说法, 讲解, 讲座, 讲义, 讲究
  are words, not 说 (文案说明), but for 说明天 (张伟说明天来).
- zhWords gets ~150 more common words (文案, 文风, 关键, 项目, 段落, 林间,
  …) for where a real cue is before a word (发给文案, 请文案), and is a
  set looked up by a candidate's first two characters rather than a scan.
- The model's own PERSON span that is such a word whole (文案) is
  dropped too (modelTakes), the other route a word reaches a name.

Old data: masked values are remembered in memory only, and 文案 (6
bytes) is under minKnown, so nothing stays masked after the update.

Fixtures are prompts with 文案 where the report gives no sentence (帮我
改一下这段文案, 文案:…, 把首页文案换成英文, ### 文案, 文案和图片, 文案已经改好了,
文案说明要简短, 这张图发给文案。), beside names in the same places that
still mask (问一下张伟,, 张伟说明天来, 客户张伟已经到了, 发给张伟。);
TestChineseWordsAreNoNames runs 25 listed words in 10 shapes plus the
model's label, and 5 unlisted ones (文创, 方位, 高铁, 安防, 林荫) through the
cue shapes alone. Every TestChineseNames case stays green.

Run (mote, mote-run, at this tree): go vet ./internal/redact for darwin,
linux and windows ok; gofmt clean; go test -timeout 45m of
internal/redact, masking, pii/..., otlp, sessions, settings, gateway
ok; internal/gui red on TestMainWindowCorners/macOS_26_SDK only, the
macOS 27 red filed as #3949 (no redact in it).
After rebasing onto 8edb9dbb7 (gateway, provider only): redact and
masking again ok at the pushed head.
Broken by hand, each red: the 一下 rule always true (改一下文创), the
zhAnyAfter check off (文创已经好了, 文创明天给你, 文创他们定), the 说明 words
off (文创说明), the model's word check off (the model's 文案, 文档, …), 文案
out of zhWords (发给文案, 请文案).
Not tried: the real model on zeewell's prompts (they gave none). Now
left: a two-character name at a sentence's start before only 已经/明天/
他 (张伟已经到了。), and an unlisted word after a person's verb at a
clause's end (发给文创。). Birthdays: the report names no birthday that
was masked wrongly, so they are unchanged.
2026-10-28 15:15:31 +08:00
yetone 8edb9dbb75 gateway: a compaction a model answers with a tool call is asked again as text
Lucy on Discord (v0.1.1676, Codex, group/auto-deepseek-v4-1-flash):
"compaction: group/auto-deepseek-v4-1-flash failed to summarise this
conversation 3 times in a row (last: the model wrote no summary (it
answered with reasoning, function_call exec_command))", so Codex could
not compact at all with that group.

Cause: the summary request offers no tools (tools [], f81913994), but its
history is Codex's exchange of exec_command calls, and a DeepSeek model
deep in it goes on with that exchange: it thinks, then calls exec_command
again. Nothing on magpie's side stops a call coming back: on a Messages
upstream the history's tools are declared as stubs (Anthropic requires
them, tool_choice none), an OpenAI-compatible server can read calls out
of the model's text with no tools offered, and magpie passes a call to an
undeclared tool through. codexCompact took that reply as "no summary"
and failed, three times, then held the conversation for 5 minutes.

Fix (codexCompact, every route that compacts: Lite and not, a group or a
single model, Chat, Responses and Messages upstreams): a summary reply
that called a tool (calledTool) is asked once more with the conversation
as text (plainCompact, as for a relay's 404): no exchange of calls to go
on with, no stubs, nothing found by tool_search. If that also writes no
summary, magpie compacts locally (localSummary, saying why), so Codex
goes on instead of failing. Codex's compaction prompt is unchanged.
Replies of reasoning alone or nothing fail as before.

Run on mote, the full suite at ea53eb126 + this change:
- gofmt -l: clean
- go vet ./internal/gateway: darwin, GOOS=linux, GOOS=windows (-tags nogui): clean
- set -o pipefail; go test -tags nogui -timeout 45m ./...: 76 packages ok, no FAIL
  (gateway 707s, agent 426s, provider 187s)
- new tests: TestCodexCompactToolCallAsksAgainAsText (Chat, Responses,
  Anthropic x group/auto-ds and ds/deepseek-flash; upstreams streaming
  DeepSeek-shaped reasoning + exec_command calls while the history holds
  calls) and TestCodexCompactToolCallEveryTimeCompactsLocally
- broken by hand: with codex_backend.go at origin/main both tests are red
  in all 9 cases with the reporter's message, "compaction: the model
  wrote no summary (it answered with reasoning, function_call
  exec_command)"; green with the fix
- real DeepSeek (deepseek-flash, the owner's key): Chat with no tools and
  Messages with the stub and tool_choice none/auto all summarised a short
  exec_command history (3 of 3 each), as did the text form plainCompact
  sends

Rebased onto a57ec0168 (Cursor plugin min only): go build ./... and
the gateway and provider compaction tests ok again at the pushed head.

Not tried: Lucy's own conversation and group members (the long history
that makes DeepSeek call a tool did not reproduce on a short one), and
a real Codex end to end through a sandbox gateway.
2026-10-28 15:14:31 +08:00
yetone a57ec01683 provider: Cursor's plugin min is 0.2.28, which doesn't wait on a failed model list or send HTTP/1.1 appends one at a time
ysm119 on Discord: claude-opus-5-5 through the Cursor plugin takes 33-36 s
to its first token and 83-253 s in all. Two waits on our side, both fixed
in the plugin (magpie-community/plugins fc14571, d9c858c, 944610f):

- A chat request picked its variant from AvailableModels (up to 30 s)
  before its Run, and a list Cursor couldn't give was asked again, and
  waited for, by every request. Now a stale list is used while a new one
  is asked for, requests at once share one ask, and after a failed ask
  requests go without it for 5 minutes.
- Over HTTP/1.1 each history message's BidiAppend waited for the one
  before it. Now up to 16 go at once, as cursor-agent 2026.10.01 sends
  them; a native session's Run stays one at a time.

0.2.28 is on npm (npm view --prefer-online). 0.2.27 never reached npm on
its own: its publish run went red on a test token collision, fixed in
944610f.

Run: gofmt -l (clean); on mote go build -tags nogui ./... and
go test -tags nogui ./internal/provider/ (ok). Plugin side: bun test
packages/cursor 314 pass on mote and on Linux; the whole plugins suite
2997 pass; the publish run's test job green.
Broken by hand (plugin): the old index.mjs turns all three
listwait.test.mjs tests red; openH1 back to one at a time turns the new
http1 test red.
Not tried: a real Cursor account (its token is in the Keychain), so
whether these are the time ysm119 sees, or Cursor's own, is not measured;
not the full go suite (a one-string min change).
2026-10-28 15:06:23 +08:00
yetone ea53eb1262 gateway: a request to an unmasked route isn't masked first (#3973)
wangbinyq (#3973): with masking on, a request to a provider set to
go unmasked was still masked whole before routing, then sent as the
agent wrote it, so the masking was thrown away. In their log that was
97.9% of magpie's own time: median 560ms, p99 16s, max 219s.

serve now masks after Resolve/FindGroup. When unredactedRoute holds
and no body goes anywhere else (bodiesKeptAway: no observer wanting
bodies, no request archive), masking is skipped. The redact writer
goes under capture, an order that commutes with the old one. A
turned-away request is logged masked (maskedCopy). count_tokens
masks only when its route isn't unmasked. The context card's text
stays masked: the kept body is masked when PromptText first reads
it (keptBody.plain), not on the request's way. The log and recent
calls keep the body as it went.

Run on mote at this tree (base 58fb3a778, rebased onto d74ef5e04
with no internal/gateway change in between):
- gofmt -l internal/gateway: none. GOOS=linux/windows/darwin go vet
  -tags nogui ./internal/gateway: ok.
- go test -tags nogui -count=1 -timeout 45m ./internal/gateway:
  one red, TestPluginStreamsPastTheBudgetWait (connection reset by
  peer, load ~80). That is #3946, already open. Alone with
  TestPromptTextIsWhatWasSent, -count=5: ok.
- The first full run caught TestPromptTextIsWhatWasSent red: the
  card's text held the key on an unmasked route. Fixed by the lazy
  masking above; it is green now.
- Broken by hand: on origin/main's gateway.go and redact.go, the new
  TestUnmaskedRouteIsNotMasked is red ("masked 1 times, want masking
  false", "count masked 1 times").
- Real run: old and new magpie serve in a sandbox HOME, redact on, a
  local Anthropic provider on a fake upstream, 15 requests of 1.2MB
  with emails, phone numbers and keys. Unmasked provider: median
  176ms on old, 13ms on new. Masked provider: 171ms vs 172ms.

Not tried: a real vendor account. The change sits before the
upstream call, and the fake upstream stands in for it.
2026-10-28 14:55:20 +08:00
yetone d74ef5e04c gui: an inner list wheeled to its end keeps the wheel; the page stays put
碳碳双键 (ysm119, Discord): wheeling the Usage page's request list to its
top or bottom carried on into the whole page, and "this happens in many
places". It is the class: every box that scrolls inside a scrolling page.

app.js marks such a box `.holds` while it overflows vertically, on
pointerover and on each wheel (the box under the pointer and its
ancestors up to the .view), and app.css gives `:where(.holds)`
overscroll-behavior-y: contain, which keeps the Mac's bounce on the box.
Not one CSS rule for every overflow:auto box: in Chromium `contain` holds
the wheel even in a box that doesn't overflow, or is overflow:hidden, or
only scrolls sideways, so short lists and the heatmap's and ledger's
sideways scrollers would have stopped the page. The .view itself is never
marked. :where() weighs nothing, so .mchips in a short window
(@media max-height 640px, #833) still passes the wheel on.

The new test, inner-scroll-contain.test.cjs, wheels the Routing page's
requests list past each end (en and zh, 900x560 and 1300x600, under
"By session" / 未提供会话标识), and ten kinds of inner box, and asserts
the page's scrollTop didn't move. A short list, heat-scroll, led-wrap and
snip must still pass the wheel to the page. routing-scroll-end now wheels
over the page's gutter: at its view centre the pointer sat on the
requests' list, which now keeps the wheel at its end (600 of 1066).

Run (mote, Playwright 1.62, Chromium and WebKit):
- inner-scroll-contain 40/40.
- 17 files: inner-scroll-contain, click-scroll, routing-scroll-end,
  routing-sessions, view-wheel-after-click/-after-redraw/-unheard,
  heatmap-scrollbar, ledger-hscroll, ledger-hscroll-foot,
  context-scroll-end, menu-scroll, provider-levels-scroll, panel-usage,
  panel-routing, qoder-cn-tile, agent-disconnect: 268/287. Reds were
  routing-scroll-end (this change, fixed above) and panel-usage webkit zh
  (#3311, commented). Rerun of routing-scroll-end, panel-usage and
  inner-scroll-contain: 66/66.
- go test -tags nogui ./internal/gui ok (TestCoreScriptBudget passes at the rebased head:
  core under 1,526,556, app.js under 1,310,460; no budget raised).
Broken by hand: the old app.js and app.css: the requests list and every
held box red in both engines (mchips aside, it had contain already).
Only the CSS rule removed: red, "the page didn't move" x8 plus each held
box x2. Only the overflow check removed: a short rt-reqs red (Chromium),
led-wrap and snip red in both engines.
Not run: full GUI suite (mote was busy with another session's suite).
Not tried: WebKitGTK on Linux, WebView2 on Windows, a real Mac's
trackpad rubber band and momentum in the app, older macOS WKWebView,
touch; zh-TW/ja/de (no strings changed).
2026-10-28 14:54:09 +08:00
yetone f0d42fbe32 gui: one cancelAsk for a confirmation's dismiss-only buttons, one Qoder risk note
Twelve buttons in app.js (eight Cancels, three OKs and a Later) each had
their own copy of `(e) => { e.stopPropagation(); closeConfirmAsk(); }`;
they now share cancelAsk. The Qoder and Qoder CN rows carried the same
risk note twice; it is QODER_RISK now. Behaviour is unchanged. This
makes room under TestCoreScriptBudget for the next commit, without
raising the budget (core 1,526,515 of 1,526,556 before).

Run (mote): go test -tags nogui -count=1 ./internal/gui ok (budget and
asset tests). The GUI suite ran on the next commit, which holds this one.
Not tried: nothing by hand beyond the suite; the buttons' code is the
same function moved.
2026-10-28 14:53:40 +08:00
yetone a41d0d5098 redact: the demo's notebook has a square icon and its entries under the header
The owner's screenshot of the masking demo's "小鹊的小本本" box: the
notebook icon was stretched tall, and the two entries overlapped the
subtitle and each other.

- The icon carried the class "acc", which app.css already styles as an
  accounts row (flex, min-height 38px, padding), so the 22px tile came
  out 38px tall. It is xq-acc now; none of the demo's other short class
  names (on, done, hot, ok, hl, far) has an app.css rule of its own.
- The entries were placed at fixed tops (40 and 81) under a header that
  is ~41px tall in CJK fonts. They are a flowing list now, after the
  header: each entry is its placeholder pill over its value, 5px apart,
  and a highlighted entry gets a soft background instead of colliding.
  The flyers already land on the values' measured positions, so the
  animation follows.
- German's title "Notizbuch der kleinen Elster" wrapped to two lines
  in the 220px box and pushed the last entry 14px out of it (the
  existing no-clip check caught it). It is "Notizbuch der Elster".

Test: masking-demo's layout test checks every box icon is 22×22 and
that each notebook entry starts at least 4px below what is above it.

Run at this tree (a463b3ede + this change), on mote:
- masking-demo + masking-records, both engines: 110 of 110.
- gui-de, gui-ja, gui-zh-tw, i18n-keys, mask-actions, mask-emails,
  masking-demo, masking-records, redact-kinds, redact-rule-edit,
  redact-rule-row, redact-shape, redact-words-any-case,
  redact-words-whole: chromium 259 of 259; webkit 135 of 136. The red
  was mask-emails' page.goto at its 5s default on the Routing page,
  at load ~80; alone it passes 3 of 3 here and 2 of 2 on origin/main
  a463b3ede. Filed as #3995 (the class of #3525).
- Screenshots of the notebook at the demo's end in zh dark, en light,
  de light and ja dark, both engines: square icon, entries under the
  header, nothing clipped.

Rebased onto 58fb3a778 (it adds a Windows modal-backdrop rule to app.css),
then run again at the pushed tree: masking-demo, masking-records,
i18n-keys and gui-de, both engines: 117 of 117. 60520ddb3 (moejs's module path, no GUI
file) landed after; the push is rebased onto it.

Broken by hand: the old demo.js and redact.css with the new test are
red in every language (icon 22×38, gaps false); with only the class
renamed, the old fixed-top entries are still red (gaps false, false).

Not tried: the real desktop app; the change is CSS and DOM order in a
page the GUI suite loads as the app does.
2026-10-28 14:39:34 +08:00
yetone 60520ddb3b moejs: v0.1.0-alpha.11, at its new module path github.com/MoeForge/moejs
Gateway middleware and agent plugins run on moejs. alpha.11 moves the
module to github.com/MoeForge/moejs; every other API change since
alpha.4 is an addition. What magpie gets: faster calls, loops, property
lookups and JSON.parse, allocation-free await, a bytecode verifier, a
correct default.pgo, and Intl / toLocaleString in plugin code.

Checked against both tags' source: every name magpie uses (NewRuntime,
Options, Compile, Link, Hook, Value, Arg, Undefined, NativeFunc,
Referrer, the Promise results, Exception) has the same signature, and
Options' defaults (shared frozen builtins, no timers) are unchanged.
fetch, Streams, URL, node:fs and node:buffer live in the separate
webapi and node packages, installed only on request; magpie installs
neither, so a plugin still reaches no network or file.

Intl's CLDR, Unicode, ICU and V8 material is compiled into every build,
and moejs asks a program that includes it to carry sections 1 to 4 of
its notices. THIRD_PARTY_NOTICES holds them verbatim. Release archives
ship no LICENSE today either; that is not changed here.

Doc and site links (docs/, site/public/docs/{,zh/,ja/}plugins.html)
point at the new repo.

Run on mote at this tree: gofmt; go build -trimpath -s -w (60,670,658
bytes on origin/main 58fb3a778, 62,329,250 now, +1.66MB); go vet of
middleware, jsmod, agentplug for darwin, linux and windows; go test
./internal/middleware/... ./internal/jsmod/... ./internal/agentplug/...
ok; go test -run 'Middleware|Strateg|OnUsage|JSPlugin|Agentplug|AgentPlug'
./internal/gateway ./internal/provider ./internal/plugin ./internal/gui
ok.
Not run: the full suite, the GUI suite, a real request through a
middleware in a running gateway.
2026-10-28 14:36:17 +08:00
yetone 58fb3a7786 redact: 关键发现, 易触发 and 和边界 are words, not Chinese names
xuanwo on X: with the model on, a report's words were masked as names,
关键 in "### 关键发现", 易触 in "`gh pr view` 易触发" and 边界 in
"判断和边界,". Each starts with a surname (关, 易, 边), and zhName took
a cue around it that was too weak alone:

- 发 and 打 after it counted as the verb a person does. They now count
  only when no Han character follows, or one of 了个给过一 (发了个消息,
  打给他); 发现, 打开 begin a word.
- 和 and 与 before it counted as "a person comes next". They join like
  to like, so they now count only when a pronoun or what may be a name
  (a surname and 1-3 characters, no zhWords word) is before them:
  吴敏和郑浩, 我和张伟, not 判断和边界.
- A sentence started after any space or symbol. A space after a word or
  code is inside a sentence, so the start is now after punctuation (with
  spaces after it or none) or at the text's start; a backtick no longer
  counts.

The fixtures are the reporter's literal lines, beside names around the
same cues that still mask (### 张伟发了个消息, 我和张伟,, 这件事。 李娜说过).

Run (mote, mote-run): go test ./internal/redact (TestChineseNames,
TestMaskEval and the rest) ok; gofmt clean. Broken by hand, each red on
its own case: the 和/与 rule off (边界), wordAfter off (关键发现),
sentenceStart always true (易触发).
Running as this is pushed: vet (darwin, windows, linux) of
internal/redact and go test of redact, masking, pii, otlp, sessions,
settings, gui and gateway.
Not tried: the real model on the reporter's whole session; a name that
starts after a space following a Chinese word (这件事 李娜说过) is now
left, as one inside a sentence.
2026-10-28 14:27:17 +08:00
yetone a3ee00c05c codex: its own GPT models stay in Codex's list when kept for routing groups
士奇 (Discord, 10-28): with a routing group on, the Agents page's Codex
list lost its Codex provider section and models, the model dropdown still
offered GPT, but the Codex app had none; with the group off they came back.

Cause: the codex provider's "Only through routing groups" (Provider.Unlisted,
只通过路由分组使用), or a group that lists itself alone (Group.Unlists), took
the ChatGPT account's own models out of Catalog(), so out of Codex's own
list too. With no Codex section, the own options were not magpie's, so the
own-models switch showed and the picker kept offering GPT; meanwhile #1602
(125dad5cb, CodexNativeUnlisted) dropped every one of them from the list
handed to Codex (backend /models, the model_catalog_json desk file,
spawn_agent). The picker and the app disagreed.

Why the earlier fixes missed it: aa766289b only stopped the GUI folding a
provider, and 508911e43 (TestCodexOwnModelsStayWithGroupOn) only kept
Served own options in the picker. Both covered a plain group; neither
touched Catalog's unlisting for Codex or the desk list's #1602 filter, and
neither test set Unlisted or Unlists.

Fix: Codex's lists start from catalogOf("codex"), which keeps CodexOwn
entries (ListedFor/CatalogFor, CodexNativeHidden, CodexOrder), and
CodexNativeUnlisted is removed with its filters in codexMerged,
spawnChoices and the list tag. Other agents and /v1/models still don't
see unlisted GPT models (checked for Claude Code in both tests).

Behaviour change for #1602: an unlisted codex provider no longer hides GPT
from Codex. The way to hide them from Codex is Codex's own list (its Codex
section's hide / only-picked), which CodexNativeHidden still applies; the
rewritten gateway test checks that and the ETag change.

Tests:
- gateway TestCodexModelListKeepsOwnForGroups (rewrites
  TestCodexModelListUnlistedForGroups): group Unlists and provider Unlisted
  keep gpt-6-sol/gpt-5.5 in Codex's /models and spawn_agent; Claude Code
  doesn't list them; hidden in Codex's list it goes and the ETag changes.
- gui TestCodexOwnModelsListedOnlyThroughGroups: agentModelList has the
  Codex section (Own) for every model, OwnModels is false, the picker has
  them, Claude Code doesn't list the unlisted ones.

Run (mote-run, -tags nogui): go build ./...; go vet for darwin, GOOS=linux
and GOOS=windows on provider/gateway/gui/agent; gofmt -l clean; go test
./internal/provider ./internal/gateway ./internal/gui ./internal/agent: ok.
Broken by hand: the five source files reverted to f20118304 with the new
tests in place: both tests red (gateway: gpt-5.5 and every own slug gone,
spawn offers only group/mine; gui: no Codex section, own switch shown).
Real codex 0.162.1 in a sandbox CODEX_HOME: `codex debug models` with
model_catalog_json pointed at the desk file CodexDesktopCatalog wrote with
the provider Unlisted and an Unlists group lists gpt-6-sol, gpt-5.6-sol and
group/mine (the old code dropped both GPT slugs).

Not run: full suite. Not tried: GUI Playwright files (no page changed), a
live ChatGPT sign-in or the Codex desktop app itself.
2026-10-28 14:26:18 +08:00
yetone 7323255b4e gui: the Windows app's confirmation backdrop goes without blur too (#3980)
Henry-916's change (the commit before) took the blur off the provider
editor's full-window backdrop in the Windows app, where WebView2 on an
Intel UHD D3D11 GPU stalled under it. The Remove/Sign out confirmation
(.action-confirm, a <dialog>) blurs the whole window behind it the same
way through ::backdrop, so it is scoped out by the same win/web rule.
modal-backdrop.test.cjs now shows that dialog and checks its ::backdrop.

Not changed: .pop, the panel's open profile chips and Settings' sticky
header blur too, but over a popover's or a header strip's area, not the
window's; nothing measured them as slow.

Run at this head (mote):
- node --test modal-backdrop: 24 of 24 ok. Broken by hand (the
  ::backdrop selector dropped): both Win32 desktop cases fail "nor the
  confirmation's".
- chromium: modal-backdrop, dialog-backdrop-drag, segment-press-dialog,
  gui-zh-tw, gui-ja, gui-de, i18n-keys, codex-signout,
  account-discovery: 93 ok, 0 fail. The same less modal-backdrop and
  i18n-keys with BROWSER=webkit: 37 ok, 0 fail.
- go test ./internal/gui: one red, TestMainWindowCorners/macOS_26_SDK on
  macOS 27, filed as #3949; nothing in it reads CSS.

Not tried: the real Windows app; the reporter measured the modal's
blur there (67 → 165 rAF callbacks a second).
2026-10-28 14:24:40 +08:00
Henry-916 824100f30f gui: keep Windows modal backdrops responsive without blur
Disable full-window modal backdrop filtering in Windows desktop windows
and tray panels, retaining the dimming veil. Browser pages and other
platforms keep their existing blur through the existing win/web markers.
Document the platform behavior in the GUI shell reference.

On an affected 0.1.1805 installation with WebView2 155.0.4283.62 and Intel
UHD D3D11, disabling the filter made provider tests visibly responsive.
The reporter confirmed the improvement. Scripted scrolling measured
roughly 67 to 165 rAF callbacks/s, not presented FPS.

Verification: modal-backdrop.test.cjs fails on the original CSS in both
Windows desktop Chromium cases (blur instead of none), with the other
10 cases passing. After the fix, 45 targeted tests pass across
Chromium and WebKit: modal-backdrop, dialog-backdrop-drag,
segment-press-dialog, gui-zh-tw, gui-ja and gui-de. node --check and
git diff --check pass. The full GUI suite, Go vet/build/test matrix and
native macOS/Linux tests were not run.
2026-10-28 14:24:40 +08:00
ggbdpq a463b3ede2 gateway: the Codex app's page state is metadata, not the user's words (#3418)
What: <external_codex_apps_open_page> joins the injected leads in
prompt.go, beside the Codex app's <in-app-browser-context …>: a user
text that begins with it is what the agent put in as the user, not
words of theirs. Codex sends the open page's state as a user message
(<external_codex_apps_open_page>{"page_id":null}</external_codex_apps_open_page>),
and userWords took it for the user's. With pasted files and an empty
"My request" — which keeps only what follows the heading — it was the
only text left, so the classifier was asked about the page state alone
and an order group fell to its first member for the whole turn.

Everything that goes by userWords skips it alike now: no turn of its
own (turnIn, the prompt breakdown's turns), no words for the classifier
(userText, firstWords), nothing for a plugin's query or Copilot's Auto
to pick on, and — through agentNotice — a page state after a tool
result closes the result without being marked as the user's. The title
digest already skipped the marker (title_link.go); the two lists say
the same again. Whatever the marker wraps goes with it, JSON or not
(the check is the prefix); a "My request" that holds the user's words
still classifies on those alone.

Run: user_said_test.go grows the page state (three rows in
TestUserTextSkipsWhatTheAgentPutIn, codexPage in
TestUserSaysPastAReminderWithASource) and
TestIntentSkipsWhatTheCodexAppPutIn asks the group end to end. All
three are red on the parent (the classifier is asked once, with the
page state alone, and a rule matches on it) and green here, beside the
#1826 tests they extend; with prompt.go alone put back they are red
again. go test -tags nogui ./internal/gateway -count=1 green (357s);
gofmt -l clean; go vet ./... on darwin, GOOS=linux -tags nogui and
GOOS=windows clean; go build ./... on darwin and the nogui CLI on
linux and windows.

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

Ported from ggbdpq's fork (hunt75-b-page-metadata, f8347ce50), as
written, onto origin/main 4c1fb7758 (321sssrt on X asked after it).
At this head on mote: the three tests above plus the TestUserText,
TestUserSays and TestIntent families green; with the prompt.go line
taken out, TestUserTextSkipsWhatTheAgentPutIn,
TestUserSaysPastAReminderWithASource and
TestIntentSkipsWhatTheCodexAppPutIn red. gofmt -l clean; go vet
./internal/gateway on darwin, GOOS=linux -tags nogui and GOOS=windows
clean. Not run at this head: the whole gateway package (the author ran
it green at dd1e8822d) and a real Codex app turn.
2026-10-28 14:15:40 +08:00