28108ddeece41b4287b716ef006582519684ff57
3
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
bc25bc5077 |
qoder 0.2.40: a queued request gives way at once when magpie has another candidate
axuhere on X sat at "模型请求正在排队 · 预计等待超过 10 分钟" on a free
model while another provider could have answered. Through magpie, a
Qoder free model queued with 10605 was waited out for up to 4 minutes
even when the request had another account, provider or routing group
member after it.
magpie now sends x-magpie-fallback: 1 on a plugin request that isn't
the last candidate (the host keeps it from the vendor). Told so, a
queued request isn't waited out: the 503 with Qoder's Retry-After comes
at once, and magpie asks the next. The message now also says how many
are ahead when Qoder says it ("Qoder queued the request for dfmodel
(this plan's queue: p3, 3 ahead); try again in 30s"). Without the
header, the wait is as before.
Run: packages/qoder `bun test` (268 pass, 22 files); `bun
scripts/check.mjs` all green.
Broken by hand: index.mjs as before with the new tests: the fallback
test and the budget test's message red (2 of 12 in queue.test.mjs).
Not tried: a real Qoder account queued live; the 10605 shape is
testdata/queued-10605.json's, captured before.
|
||
|
|
a379c54b17 |
qoder 0.2.39: a queued call's stream is closed, and its resend is a new request in the same set (#427)
Peterpig (#427, qoder.com, personal_standard, magpie 0.1.1709, plugin
0.2.38): both free models, qfmodel and dfmodel, fail every test with
"context deadline exceeded". Reproduced with the owner's real qoder.com
account and the plugin driven straight from bun (sandbox HOME, its live
token unrenewed): the free models are queued intermittently with
10605 {"isQueued":true,"queueType":"p3","subCode":"RESOURCE_LIMIT",
"serviceAvailable":false,"retryAfterSeconds":30,"waitTime":30}. A
status ask 30s later says isQueued false, the resend is sometimes queued
again, and the answer comes 38s to 71s after the request. magpie's test
waits 20s, so a queued free model is "context deadline exceeded" there
whatever the plugin does; that is Qoder's queue, not the network.
Two things the plugin did differently from Qoder's client
(qoder-agent-sdk worker in Qoder.app 0.4.3, the [ModelQueue] path):
- Qoder keeps a 10605 stream open after its one event. The plugin read
that event and left the stream open through the wait and the resend
(seen held to the 170s abort on the real account). The refused call's
fetch now has its own AbortController, aborted once the call is read
as refused.
- The client gives every resend a new request_id and chat_record_id
(o4i) under the same request_set_id, and asks the queue with the
latest request_id. The plugin sent the same request_id again. It now
does as the client does. Not shown to matter: with the old code a
resend was answered once and queued again in other runs, as with the
new code, so the queue looks load-driven either way.
Run at this tree (base
|
||
|
|
26ddabe4de |
qoder 0.2.28: a queued request waits its turn in Qoder's queue and is sent again, as Qoder's client does (wallance on Discord)
wallance (Discord, magpie latest, qoder 0.2.27): Qoder's free deepseek
flash (dfmodel) through magpie ended in 503 "Qoder queued the request for
dfmodel (this plan's queue: p3); try again in 30s" after 27s, while Qoder's
own client answered the same model, slowly. magpie's gateway retries a
Retry-After of 8s at most, so the 30s was the agent's error.
What Qoder's client does, read from Qoder.app 0.4.3's
qoder-agent-sdk/dist/_worker/qoder-worker-runtime.obf.mjs ("[ModelQueue]"):
on a 10605 or a queue state it asks
GET <api>/algo/api/v2/service/ask/queue/status?requestSetId=&modelKey=&queueType=
(signed as any GET, X-Request-ID and X-Session-ID), at once and then every
retryAfterSeconds held to 0.5..30s (30s unsaid), while isQueued is true or
serviceAvailable false. Once isQueued is false it waits that state's
retryAfterSeconds and sends the same chatAsk again (same request_set_id),
up to 10 times; 3 failed status asks in a row, a 404 or a state with
neither field end it. It waits up to an hour (QODER_MODEL_QUEUE_MAX_WAIT_MS),
and tells /api/v2/service/ask/finish at the end of its turn, best effort
("server TTL will release the lease").
The plugin now does that, under a 4-minute budget from the request's
start: nothing reaches the agent meanwhile, and magpie keeps a stream's
agent alive with SSE comments for 5 minutes of silence (keepQuiet,
keepaliveLongest). Past it, the 503 with Retry-After as before, so magpie
may ask another account. A cancelled request stops the wait and sends
nothing more. The status path's /algo prefix follows the client's other
paths (it signs "/api/v2/model/list", the plugin calls
"/algo/api/v2/model/list").
Run: HOME=$(mktemp -d) bun test in packages/qoder, 185 pass; at the repo
root, 2114 pass, 0 fail, at
|