ac4af582301a4e8a29245dbba767eba31334ddf9
7089
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
766d2a9f54 |
gateway: a Claude turn sent again while its run is busy with it goes on from a copy of its session (#5405)
A client's connection dropped mid-reply and its request was retried, with no cancel reaching magpie (#5405, margbug01: a gateway between the client and the server magpie retried after "unexpected EOF"). The run the first attempt resumed was still busy with the very turn, so resume and unshelve found nothing, and the retry started a new Claude Code told the whole conversation in one message: only Claude Code's own system prompt and tools read from the cache, the rest (92K to 142K tokens in the report) written again on every retry. retryBranch, tried in start between unshelve and retire, finds a busy run of the account whose last heard request is this one, message for message, and starts the retry's run from a copy of that run's session cut before the turn (cutReply at backLine/backMsg), told only the turn, as a branch off a side question already is. The busy run is left alone; when both park at the same key, keepIdle lets the older go. nil, and the conversation told whole as before, when no run matches, the client places its own cache marks, the run was or is being taken back, it was started for this turn (nothing before the turn to cut at), or the session can't be cut (logged). Changed from ggbdpq's patch: it matched with follows, which also takes a request that goes on past the busy run's turn; the retry is matched by the heard request's key alone. A copy cut for an older run is discarded when a newer one is taken, a failed cut is logged as the patch's notes say, and a run with a reply id but no line yet is cut by the reply, as branchAt does. The test waits for the busy run to have heard the turn instead of sleeping 200ms, and stops the held first attempt in t.Cleanup, so a failing assert doesn't leave it running. The doc's "goes on to step 3" now says step 4. Run (mote, -tags nogui): - TestClaudeTurnSentAgainWhileItsRunIsBusyBranchesOffItsSession (print, interactive) -count=3: ok. - Broken by hand: claude_subscription.go back to origin/main, test kept: FAIL in both modes, "0 runs branched, 2 started anew, want one of each". Restored: ok. - TestClaudeTurnPastABusyRunsTurnIsNotBranchedOffIt (print, interactive): a turn sent past the busy run's own, with a reply the client has, is told whole (one message, or the interactive mode's transcript), not branched off the busy run. -count=3 with the other test: ok; -race -count=5 of both: ok. - Broken by hand: the match back to follows: FAIL in both modes, "the turn past the busy run's was branched off it" (nextTurn gives its run only "now commit it", the turn and reply before it lost). Restored: ok. - -run TestClaude ./internal/gateway/: ok 139s. - -race -count=5 -run of the busy-retry, fork, side-question, given-up, rewind, unshelve and branch tests: ok 52s. - go vet, GOOS=linux go vet -tags nogui, GOOS=windows go vet of internal/gateway: clean. - gofmt -l on both Go files: empty. Not tried: a real Claude subscription with a real dropped connection. The full suite runs after the push. Co-authored-by: ggbdpq <ggbdpq@gmail.com> |
||
|
|
1493acb468 |
gui: Codex's memories default reads right on Codex 0.167.0 and before
Codex 0.167.0 (openai/codex#58091) moved its default memory models:
extraction from gpt-5.6-luna to gpt-6-luna, consolidation from
gpt-5.6-terra to gpt-6.1-terra. The memories square's unset text and the
Settings row's tooltip named the old pair. They now say "Codex's own
memory models", true on either version, in en, zh, zh-TW, ja and de.
The code comments (agent/codex.go, gateway/codex_memory.go,
gateway/codex_follow.go, the tests' headers) name both pairs with the
Codex version that uses them. No behaviour changes: magpie routes these
calls by kind (memgen, memory_consolidation), not by the model name.
Run on mote at the pre-rebase base
|
||
|
|
859b292d91 |
gateway: the Qoder plugin's queue answer ends a group's patience rounds (#5346)
#5346, hardy20260000: a Qoder route of 217 accounts (routing=order) asked one request up to 656 times, 20 GB of re-uploaded bodies a day. When magpie has another candidate, the Qoder plugin answers Qoder's queue code 10605 at once with a 503 + Retry-After (#4049). busy() took that for a moment's trouble, so once every member had given way the group's patience asked all of them again, one whole round after another, re-sending the body on every account each round. Now busy() leaves the plugin's queue answer alone: each member is asked once, and the last one, asked untold, has the plugin wait the queue out as Qoder's own client does (polling its queue status, not re-sending the body), then gets its same-one retries. Changed from ggbdpq's patch: it matched `\bqueue|排队` in any provider's 5xx. A relay's "Request queue is full" or "当前排队人数较多" is the overload a pause mends, and would have lost its patience. The match is the plugin's own words now ("queued the request", "this plan's queue:"), and the tests use the plugin's real errorResponse body for both its forms (isQueued, and the service out as in testdata/qoder_queued_10605.json) instead of an invented message. Not changed: the walk itself. With patience=off (the reporter's setting now) a request still asks each account once until one answers, ~20x on this route; that is the routing group finding a free account, and a per-request attempt budget is a separate decision. Run (mote, -tags nogui, sandboxed by the package's TestMain): - TestQueuedGroupAsksEachMemberOnce/{queued,busy}: 5 asks, 503 told. - TestOverloadedGroupStillReplans/{overloaded,queue full,排队}: ok. - Broken by hand: without `!queued(body)` both queued cases FAIL "a queued group asked 39 times, want 5 at most"; with the patch's broad regex, "queue full" and 排队 FAIL "asked 5 times, want more than 5". Restored, green. - -run Queued|Overloaded|Plugin|Qoder|Patience|Replan|Single|Busy| Fallback|Nested|Affinity|Codex busy|Shared|Retry: ok. - gofmt -l clean; go vet -tags nogui, GOOS=linux -tags nogui and GOOS=windows vet of internal/gateway: clean. Not tried: a real Qoder queue on a many-account route; the full suite. Co-authored-by: ggbdpq <ggbdpq@gmail.com> |
||
|
|
baf70992f6 |
usage: a call the vendor answered with another model is priced as the model that served it (#5340)
The ledger priced a call at the model asked for and fell back to the
model the reply named (Served) only when the asked-for one had no price
(#1498). That order is right for a relay that sells kimi-k3 as
moonshot-kimi-k3 and bills by the name it sold, but it also priced a
real substitution: claude-opus-5-5 asked, claude-opus-5 served. The
vendor bills for the model that ran. kaimo455's ledger had 836 such
rows, every one at the asked-for rate: $374.06 reported against
$493.28 at the served model's rate. gateway-key cost limits (KeySpent,
NewCoster) and budgets read the same pricer.
Pricer now prices a call the ledger marks swapped at the served model's
price. That covers a price the user set for the served model and every
other layer of BasePriceIn. A price the user set for the model asked for
still wins, 0 included (new provider.UserBasePriceIn is BasePriceIn's
user layer alone). When the served model has no price, the asked-for
one's stands. Renames, vendor aliases, serving names and region
deployments price as before, and rate windows still read each record's
own time. apiPricer, the API price behind a subscription window's whole,
follows the same rule: the served model's API price first, then the
asked-for one's.
Review changes on top of ggbdpq's patch:
- The swap is judged the way the ledger's Swapped column judges it: on
the model id and on the name that went out (SentNameIn over the
user's ModelWires). A model the user sends under the served one's name
was answered as asked, so it keeps its own price. The patch judged the
model id alone, so such a row was priced as swapped while the Requests
page said it wasn't. The pricers' memo keys now include the effort,
because the sent name depends on it.
- apiPricer (window holds) got the same rule. The patch left it on the
old order.
Tests:
- TestLedgerPricesASwappedCallAsTheModelThatServed (patch, plus a
ModelWires case) checks the ledger and the Requests page.
- TestLedgerPricesARenamedModelAsTheOneServed: the sol row (sol asked,
kimi-k3 served, both priced) is a genuine swap, so it now prices at 3,
not 2.
- TestHoldsPriceTheModelTheReplyNamed: claude-opus-4-7 answered by
gpt-5.5 is priced at gpt-5.5's API price. Answered by an unpriced name,
it keeps opus's.
Run on mote at this tree, on origin/main
|
||
|
|
bfb0d92ca8 |
gateway: a ToolSearch answer's definition goes to DeepSeek as the reference it takes (#5404)
Newer Claude Code builds put the loaded tool's definition itself in the
ToolSearch answer's tool_result.content[] ({"type":"tool_definition",
"definition":{...}}, the same block shape Claude Code's own bundle
handles beside tool_reference). DeepSeek's Anthropic endpoint refuses
it there: 422 "messages[1].content: unknown variant `tool_definition`,
expected `tool_reference`". withoutDeferredTools walked the messages'
top-level blocks only, so the nested definition survived every learned
retry, and a body with no top-level deferred block never learned the
refusal at all.
hasDeferredTools now sees a tool_definition in a tool_result's content,
and withoutDeferredTools hoists each such definition onto the request's
tools (once; one already listed wins) and sends the block as
{"type":"tool_reference","tool_name":...}, which the endpoint takes only
once the tool is declared. A result whose content isn't an array, or a
definition without a name, goes as it came. DeepSeek's own host
(isDeepSeekAnthropic, by host, not preset) now gets the deferred blocks
stripped up front like Kimi (#2042), since it takes a tool_addition at
no position (erlinerd's live check of 2026-11-05).
Review change on top of ggbdpq's patch: added
TestDeepSeekAnthropicIsStrippedUpFront, which drives a provider at
api.deepseek.com (dial redirected to httptest) through the server; the
patch had no test for the forwardOnce wiring.
Run (mote, -tags nogui, -count=1):
- TestToolResultDefinitionRefusedOnceBecomesReference,
TestNestedToolResultDefinitionBecomesReference,
TestDeepSeekAnthropicRecognized, TestDeepSeekAnthropicIsStrippedUpFront:
PASS.
- -run 'Deferred|Kimi|DeepSeek|ToolSearch|ToolReference|RefsOnly|OpenCode|Shape'
./internal/gateway: ok 18.3s.
- gofmt -l clean; GOOS=linux go vet -tags nogui and GOOS=windows go vet
of ./internal/gateway: clean.
Broken by hand:
- anthropic_shapes.go at the parent: the refused-once test 422s to the
client, the unit test fails "a nested tool_definition was not seen as
a deferred tool", the up-front test 422s.
- gateway.go at the parent: TestDeepSeekAnthropicIsStrippedUpFront fails
"DeepSeek was asked 2 times, want once".
Not tried: a live api.deepseek.com request (no DeepSeek key here); the
endpoint's answers are the reporter's live checks. Not run: the whole
gateway package or ./... suite.
#5404, erlinerd.
Co-authored-by: ggbdpq <ggbdpq@gmail.com>
Co-authored-by: erlinerd <10431861+erlinerd@users.noreply.github.com>
|
||
|
|
d84f58fd2b |
claude bridge: Claude Desktop's own annotations are not the user's words (#5403)
Claude Desktop's Claude Code appends notes of its own after tool
results: the scaling note a wide Read gets ("[Image: original 2200x680,
displayed at 2000x618. Multiply coordinates by 1.10 …]"), the Skill
tool's "Base directory for this skill: …" and ToolSearch's "Tool
loaded.". The bridge took each for words the user sent mid-turn, so
the run was told "The user sent a new message while you were working:"
with the note, and the next turn's history marked it [user message].
The model answered messages nobody wrote (#5403, miroku9: about 30
such notes in 13 sessions, two answered).
They join agentNotice, the table #2060 built for hook notices and
token counts, so saidWithResults leaves them out and renderParts
closes the result without the [user message] mark. Wide images read
in parallel bring one note each; miroku9's inner-session queue shows
them joined by blank lines, so the image branch matches one or more
notes (with "Tool loaded.") separated by whitespace, both as one text
and as separate parts. A user's own words after a note still go on.
Patch from ggbdpq; the parallel-notes case and its test are added
here, after miroku9's follow-up on the issue.
Run (mote-run, go test -tags nogui ./internal/gateway/):
- TestDesktopAnnotations*, TestParallelImageNotesAreAgentNotices,
TestAgentNotice*: with claude_subscription.go at origin/main all four
new tests FAIL ("… was taken for the user's words", "[user message]"
before the note); with the fix ok.
- With the patch's single-note regex, TestParallelImageNotes FAILs on
the joined text only (the separate-parts case passes).
- -run 'Notice|MidTurn|SaidWith|RenderParts|UserWords|Claude': ok 74.8s.
- gofmt -l clean; GOOS=linux go vet -tags nogui and GOOS=windows go vet
of internal/gateway clean.
Not tried: a live Claude Desktop + inner Claude Code pairing; the note
shapes are the reporter's jsonl verbatim. userWords (routing's view of
a user text) is unchanged: these notes only follow tool results, where
routing doesn't start a turn. A new kind of note from a later Claude
Code needs its own line here.
Co-authored-by: ggbdpq <ggbdpq@gmail.com>
|
||
|
|
5ca9f0f9d7 |
sessions: a ZCode fork's card shows its own title (#5365)
ZCode files a fork as sess_<id> with its parent's id in parent_id (task_type=fork), and ocRoots groups it under the parent's key. A request names the fork by its own id, but Titles only looked up sess_subagent_agent_<id> children, so a fork's Routing card fell back to the folder name though its row has a title of its own. The child index in Titles now holds every ZCode session with a parent, by its sid and its bare id (zcodeBareID), so a fork is named from its own file the way a subagent is. A top-level session is still named by its own group only. The parent's title is unchanged. Changed from the patch: the index holds child sessions only (the patch indexed every ZCode session, so a top-level session's empty group title could be filled from the cache fallback), and the "session_" prefix the patch also stripped is dropped, since no ZCode id has it. Run (mote, sandbox HOME via the package's TestMain): - go test -tags nogui -run 'TestZCode|TestSessionTitles' ./internal/sessions/: ok. - go test -tags nogui ./internal/sessions/: ok (20.7s). - go test -tags nogui -run TestSessionTitlesNameOtherAgents ./internal/gui/: ok. - GOOS=linux go vet -tags nogui and GOOS=windows go vet ./internal/sessions/: ok; gofmt -l clean. - Windows box (win-run): -run 'TestZCode|TestSessionTitles' ./internal/sessions/: ok. Broken by hand: with origin/main's sessions.go, TestZCodeForkTitlesByRequestID fails: fork by request id: "", want "Fork of The parent session's title". Not tried: a real ZCode database here (none on this machine); the reporter ran the patch against theirs on Windows and got the fork's own title and the parent's. #5365, Flandern1211 (report, patch, test). Co-authored-by: Flandern1211 <163982805+Flandern1211@users.noreply.github.com> |
||
|
|
cf15d79d7f |
gateway: a relay's Gemini refusing a tool's anyOf beside a description hands the request to the group's next member (#5374)
Google's Schema takes an anyOf alone: a tool whose parameters carry a
description beside an anyOf is turned away with "Unable to submit
request because `tool` functionDeclaration `parameters.response` schema
specified other fields alongside any_of. When using any_of, it must be
the only field set." Asked straight, Google points at
function_declarations[N].parameters, which shapeWords reads. A relay
(sub2api, TokenFree) passing Google's words on writes them camel-case,
the field in backticks and no path, so the 400 went back to the client
and the group's later members, a non-Gemini fallback among them, were
never asked (#5374, worksyang, with the two-channel comparison and the
one-line fix).
shapeWords now also reads "schema specified other fields alongside
any_?of" (any_of and anyOf). The next member is asked once and the relay
doesn't rest (failShape), as for every shape refusal. A plain "messages:
field required" and Google's "Invalid function name" 400 stay the
request's.
Run (mote, testenv sandbox HOME):
- TestGroupFailsOverAnAnyOfSchemaRefused with fallback.go put back to
|
||
|
|
4e7661adce |
redact: an app's one-word name the model took for a person's goes as written
Reported by ylorn. on Discord (11-06): choosing apps in Alma, a question
about one app was answered with another's facts. Privacy Filter took the
apps' names (Cicada, Mimi, Phosphor, Parakeet, Muesli) for people's: in a
bare list of them, alone, and in the Markdown list of apps the assistant
answered with (probed on the real model: ~0.99 each). The follow-up
questions ("How about Mimi?", "Phosphor vs Parakeet") it did not flag, so
they went as written while the history held the names as placeholders;
Phosphor and Parakeet (8 bytes) then became known values and were masked
everywhere. The vendor could not tell which placeholder was which app.
Restore was not the cause: placeholders are a keyed hash of kind and value,
one per value, and restore maps each back to its own value in any case
(TestManyNamesRestoreEachToItself, a guard: it passes on the old code too).
personFits now lets one ASCII word go when what is around it says a thing
and nothing says a person (thingNamed, internal/redact/thingname.go): a
person's word beside it (my colleague, Hi, Mr, said, told) masks; a thing's
word beside it (using, switched to, the ... app, vs, apps like, 这个软件)
lets go; else its sentence decides (he/she/relations/greetings/said mask;
app/macOS/subscription/vs/软件 let go); else a list item among items that
speak of apps, or a text of capitalized names only, lets go.
Trade-off, by design: a single first name alone, or a first name in a
sentence that speaks of an app with nothing of a person ("Mimi uses the
app daily"), goes as written. A full name (John Smith), a Chinese name
(张伟), and a first name beside a relation, a greeting, said or a pronoun
are masked as before.
Run (mote, worktree at
|
||
|
|
8b70b7d976 |
usage: a request's bytes up and down, and what DeepSeek's image files saved, in Requests
Suggested by @faithleysath (matrix0487 on Discord): the usage ledger now keeps what each request received back (down_bytes) beside what it sent up (up_bytes, #4456), and what DeepSeek's image files (#5407) kept out of the upload (image_files_saved). Shown in Usage → Requests: - a row's details: "Sent upstream", "Received" and "Saved by image files", each only when it is above 0. A row from before has none of them, not 0; - under the Requests card, the period's "↑ up · ↓ down", with "{n} saved by image files" when there is a saving. Its title gives the exact bytes. A period with no counted bytes shows no line. What is counted: - Down bytes are counted as the reply body is read, after Go's transport has undone gzip, so a gzipped reply counts its plain size, not wire bytes. A plugin's row counts the local hop to the plugin host. A 101 body is not wrapped. Every try counts, so a refused try plus the answering one add up (TestLedgerKeepsDownBytes). - Image files saved, per try: the body before the swap minus the body sent, minus the upload bytes this request itself paid (len(b64)/4*3). It can be negative on the turn that uploads; the GUI shows only a saving above 0. Gaps: an upload that finishes after the wait timeout or ctx-done is not subtracted (as with up_bytes); a joined upload flight is paid by the request that started it; multipart overhead is approximate. - packedRow grows by three int32 (152 bytes, still within the test's bound), clamped to the int32 range. Totals sum all three. - settledCountVersion goes 1 → 2, because Totals now count bytes. The settled page, heat and effort caches recount once, on the first start after the update. The heat key hash includes the new fields. Run on mote at |
||
|
|
84ad780b65 |
gui: DeepSeek's image-files setting in the provider editor's Advanced (#5407)
matrix0487 on Discord (#feedback, 11-05) asked to change image-files from
the GUI:
|
||
|
|
ef176e21f6 |
sessions: a Claude Code session moved with /cd is listed under its new folder
usrname1833 on Discord (#feedback, 11-05): after Claude Code's /cd the
session's file is in the new folder's .claude/projects directory, while
magpie kept showing the session under the folder it was started in.
What /cd does (Claude Code 2.1.316, read in the binary and run for real
in a sandbox CLAUDE_CONFIG_DIR against a fake API): relocateSessionTranscript
renames projects/<old>/<id>.jsonl and its <id>/ folder to
projects/<new>/, and appends {"type":"relocated","relocatedCwd":"<new>"}.
The lines from before keep the old cwd; a second /cd adds another line,
and the last one names the folder.
Cause: a Claude Code session's folder was its first line's cwd only, and
a relocated line went to the default case. Every place that groups or
resumes by folder (GUI, TUI, `magpie sessions`, stats, the resume
command's cd) reads Session.Cwd, so all of them showed the old folder.
- claudeLine reads the relocated line (ccRelocated): the last move's
folder is the session's.
- A parse kept by an earlier magpie isn't read again when the file
hasn't changed. One whose folder isn't the project folder the file is
in (ccStale, with Claude Code's own name: non-alphanumerics as "-",
past 200 cut and a hash added) is read again once. state.CdRead marks a
parse made by this reader, and a kept one in its right folder is marked
on the first refresh, so the name isn't worked out on every poll.
parseVersions isn't raised: that would read every Claude file again.
- A glance (a long file's row before its first read) takes a relocated
line in the last 64 KB too.
- Sibling, magpie's own project move (relocateClaudeJSONL): a /cd'd
session was judged by its first cwd, so moving the folder it was moved
to failed with "a different project cwd", and relocatedCwd was never
rewritten. It now judges by the last move and rewrites relocatedCwd.
- docs/subsystems/gateway-sessions.md says how the folder is found.
Fixtures (internal/sessions/testdata/claude-cd) are Claude Code
2.1.316's own lines from that run, paths written as /w, without request
records, attachments and file snapshots.
Run (mote, at
|
||
|
|
a754660b2a |
gateway: requests that come together spread over a pool's accounts (#5242)
Moody-Sin and Tericerice (#5242, magpie 0.1.3072 on Linux): an antigravity provider with three accounts and affinity turn sent four requests at once all to one account, under In turn and By pace alike, each request with its own X-Magpie-Session. Cause: - Nothing counted the requests in flight when a request was planned. Pace (internal/routes/strategies.go:348) goes by pace, wallet and Tokens, all of which move only once a reply ends; a key's lane counts a request only once its try starts, after planning. Requests that came together were planned on the same figures and all went to the first. - In turn's next turn (affinity.go:685 "new-turn" → after(), :937) reads a stick that moves only when an answer comes back, so a burst of turns of conversations already answered all went to the one next account. - conversationID (gateway.go:9160 on origin/main) ignored X-Magpie-Session, so callers that named their own sessions but opened alike were one conversation and kept together. Fix: - burst.go: burstSpread, called in serve once the candidates are planned (gateway.go:3013), counts each request on the account it goes to until it ends, and puts first, among the accounts routing would as soon pick (burstAlike: In turn any ready one; By pace a pace within a tenth, no wallet told apart, none near its cap; Least used within a point), the one with the fewest in flight. A kept conversation (session, turn's stick, strict), a pin, a lead's account, a checkpoint and a new conversation leastHeld spread are counted where they are, not moved. Fallbacks, reserved, aside, resting, held, barred and capped accounts, other routings (Smart, In order, ...) and a group in a group keep their order. In a group, a member routed its own way is alike only to its own provider's. The one step covers direct models, groups, plugin providers and a remote magpie. - affinityID: the stick key (stickKey), a group rule's key (ruleKey) and the sealed lead's stick read X-Magpie-Session after an agent's own session header. conversationID, which Kilo and a plugin are sent as the conversation, is unchanged, so the caller's session never goes upstream. - docs/subsystems/gateway-routing.md says both. Not done: putting a markedly slower account behind by its TTFT. A first token's wait goes with the prompt's size and the vendor's queue more than with the account, so a small sample would move turns away from a fine account and off its cache; it needs its own design. Run (mote, mote-run): - go test ./internal/gateway -run 'TestABurst|TestBurst|TestMagpieSession| Kilo|Sealed|Rule|Stick|Affinity|Conversation': ok - go test ./internal/gateway ./internal/routes: ok (654s, 0.3s) - GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: ok; gofmt -l: clean New tests (burst_spread_test.go): six at once over three keys, rotate and pace × affinity turn/off/auto × x-session-id / X-Magpie-Session / same body × fresh and warm; over a group of three providers and of one provider's keys; behind a remote magpie; over a plugin's three accounts (fake plugin, streaming); a kept session stays on one account; paces {10, 9.5} spread and {10, 5} don't; three X-Magpie-Sessions in turn get an account each under session affinity, and conversationID never returns X-Magpie-Session. On the old code every pace case went 6 of 6 to k1, and rotate's warm cases 6 of 6 to the next account. Broken by hand: - reorder forced false: every pace case, rotate's warm cases, the group pace cases, the remote and the plugin tests red. - !aff.Kept dropped: TestABurstKeepsAKeptConversation red (map[k1:2 k2:2 k3:2]). - affinityID without X-Magpie-Session: TestMagpieSessionIsTheConversation red (map[k1:3]); the burst tests stay green, as the count covers them. Not tried: real Antigravity accounts, a run on Linux, a real remote magpie on another machine. |
||
|
|
5ae0ed1ab0 |
claude warm-up: a week left out while the five hours run is one the account hasn't
koohoko5924 (v0.1.3057, Claude Enterprise): the account has only a five-hour window, and the warmer kept warming a week it doesn't have (state Idle, 189 tries). warmNow walks withExpected(q.Windows, expect), which adds the 7-day window whenever a reading leaves it out, since Anthropic leaves a window out until the request that starts it. But any request starts every window a plan has, so a week left out while the five hours are running is not a week waiting to start. warmNow now marks such a window Absent (codex-warmup.json, compared in mapsEqual) and sends it nothing (windowAbsent). The rule: the reading leaves it out, the reading is whole (no partial window), a shorter plan window is running (shorterRunning), and it was never seen with a reset or use. A week seen running before, or left out of a partial reading, is warmed as before. usageRead counts an expected missing window as due only when no shorter window runs. withExpected itself is unchanged: claudeWithUnstarted uses it for the card. Codex has no expect list, so it is untouched. Docs: providers-accounts.md gets the rule. Run (mote, at this tree): go test ./internal/provider -run 'Warm|NotStarted|UsageRead|Claude|Codex' ok; gofmt -l clean. Broken by hand: windowAbsent off and the old usageRead check: TestClaudeWarmLeavesAWeekTheAccountHasnt red (12 "7 days" sends), TestClaudeWarmStartsAWeekThatReset's "never read" warmed, and TestUsageReadLeavesAWeekTheAccountHasnt told five-only@x. With the seen/partial guard taken out, "reset" and "partly told" go red. Not tried: a real Enterprise account or a real warm-up; the state is the report's (Idle 189), rebuilt in the test. |
||
|
|
beba9e8a1f |
claude warm-up: the account it started is read again, its old reading keeping its time
koohoko5924 (v0.1.3057): after a warm-up the card said "just updated"
over windows read before it. claudeWarmedNow cleared the kept
reading's time (e.at) and kept its windows, so claudeReadAt gave nil
and readNow stamped them now. Nothing read the account again either:
claudeWindows' next read waits on when /usage last ran (e.tried),
which the warm-up left alone.
claudeWarmedNow now clears e.tried, which makes the next read due as
for an account never read, and keeps e.at, so until that read the card
shows the reading's own time. Codex's warmed hook only drops its cache
(its usage is a fresh API read), so it has no such sibling.
Run (mote, at this tree): go test ./internal/provider -run
'TestClaudeWarmedReadAgain|Warm|Claude' ok; gofmt -l clean.
Broken by hand: on the old claudeWarmedNow TestClaudeWarmedReadAgain is
red ("the kept reading's time is <nil>"); keeping e.at but not clearing
e.tried, red ("warmed, not read again", the 10% reading kept).
Not tried: a real warm-up on a real Claude account.
|
||
|
|
77031d5817 |
claude usage: a /usage panel with no window is no window started, and a failure says why
koohoko5924 (Discord #help, v0.1.3057, macOS): a Claude Enterprise
account with a five-hour window only. A manual refresh took ~5s and
gave the card no window and the error "Claude Code's usage showed no
usage figures: ▐▛███▜▌ … magpie-claude-work…": Claude Code's banner,
not a reason.
Claude Code 2.1.316's Usage tab (gi) draws a window only once
Anthropic's answer has it non-null, and a window is null until the
request that starts it. An idle 5h-only account's panel loads with
the session's cost, maybe the plan's credit bar, and no window. The
helper told that panel's words, joined from the top of the screen, and
the card took them as a failure with the banner first.
- claudetui: a panel that loaded (tabs, Session/Total cost, nothing
loading, refreshing, stale or failed, no gateway Spend limit) with no
"Current session"/"Current week" is told as NoUsageWindow ("No usage
window has started"). The provider reads that as no window started:
no error, the unstarted 5h window as for any account.
- claudetui: the two rate-limit errors gi draws ("Claude is temporarily
limiting requests to the usage page (not your usage limit)…",
"Usage endpoint is rate limited until …") are failures to load, like
"Failed to load usage data": retried once, then told as an error with
the panel's own "Error: …" text, never the banner. A panel with no
window and no error is told from its tabs on, the session's cost
lines left out.
- provider: "(not your usage limit)" no longer reads as an account
refused (claudeDenied, at every place claudeUsageDenied judged a
reading: the CLI parse, codex_switch, quota_last, subscription_usage).
Counts ("Last 7d · 403 requests …") are taken out wherever they sit in
a line before that check, as the panel's words come on one line now.
A no-figures error keeps every line (600 runes), not the first clipped
at 120.
Tests are built from 2.1.316's own strings (ko/gi/hi in the bundled
cli.js), drawn on the helper's 200x50 grid row by row. Guessed: the
exact bytes of a real Enterprise panel (not captured; no such account
here) and the credit bar's layout.
Run (mote, at this tree): go test ./internal/claudetui ./internal/provider
-run 'Usage|Claude|Shim|Quota|Codex' ok; go vet for claudetui, provider,
gateway; GOOS=linux -tags nogui and GOOS=windows go vet; gofmt -l clean.
Broken by hand (each red, then restored):
- the NoUsageWindow case off: TestShimReadsUsageWithNoWindow red in all
three panels (told the panel's words as success);
- the provider's claudeNoWindow branch off: TestClaudeUsageNoWindowStarted
red ("showed no usage figures: No usage window has started");
- claudeDenied back to claudeUsageDenied: TestClaudeUsageWhyKept red
("read as an account refused");
- usageFailed back to "Failed to load usage data" and the whole screen as
the reason: TestShimToldWhyUsageFailed red in all three (the banner as
the reason; the rate-limit panels told as no window), TestUsageNoWindow
red.
Not tried: a real Claude Enterprise account; a real rate-limited panel.
|
||
|
|
b7631300ec |
claudetui: a successful interactive turn tells its account's allowance
Since the interactive mode replaced -p for Claude subscription turns ( |
||
|
|
0076fb0c9c |
gui tests: the lightweight click fails at once on an option out of sight (#3078)
The red reported on origin/main |
||
|
|
faa69b8319 |
dsh: a dsh test's temp home is given up only once it is really gone
TestDshSetEffortWritesALegacyEntryWithTheCatalog died once at cleanup, not in its body: on Windows, t.TempDir's RemoveAll found .config/magpie not empty (LoKi's box, reported by yetone, #2982). Save replaces providers.json by renaming a file over it, and a scanner holding the file that was just renamed over keeps its entry listed while the entry is pending deletion, so the folder reads as not empty for a moment; t.TempDir's own cleanup retries a sharing violation but not a "not empty" one, so it gave up on the first try. The seven dsh tests that set up such a home now share dshTempHome, which tries the removal until the folder is really gone, for a short while, before t.TempDir's cleanup gets its turn. Not verified on Windows: the failure is one-off under a scanner there, and on macOS removing a folder whose file is still open succeeds, so the race cannot be reproduced on this machine. With the retry taken out the suite is green on macOS as before, so the only change in behavior is the retry itself. Generated-by: GLM-5.3-Flash (ZCode) Review: go test -tags nogui -count=20 -run TestDsh ./internal/agent/ ok on Windows 11 (xiaomi-gpu, win-run, 232s) and -count=3 on mote. The cleanup is registered after t.TempDir, so it runs first (LIFO) and TempDir's own RemoveAll finds the folder gone. Not tried: a Windows box under the load that made the original red. |
||
|
|
24d4425944 |
gateway: TestRequestBuildsProvidersOnce judges the build's ask, not the
request's start (#2965) Cause: the test judged the second request by when it began, letting it want 0 rebuilds only within 900ms of the first, while what decides a rebuild is the hold and the stamp, not the clock from a request's start. Two ways that guess goes red: on a loaded machine a request can begin within the second and reach the build after the hold has let what was built go — "request 2 built the providers 1 times, want 0", seen in full runs at load ~280–400; and since |
||
|
|
d1b0b34430 |
gui tests: sidebar's unroll is counted as its animations are made
"the list opens and folds as it plays" sampled getAnimations() once after the click to see the list's unroll still playing. Under a machine load of ~175 that one sample landed after the whole play was over: a finished animation is out of getAnimations(), so the test read "not animating" and went red once (8be402816's GUI run; it passed on rerun). The list unrolls for 460 ms and its rows come one after another for 636 ms in all - the round trip from the click through the element wait to that one sample is not bound to that window. The animations made are counted instead: Element.prototype.animate is wrapped ahead of the click, and the assert reads that the nav-sub's own unroll was among them. An animation made is a fact that stays put, so the sampling race is gone. The assert is not looser: an opening with no animation still fails it. Run (playwright 1.62.0, idle machine): - this file: 10 runs, 160/160 ok (Chromium and WebKit) - nav-sub-unroll, sidebar-glide and sidebar-tab-top together: 2 runs, 136/136 ok - a 700 ms wait put between the click and the old sample turned it red with the reported "the list unrolls" assertion; with this change the same wait passes, and cutting navSubEnter's animations off turns it red again Not tried: a machine at load ~175 (the load figure is the report's; the delay injection stands in for it). Siblings: provider-advanced-fold's boxMoves() reads getAnimations() once after its own click the same way; it has no observed red, so it stays as it is. Fixes #2950 Generated-by: GLM-5.3-Flash (ZCode) Review (at the pushed head, mote, playwright 1.62.0): agent-expand-steady, sidebar and lightweight together, Chromium and WebKit, 30/30 ok. navSubEnter animates the nav-sub box itself, so the wrapped animate sees it. The sibling named above is filed as #5417. |
||
|
|
682848300c |
gui tests: agent-expand-steady checks the slide's animation, not the frames drawn (#2935)
yetone reported the webkit 980px leg going red once under load: "slid
open: 208". The test sampled the row's height every frame for 800ms and
wanted at least three heights between shut and open. A busy machine
drops frames — WebKit drew the whole slide in one frame, the sampler saw
only the final height (208), and the count came up short while the slide
itself was drawn correctly. Alone, the same test passed 3 of 3 at the
same load: a timing assumption, not a broken slide.
The drawn heights stay as an ordering check only; the slide itself is
now checked where it lives. A click drives a height animation on the
row's opened part (sheet() animates it through the Web Animations API),
so the sampler reads the opened part's animations in the same tick as
the click, before any frame is drawn: a keyframe animation carrying
height is the slide's witness, whatever number of frames the machine
went on to draw. The same evidence answers for the slide shut.
Run (playwright 1.62.0, darwin/arm64, node --test):
- agent-expand-steady: 40/40, ten rounds, Chromium and WebKit, 980px
and 560px.
- A probe that starves requestAnimationFrame past the sampling window
(the reported shape: one drawn frame, the final height) is red on the
old assertions ("slid open: 746") and green on the new ones, then
removed.
- agent-connected-unfolded and agent-models, the neighbouring agent-row
files: green, two rounds.
Generated-by: GLM-5.3-Flash (ZCode)
Review (at the pushed head, mote, playwright 1.62.0): agent-expand-steady,
sidebar and lightweight together, Chromium and WebKit, 30/30 ok. sheet()
calls box.animate inside the click handler, so reading getAnimations()
right after the click sees the slide. These tests run in English only;
the change adds no text.
|
||
|
|
83fdd09c07 |
agent: the Agents page's re-detect asks where updates come from again (#4980)
latestVersion kept its answer for 6 hours under a constant key, and the
page's re-detect (Rescan) forgot everything but it. A version published
after magpie started showed no update until the memo ran out or magpie
restarted, though a fresh process asked npm at once and saw it.
Rescan now expires the kept latest versions, the way it already forgot
where commands were found and what the slow readers had said. Unlike the
patch's forget, the entries are only expired, not dropped: the value stays
until a new ask answers, so a re-detect while npm is down still shows the
last version known instead of none (a failed ask keeps the old value in
memo.get). An ask already running is left to finish.
Run on mote (macOS arm64, go1.26.8), sandbox HOME:
go test -tags nogui -race -count=1 -run "Rescan|Latest|Update"
./internal/agent/ ok. TestRescanAsksLatestAgain: 1.4.0, then 1.5.0 after
a Rescan, then still 1.5.0 when the next ask fails with a 502 (asked 1, 2,
3 times).
Broken by hand: without the expire in Rescan, red ("1.4.0, asked 1
times"); with an expire that deletes the entry, as the patch did, red ("a
failed ask after the refresh: latest \"\", asked 3 times").
Not tried: the Agents page against the real npm registry; Windows and
Linux.
Co-authored-by: ggbdpq <ggbdpq@gmail.com>
|
||
|
|
59907fd554 |
claude: a /usage count of 401 or 403 is a count, not a denial (SCIYYDy, #4995)
SCIYYDy's Claude account closed /usage with the machine's own activity, "Last 7d · 403 requests · 388 sessions", and magpie read the count of 403 as the HTTP status. parseClaudeUsage scans every line for claudeUsageDenied before it reads the windows (account errors come first, #4532), and the bare \b(401|403)\b in that regex cannot tell a statistic from a status. So a whole reading with valid session and week windows came back "told no allowance" and the card kept none. A count of 401 denies as much. The scan now skips a line that reads, whole, as one of /usage's count lines ("Last <span> · N requests · N sessions", the numbers with or without thousands commas, so "1,403 requests" is a count too). A line that says more ("… · HTTP 403 Forbidden") is no count line, and a real 401 Unauthorized, 403 Forbidden or authentication failure still denies the account, on its own line and beside the windows; the #4532 precedence holds. Sibling (review): a count line with no windows around it fell to the "no usage figures" error, which quoted the panel's first line, so the error text held "403". That error is matched with claudeUsageDenied again in subscription_usage.go, quota_last.go and codex_switch.go, where it would read as a denial after all. A counts-only panel now gets an error that does not quote it, and the test asserts the error does not match claudeUsageDenied. Run on mote (macOS arm64, go1.26.8) at the pushed head, sandbox HOME: go test -tags nogui -count=1 ./internal/provider/ ok (116s). Broken by hand: without the count-line skip, the counts case is red ("told no allowance: Last 7d · 403 requests"); with the patch's narrower regex (no commas), the "1,403 requests" case is red. Not tried: a real Claude account whose /usage shows 401 or 403 requests; Windows and Linux. Co-authored-by: ggbdpq <ggbdpq@gmail.com> |
||
|
|
3da58c3dfc |
fix(plugin): end ordinary RPCs' plugin work when their caller leaves (#4678)
A plugin model list's deadline and an ordinary RPC's cancellation released only the caller. inTime raced the hook without stopping it, and host.go marked only gatewayRequest cancellable, so a cancelled usage or providers call never told the host: the plugin's task kept running, the host's pending count kept it, and repeated reads left task after task alive past their callers. Reported with an offline host-script reproduction that shows abort reaching none of three pending usage tasks and five model tasks outliving their deadlines. The cancellation path a fetch and a gateway request already take now carries ordinary RPCs too: - host.go marks every call but init cancellable, so a caller whose context ends has the host told (the existing callAborting write), the way it already tells it of a stopped fetch. init is left alone: a start that overruns is stopped whole. - host.js registers each ordinary RPC's AbortController; an aborted RPC's answer, nobody's then, is not sent. - the handler is handed the signal: usage passes it to the plugin's auth.usage hook as its own options, and a model list's hook options carry it, with the listWait deadline aborting the same controller, so vendor I/O that supports stopping stops at the deadline or when the caller leaves, whichever comes first. Sign-in renewal and its persistence are untouched: fresh() runs before the hooks, and an aborted RPC's handler still finishes what it saves. Refs #4678 Generated-by: GLM-5.3-Flash (ZCode) Reviewed and ported, narrowed: an aborted ordinary RPC is no longer answered "Aborted" at once and dropped from pending. It stays pending until its handler ends, as on main. host.go's stop() closes the host's stdin and then gives a renewing host up to stopRenewing to save the rotated token; with the early done(), host.js's own `pending === 0 && closed` exit ended the process at once under a cancelled call whose handler was still renewing or saving (keepSignedIn, set, signOut, a usage hook mid-refresh). The Go side needs no answer: an aborted call is released once its abort is written. The signal to the usage and models hooks, and the listWait deadline aborting the models hook, are kept as the patch had them. TestCancelledCallKeepsTheHostTillItsHookEnds is new: a usage hook that ends 600ms after its abort, then Settle() closing the host's stdin; the hook's end must reach its trace. Run on mote (darwin arm64, Go 1.26.8, Bun via testenv): go test -tags nogui -count=1 ./internal/plugin/... ok 102.8s; -run Plugin ./internal/gateway/ ok 52.1s and ./internal/provider/ ok 13.3s. Broken by hand: host.js and host.go at main, tests kept: TestOrdinaryCallCancelTellsTheHost FAIL "the host was told of the cancellation didn't happen", TestCancelledUsageReachesThePlugin FAIL "the plugin's usage hook was handed a signal didn't happen", TestModelListDeadlineTellsTheHook FAIL "the models hook was handed a signal didn't happen". host.js as the patch had it (early answer): TestCancelledCallKeepsTheHostTillItsHookEnds FAIL "the host left before the hook ended; trace: {"signal":"live"}...". Not tried: the reporter's replay.py against the built host, and a real plugin's usage hook that passes the signal to its fetch. The reporter's "host lives on after stdin closes with a task pending" row is unchanged by design: that is the renewal safeguard. Co-authored-by: ggbdpq <ggbdpq@gmail.com> |
||
|
|
9f6407321d |
library: a project whose folder was deleted outside magpie comes off the list when it's removed (#3510)
RemoveProject empties a project (Skills, Servers, then syncProject) and takes the entry off the list only once nothing magpie placed or wrote is left in it. But the only thing that empties those records, syncProject, gives up on a folder that's gone: it says "the folder is gone" and returns with the records as they were — and the Result RemoveProject hands it is thrown away, so the removal itself says nothing; the toast the user sees is the one the full sync after every change reports. With the folder gone there is nothing magpie can ever take back, so the records never empty and the entry stays for good: the only way out was the keep checkbox, which takes the entry off the list without looking at the folder (#514), though that reads as keeping what magpie wrote, not as the way out of a dead removal. So removal now does what a skill's removal already does when its folder is gone (removeSkill: only the entry goes): a folder that isn't there has nothing of magpie's on disk to take back, so the project and the records of what it placed and wrote go together, and the removal says nothing failed. A folder that is there removes as before; a project gone from disk still shows its "folder is gone" badge and still reports the folder on a full sync; keep is untouched. TestRemoveProjectWhoseFolderIsGone is new: a project with placed skills whose folder is deleted outside magpie, removed without keep — the entry goes, the Result has no problem, the library's skills stay; and a gone project removed with keep goes off the list as it always did. It fails without the change (the removal says "the folder is gone" and the entry stays) and passes with it. go test -tags nogui -count=1 ./internal/library/ pass (28 project and gone-family tests targeted first); gofmt, go vet -tags nogui and go build -tags nogui ./... pass. The cgo warning from internal/gui/trayimage_darwin.go is there before this change. Generated-by: GLM-5.3-Flash (ZCode) Reviewed and ported, narrowed: only a folder known to be gone (not there, or not a folder) drops the records. A Stat that fails another way (no permission, a drive answering with an error) isn't known to be gone, so the removal goes as before and the records stay, to be taken back once the folder answers; TestRemoveProjectWhoseFolderCantBeRead pins it. Run on mote (darwin arm64, Go 1.26.8): go test -tags nogui -count=1 ./internal/library/ ok 73.8s. On Linux (wsl-run, magpie-desktop): -run TestRemoveProject ok. Broken by hand: projects.go back at main, tests kept: TestRemoveProjectWhoseFolderIsGone FAIL "the removal said: [... the folder is gone]", the entry left with Placed [.agents/skills/pdf .claude/skills/pdf]. The patch's own check (err != nil): TestRemoveProjectWhoseFolderCantBeRead FAIL "projects: []". Not tried: removing a deleted project from the GUI on Windows, the reporter's system. Co-authored-by: ggbdpq <ggbdpq@gmail.com> |
||
|
|
8807f621f2 |
gateway: a relay's DeepSeek model reads max_tokens as its own (#5030)
deepseekTokenField named a chat request's reply length max_tokens for the DeepSeek preset and api.deepseek.com alone; a relay on its own domain serving a DeepSeek model got max_completion_tokens as it came, DeepSeek behind it ignored it and answered with its default, 8K without thinking (#5030, NOMOAX) — the gate the tool-schema normalization's had too (#4852, ethanfly). DeepSeek's quirks are told by the model named in the body now, as Grok's are (grokModel): a model a relay names deepseek-whatever gets the field DeepSeek reads, whoever serves it; another vendor's model through the same relay goes as it came. Generated-by: GLM-5.3-Flash (ZCode) Reviewed and ported. The model's name decides only on a host that isn't DeepSeek's: chatTokenField runs after deepseekTokenField in forwardOnce, so OpenAI's own hosts still get max_completion_tokens and a relay whose 400 names max_completion_tokens is still asked that way from then on. The model test (provider/test.go probe) already sends max_tokens to a host that isn't OpenAI's, so it needs nothing. The tool-schema \0 gate, the same narrow gate, is #4852's, open. Run on mote (darwin arm64, Go 1.26.8): go test -tags nogui -count=1 -run 'TokenField|MaxTokens|MaxCompletionTokens|DeepSeek' ./internal/gateway/ ok. Broken by hand: deepseek_schema.go back at main, test kept: TestDeepSeekRelayChatGetsMaxTokens FAIL "upstream got {...max_completion_tokens:393216...}". Not tried: a real request through AI Flash API. Co-authored-by: ggbdpq <ggbdpq@gmail.com> |
||
|
|
c6d2bd3316 |
library: ZCode reads the shared skills folder too (#4987)
ZCode reads ~/.agents/skills beside its own ~/.zcode/skills, but it wasn't among the readers of the shared folder: a skill kept there behaved as if ZCode didn't have it — its chip unlocked, a tick writing a second link into its own folder. It reads it as the others do. Generated-by: GLM-5.3-Flash (ZCode) Reviewed and ported: docs/subsystems/library.md now lists ZCode among the readers of ~/.agents/skills, as Ikki6666's own branch (a23828e81) had it; the reporter checked the published ZCode builds for a version boundary and found none (#4987). Run on mote (darwin arm64, Go 1.26.8): go test -tags nogui -count=1 ./internal/library/ ok 76.5s; -run 'ZCode|Shared|Always' ok. Broken by hand: "zcode" taken out of readsShared, test kept: TestSharedSkillReachesZCode FAIL "zcode has a second link to it in its own folder" and "zcode's own folder got it on the sync too". Not tried: a real ZCode install reading the skill. Co-authored-by: ggbdpq <ggbdpq@gmail.com> Co-authored-by: Ikki <824310075@qq.com> |
||
|
|
acde144a7a |
providers: a vendor of embedding and rerank models alone is detected on /embeddings and /rerank (heatonz)
heatonz on Discord (#help, 11-05): a custom provider whose models are only
embedding and rerank models couldn't be added. Detect APIs ("检测协议")
picked the first listed model, an embedding model, and asked it to chat on
every API, so nothing answered.
- tiny: an embedding or rerank model (catalog.ServesOf) on Chat is asked
where the gateway's retrieve sends it: the OpenAI base's /embeddings
({"model","input"}) or /rerank ({"model","query","documents"}). tested
adds no extra body there, as the gateway sends none.
- detectModel asks each API a model that chats when the list has one, so
a chat vendor's detection is unchanged. A retrieval model is a last
resort on Chat only. Responses, Anthropic and Gemini say why they weren't
asked (DetectModels too).
- testModel: a saved provider with nothing to chat with tests on a
retrieval model its list keeps apart (LiveServing). testOne asks such a
model on Chat and never moves it to another API.
- provider.ListAll is List with Serves models kept. /api/provider/list and
the provider's JSON carry a `retrieval` count. The add form's Fetch models
and the saved editor say "Only embedding and rerank models are listed.
They need no pick: ask them on /v1/embeddings and /v1/rerank." in place
of "the list is empty". One new string, in zh, zh-TW, ja and de.
- app.js stays under TestCoreScriptBudget with no raise: +42 bytes, paid
for by two add-form comments cut.
- The gateway already routes /v1/embeddings and /v1/rerank to such a
provider (#765, resolveRetrievalModel by prefix or KindGroup), so nothing
changed there.
Run (mote, at this tree on origin/main
|
||
|
|
60fe6645a9 |
claude: a caller's folder Claude Code would ask about is known before the run, and the session kept (sleepy_shibe)
sleepy_shibe on Discord (magpie 0.1.2996, Claude Code 2.1.318, own account, interactive mode): message counts 36, 65, 85, 108, 128 for one conversation. Confirmed at origin/main |
||
|
|
74d1cda421 |
gateway: a rate limit with a bracketed reset time rests the model until then, and says rate limited
taoxiaoxin on Discord (v0.1.2992, WorkBuddy China, plugin 0.2.24):
deepseek-v4.1-flash got 429
{"error":{"code":null,"message":"WorkBuddy: 您的使用量已超出频率限制,将在
2026-11-06 17:13:04 (UTC+8) 重置,您也可以切换其他模型继续使用。",
"param":null,"type":"rate_limit_error"}}
with credits left, and Routing showed the account as 额度用尽.
Cause: WorkBuddy now writes the offset in brackets, "(UTC+8)".
resetsWhen read "UTC+8" only bare, so the reset time went unread, the
refusal fell to plannedWords (用量) as failQuota with no time, and the
whole account rested a quarter of an hour as quota used up. With the time
read, the existing path (resetsWhen + otherModels) rests only that model
on that account until 17:13.
- resetsWhen takes an optional ASCII or fullwidth bracket round the
offset (zh and en forms); a body cut inside or after the bracket,
before 重置, still reads no time.
- Rest.Rate (and provider.KeyRest.Rate): a refusal read as out of quota
until a named time whose words say rate/frequency limit. Routing is
unchanged (it rests as the quota it is until then); the Providers row,
Routing's stage row, its Accounts line and the account tallies (live
and the day's, history.go) say "rate limited" (限流, 限流, レート制限,
Rate-Limit; strings already translated) with "back at {time}".
- workbuddy-ai gets the same: one path, tested for both ids. The plugin
(opencode-workbuddy-auth) already reads the bracketed time; no plugin
version or mover min.
Run (mote, at this tree):
- go test ./internal/gateway -run 'TestDayTallies|TestResetsWritten|
TestWrittenReset|TestBracketedReset|TestMonthlyWritten|
TestRateLimitBelieves': ok
- go test ./internal/gui ./internal/provider: provider ok; gui red only
in TestMainWindowCorners/macOS_26_SDK, #3949 (macOS 27, untouched)
- go vet (darwin) gateway, gui, provider; GOOS=linux and GOOS=windows
go vet gateway, provider: ok; gofmt -l clean
- node --test account-rate-rest (new; chromium + webkit, en zh zh-TW ja
de, 1100 and 420px): 10/10
- GUI routing-*, account-*, i18n*, key-rest*, rate-limited-* (194
files, 3127 tests): 3086 pass, 41 red. Rerun at concurrency 2 here
and at origin/main
|
||
|
|
8fbf8e0af6 |
gateway: DeepSeek's own API gets an agent's images once, by file id, not on every turn (#5407)
DeepSeek's API is stateless, so every turn re-sent every inline image in
the history. Now, on api.deepseek.com only (never a relay or another
base), for a model with "flash" in its name (deepseek-flash sees images;
deepseek-v4-pro reads them as "[Unsupported Image]"), each base64 data:
image goes up once through POST /files (purpose=user_data, expires_after
a day) with the candidate's own key, and later turns name it by file id:
- Chat: {"type":"file","file_id":…} (flat, as DeepSeek's vision guide);
- Responses: input_image with file_id in place of image_url;
- Anthropic: source {"type":"file","file_id":…} plus anthropic-beta
files-api-2025-04-14.
Shapes checked against api-docs.deepseek.com files_api, vision,
responses_api and anthropic_api. The Anthropic guide names the "file"
source type and the beta; the field name file_id is Anthropic's Files
API's, which DeepSeek says it follows. Not confirmed with a real call.
Ids are kept per key hash + image sha256 in deepseek-files.json beside
providers.json (temp+rename, unparseable file moved to .bad), reuploaded
with under an hour left. One upload per image and key however many
requests want it; a request waits at most 8s for its uploads, and what
isn't up goes inline this turn. A failed upload leaves the image inline
and rests that key's uploads for 10 minutes. A 4xx naming a file-api id
or a missing/expired file forgets the ids, uploads again and asks once
more; refused again, the request goes inline. detail:low stays inline.
`magpie provider set <id> image-files=off` turns it off (kept on GUI
save). Doc: docs/subsystems/gateway-routing.md.
Run (mote, at this tree on
|
||
|
|
7625481b9e |
library: a Codex MCP entry never keeps the other transport's keys
kwanyu (Discord #help, 11-06): with Codex connected to magpie, the ChatGPT/Codex app wouldn't start: "config.toml:209:1: env_vars is not supported for streamable_http". Codex refuses a command's keys (args, env, env_vars, cwd) beside a url, and a url's (bearer_token_env_var, http_headers, env_http_headers, http_headers_helper, oauth, oauth_resource, auth) beside a command (codex-rs/config/src/ mcp_types.rs, TryFrom RawMcpServerConfig). merged kept every old key magpie doesn't own. env_vars is magpie's only while the server references a variable in its env, so a server changed from a command to a URL (in the Library, or one imported from the user's own stdio entry) kept its env_vars and cwd under the new url. The converse kept bearer_token_env_var and env_http_headers under a command. The sync's in-step check decodes neither key, so an entry already broken was never written again. Now codexRefused names the other transport's keys. merged drops them, and behind reports an entry holding one, so the next sync (and a project's .codex/config.toml) rewrites it. The user's keys of the entry's own transport stay (enabled_tools, tool_timeout_sec, scopes, a stdio entry's own env_vars). bearer_token, which Codex refuses for both transports, is left as the user wrote it. Run (mote): go test ./internal/library -count=1 ok (77.8s); GOOS=linux and GOOS=windows go vet ./internal/library ok; gofmt -l clean. Broken by hand: the four new tests against the old mcp.go are all red (env_vars/cwd kept under a URL; bearer_token_env_var, env_http_headers and oauth_resource under a command; a broken entry left in step; a project entry read as in step). Real Codex (codex-cli 0.165.0, sandbox CODEX_HOME, codex mcp list): a url + env_vars entry fails with the reporter's exact error. The three config.toml files the new tests write load and list their servers. Not tried: the reporter's own config.toml (we only have the error line); the ChatGPT desktop app itself; Grok's config (written by the same TOML writer, its own transport rules not checked); a full suite before push (runs after). |
||
|
|
498b6419ff |
claude: a turn Anthropic refuses in the interactive mode as a third-party app's is asked again as claude -p, and the agent's prompt is remembered
Raven (Discord #general): Cindy with Pi as its engine, routed through
group/auto to a Claude subscription, failed every turn with "Anthropic
refused an interactive-mode turn on claude-opus-5-5 as a third-party
app's", and the message told them to turn the interactive mode off in
Settings, which makes every request of every agent run as -p (about twice
the plan count).
Now, with the interactive mode on:
- a refusal carrying "Third-party apps now draw from your extra usage",
met before a byte of the reply reached the client (stream head, or a
whole reply with no parts), is asked again once as claude -p
(redoAsPrint); the client sees only the -p answer;
- the agent's system prompt (sha256 of its first 2KB, billing header
dropped, so Pi's trailing <cwd> doesn't change it) is remembered for
12h, and its next turns go straight to -p (wantTUI, req.tuiRefused,
clientCache.print) while every other agent stays interactive;
- a refusal after the reply had begun (keepalive sent, or text said) is
not redone, so nothing is spent twice; the prompt is still remembered
and the message now says magpie runs its next turns as -p: ask again;
- a -p run that is refused too fails as before ("run as claude -p"),
once, no loop;
- the setting is untouched; with it off (claudePrintMode) everything is
-p as before. The run is the real claude binary, nothing else changed
in what is sent.
This reverses the #4503 call (
|
||
|
|
1100ed6494 |
gateway: an overlong item id goes left out on every kind that may go without one, and under its kind's own prefix on the rest (echo_ts, web_search_call)
echo_ts (Discord, Codex on GitHub Copilot, after |
||
|
|
1d704f8190 |
codex: OpenAI's threads follow a provider of the user's at the top, where Codex resumes them
harris on Discord (the Codex app, after switching from CC Switch): "This chat uses openai, but your current provider is custom. Switch to openai to continue." CC Switch left its "custom" as config.toml's model_provider, which magpie keeps since #4347, and Codex 0.166 resumes a thread only on the provider it is on now. Every thread started on OpenAI before was refused, and switching to OpenAI would refuse custom's threads instead, so the user was stuck. Nothing moved them: bringOver moves only onto magpie, bringBeside only from such a provider onto OpenAI. lendOwn (each Sync) moves OpenAI's threads onto that provider, as bringBeside does the other way: in place at OpenAI's length, by the row for a paginated thread, the last 30 days rewritten with a copy kept otherwise. The ids go in stash codex.lent; giveLent returns exactly those to OpenAI once Codex is on it again (CC Switch's official card), keeps the record while Codex is on that provider or on magpie, and drops it on any other. Nothing moves while a profile names openai, after the user disconnected Codex, or from a distro's Codex. TestCodexThreadsComeBackOffMagpie/by_hand expected an OpenAI thread to stay on OpenAI with custom set by hand at the top, the stuck state itself; it now expects it on custom. docs/subsystems/agent-wiring.md says so. Run (mote, go 1.26.8): go test -count=1 ./internal/agent/ ok (250s); GOOS=windows, GOOS=linux and native go vet ./internal/agent/ ok; gofmt -l clean. Broken by hand: Sync without lendOwn, TestCodexOwnProviderTakesOpenAIThreads red (thread left on "openai", rollout not on custom); without the disconnected and profile guards, TestCodexOwnProviderLeavesOpenAIThreads red for both cases. Not tried: a real Codex app resuming a moved thread on a real relay; harris's config.toml wasn't seen, so the "custom" here is CC Switch's relay table as it writes it. A thread moved from the ChatGPT backend to a relay carries its encrypted reasoning, which a relay on another account may not accept; the thread then fails on the relay as a switch to it by hand would. |
||
|
|
845e324b13 |
liveagent: each model on its own API, and the request format the user picks stays (xiaoxiaofei)
xiaoxiaofei on Discord: "magpie 默认导入的是 message 格式的,要可以自定义请求格式".
magpie wrote one LiveAgent provider, "magpie", type claude_code with
api anthropic-messages, for every model. K-brain asks all of a
provider's models on the provider's one API (routing/client.go builds
the client per provider; PiModel.api is only validated), and LiveAgent's
settings lock an Anthropic provider's API: only an OpenAI provider
(type codex) has a request format to pick (ProviderModalView.tsx,
resolveProviderApi; K-brain settings_provider.go accepts
openai-completions and openai-responses). So the format couldn't be
changed, and a GPT served on Responses was translated from Messages on
every turn.
Now, as dsh's routes do (dshKinds), each model goes on the provider of
the API it is served on natively (catalog.Model.APIs):
- magpie: type codex, Chat Completions, baseUrl the gateway's /v1, for
every model with no Responses or Messages API of its own (groups, Chat
providers' models);
- magpie-responses: type codex, Responses, baseUrl /v1;
- magpie-anthropic: type claude_code, Messages, baseUrl the root (K-brain
appends /v1; for OpenAI it appends only /chat/completions or
/responses, hence /v1 there).
A codex provider is written with api and requestFormat, as LiveAgent's
settings write one; when the user switches it in LiveAgent, a sync keeps
their format (one LiveAgent doesn't offer goes back to magpie's). A
provider left with no model is taken out. A config.json from before (all
on one claude_code "magpie") is moved on the next sync: each model brings
its record (the user's display name) and whether it was turned off, and
a default/compact/task pick of it follows it to its new provider.
Disconnect takes all three out. Docs: reference.md, agent-wiring.md.
Run (mote, through mote-run):
- go test -tags nogui ./internal/agent -run '^TestLiveAgent|Key': all pass,
new TestLiveAgentRequestFormat and TestLiveAgentFormatMove included.
- go test -tags nogui -timeout 45m ./internal/agent: ok (320s).
- GOOS=linux and GOOS=windows go vet ./internal/agent: clean; gofmt -l clean.
- K-brain 507f560 (the version LiveAgent af89ea7 pins), with Go 1.27.0
on mote: config.LoadFile on the config.json magpie writes in
TestLiveAgentRequestFormat loads it, and routing.ClientForProvider
builds *ai.OpenAI at http://127.0.0.1:3425/v1 for magpie,
*ai.Responses at /v1 for magpie-responses and *ai.Anthropic at the
root for magpie-anthropic (a throwaway test, not committed).
Broken by hand (a copy), each turned a test red:
- the user's format not kept -> TestLiveAgentRequestFormat;
- no carried record from another provider of magpie's -> FormatMove;
- picks not following their model -> FormatMove;
- Responses models left on magpie -> both;
- an emptied provider not taken out -> FormatMove;
- turned-off not carried to the new provider -> FormatMove.
Full suite at
|
||
|
|
814a625a24 |
usage: the top refresh reads saved Claude accounts again (#5380)
The tray panel's Allowances refresh said "Allowances refreshed" but a
saved, non-active Claude account kept its old reading: claudeWindows runs
Claude Code's /usage for a saved account only under savedRefresh, which
only that account's own card refresh sets.
Now a refresh of every allowance by hand asks usage/quotas?asked=1&all=1
(AskEveryClaudeUsage). It marks its ask generation in claudeEveryAsked,
and for claudeEveryFor (2 minutes) each saved account not read since is
read as its card's refresh would, under the same due check, the
30-second per-account floor and the same running holds. Opening the
Usage page or the Allowances tab (?asked=1 alone), the timed refresh and
every background read are unchanged, so nothing polls more. Callers:
the panel's top refresh (refreshPage "allowances"), the Usage page's
refresh and sidebar reload (refreshUsage -> loadQuotas("all")),
Routing's Read allowances, and the TUI's r. loadQuotas no longer lets a
lesser load on its way (an opening's asked read) swallow a Refresh.
Siblings: saved Codex accounts are already read anew on every asked
whole read (loginReading over HTTP after AskUsage clears the cache), so
Codex is unaffected. PlanQuotas and KeyBalances keep their 1-minute cache
on an asked read; left as is. The core scripts' budget is not raised:
the ~140 bytes are paid for by two loadQuotas/quotasOpened comments cut.
Run (mote, at 807341cdc on origin/main 5666cb049; rebased onto
|
||
|
|
5055349922 |
plugin: a host ended ends what its plugin started, at any depth (#5402)
A plugin host was ended with cmd.Process.Kill(), the host alone. A plugin that starts a browser or a daemon (magpie-magicrew-auth's headless Edge behind a WAF) left it running with no parent: 620 msedge.exe (6.8GB) and 382 temp profiles (57GB) in an hour on one Windows machine. Bun's own job ends its direct children with it on Windows, but lets their children out, so Edge's gpu/renderer processes lived on. On macOS and Linux nothing ended them at all. The host now starts as a proc.Tree (new Output.StartTree): a session of its own on Unix, a job (kill on close) on Windows. host.kill kills the tree; stop (after stopWait, so EndHosts, Restart, a moved proxy, an update) and the line-too-long path both use it. A host that ends by itself is swept by the tree's Wait: the Unix group is killed, the Windows job closed. Nothing outside the host's own session or job is signalled, so magpie's own process group is never reached. Ported from baijiu666's fix/plugin-host-tree (a8172a1), which called proc.End then Process.Kill. Reviewed against it: - macOS/Linux: proc.End is SIGTERM to the host pid alone, followed at once by SIGKILL; host.js has no SIGTERM handler and the host was in magpie's own process group with no session of its own, so nothing it started was ended. Red on mote and WSL, same as main. - Windows: endTree walks living parents, so it covers the killed host but not a host that ends on its own (crash, process.exit) or one that leaves when its input closes; those were red on Windows too. - Its test was Windows-only and checked a direct child, which Bun's job already ends: the new test checks a grandchild, through a real host. Run (TestHostEndedEndsWhatItsPluginStarted: a real Bun host whose plugin starts a child that starts another; subtests stop / killed / own end): - origin/main |
||
|
|
5666cb0490 |
search MCP: web_search takes a count, 6 by default, 1 to 20 (treeman)
The web search MCP server's web_search always gave 6 results: searchHits was both what a search API (a plugin's included) was asked for and where its pages were cut. It now takes an optional count, described in its input schema (integer, minimum 1, maximum 20, default 6). A number or a number in a string is taken, floored; below 1 is held to 1, above 20 to 20 (Brave and Tavily take no more than 20); null or a non-number is the default 6. The tool's description is unchanged, and the web_search magpie offers models on vendor requests keeps its schema (no count). The count rides the search's context (withSearchCount/searchCount), so every backend reads it: plugin search APIs by key and signed-in (the count handed to the hook and the pages cut), Tavily max_results, Brave count, Exa numResults, Firecrawl limit, DeepSeek count, Volcengine Count, You.com count (all three routes), Yuanbao Search's Cnt (the fewest of 10/20/... that covers it), SearXNG (cut only), Kimi Code's limit, GLM's search MCP and Codex's backend search (cut only, neither takes a count), WorkBuddy (its client's 5 unless more than 6 is asked). A searcher model's search is prose and has no count. Run (mote): go test -run 'Search|Codex|Kimi|GLM|WorkBuddy|Plugin' ./internal/gateway ok; -race of the new tests and TestSearchMCP* ok; go vet, GOOS=linux go vet -tags nogui, GOOS=windows go vet of the package ok; gofmt -l empty. Broken by hand: searchCount ignoring the count went red in both new tests (plugin asked for 6, said 6, every vendor asked 6); withSearchCount without the clamp went red for 50, 0 and -3. Not tried: a real search API or plugin with count > 6; the full suite runs after the push. |
||
|
|
c24915f04e |
library: LiveAgent in the MCP and Skills pickers (zero2sin)
LiveAgent was missing from the Library's MCP and Skill agent pickers
(zero2sin on Discord #feedback). It is now a target, written in its own
engine's formats, read from K-brain 507f560 (the one LiveAgent af89ea7
pins), not guessed:
- MCP: <data dir>/config.json.live-mcp.json (cmd/kn/backend.go,
internal/mcp/live.go LiveSettings): {"servers":[{"id","enabled",
"transport":"stdio"|"http","command","args","env" | "url","headers",
...}],"selected":[...]}. Streamable HTTP only, so SSE is refused.
${NAME} in env and headers resolves as K-brain's secret refs
(internal/config/secret.go). The user's servers and their
description/enabled/cwd/timeoutMs/policy/auth/... are kept; untouched
servers are written back byte for byte (json.RawMessage). A non-empty
selected gets magpie's server added (or it would have no tools) and
taken out on remove, never the last one. With no file yet, K-brain
reads config.json's "mcp" object (settingsFromConfigs), so the first
write carries those servers over the way K-brain's own first save
does. A new file is 0600 like K-brain's. A file K-brain itself could
not parse is not written over.
- Skills: <data dir>/skills, as copies (Target.Copy): K-brain refuses a
link in a skill's path (safePath) and ScanDetailed walks past one. A
skill there loads only when picked in skills-settings.json
global.selected (Manager.Effective), so syncLiveAgentPicks picks each
copy magpie makes once (Applied.Picked), never again after the user
unpicks it, and unpicks it when the copy goes. Names K-brain refuses
(validManagedName) are never put in selected, since its next save
would fail on them. Its built-in skills-creator/skills-installer are
not offered for import.
- Not added: instructions (K-brain's brain.md is its own memory file).
A server written while LiveAgent runs is seen at its next start (the
app holds the list in memory and saves it whole).
Run (mote-run, at base
|
||
|
|
125fd93ecd |
gateway: an overlong message or call id goes left out, and any other is bound under its kind's prefix, which Copilot checks (echo_ts, #5266, #4972)
echo_ts (Discord #feedback, v0.1.3058): after Codex's native compaction, a tool call on GitHub Copilot failed with an empty 400 "invalid_request_body". Copilot had handed the call a 452-character opaque id (Base64, + and / in it, no fc_ prefix). plainItemIDs, on every relay that checks ids (validatesItemIDs, Copilot among them), sent any id over 64 as boundItemID's sha256. That kept an id's own prefix only when it had one, so an opaque id went as a bare 64-hex digest. Copilot refuses that. By hand, the reporter got 200 with the original id and 200 with the id left out (call_id kept). isnine found the same thing for a message on #4525/#5266: left out 200, bare digest 400, msg_+hash 200. The bare digest dates from |
||
|
|
2df5d40ee3 |
usage: a ChatGPT API account's calls count in the same ChatGPT account's Codex window estimate (jctaoo on Discord)
A ChatGPT account signed in through Sign in with ChatGPT (chatgpt-api) and to Codex draws on one plan's five hours and week. Only the Codex card reads those windows, and its whole-window estimate (usage.windowHolds) keyed the ledger's calls by provider + account, so the chatgpt-api calls were never counted and the estimate came out low. provider.SamePlanAccounts maps each chatgpt-api account to the Codex account that is the same ChatGPT account, matched on the tokens' chatgpt_account_id and chatgpt_user_id, both known and both equal, never on a name: two Team seats of one email share the name and the user id, not the account id. A token that names neither matches nothing, as before. windowHolds (current and HistoricalWindowHolds) counts a matched account's calls as the Codex account's, dry runs included. chatgpt-api alone (no Codex account) is unchanged: its card reads no windows, so there is nothing to estimate. Routing's caps and pace go by the vendor's own reading of the windows and don't sum the ledger, so they are unchanged; the per-provider account breakdown in the summary stays per provider on purpose. Run (mote, at this tree): - go test ./internal/usage/ ./internal/provider/: ok. ./internal/gui/: TestMainWindowCorners/macOS_26_SDK red, the AppKit test filed as #3949 (macOS 27 on mote), untouched by this change; the rest ok. - go vet, GOOS=linux go vet -tags nogui, GOOS=windows go vet of internal/usage and internal/provider: ok. gofmt -l: nothing. - quota-holds.test.cjs in Chromium and WebKit: 2/2 each (the GUI only renders the server's holds; no asset changed). Broken by hand: - remap removed in windowHolds: TestWindowHoldsCountsTheSameChatGPTAccount- ThroughTheAPI red, "whole 5 hours 2500 tokens, want 10000" and "the personal account holds 2500 tokens, want 10000". - account id ignored (user id only) in SamePlanAccounts: red, "the Team seat holds 12500 tokens, want 5000" and "whole 5 hours 10000 tokens, want 2500" (token naming no account). Not tried: a real chatgpt-api sign-in. No such account on this machine, so whether OpenAI's Sign in with ChatGPT tokens carry chatgpt_account_id and chatgpt_user_id (Codex's do, checked on the real Codex logins here) is not verified; if they don't, nothing is matched and the estimate stays as before. GUI suite in other languages not run (no strings changed). |
||
|
|
326e72f4c5 |
routing: the "No session ID" group folds like the others, and one button folds or opens every group (zzzkl on Discord)
zzzkl: the Routing page's 未提供会话标识 group couldn't be collapsed. Its
head was a div with no click handler, no arrow and no aria-expanded,
because only a group with a key could be folded (`g.key ? "button" :
"div"`). closedSessions is keyed by the group's key, and "" is a key a Set
holds, so the no-session group now uses the same button, arrow and
handler as the rest.
Also, as asked: an icon button in the request list's existing header row
(.rt-fold-all, beside Replay) folds every group while any is open, and
opens them all otherwise. It shows only when the list is grouped (by
session or by key) into two or more groups. It has a tooltip and an
aria-label only, no text: "Collapse all" / "Expand all". Those two words
moved from plugins/library/i18n.js to the core i18n.js (zh, zh-TW, ja,
de), since Library and Routing now both say them (i18n-keys: a word used
by two plugins is the core's). The core script budget doesn't count
i18n.js or plugins/, so it isn't raised.
routing-sessions and inner-scroll-contain found group heads by
`button.rt-session` with a key; they now filter .rt-session by text, as
the no-session head is a button too.
Run (mote, node --test, Chromium + WebKit):
- routing-fold-all.test.cjs (new): 2 engines x 1100/420 x en, zh,
zh-TW, ja, de. It covers the no-session group folding on click, the
fold-all button folding then opening every group, its tooltip in each
language, and it being hidden with one group.
- i18n-keys, i18n-en-no-cjk, routing-sessions, inner-scroll-contain,
skill-fold-all, routing-row-swap, routing-rule-drag,
routing-order-unknown, routing-many-keys, in one run at concurrency
3 with routing-fold-all: 170 tests, 157 ok, 13 red. Every red is also
red on a clean origin/main
|
||
|
|
8bfc551ee2 |
providers: a built-in icon picked over one found from the base URL is the one saved (Refeccd on Discord)
Get icon > Automatic looked for the site's icon from the base URL and kept that base URL as the picture's address (iconFrom). The editor then opened with the base URL in the Image URL box, and picking a built-in icon left the box asking: Save flushed the "typed" address first, fetched the base URL as a picture over the built-in one, and the built-in pick never stuck. Now only icons/url's own address is kept as iconFrom, and picking a built-in icon or choosing a file closes the address box and clears what was typed, so nothing is fetched over the user's pick. A provider saved before with the base URL as its address is fixed the first time a built-in icon (or a file) is picked: the backend drops iconFrom with a non-file icon already. Test: internal/gui/tests/icon-builtin-over-address.test.cjs (the reporter's saved state: a file icon with iconFrom = base URL; pick github, Save, open again; Automatic then Save; built-in over Automatic's), Chromium and WebKit, 420 and 1100 wide, en/zh/zh-TW/ja/de. Run on mote (mote-run), at this tree: - icon-builtin-over-address, icon-url-saved, icon-url: 60 of 60 pass. - Broken by hand: the old app.js put back, the new test fails 20 of 20 with "the base URL is still in the Image URL box" (1 !== 0). - go test -tags nogui -run Budget ./internal/gui: ok (core scripts 1,533,742 <= 1,533,802, paid for by one comment cut, no raise). Not tried: the real app with a real provider's favicon; the full GUI suite (runs once after the three fixes). |
||
|
|
055a81e9ac |
gui: the image chips' names fit the core's script budget, no raise
0d73a6348 (GPT Image chip names) took the core's scripts to 1,533,986,
184 bytes over coreScriptBudget (1,533,802): TestCoreScriptBudget red on
main. Paid for without a raise: mediaChips' new comment dropped, its name
read once, and renderRouting's comment cut to two lines. app.js is now
1,311,215, 129 bytes under its size before 0d73a6348.
Run (on mote, at this tree):
- go test ./internal/gui: ok but TestMainWindowCorners/macOS_26_SDK, red
on mote's macOS 27 as filed in #3949 (not touched here)
- GUI: chatgpt-image-chip 22/0, image-models-hide 52/0,
video-models-hide 22/0, group-pick-drawers 4/0
- i18n-keys: 3 pass, 1 fail ("a plugin's words are its own": "No session
ID", "View routing"), the same on origin/main
|
||
|
|
d00e41604c |
settings: the image model error's example is gpt-image-2, not the shut-down gpt-image-1
OpenAI shut gpt-image-1 down on 2026-10-23. Run: go test ./internal/settings on mote: ok. |
||
|
|
2d6939ec64 |
gateway: Automatic draws with the newest GPT Image, and a ChatGPT account's shows as GPT Image (StarBits on X)
StarBits asked on X whether magpie draws with OpenAI's newest image model, as the editor showed "gpt-image-2". - AutoDrawer took the cheapest priced model. An OpenAI key lists gpt-image-2.5/2.6 with no price (models.dev prices gpt-image-2 only), so Automatic kept an older GPT Image. Now a GPT Image that a newer one set up supersedes is never picked (gptImageGenOf: version, then base/Sunburst > Flare > mini; dall-e and chatgpt-image-latest under all), and an unpriced one is costed as the newest priced one. Another kind of model that costs less still wins. - A ChatGPT (Codex) account's backend ignores the model name (#1865; re-checked today with a real account: gpt-image-2, 2.6-sunburst, 2.5-flare and a bogus id all drew the same 1536x1024 image), so it is never superseded, and its chip now reads its name "GPT Image" with the id as tooltip (/api/providers drawNames). Unticking still saves the id. - docs/subsystems/gateway-routing.md says both. Run (on mote, at this tree): - go test -tags nogui -run 'AutoDrawer|GPTImageGen|Codex.*Image|ImageGen|Drawer|Draw' ./internal/gateway ./internal/gui: ok - GUI: chatgpt-image-chip (new), image-models-hide, video-models-hide, group-pick-drawers, chromium + webkit, en/zh/zh-TW/ja/de, 1000 and 360px: 100 pass, 0 fail - gofmt -l: clean - Full go test ./... -timeout 45m and Linux/Windows vet: running; record follows in the next commit or a comment. Broken by hand: without the supersede filter TestAutoDrawerTakesNewestGPTImage picks oa/dall-e-3; without the ChatGPT exclusion TestAutoDrawerKeepsChatGPTsOwnPick picks oa/gpt-image-2.6-sunburst; with the chip label reverted the GUI test is red. Not tried: a real OpenAI key's live model list in the app. |
||
|
|
8c733bb362 |
gateway: a bare JSON error line in an event stream is the vendor's error
zRain (Discord #feedback, Windows, v0.1.3039/v0.1.3041) asked
antigravity/gemini-4-argon high. Code Assist answered 200
text/event-stream, a few thinking events, then ended the body with
{"error":{"code":400,"message":"Request contains an invalid argument.","status":"INVALID_ARGUMENT"}}
on a line of its own, no "data:" before it. readSSEAlive and the
passthrough sniffer skip any line that is no SSE field, so the stream
ended with no finishReason and the agent was told "Antigravity: the
reply ended before it was complete" instead of Google's 400.
- sse_bare.go: bareErrors hands such a line (Google's shape, a list
of one, pretty-printed over several lines, OpenAI's {"error":…},
Anthropic's {"type":"error"}) on as the data event it means. Every
other line goes byte for byte, a line under way at once; only a line
starting { or [ waits for its end (held up to 1MB). eventStream wraps
the body with it (passthrough, translated stream and whole reply,
continuation, search), and readSSEAlive wraps every other reader.
- codeassist.go and carriedError take the status the error names
(namedStatus, #4855), so a whole reply's error goes out at 400.
- continuation.go notes that status for routing (namedStatusHeader);
refusal events and Antigravity's own turning away are left as they
were.
- gateway.go: a reply broken off by an error frame that names a 4xx
retryable() calls the request's fault rests nobody, as that 400 does
before the 200.
Plugins: antigravity-cloak only rewrites the request, reads no stream,
so nothing to change there.
Run (mote, at this tree on
|
||
|
|
7c5c90f958 |
provider: a ChatGPT account's GPT Image is tested by drawing, as the gateway draws it (ChangQiu on Discord)
ChangQiu added gpt-image-2.5 to a ChatGPT (Codex) subscription, and the editor's Test failed. The Test asked every model as a chat on the Codex backend's /responses, and that endpoint refuses an image model: 400 model_not_found, "The 'gpt-image-2.5' model is not supported when using Codex with a ChatGPT account" (a real call). Drawing through the gateway already worked: drawsFamily lets any gpt-image-* draw on /backend-api/codex/images/generations. What the vendor's own clients send: - Codex CLI (codex-rs ext/image-generation tool.rs) names one model, IMAGE_MODEL = "gpt-image-2". - CLIProxyAPI (executor/codex_openai_images.go) passes gpt-image-1.5 to 2.6 and their -flare/-sunburst variants straight into the same /images/generations JSON. magpie sends the same shape. - Real calls with one account: gpt-image-2.5, gpt-image-2 and the made-up gpt-image-9.9-nope each answered 200 with the same thing: 1536x1024, 12 input / 343 output tokens, x-codex-active-limit imagegen_premium. The backend picks the model itself (#1865), so the list keeps one GPT Image. Changes: - provider.testOne: a ChatGPT account's gpt-image-* is tested on {codex base}/images/generations with a tiny drawing. probeOnce adds Codex's image headers (Accept json, x-codex-imagegen-request-id, x-codex-image-turn-id), as gateway sendWith does. - The editor's Image models row, for a provider whose vendor picks the drawer (gateway.VendorPicksDrawer, new providerInfo.drawPicks), says why only one GPT Image is listed. It reuses an existing string, so there are no new keys. After the rebase onto |