65cb76ca2e2b59892ecb41fd3fcf6dbe07dde1c3
2375
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
65cb76ca2e |
gateway: Copilot's Gemini gets tool schemas of six shapes it took as 400 (ProgCZ, tmhyt1 on X)
Copilot answered 400 to an MCP tool schema with an array-level enum, a root
oneOf or anyOf, prefixItems, an anyOf beside its own type, or an object
without properties at the root. copilotGeminiToolShapes (after
copilotGeminiToolUnions) writes each as the nearest schema it takes:
properties {} added; same-type anyOf merged (null kept as anyOf with null);
an anyOf with an untyped branch dropped, so geminiTypes types the node;
array enum moved to string items or dropped; root union an object with the
branches' properties, none required; prefixItems / items-as-list one items
schema. Nested oneOf and fit schemas go byte for byte. Antigravity's
plainSchema had the same array-level enum and now moves it to items. A
same-type object anyOf that wasn't provably disjoint is now merged instead
of refused (TestCopilotGeminiKeepsUnprovenUnions uses mixed types now).
Real Copilot account, sandbox magpie (own HOME, only the copilot login),
gemini-3.8-flash and gemini-4-argon, build without the pass -> with it:
array enum 400->200, root oneOf 400->200, prefixItems 400->200, root anyOf
(strings, objects, untyped) 400->200, anyOf beside type 400->200, root
{"type":"object"} 400->200, fit control 200->200. Nested object-without-
properties and nested typeless same-type anyOf were already 200 on the old
build, so the reports' failing forms are the root and type-beside ones.
Run: new TestCopilotGeminiTakesToolShapes (8 rows, red on the old code with
the call unwired), TestCopilotGeminiToolShapesLeavesFitSchemas,
TestAntigravitySchemaArrayEnumMovesToItems, -run Copilot|Antigravity|Schema
on internal/gateway ok (mote); vet darwin, windows, linux nogui ok.
Not tried: the full gateway and provider package run (mote busy, still
going when tagged); Google AI, Vertex and Antigravity with real accounts;
the GUI suite (no GUI file touched).
|
||
|
|
67f61bd789 |
gateway: a Claude account's plain rate limit on one model rests that model, not the account (kaitokiku on X)
v0.1.3817 and the fixes after it scoped Fable's quota refusals ("hit your
limit", "reached your Fable limit") to Fable. A plain 429 rate_limit_error
is failRate, and restAfterMarked rested the whole account for it, with its
backoff ladder and sink: Fable rate limited showed "限流 · 42 分钟后恢复" on
the account's Opus row too.
claudeModelRate: a Claude account's failRate that names no window that
counts every model (5-hour, session, weekly, usage limit, organization,
overage, or a representative-claim header of five_hour/seven_day) rests
that model only, in restAfterMarked, rateRest and the sink. Anthropic counts
rate limits per model. Quota refusals and account windows rest the account
as before. Messages, Chat Completions, Responses, groups and the Routing
rows share restAfter.
No real Fable 429 was available: ~/.config/magpie/usage.jsonl, rests.json
and app.log hold none, and Claude Code's bridge keeps no response headers,
so the rule is not checked against real anthropic-ratelimit-unified-*
headers. The account-wide limit the logs do hold ("You've hit your weekly
limit · resets 2pm") is in the test and still rests the account.
Cost if the guess is wrong (Anthropic applies a plain 429 to the whole
account): the next Opus request to that account gets its own 429, rests
Opus there, and falls over to the next account in the same client request,
as any rested candidate does; the user sees no error. One extra refused
request per model per rest. The test checks Opus's own rest and that
Fable's stays and a second account is not resting.
Run at this tree (mote): TestClaudeModelRateRestsThatModelOnly red with
claudeModelRate returning false (account rests, Model empty), green with
it; TestFallback* ok; gofmt. Package internal/gateway and internal/provider
run, and vet on darwin, linux and windows, were still running at commit;
results follow. Not tried: a real Fable-limited account.
|
||
|
|
2e92d71aab |
gateway: Anthropic's message_stop and a Responses upstream's completed end a translated read too (#5936, ggbdpq and polaris-yhl on X)
The [DONE] fix in the previous commit (ggbdpq's patch, applied with git am, reviewed: three hunks in continuation.go plus tests, nothing else, nothing that reaches out) ended a Chat upstream's read at its own end. The other two translated upstreams had the same hole: a relay that holds the connection after message_stop, or after response.completed/incomplete/failed, kept the translated reply's end waiting for the hangup. saidOver now names each protocol's last word and the read ends there. Run: TestAnthropicStopEndsTranslatedReply and TestResponsesCompletedEndsTranslatedReply (a held upstream; Responses client over Anthropic, Chat client over Responses) plus ggbdpq's two tests; all four red on origin/main's continuation.go (5s/30s timeouts), green with the fix. go test ./internal/gateway ok (1039s, on mote); go vet darwin/linux/windows clean; gofmt clean. Not tried: a real OfficeAce account, the full ./... suite before the tag. Co-authored-by: ggbdpq <ggbdpq@gmail.com> |
||
|
|
48875e580a |
gateway: a Chat upstream's [DONE] ends a translated reply's read, not its hangup (#5936)
A relay that streams a reply whole, says it over (finish_reason, [DONE]) and holds the connection kept the client waiting on the translated reply's end: the read went on, the end was said only when the reading gave up, and the client — Codex on a Chat-only provider, its turn stuck in progress — gave up first. The reply now ends at the [DONE] its protocol says it over with, its usage in the chunks before it; a reply that said nothing is still the empty reply's to answer, and an upstream whose end is told by its finish_reason (Gemini's OpenAI-compatible, Command Code) is read as it was. Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
409581c053 |
routing: Least used first spends credits about to lapse first (kudi3699 on X)
kudi3699: a WorkBuddy account with a 5000-credit pack ending next March, half used, plus check-in credits ending soon, was ranked by the whole pool's used share in "Least used first", so it was never picked and the check-in credits were lost. Smart (Renewal, Lapse) and Use before expiry (Pace) already went by the plugin's runsOutAt/runsOut; Least used did not. Allowance.Lapsing is what a window loses at RunsOut (RunsOutLeft of Of, at most what is left) as points of the used share, fading to nothing a week out; an amount not told is 0. routes.Seat.Lapsing at >= 0.5 points puts a seat with room ahead of the rest, soonest Lapse first, then Used as before. A seat at 90%+ is not helped. It is the shared runsOutAt/runsOut field, so any plugin that sends it gets this. The WorkBuddy plugin already reports it (0.2.27, the soonest pack incl. check-in rewards), so no plugin change and no mover min change. Run (mote): go vet routes/provider/gateway; GOOS=linux -tags nogui and GOOS=windows vet; go test internal/routes, internal/provider (all), internal/gateway -run "WorkBuddy|LeastUsed|Smart|Pace|Routing". Broken by hand: urgent() forced false turns TestLeastUsedSpendsLapsingFirst and the gateway test red. Not run: the full suite (started after the tag), real WorkBuddy accounts, the plugin's bun tests (plugin untouched). |
||
|
|
727e236378 |
gateway: a management API for providers, accounts and gateway keys, for a key set to manage (ljayic on X)
ljayic asked for a complete, stable management API so nothing needs a hand-edited file. /v1/magpie/admin/ now serves the app's own /api handlers (providers and their keys and accounts, OAuth sign-in start/poll/cancel, gateway keys, account groups) to a gateway key set with `magpie gateway-key admin <id> local|any`. Routes and actions not in gui/admin.go's adminRoutes are 404, so a provider's saved key, a gateway key's secret, sign-in export and actions on this computer's apps are not served; "admin-key" is not served either, so the API can't raise its own caller. Sign-in returns the vendor's page and code, opens nothing, takes no password. Guard (gateway/admin.go), in order: any Origin or Sec-Fetch-Site/-Mode is 403 with or without a key (Origin null, foreign, listed, *.localhost, an app scheme); no key 401; a key without Key.Admin 403; from loopback the Host must be ownHost (a rebound page's GET has no Origin); from the network the key must be "any"; a proxied request counts as remote. Key.Admin is dropped (adminOf) for a read-only, Browser, issued, expiring or default key, and setting read-only clears it. The route is in readOnlyRefused and keySlotFree. Docs: docs/reference.md "Management API", gateway-routing.md, and the remote page in en, zh and ja. Routing Groups, sign-in export and a GUI switch for the level are left to #6307. Run (mica, the worktree before the rebase onto 9 newer commits): go vet of access, cli, gateway, gui (darwin), GOOS=windows vet of the same four, GOOS=linux -tags nogui vet of access, cli, gateway; gofmt -l empty; go test -count=1 -timeout 45m ./internal/access ./internal/cli ./internal/gateway ./internal/gui: all ok but TestKeySlotEveryRoute, which named the new route and is fixed here, then it and the read-only, admin and guard tests pass again. After the rebase the same tests ran again. Broken by hand, each red in TestAdminAPIGuards: browser check off (a browser case served), Admin check off (a key without it served), Host check off (a rebound name served), the "any" requirement off (a local-only key from the network served, and a proxied request). Tests: TestAdminAPIGuards (no key, unknown key, non-admin, read-only, local/any, x-api-key, 8 browser headers x 3 callers, rebound Host, proxy, no handler), TestAdminKey (access: levels, read-only, Browser, issued), TestGatewayKeyCLIAdmin, TestAdminAPIGatewayKeys / Providers (a canary key is never told) / SignIn, TestAdminRoutesEveryAPIRoute. Not tried: a real sign-in against a vendor through the API, a request from a second computer on the LAN, the GUI suite (no page or app.js changed), a Linux/Windows run of the new tests. |
||
|
|
4a5e58a04f |
gateway: one account held only by Codex credits being off is sent at once, not queued (tmr11235 on X)
tmr11235, after v0.1.3857: "没有设置上限或者并发,只有一个号,这个号额度用了95%,
但我不希望排队". v0.1.3852/3857 made a turn that waits for its account's one
turn near a usage cap say "queued". The wait itself is nearCap: an account
within 5 points of a cap holds one turn at a time. HoldCaps counts a Codex
account set not to spend its credits as capped at 100% of any window
(Credits), though the user set no usage limit, so such an account at 95%
was near its "cap" and its second turn waited for the first, with no other
account to send it to.
Now a try near its cap takes the account's turn only when the user set a
usage limit on it (a share or an amount: userCapped) or the turn has another
candidate to go to (it is sent there first, the account kept behind). A sole
account whose only hold is credits off is sent at once; the 100% hold itself
still applies at the try (capHeld). A cap the user set keeps its one turn at
a time, as dyzdyz010 asked for.
Run (mica): TestNearCap*, TestFarFromCap*, TestPiTwoTurns*,
TestNearCapOnlyCreditsOffOneAccountSendsAtOnce (a single account at 95%,
credits off, no cap: both turns out at the vendor at once, none waiting);
gofmt; go vet darwin, linux nogui, windows of internal/gateway.
Broken by hand: the userCapped condition removed, the new test red ("never:
both turns out at the vendor at once").
Not tried: a real Codex account; I could not tell from the report whether
tmr11235's account has credits off or a cap they forgot: with a cap set,
a sole account still queues, by design. Full suite after the tag.
|
||
|
|
4718943432 |
gateway: a small reply limit sent to Tencent's DeepSeek has room to think above it (WaiooT on X)
WaiooT (Tencent Cloud Token Plan, deepseek-v4.1-flash, an agent named nowledge-mem): requests often ended "an empty reply (the model answered nothing; try again) -- cut at its length, the whole output spent on reasoning". Output 4,096, reasoning tokens 4,096, finish length. The request named max_tokens 4096 (the memory tool's own setting; magpie adds no limit to it) and no reasoning. Tencent's DeepSeek runs thinking by default (docs 1823/132248: thinking "enabled", reasoning_effort "high", "max_tokens >= 2048 advised in thinking mode") and counts it in max_tokens, so the thinking spent the whole limit before an answer. A Chat or Responses request to a tencentmaas.com provider's DeepSeek model that names a reply limit of 16384 or less, names no reasoning of its own (reasoning_effort, thinking, enable_thinking, reasoning...) and has no Max output set by the user is sent that limit plus a high effort's room (replyRoom, as side calls are), within the model's own limit where known (withThinkingRoom, maxoutput.go). Scoped to that host and DeepSeek models. The failure itself, a cut void, was already failed at once and asked nowhere (#2972): its text now names the limit the request set and what to do ("raise max_tokens in the agent, or ask for less reasoning"), still holding cutVoidWords, so the group and patience matching is unchanged. Run (mica): TestTencentDeepSeekCapGetsThinkingRoom (4096 gets room; max_completion_tokens too; effort asked, thinking off, a large limit, no limit, and another vendor's DeepSeek go as they came), TestChatLength* (the error names the limit), TestShortDefault*, and gateway tests matching Void|Length|Empty|Cut|Tencent|Output|Thinking|Reasoning; gofmt; go vet darwin, linux nogui, windows of internal/gateway. Broken by hand: withThinkingRoom's call removed, the new test red ("4096 and no reasoning: max_tokens 4096, want 28096"). Not tried: a real Tencent Token Plan key (none here), so that the 4096 came from the agent and not a Tencent default is read from the docs and the reporter's numbers, not seen on the wire; an Anthropic-protocol client in front of Tencent's DeepSeek is not covered; full suite after the tag. |
||
|
|
0d3bba882e |
tests: the search queue's fake upstream ends when its client fails first (#5666)
macOS CI at |
||
|
|
8d5bcf18b0 |
gateway: a request to Mistral keeps its newest 20 images (regain4125 on X)
Mistral answers a Chat request with more than 20 images with 400 "Total
number of images exceeds the maximum allowed of 20." Codex reading its
21st screenshot in one conversation failed on every later turn. Both
routes to Mistral (the Chat passthrough and the Responses-to-Chat
translation) now replace the oldest images past the newest 20 with a
short text part, in place; a request within 20 goes byte for byte, and
other vendors are not touched. Mistral's docs give no number ("depends on
the model"), so 20 is the one its error names.
Run on mote: TestMistralImageLimit (Chat route, Responses route, 20 images
unchanged, another vendor's 26 images unchanged). Broken by hand: with the
two calls off, the chat and responses cases fail. Not tried: a real
Mistral key; a model with a smaller limit than 20 (Mistral's docs do not
say any does).
|
||
|
|
327da691ae |
gateway: the Codex app's list stands on Codex's cache while the backend can't be reached (not_4O4 on X)
Beside the ChatGPT sign-in the Codex app's picker reads magpie-desktop-models.json, written only once the ChatGPT backend's model list is known. not_4O4 (Windows, Codex App 26.1106.6628.0) had no such file: the backend's ask never succeeded from there, so the file was never written and the picker showed GPT alone while the account had room, magpie's models only (and no GPT) once it was used up and magpie became the provider. After an ask has failed with no list from before for that sign-in, CodexDesktopCatalog now hands Codex's own models_cache.json entries and magpie's models (the revoked sign-in's path), told once through CodexDesktopChanged; the backend's list replaces it when it answers. With no cache the file stays as it was, and a 502 after a revoked sign-in is still no answer. Run (mote): go vet gateway and agent (darwin), GOOS=windows and linux -tags nogui vet of gateway, go test ./internal/gateway ./internal/agent; TestCodexDesktopCatalogBackendUnreachable is new and TestCodexDesktop*, TestCodexDesktopCatalogRevokedSignIn still pass. On the Windows box (win-run) the agent's Codex desktop tests passed and a used-up probe wrote magpie-models.json with relative key as in the report. Broken by hand: the stand-in only for revoked, the new test went red. Not tried: the real Codex app on the reporter's network; the reporter's used-up half (GPT missing from the provider catalog) did not reproduce, the catalog carries codex/<slug> entries in the probe on macOS and Windows. |
||
|
|
19a698d0f9 |
Plain wording for the held-compaction error and the account-switch hint (ccw1942796 on X)
The error magpie gives Codex when a conversation's compaction has failed 3
times now says what happened, how long magpie waits and what to do:
"Couldn't compact the conversation: <model> failed N times in a row (last:
<vendor's reason>). magpie waits <t> before asking it again. To compact now,
switch this conversation to another model." It is a 400 back to Codex
(codexCompact), never sent upstream as prompt.
The hover hint beside "Switch {agent}'s account automatically" is two short
lines per agent instead of three long ones, in en, zh, zh-TW, ja and de.
It still says it is the agent's own sign-in that moves, that the agent sends
the requests, and that sharing an account is against the vendor's terms.
Run on mote: gofmt -l, go vet (darwin, linux, windows) on internal/gateway,
go test -run Compact ./internal/gateway, and in chromium and webkit
i18n-keys, i18n-en-no-cjk, keep-login, pool-ends, sign-in-moves (84 of 84
GUI subtests ok, en and zh). The hold test now asserts the new wording.
Not run: the full suite before the tag (started after it); ja, de and zh-TW
screenshots of the hint; breaking the new assertion by hand (the old text
lacks the asserted words).
|
||
|
|
1b884225ad |
gateway: agy's own /effort or --effort level beats the Agents row's pick (haohaolee on X)
Antigravity CLI on a Google model through an API provider: the row's effort field was there and applied (TestAgyAgentEffort), but agy's own /effort (works on the Google names agy knows, which the gateway serves by bare name) and --effort low|medium|high (any model) send a thinkingLevel that the row's pick then rewrote, so the session's choice seemed to do nothing. A request naming a level is now left as asked (agyLevelAsked); a request with thinkingBudget -1 still gets the row's. "/effort" stays "not adjustable" for "magpie/..." model keys: agy 1.5.5 and 1.5.6 have no settings or ModelInfo key that enables it (tried thinkingLevel, thinkingBudget, displayName, vertexModelId). Run: TestAgyAgentEffort, TestWithGeminiEffort on mote; the new case is red (sent "low" for an asked HIGH) with the condition removed by hand and green with it. Real agy 1.5.5/1.5.6 against a fake Gemini upstream in a sandbox HOME showed the levels reaching the gateway. Not tried: a real Gemini API key, agy against the real gateway end to end. |
||
|
|
531b277836 |
claude: an idle run's session survives a restart, so the next turn resumes it (recih on X, #6292)
As the gateway ends (abortAll), keepShelf shelves every run idle between turns and writes the shelf to claude-shelf.json (temp and rename): per entry the conversation fingerprint (turnKey: account, model, settings, messages), Claude Code's session id, its project folders (config folder and work folder), the account, tools and cache marks. The next gateway's unshelve reads the file once when its shelf has nothing for the turn (loadShelf, which takes the file away) and starts Claude Code with --resume, told the turn alone, instead of the whole transcript (~100k cache-write tokens on a long conversation). A file that does not parse whole, another version, a missing session file, a folder that is not a Claude project folder, or an entry older than idleLongest is unknown and falls back to today's replay. Rewritten-turn matching (looseTurn) is not kept; runs in a turn or parked on tool results at the stop are not either; a crash writes nothing. Run (mote): gateway "Claude|Subscription" tests green (90s), gofmt, go vet darwin/linux/windows (nogui) and gui. TestClaudeIdleRunSurvivesARestart (two Servers on one HOME, fake claude) is red with keepShelf off (session removed as the gateway ended) and green with it; the unreadable-file cases fall back to replay. TestClaudeSessionFilesAreRemoved now expects the sessions to stay until the shelf discards them. Not tried: a real Claude Code (a sandbox HOME has no sign-in), the full ./... suite before the tag, Windows. |
||
|
|
4b283e4f2c |
gateway: a Claude refusal for one model's limit rests that model, not the account (YsiCing on X)
Claude Code's "You've reached your Fable limit. Run /usage-credits to continue or switch models with /model" read as a plain rate limit: the "reached your ... limit" wording was in none of the quota word lists (only "hit your ... limit"), so the whole account rested and Opus was refused with Fable though its quota was left. The four lists in routing.go and fallback.go's quotaWords take "reached" as they take "hit". modelNamed (so every rest path that asks modelLimited) reads a Claude account's "reached/hit your <family> limit" as that model's when the family is in the model's id (claudeFamilyLimit); "usage", "session", "weekly" and the like, and "You've hit your limit", stay the account's. Messages, Chat Completions, Responses, the group fallback and the Claude Code bridge all rest through restAfter. Run at this tree (mote): TestClaudeNamedModelLimitRestsThatModelOnly red without claudeFamilyLimit (rests the account, Why rate), green with it; internal/gateway and internal/provider, gofmt, vet on darwin, linux and windows (results below). Not tried: a real Fable-limited account; the family word is Claude Code's wording as the screenshot shows it. |
||
|
|
223b57ffa3 |
gateway: a turn waiting for its account's turn near a usage cap says queued, not routing (tmr11235 on X)
tmr11235 (Pi, Codex subscription, gpt-6.1-sol): the second request sat in
"routing" until the one before it was answered. Two Pi turns at once on a
Codex sign-in are both out at the vendor at once (HTTP and websocket
upstream, TestPiTwoTurnsOnCodexAreOutTogether, green on the old code too),
and no concurrency cap is set for Codex by default. What does hold a
second turn is an account within 5 points of a usage cap the user set
(nearCaps, one turn at a time). That wait comes before the first try is
begun, so the row had no try and read "routing", and the wait wasn't a
known one for the unrouted watch either (it could end the request as
unknown after 30s).
The wait now sets the route's Phase to "queue" and the request's phase
(notePhase, so it is a known wait). The Routing page says "queued…" and
its explanation says what it waits for, in en, zh, zh-TW, ja, de.
The one-turn rule itself is unchanged: it protects a cap the user set.
Run (mote): TestNearCap*, TestNearCapWaitSaysQueued, TestPiTwoTurns*,
go test ./internal/gui, routing-queued/routing-masking/routing-wait-dot
in chromium, routing-queued in webkit, i18n-keys, i18n-en-no-cjk, gofmt,
go vet darwin/linux nogui/windows of internal/gateway.
Broken by hand: showQueued replaced by a no-op, TestNearCapWaitSaysQueued
red ("never: the waiting turn's route says queued").
Not tried: a real Codex account near a real cap; full suite is started
after the tag.
|
||
|
|
b883b11c8a |
gateway: a test holds Copilot's Gemini and Grok tool schemas on every client route (Novello42 on X, #3931, #4374)
Novello42 reported Codex with MCP tools through Copilot's Gemini and Grok failing with 400 or empty tool arguments. Both causes were fixed in |
||
|
|
4028687b8c |
memory: dates in memory_search and the dream's notes are the user's local time, with the hour and offset (Norethcy on X)
memory_search printed a memory's Updated as a bare UTC date, so a memory
saved at 04:30 on the 11th in Shanghai read as the 10th, and the stored
times were written in UTC. Now:
- every memory time is written in the local zone (now() instead of
now().UTC()): created, updated, edited, used, sync tombstones, digest
publish time;
- memory_search shows 2026-11-11T04:30+08:00 (memoryStamp);
- the dream's notes list the creation day in local time, as "Today" there
already was.
Old data: the file already held full timestamps, only in UTC ("...Z").
They parse as the same instants and are shown in local time, so no
migration; they are rewritten with a local offset when next changed.
There is no date filter in memory_search, and the Memory tab shows no
dates, so nothing else read the UTC day.
Tests: TestMemorySearchDatesInLocalTime (gateway) with time.Local at +08:00
reads an old "Z" memory and checks a new save is stored with +08:00. Red on
the old code both halves, broken by hand: the DateOnly line printed
2026-11-10, and now().UTC() in memory.go failed the saved-zone check.
Run with TZ=UTC and TZ=Asia/Shanghai on mote: internal/memory,
internal/memdistill, internal/gui (memory tests) ok; gofmt clean;
go vet ./..., linux nogui, windows ok. Not run: full ./... suite before
the tag (started after it), GUI browser tests (no assets changed).
|
||
|
|
169ec91651 |
gateway: a relay's Chinese "未知请求字段:prompt_cache_retention" is read as a refusal of that field, and the request is asked again without it (ldl123292 on X)
基元律动's OpenAI-compatible relay answers a field it doesn't take as "未知请求字段:<name>". refusedOptional only knew the English wordings, so the retry without prompt_cache_retention (and the other optionalFields) never happened and the error went to the client. magpie itself adds none of these fields to a custom provider's request: prompt_cache_retention is the client's own, and optionalFields already drops it on a refusal and remembers the provider. Added the Chinese wordings (未知/未识别/不支持/ 不允许/无效 + 请求 + 字段/参数/属性) to unsupportedOptionalField. Run: gofmt clean; go test -run 'Optional|Refus' ./internal/gateway ok on mote; go vet gateway darwin/windows/linux. chinese-unknown-field and chinese-unsupported-quoted in TestRefusedOptionalNamesOnlyUnsupportedFields fail on the old gateway.go (checked by hand). Not run: full suite before the tag (started after), the relay itself (no account). |
||
|
|
a168d4dd96 |
gateway: a sub-agent's report delivered as a system message reaches the Claude bridge (#6277) (recih on X)
Claude Code delivers a sub-agent's report that arrives mid-turn as a
{role: "system"} message: "Another Claude session sent a message while
you were working: <agent-message from=...>report</agent-message>", beside
a <task-notification>. saidWithResults skips system text, and
withTaskNotices kept only the notification, so the bridged main agent was
told the report was delivered and never saw its 14k chars. withTaskNotices
now also hands over <agent-message> blocks from system/developer messages,
in order, labelled as another agent's output and not the user's. User-role
standalone reports already went through as said text, so no duplicate.
Siblings: the only other system filter is saidWithResults's (deliberate:
system text is never the user's); the workdir scan skips system on purpose.
Run: TestClaudeAgentMessageReportGoesWithTheResults (notification beside,
split across blocks, two agents) red on origin/main's code (3 of 3), green
after; go vet darwin/linux nogui/windows; full internal/gateway on mote ok;
gofmt clean.
Not tried: a real Claude Code with a real sub-agent, GUI tests (no GUI change).
|
||
|
|
28b8244d47 |
gateway: a Chat reply with only a usage frame is an empty reply, asked again (codealc on X)
Copilot's gemini-4-carbon now and then answers a Chat request 200 with completion_tokens above 0, no content or tool delta and finish_reason null (~855 bytes: the usage frame). thoughtOnly never saw it (no reasoning in it), the Chat decoder gave no stop, and the Responses encoder closed it with an empty response.completed, so Codex stopped without a word. A Chat upstream's reply that said nothing and never gave a finish_reason now takes the empty-reply path (#667): asked again in place, the error when it stays empty. A reply with text and no finish_reason, and one ending with a stop and no text, go as before. Run: TestChatUsageOnlyReplyIsEmpty plus the gateway empty/length/thinking tests via mote-run. Broken by hand: without the `voids && stop == ""` condition the new test is red with the empty response.completed. Fixture: role chunk, then a choices:[] chunk with usage, then [DONE]. Not tried: the real Copilot account (the empty reply is intermittent). |
||
|
|
446d025192 |
gateway: a turn's effort is never outranked by one made of the budget, through a remote magpie (DIYgod on X)
adaptiveThinking turned thinking enabled+budget into adaptive and wrote the budget's nearest level as a top-level output_config.effort whenever none was there. Claude Code's High is carried in a turn's own message (turnEffort) beside a 31999 budget, so the first magpie wrote "max" on top, and the next magpie (parseAnthropicRequest, requestEffort) reads the top-level level before the turn's: every request ran at max. Now no top-level level is made of the budget when a turn carries one. Siblings that read only the top-level effort: thinkingOffAsTaken and withBetweenTools judged "above high" without the turn's level, and withBetweenTools wrote into a nil map when there was no output_config (panic); both now use outputConfigEffort (top-level, then the turn's). Reviewed and left: requestEffort, parseAnthropicRequest, outputConfigEffort (turn after top-level, never the budget), buildAnthropic from the IR (r.Effort is already the turn's), withOutputEffort, decide.go's rule effort (an explicit pick), gemini/chat budgets (no turn effort exists in those protocols). Run (mote): the two new tests, red on the old anthropic.go (upstream effort max / top-level max), green on the fix: TestRemoteMagpieKeepsTurnEffortOverBudget goes local -> remote magpie (both real handlers) -> Anthropic fake and checks the hop's body too. Not tried: a real Claude Code through two magpies. |
||
|
|
ffc1d64e5e |
usage: a call recorded under magpie's alias id is the gateway's, not a direct one (CrazyJal on X)
Claude Desktop's Code tab, and Claude Code under it, write the id the gateway listed the model by (magpie-<number>.anthropic.<Claude model>, mythos-magpie-<n>, anthropic/magpie-<n>, claude-magpie-<n>) as each turn's model. The gateway's log counts the turn under the model that served it, and the agent's file counted it again under the alias: a row for a model that is none, its cost on top of the real one. Only the gateway knows those ids, so a call that names one went through it. Such calls are now left out of what Direct, the ledger and the Requests page's chunks take from session files, for every agent that records one. Calls under a model of the agent's own are unchanged. usage.MagpieAlias mirrors the gateway's alias forms; a gateway test fails when the two differ. Run (mote, at the pushed head): TestAliasCallsAreTheGatewaysNotDirect, TestMagpieAliasForms and the gateway's TestUsageKnowsEveryAliasForm pass; with ownCalls returning its input the first fails (7 rows, four under aliases). go test internal/usage, internal/gui, internal/sessions ok; vet darwin, linux nogui and windows of usage and gateway clean; gofmt clean. Go-only change, so no GUI file was run. Not tried: a real Claude Desktop 3p session (none on this machine; the model forms come from the gateway's own alias code and its tests, not JSONL bytes). Existing persisted request chunks rebuild with the new binary. |
||
|
|
d91720d406 |
gateway: a Claude Desktop turn's run keeps Claude Code's hour of cache, not the 5 minutes its marks name (DIYgod on X)
Claude Desktop reaches magpie with a gateway key, which Claude Code takes for an API key (docs: automatic is 1 hour on a subscription, 5 minutes on an API key) and marks with no ttl. runTTLFor read that as the client's word, since claudeTTLOf gave Desktop no pick, and the bridge's run wrote 5-minute caches. Desktop with no pick now gets "default" (this computer's Claude Code pick, else an hour); a 1h mark and a magpie's header stay as they are. Run: TestClaudeCacheTTLOf and TestClaudeDesktopRunKeepsAnHour (both red on the old code, checked by reverting remote_magpie.go), go test -run 'Cache|TTL|Claude' ./internal/gateway ok on mote, gofmt, go vet darwin, linux, windows. Not tried: a real Claude Desktop turn and a usage row's ephemeral_1h in a sandbox (needs Desktop signed in to a gateway and a live account). A Desktop user who picked 5m in its own config is now given an hour: its marks can't tell that from the API-key default. |
||
|
|
0af73f42b4 |
gateway: an app update asks its own background service to restart, and the page no longer calls it another program (Norethcy on X)
After an app update the service (`magpie daemon`, ~/.local/bin/magpie) ran on as the old version until its own look at the disk found the gateway idle, and `magpie daemon restart` by hand showed the app "Port 3425 is in use by ~/.local/bin/magpie (pid N): quit it" while the new service came up. - PortHeld.Own: a holder that is a magpie running this install's program (same file, symlinks followed) is marked; the Gateway card then says "Starting the gateway…" instead of the port-in-use error. - The app asks an older service of its own install (the pid the service manager reports, program from the unit/plist: daemon.Program) to restart, once per process, through gateway.RestartPath, as `magpie update` does: it restarts into the new version once idle, bounded by its drain, under the same service manager. Run on mote: go test of the new tests in internal/gui, internal/daemon, internal/gateway; go vet darwin, linux nogui, windows; gofmt; gateway-* and i18n GUI files in chromium and webkit. Broken by hand: dropping the Older check makes TestNudgeAsksOwnOlderDaemonOnce red. Not tried: a real app update over a real launchd service. The restart is an in-place re-exec of the service, not a socket handover, so the port is closed for the service's start-up. GUI (mote, chromium+webkit): gateway-port-holder, older, skew, takeover, port, i18n-keys, i18n-en-no-cjk 36 of 36 ok. All gateway-* files: 30 reds, all in gateway-card (shares on the network, #6267) and gateway-key-arrange (420px, #6268); the same 30 with client.js reverted to origin/main, so not from this change. Not tried: a real app update over a real launchd service; the daemon re-execs in place, it is not a socket handover. |
||
|
|
9d47b441e1 |
gateway: a Claude Code run shows its thinking, and a turn's own effort beats the budget beside it (DIYgod on X, #5379)
Interactive mode dropped --thinking-display, so no summary reached the client, and -p set it only when an effort was known: both runs now get showThinkingSummaries in --settings. A High carried in the turn's own message (output_config on a {role:system} message) lost to a 31999 budget read as xhigh; the turn's level now wins in parse and in routing's requestEffort.
Red on the old code: TestClaudeBridgeTakesTheEffortOfEveryRoute (3 new rows), TestTurnEffortBeatsBudget.
|
||
|
|
f1e6705c52 | wip | ||
|
|
2858566a13 |
gateway: bring back Mistral's prompt_cache_key, which d31988c95 undid
|
||
|
|
04e38e6045 |
gateway: a reorder moves only its own provider's conversations, and tests forget it (#6249, #6262)
|
||
|
|
3297243184 |
gateway: Antigravity gets DeepSeek Harness's @-path paragraph reworded (plugins#1028)
DeepSeek Harness's desktop app puts one paragraph on @ paths in every
system prompt. With it word for word, gemini-4-argon on Antigravity
answered most requests in about 3s, with no thinking, and stopped after
one shallow step. The reporter found that removing just that paragraph
fixed it, and a recorded DSH request with the paragraph reworded was
answered normally 20 of 20 times. The antigravity plugin 0.1.7 now sends
it reworded; this is the same for magpie's built-in Antigravity.
codeAssistBody, for an Antigravity account and unless the prompt is set
to go as written, now sends antigravityReword(antigravityCloak(system)).
antigravityReword replaces each exact paragraph in agReworded with a
rewording that says the same, and leaves the rest alone. The caller's
request keeps the system prompt as written, as it does for the cloak.
Run (mica, at origin/main
|
||
|
|
d31988c957 |
gui: the Mac's plain title bar is done as the main window is first shown, not at start (eating_dream on X)
On macOS 26 an update's silent relaunch (open -n -g) deadlocked the new process's main thread: ApplicationStarted ran plainTitlebar -> insetLights -> toolbarRounder, which allocates a temporary NSWindow and releases it while the hidden background launch is still inside FBSWorkspaceScenesClient createSceneWithIdentity. Every InvokeSync waiter (tray usage, lighten, the resize/move timers) then blocked behind it, so the old tray left and the new one never came up. The Mac's title bar is now done in reveal, just before the window is first shown (a user action, never inside the launch); Linux keeps it at start. Their other two suggestions need no change: keepAt already returns while h.placed isn't the window, and with the main thread free the ready waiters no longer pile up. Run: gofmt; go vet darwin, linux nogui, windows; go test ./internal/gui on mote (ok, 136s). New TestMacTitleBarNotDoneAtStart, red with the call put back in ApplicationStarted and red with it removed from reveal. Not tried: the real deadlock. It needs macOS 26's hidden relaunch through LaunchServices from an updated bundle; mote (macOS 27) was not driven that way, so it is not shown not to reproduce there either. The full suite was not run before the tag. |
||
|
|
95eab9a66b |
gateway: Mistral's key is written ahead of the body's members, not through a re-encode (daoche_wuzui on X)
withFields re-sorted the client's message keys, which the Mistral reasoning tests (byte-for-byte) caught. The fake Mistral's known fields now list prompt_cache_key, as Mistral's chat docs do. Run: Mistral, CacheKey, Hermes and the five full-run reds alone (all ok); gofmt. |
||
|
|
1648fcfe27 |
gateway: Mistral requests carry a prompt_cache_key of their conversation (daoche_wuzui on X)
Mistral routes a request by prompt_cache_key to the server holding its prompt cache; magpie sent none, so cache hits were poor. A Chat request bound for Mistral (preset or api.mistral.ai) with no key gets the sha256 hex of the session, else the conversation id: opaque, stable per conversation, never the raw id. A client's own key and a user's extraBody key are kept; translated requests get it through ownCacheKey (its refusal retry applies). Other vendors are unchanged. Run (mote): TestMistralPromptCacheKey, TestOwnCacheKey, CacheKey tests, then gofmt, go vet on darwin/windows/linux nogui, and the gateway package. TestMistralPromptCacheKey was red on the old code (no key). Not tried: a real Mistral API key. |
||
|
|
70836f732b |
gateway: Codex's image call goes over the pool, not to the account it is signed in to (Richyisaflower on X)
Codex sends its image tool's calls to the ChatGPT backend path magpie serves (/backend-api/codex/images/generations and /images/edits). codexBackend relayed them as they came, signed with Codex's own sign-in. With Codex kept signed in to account A (KeepLoginAs) and the pool ordered to put B first, text turns went to B, but every image call still spent A's image allowance, so once A's was used up no image could be drawn while B had room. Now, when magpie has more accounts than the sign-in (and the call carries no API key, names no account, and is signed by the sign-in), the call is served by the images handler on codex/<model>: drawOnAccounts goes over the accounts in the pool's order, past one whose image allowance is spent (restDrawer), signed with that account's own token and chatgpt-account-id. A sign-in alone, an API key, a request signed by an account magpie lacks and a model with a namespace are relayed as before. Run on mote: TestDrawingFollowsThePoolNotTheKeptLogin (two fake accounts, acct-1 answering usage_limit_reached, pool order spare first, Codex kept on acct-1) red on the old code for the /backend-api/codex path (asked acct-1, 429), green now for it and for /v1/images/generations; TestCodexImagesRelayedWithTheSignInAlone green. go vet darwin, windows, linux nogui ok; gofmt clean. internal/gateway -run "Codex|Draw|Image|Keep|Relay" ran: two reds, TestAffinityKeepsAnHourCachePastFiveMinutes and TestClaudeConversationKeepsItsAccountsCache, both ok alone and neither near this change (see issue). Not tried: a real Codex account; Codex's real image request body (edits shape taken from the images API's); the full suite (started after the tag). |
||
|
|
b70563ec6b |
gateway: a reorder of the pool counts at a conversation's next turn (Richyisaflower on X)
Auto affinity kept a conversation on the account that answered it by its cache, so an account moved down (or another made First) still took the next turn. SetAccountOrder, the login switch and the CLI switch now call provider.NoteReordered; affine drops a stick last answered before it, in Auto and not within a turn (Session and Strict keep it). Run on mote: TestReorderedAccountsTakeTheConversationAtItsNextTurn red with the check off (k1 k1 k1), green with it; go test internal/provider, internal/cli ok; internal/gateway -run Affinity|Ordered|Stick|Reorder|Strict|Conversation|Fallback ok; go vet darwin, windows, linux nogui ok; gofmt clean. Not tried: a real Codex account; GUI tests (no GUI file touched beyond the switch handler); the full suite (started after the tag). The image-quota half of the report is not fixed: no real refusal body was available. |
||
|
|
9c9812ace7 |
remote magpie: a list wait behind Cloudflare is held, not asked once a second (y0ngb1n on X)
y0ngb1n runs magpie on a server behind Cloudflare and uses it from a local magpie as a Remote magpie. Cloudflare's analytics showed /v1/models asked ~3.7k times an hour (one a second) since Nov 10, 175k in 7 days. Cause: the follower (KeepRemoteListsFollowed, 11-06/11-08) waits at the other magpie's /v1/models with X-Magpie-List-Wait and If-None-Match, and the gateway holds the wait while the tag is the one named. Cloudflare compresses the list and so turns its ETag weak (W/"ml-..."); the follower sent that back, and modelsOnceChanged compared it exactly (tag != since), so every wait was answered 200 at once. The tag it answered equalled the follower's, so no refetch, only followGap (1s) before the next ask: a request a second for ever, for as long as the local magpie runs. Fix: - gateway/models_wait.go: the wait compares the tag weakly (tagNamed, as listModelsTagged already does), so it is held to its end and answered 304. - provider/remote_follow.go: a 200 that carries the tag the follower has, answered sooner than followQuick, is a wait that was not held (an older gateway behind such a proxy): the remote is left to its schedule (errListNotWaited, again after followOldAgain) as other non-waiting magpies are. Tags are compared without W/. Run: - Two magpie processes in sandbox HOMEs on mote (A serving, B a Remote magpie of A through a counting proxy that makes ETags weak, as Cloudflare does): old code 14-15 /v1/models per 15s on A, with the fix 4 at start and none in the next 30s. Without the proxy's weakening the old code was already quiet (1 per ~50s), so the cause is the weak tag. - TestModelsWaitNamedByAWeakTag and TestRemoteMagpieWeakTagNotAskedOver: each red with its half of the fix reverted (200 instead of 304; 32 asks in 400ms), green with it. - go test -run 'TestRemoteMagpie|TestModelsWait|TestModelsList' on internal/provider and internal/gateway; gofmt; vet darwin, linux nogui, windows: clean. Full packages internal/provider (160s) and internal/gateway (929s) on mote at the head before the rebase: ok. Not tried: the user's real Cloudflare; GUI. |
||
|
|
698ed4adb5 |
gateway: a busy port names the program holding it, and Tailscale's serve gets its fix (pluoki on X)
The Gateway page, `magpie serve` and the app log said only "port N is held by another program". pluoki's was `tailscale serve` on the same port number. proc.PortHolder reads the holder (lsof on the Mac, /proc on Linux, Get-NetTCPConnection on Windows). Tailscale's daemon is root's and often unreadable, so `tailscale serve status --json` is the fallback for the port. gateway.NoteHeld / PortHeld.Sentence say who holds it, and for Tailscale give `tailscale serve --https=<other> http://127.0.0.1:<port>`. Shown in the `magpie serve` standby line and bind error, the app log, `gatewayHeld` in /api/state (Gateway page) and Start's "taken" answer, in en, zh, zh-TW, ja, de. A holder that can't be read says nothing; the old wording stands. Nothing is killed or touched. Run: gofmt clean; go vet darwin, linux nogui, windows (mica); go test ./internal/proc ok; targeted holder/gateway tests on macOS (mica), Windows (win-run) and Linux (wsl-run); parser tests with real lsof output; GUI gateway-port-holder, gateway-takeover, gateway-older, gateway-skew, gateway-port, i18n-keys, i18n-en-no-cjk in chromium and webkit. Real run on WSL: a holder named tailscaled on the LAN address with magpie on 0.0.0.0 gives the Tailscale sentence at the bind error; a Python holder on loopback gives "held by python3.12 (pid N)". Broken by hand: each fix reverted in turn, its test went red. gateway-card.test.cjs is red on origin/main too (#6029). internal/gateway, gui and cli package runs were still going at push; the full suite follows the tag. Not tried: a real `tailscale serve` (changes live config), a real Windows holder end to end, the bind-error path on macOS (a wildcard bind coexists with a specific one there). |
||
|
|
848269fcff |
gateway: a reply limit filled in stays within the window; OpenRouter's "maximum context length" refusal is read (H1_B1_K1 on X)
Codex through an OpenRouter DeepSeek model (window 1048576, catalog output 943718) failed every long turn. Checked against the code, the report's four claims hold: the catalog gives that output; magpie translates the Responses turn to Chat Completions; Codex names no max_output_tokens and the translation fills in askedOutput (fillsOutput); and replyLeft, which asks again for what the window has left, read only DeepSeek/vLLM/Anthropic wording, not OpenRouter's "(N of text input, M of tool input, K in the output)". - replyLeft reads OpenRouter's message (every "N of <kind> input" is the prompt). - The filled-in limit (translated turns, and withOwnOutput for DeepSeek's own API) is lowered to window minus the prompt estimated from its size, when that leaves at least 8192; otherwise as before. Anthropic's fill is unchanged: its refusal wording was already read. Run (mote, at this head): gofmt clean; go vet darwin, linux nogui, windows for internal/gateway; go test ./internal/gateway ok. New tests TestReplyLeftOpenRouter and TestOpenRouterReplyFitsTheWindow use the report's literal message. Broken by hand: with the regex changed both fail (replyLeft 0, HTTP 400 with the report's text); with roomedOutput returning n unchanged the second test fails (asked [943718]). Not tried: a real OpenRouter account; the full suite (started after tag). |
||
|
|
47128ffa59 |
gateway: a remote client's effort reaches Claude Code from every route (amhcwushuang on X)
amhcwushuang on X runs Claude Code -> new-api -> magpie on a server ->
the Claude subscription, and says the thinking level is lost.
Read from new-api (QuantumNous/new-api main): a Claude channel keeps
thinking and output_config as written (relayconvert shared/claude
ApplyReasoning passes a native request through), including the
{role: system} turn's output_config; an OpenAI channel turns the request
into Chat with reasoning_effort (reasoning.ApplyToOpenAIChat), and an
OpenRouter-dialect channel into a `reasoning` object. Claude Code's own
fixture (claude-code-2.1.296.json) carries top-level output_config.effort,
thinking adaptive, and the same effort on a system turn.
magpie already passed, to the spawned Claude Code's --effort: Messages with
a thinking budget or a top-level output_config, Chat reasoning_effort,
Responses reasoning.effort (checked by the new test on the old code).
It did not take the level from:
- a Messages request whose only effort is the last turn's output_config;
- a Chat request with reasoning.effort (an object), output_config.effort
or a thinking budget in place of reasoning_effort.
Those now set the request's effort. reasoning_effort, when present, stays
the client's word; no setting of the user is read or overridden.
Run: TestClaudeBridgeTakesTheEffortOfEveryRoute red on the old chat.go and
decide.go (4 of 9 cases), green now; gofmt; go vet darwin, linux nogui,
windows on internal/gateway; internal/gateway full package on mote.
Not tried: a real Claude subscription behind new-api; Claude Code's
interactive mode with a message-only effort (the -p stand-in was used).
|
||
|
|
3af8fe9cf7 |
gateway: a Claude account's Fable week used up rests Fable on it, not the account (kaitokiku on X)
Claude Code's refusal for a used-up window is "You've hit your limit" and names no window, and its rate_limit_info may carry no rateLimitType (the transcript's rejected row). restAfter read the account's windows as they were cached before the Fable week filled (Fable 60%, nothing full), so Pooled said no and the whole account rested for the refusal's time: Opus, Sonnet and Haiku with it, though the other weekly quota was left. A quota refusal on an account whose reading holds a window of some models only that counts the model, none known full, now asks for the reading again and narrows the rest to the model when it shows that pool full (narrowWhenRead, as for an unread account, #2036). Every route rests through restAfter, so Messages, Chat Completions, Responses and the group fallback share it; Claude is not a plugin. Run at this tree (mote): TestClaudeFableWeekRestsFableOnly red on the old routing.go (rests the account), green with the fix; internal/provider, gofmt, vet on darwin, linux and windows. Full internal/gateway follows. Not tried: a real Fable-limited account; a usage reading that keeps failing leaves the account resting whole, as before. |
||
|
|
7b5c069c3a |
gateway: Vertex AI gets a tool's image in a user turn of its own, no "Requests ending with a model turn" after view_image (Voo_Ler on X)
What the user saw: Codex on Google Vertex AI stopped right after "Viewed an
image" with "Requests ending with a model turn are not supported".
Why: Codex's view_image answers with a function_call_output whose output is
[input_text, input_image] (as ~/.codex/sessions rollouts record it). The
Gemini build kept a tool's images in the same user turn as its
functionResponse. Vertex AI answers a response turn mixing in anything else
with that 400 although the last role is user (#1533 showed it for text, and
|
||
|
|
a535bbf3cf |
gateway: a Claude TUI test's unanswered call ends with its test
tuiCalls.call made Claude Code's MCP call with httptest.NewRequest, whose context is never done, so a call a test didn't answer waited in mcpCall until the package ended. macOS CI's 30m alarm at |
||
|
|
729664580b |
gateway: the Grok balance rest test waits for its narrowWhenRead
TestGrokBalanceExhaustedRestsToReset ( |
||
|
|
e7980ed955 |
gateway: a summary that arrives while the reply streams still branches from the run's session (recih on X, #6128)
A call got the conversation it answers only in park(), after the whole
reply ended. Claude Code's AgentSummary that arrived while the reply
still streamed (a call shown, park not yet run) found no line with that
conversation, so branch() said "no run waits on a reply to this
conversation" and a new Claude Code was told the whole transcript
(108K cache tokens written). emit now registers a call's line with the
run's conversation when the call is shown; park and noteLines keep it.
Run (mica, load on mote): TestClaudeBranchForSummaryWhileTheReplyStreams
(attach, KStart, KToolStart, no park, then the summary) is red on the old
code ("no run waits on a reply to this conversation") and green now.
go test -run 'Claude|Branch|Fork|Park|Subscription' ./internal/gateway ok;
gofmt clean; go vet darwin, windows, linux nogui ok.
Broken by hand: the fix reverted, the new test goes red.
Not tried: a real AgentSummary on a live TUI run; the full suite is
started after the tag.
|
||
|
|
e6bf4adf1f |
usage: Claude Code's helper requests are labelled, the largest cache write is one click away (recih on X, #6199)
Claude Code's AgentSummary and its auto mode classifier name themselves nowhere in the request, so there is no client marker to read. The gateway tells them by their content (inferredKind: a claude-cli/ request on the Messages API; the classifier by autoModeClassifierAsk, the summary by its last user text "Describe your ... in 3-5 words") and records them as agent_summary_inferred and auto_mode_check_inferred. The purpose catalog names them "Progress summary (inferred)" and "Auto mode check (inferred)" and puts each with its plain kind's purpose, so the existing Purpose filter lists both; nothing known and nothing inferred share a name. A tool that printed the same words, a chat, and another agent's request stay unmarked. A requests page now also holds BigWrite, the gateway-served row that wrote the most to the cache (cells, page-v1.json and pageFromLedger all carry it; rows from session files have no request to open). The Requests line shows it as "109K largest write", a button that opens that request through openUsageRoute. settledCountVersion is raised to 3, which keys the cached pages. Not done: the per-request branch recovery result asked for in #6199. No structured field holds it. Run on mote (load 21-24 of 18 cores, mica was higher): go test ./internal/usage ./internal/usageapi, the gateway and gui purpose tests, go vet for darwin, linux (nogui) and windows, gofmt; the GUI files usage-big-write (new), purpose-filter, routing-kind, i18n-keys and usage-ledger in chromium and webkit. Broken by hand: inferredKind returning "" turns TestClaudeHelperRequestsAreLabelled red; the larger-than test of BigWrite.add turned round turns TestRequestPageBigWrite red on both paths; the jump off turns usage-big-write red. Not tried: a real Claude Code session against a live subscription, Linux WebKitGTK. |
||
|
|
a5e805f574 |
Codex: Ultrafast beside Fast in a group member, and a Fast/Ultrafast setting per model (kdajenks on X)
kdajenks (magpie 0.1.3739, Codex on ChatGPT Pro) could set Fast only from a
routing group's member row and had no Ultrafast there, and no way to set the
speed in the model's own settings. Ultrafast exists: Codex's catalog lists
the `ultrafast` service tier, the code already sent it for agent picks and
Codex's service-tier row, and the live account's service_tiers hold it.
- Group member: the button steps Standard speed, Fast, Ultrafast (where an
account offers it, `ultraOK`), back to Standard. `Group.Ultra` is a subset of
`Fast`, kept through rename, fold, share, gone-filter and the CLI
(`magpie group ... ultra=`). The gateway marks the candidate `ultra`.
- Per model: `settings.ModelTiers` ("<provider>/<model>" to priority or
ultrafast), `provider.SetModelTier` (refused where CanFast/CanUltra say no),
`ModelPref.Tier` in Model settings (Standard speed / Fast / Ultrafast, in
modellimits.js), and `magpie model tier <provider/model> [fast|ultrafast|usual]`.
The gateway sends it on a direct pick for an agent with no fast pick of its
own, through fastPick, so an account without Ultrafast gets priority. A group
member goes as the group says.
- Docs: gateway-routing, providers-accounts, reference.
Run (mica, at the rebased head over
|
||
|
|
fc615339f0 |
provider: Alibaba Cloud Token Plan quota read with the account's AccessKey; intl Token Plan preset (pppMathew on X, #2940)
Cause: a Token Plan sk-sp- key only authorizes inference. The plan's
usage sits on the Bailian console gateway, which wants a console token
(the key gets BailianGateway.Login.NotLogined) that Alibaba's own `bl` CLI
makes from the account's AccessKey through GenerateCLIAccessToken (ACS3
signed). magpie had no such path, so the usage card showed no quota.
Change:
- alibaba_usage.go: ACS3-HMAC-SHA256 signing, the console token (kept 20
minutes per AccessKey and region, made again once on NotLogined), the
personal plan's usage API, and per<N><Unit>Percentage/ResetTime read as
5 hours / Weekly / Month windows. Hooked in as AccessKeyVendor "alibaba"
(editor asks AccessKey ID and Secret, a keyless card says so),
accountPlanOf (routing), PlanQuotas and the key card tag.
- Hosts: token-plan.cn-beijing.maas.aliyuncs.com (bailian-token-plan) and
the new token-plan.ap-southeast-1.maas.aliyuncs.com preset
alibaba-token-plan (Alibaba Cloud international Token Plan, #2940), also
an OpenCode import target.
- Editor hint in zh, zh-TW, ja, de; docs (providers-accounts, reference).
Not covered: qwen-token-plan (Qwen AI platform) and qwencloud-token-plan
have no AccessKey route (browser-session console, #5829); team plans.
Run on mica at this tree: go test ./internal/gui ./internal/provider ok;
go vet darwin, linux nogui, windows on provider/gui clean; GUI files
i18n-keys, i18n-en-no-cjk, tencent-access-key, volc-access-key,
usage-access-key-card, tencent-cloud in chromium and webkit: 60 of 64 pass,
the 4 reds are tencent-cloud's "region clicked right after the strip
scrolled", red the same at origin/main
|
||
|
|
319753d892 |
gateway: a key can follow, force on or force off masking (y0ngb1n on X)
A gateway key now carries Redact: "" follows the global setting, "on" masks that key's requests even when masking is off, "off" sends them as written. Trusted devices turn it off, external ones are forced on. - access: Key.Redact, CleanRedact and the redact-key action; an issued key inherits "on" from its issuer and can't turn it off; the default key takes the same values. - gateway: maskingFor(ctx) decides per request; every route that masked (chat, native, text hits, the Masked-As header) asks it. A local request with no key keeps the global setting. masking.WithForced carries "on" into the masker; the redact plugin's InUse counts keys set on. - CLI: magpie gateway keys redact <key> follow|on|off. - GUI: key-row badge and an app menu; 7 strings in zh, zh-TW, ja, de. - docs/subsystems/gateway-routing.md: the Redact paragraph. Note: "on" with global masking off masks secrets and personal data by the defaults. An off key is still masked on a Remote magpie hop, which sends no Masked-As header. Run (mote-run): go test for access, masking, redact, cli, gui and plugins/redact packages and the new gateway key_redact tests; gofmt -l and go vet on darwin, windows and linux nogui, all clean; the new GUI test. Broken by hand: maskingFor returning the global value goes red in key_redact_test.go. Not tried: a real remote-to-remote hop with two keys; the full suite runs after the tag. |
||
|
|
db58a88a83 |
gateway: a request masked by another build with the same settings is not masked again (Luxzinw on X)
Cause: X-Magpie-Masked-As carried this build's version and the other
magpie skipped its pass only on an exact match, so 0.1.3771 into 0.1.3638
(or any two builds) masked twice. Now the settings fingerprint must match
and the sender's build must be >= maskerSince (3584, the last masker
change), whichever build is newer; the header is passed on as it came
(it named the passing magpie's build, which never masked). Old-format
headers (v0.1.N/fp) parse the same.
Stand-ins: a user name's made-up name, public-ip- names and {{}}
placeholders are left alone by a process that has none of them in memory
(TestSecondProcessLeavesStandInsAlone). A made-up key looks like a key and
is masked again by such a process; the header skip covers that between
magpies with the same settings, not different ones.
Run (mote): go test -run 'MaskedBefore|RemoteMagpie' ./internal/gateway ok;
internal/redact SecondProcess ok. Broken by hand: maskerSince=999999 turns
the new tests red. Not tried: a real two-machine hop; full suite after tag.
|
||
|
|
8bc46b407a |
gateway: tests that an overloaded Codex account fails over to the next, by every door (Coordinate_siwu on X)
Coordinate_siwu: two ChatGPT accounts of different emails, GPT answers 529, magpie asks again and fails instead of moving to the other account. Could not reproduce. New tests hold two Codex accounts, acct-1 refusing every ask and acct-2 serving, and the turn must reach acct-2: 529 (json, empty, html, rate and usage words), 503 overloaded and plain, 500, 429 rate, 200 stream ending response.failed server_is_overloaded; by Codex's POST and its WebSocket, /v1/chat/completions (stream and whole) and /v1/messages; routing smart, order, rotate, drain; and a conversation kept on the account that answered its first turn. All pass on main, so no gateway change. Broken by hand (codexAccounts always relaying as it came): 47 subtests red. Run: go test -run 'TestCodexOverloaded|TestCodexKept|TestCodexSocketOverloaded' ./internal/gateway on mote, ok. Not tried: a real ChatGPT 529, the reporter's own settings (Codex "only switch sign-in", the second account switched off), WebKit/GUI (no GUI change). |