Files
magpie/internal/settings
yetone 419ef30219 gateway: Claude Code gets a safety refusal as Anthropic's own, and switches to its fallback model; how many more accounts are asked is a setting (#1925, DD on Discord)
DD on Discord: through magpie, Claude's safety filter refusing a turn never
makes Claude Code move to its fallback model, as it does on Anthropic's API.
magpie asked every other account and group member (#248), then told Claude
Code a 400 "<model> refused this request", which it takes as an API error.

Claude Code 2.1.296 switches on stop_reason "refusal" in a 200 reply (the
stream's message_delta or a whole message, stop_details giving the
category), and only with a fallback model set; a 400, Anthropic's
"Output blocked by content filtering policy" or magpie's, is never retried.

What changed:
- When nobody is left after a refusal, an agent on Anthropic's Messages API
  gets the held refusal itself, the vendor's 200 with stop_reason and
  stop_details, streamed or whole (holdWriter.handBack): keyed Anthropic
  providers, groups, the Claude subscription. Codex and Chat clients keep
  the 400, since an empty-looking whole reply makes Codex ask again.
- Settings' refusalRetries counts how many more candidates (accounts, then
  group members, another model among them) a refusal is asked of. Unset is
  every one, #248's behaviour (Koohoko asked for it); 0 hands it straight
  back. GUI: Settings > Models > Replies > "Ask again after a refusal"
  (Never ask again, 1, 2, 3, All), en/zh/zh-TW/ja/de. Global, no CLI:
  magpie has no general settings CLI (as noLoopGuard). Other 400s are still
  never asked again; refusals still rest nobody.
- disabled-models.test.cjs wheels to Enable, which the new row put past the
  window's foot at webkit de 420.
- Docs: reference.md "When the safety filter refuses", gateway-routing.md.

Run:
- go test -tags nogui ./internal/gateway (full, -timeout 40m: a first run
  hit the 10m default at load ~70 from other sessions), ./internal/gui,
  ./internal/settings; gofmt -l clean; GOOS=linux and windows go vet.
- GUI: refusal-retries-setting (en, zh, zh-TW, ja, de at 1100 and 420) with
  gui-zh-tw, gui-ja, gui-de, i18n-keys and every tab=models suite
  (disabled-models, images-*, loop-guard-setting, member-model-setting,
  search-*, searcher-pick, vision-mcp), chromium and webkit: 176 pass.
- refusal-retries-setting under load (8 runs at once, load ~200): first
  4 of 8 failed at en/ja 420, a press landing on the first save's "Saved"
  note over the row, then WebKit's wheel still moving the view as the
  press was measured. It now reaches each button clear of anything drawn
  over it (reader.cjs reach) and waits for the scroll to rest: 16 of 16.
Broken by hand:
- handBack off: TestRefusalRetriesNoneHandsClaudeCodeTheRefusal,
  ...CountsTheTries, ...Group, ...ClaudeSubscription and
  TestRefusalWithNobodyLeftIsAnError fail (400 "refused this request").
- count ignored: those plus ...CodexStillTold400 fail (the next key answers).
- GUI keep-on-omit dropped: TestSettingsRefusalRetries fails; the GUI test
  fails with All sent as undefined, and with the row not appended.
Not tried: a real Claude account's refusal, or Claude Code's fallback
switch end to end; the refusal shapes are from Claude Code's source and
Anthropic's docs.
2026-10-13 15:06:20 +08:00
..
tray: the menu bar shows several subscriptions' usage side by side (KevinXC on Discord) — Settings → Usage in the menu bar picked one card; its menu now ticks any number (kept open while ticking, saved once when it closes, Off unticks all, a ticked card that has gone stays listed to untick) and the pill says "3 subscriptions". settings.TrayUsages keeps them in order; a file with only the older trayUsage shows that one, and trayUsage is still written as the first for an older magpie. On the Mac the bird and a cell per card are drawn as one image by AppKit on the status item's button: the card's logo (a black glyph tinted in the menu bar's text colour, a coloured one as it is, the name's letter in a ring when there is none) and its two windows stacked, "42%" over "18%", in the bar's colour light or dark and sharp at any scale; the bird's flap goes through it. Arc flags run into numbers (Codex's logo) are spaced out for AppKit's SVG reader. A row longer than 10 characters (a plan's balance read from its page) is cut with an ellipsis in the bar and whole in the tooltip. Windows and Linux show the cards as text, " | " between them. TestTrayUsageCells, TestSVGArcFlags, TestTrayImage (darwin, renders 0-3 cards light and dark at 2x), TestTrayUsagesMigrate and tray-usages.test.cjs (Chromium, WebKit, en/zh) are new. go vet, go build (darwin GUI), go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./..., go test ./internal/gui pass; tray-usages, settings-groups, panel-*, click-scroll, old-webkit pass. Not seen in a live menu bar.
2026-09-30 19:45:44 +08:00