ac4af582301a4e8a29245dbba767eba31334ddf9
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
8de63c8b5a |
gateway, usage, gui, otlp: a request its agent canceled is no failure (#2398)
An agent that cancels its request before it is answered is logged 499 "the agent canceled the request": a person stops the reply, or sends the next message while it is coming and Claude Desktop cancels it and asks again, or Codex takes a subagent's report (#2398). The gateway already says nobody failed (no rest, no reroute: TestCanceledRequestRestsNobody), but Record.Failed is a status >= 400 or an error, so every page counted it as a failure: the Requests card's "N failed" and success share, its Failed filter, the CSV's error column, the Routing page's "errors your agent saw", the Context page's error rate, the failed colour in the Requests list, Routing and Recent calls, and the OTLP export's error status. A Claude Desktop session on 2026-10-27 had four, each a message sent mid-reply; #2398 had 91 of a day's 92 failures. usage.CanceledBy tells the agent's cancel (499 with AgentCanceled) from magpie's own limit on a request it asked of itself, logged 499 too and still a failure (#2318). The cancel is logged with an error type of its own, agent_canceled (usage.CanceledErrType, set in failedWith), so the record says what it was and nothing guesses it from a 499, as #2398 asked. Record.Canceled reads the type, and a record logged before it by its status and message, so the old log reads the same with nothing migrated. A middleware's usage rows carry the type, so a module can tell the cancel from magpie's own limit, which its rows (no error text) couldn't. Record.Failed leaves the cancel out; Totals counts it apart (Canceled, in count and plus); RetriedRequest and the first-token and speed sums ask Answered, so a canceled request is timed nowhere, as before; Codex's memory of the last model still skips it. Routes and Recent calls say canceled (set as a route is done and as a day's history is read, so old days read the same); the Routing totals and the Context page's errors leave it out. Ledger rows say canceled, and the pages show it muted, in neither the failed nor the answered colour: the Requests list and its detail ("499 · canceled"), the Requests card ("N canceled", the success share of the requests not canceled), the overview tile, the Routing page (a "gone" outcome, no speed) and Recent calls (muted). New strings are in zh, zh-TW, ja and de. The OTLP export: the records the gateway gives its observers for a request and its try carry the type too (canceledAs), and a root span's error.type follows Record.Failed, so a canceled request's span and its try's go with status code 499, no error and no error.type. TestOTelWaterfallFailureAndCancellation's canceled case held two failed spans (the try the vendor refused as the agent left is recorded canceled, as the request is); it now holds neither failed, both 499 and no error.type. That change to the test is the point of this one. mdwsk88's patch (aea0027fd) ran its tests at |
||
|
|
4594d66d2d |
gateway: an image description's time limit is the describer's, not its wait in the queue, and the usage log no longer calls it the agent canceling (#2318, davisjiahao)
askVisionWith put a 2-minute context.WithTimeout around the whole description, which goes through the gateway itself (s.serve): its wait for a slot (MaxConcurrency, QueueWait), for room in the minute, and the pauses between tries all spent it. A reasoning seer (gpt-6.1-sol on a Codex account) queued or retried had little or nothing left to describe in, and the image's turn failed. The usage log said 499 "the agent canceled the request" for magpie's own limit. sideDeadline (side_deadline.go) now bounds a request magpie asks of itself: the vendor has its limit from when the request last went out to it (httptrace WroteRequest, each try's own), and the whole of it, waits included, a larger one. Image descriptions get 3 minutes per try (a dense screenshot at a high reasoning level can take over two) and 10 in all; a model's search (modelSearch, the same 2-minute limit, the #1522 message) keeps 2 minutes per try and 5 in all. The context's cause says which limit ended it, and the 499 sites in serve record "magpie stopped waiting: its image description had no answer in 3m0s" instead of the agent canceling. Still 499, no fault of the vendor's. Not done: the issue's setting for the limit (none needed once the wait isn't counted) and sending the raw image to a model that can't see it. A pause between two tries still runs on the first try's limit. Tests (vision_wait_test.go): TestVisionWaitIsntTheDescribersTime queues the description behind a held request for twice the limit; TestVisionLimitEndsASlowDescriber has a describer slower than the limit and checks the 502 and the usage row. Broken by hand (WithTimeout back, the old 499 text) both fail: "no answer in 300ms" and "vision usage: 499 the agent canceled the request". modelSearch has no test of its own; it uses the same sideDeadline. Run: go test -tags nogui ./internal/gateway -run 'Vision|Search|Image|Seer|Describ|Concurren|Queue|Cancel|Usage|Lane|RPM' ok (58s); gofmt clean; go vet -tags nogui ./internal/gateway on darwin, linux, windows clean. Not tried with a real queued seer. Full suite: SUITE_LINE |