Commit Graph
2 Commits
Author SHA1 Message Date
yetoneandump45nose 50a7031902 test: TestVisionWaitIsntTheDescribersTime gives the describer 2s, not 300ms, so a loaded run doesn't turn it red (#2444, ump45nose)
The test queues an image description behind a held request for twice
the describer's limit, then needs the description back within that
limit once the lane opens. At 300ms the fake's answer itself came in
late on a loaded machine and on CI (main f191d6423, test
(ubuntu-latest): "no answer in 300ms"). ump45nose's patch on #2444
gives it 2s; it is queued 4s, so the queue still outlasts the limit
twice over and the test still holds #2318 to its point.

Run, in my own worktree at origin/main 717b69f78 + this change:
- go test -tags nogui -count=3 -run TestVision ./internal/gateway: ok
- broken by hand: askVisionWith back on context.WithTimeout(ctx,
  visionTimeout) (the code before #2318) -> red, "context deadline
  exceeded" after the 4s queue; restored.
- go test -tags nogui -race -count=5 -cpu 1,2 -run TestVision
  ./internal/gateway: ok (151s) at load average ~400.
- gofmt -l clean; GOOS=darwin, linux and windows go vet -tags nogui
  ./internal/gateway: ok.
- Only this _test.go file changed, and no other package imports it, so
  the full suite was not run. Rebased onto e183604f0 (two claude
  commits, not in internal/gateway) before pushing.

Co-authored-by: ump45nose <52391318+ump45nose@users.noreply.github.com>
2026-10-17 20:19:07 +08:00
yetone 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
2026-10-15 23:08:01 +08:00