Files
magpie/internal/gui/assets/plugins/routing
yetone 2570efb5f7 gateway: an image the picked model can't describe is described by the next model that sees (kelvinjason11 on X)
kelvinjason11 on X: "图片识别好像只支持一个模型识别 没有fallback". When
the describer (Settings' Image recognition model, or AutoVision's pick)
failed, the turn failed with it, though other models that see were there.

Now describeWith asks the pick first, always. When it fails for any reason
but the client's own cancel, magpie asks the next model that sees: the
first ready one of seersRanked, AutoVision's own order (ready, then
Claude account, Codex, API key, other, then cost), leaving out each model
already tried and each one that turned an image away (sightRefused). At
most 3 models (visionTries), and all of them within visionWaitMost
together: each try gets what is left of it, not a fresh visionTimeout.

- The text header names the model that described the image
  ("as other/bigeye describes it"), not the pick.
- The Routing row of the stand-in carries Instead, Why and Picked
  (describingInstead, the same fields web search's searchingInstead
  sets), and the Routing page says in every language that the pick
  couldn't describe it, why, and which model did instead.
- When none answers, the error is the first failure as before, then
  "nor could X, asked in its place: why" for each other model tried.
- Spent/allowance: each try goes through serve as before, so autoSpent
  and spentModel judge every stand-in the same as they judged the pick.
- vision_mcp's describe_image tool gets the same fallback.

Cache (s.sights): a description is kept under the pick and the image,
whichever model described it, with the describer's name beside it. The
same image sent again asks no one, the stand-in's text is reused, and
its header still names the stand-in. A new image asks the pick first
again, so a pick that comes back is used at once. Failures are not kept.

Settings' text ("When the model in use can't see images, this one
describes them to it") is left as it is: the pick is still asked first
for every image.

Tests (internal/gateway/vision_fallback_test.go):
- TestPickedDescriberThatFailsGivesWayToTheNextThatSees
- TestAutoDescriberThatFailsGivesWayToTheNext
- TestNoDescriberAnswersNamesEach
- TestPickedDescriberThatAnswersIsTheOnlyOneAsked
- TestCanceledDescriptionAsksNoOther
TestDescriberThatCantSeeIsntAskedToDescribe now expects the next model
that sees to describe in place of a text-only pick, not a 502.
GUI: internal/gui/tests/vision-instead.test.cjs (every language, 1100
and 520 wide).

Run on mote at 45739f15b (this tree, on origin/main 74f1df869):
- go test -tags nogui ./internal/gateway/ -count=1 -timeout 45m: ok
  (542.988s). An earlier run while mote was at load ~26 failed four
  Antigravity turned-away tests and TestCodexSpentGrokFailingIsTold.
  None of them touches vision, and all passed in this run.
- gofmt -l: nothing.
- GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./...: ok.
- GUI, Chromium: vision-instead, search-instead, routing-vision-why,
  vision-mcp, routing-kind and i18n-keys (4/4) pass.

Broken by hand (in a worktree at 0fcb3acb3):
- The old code with the new tests: Picked, Auto and NoDescriberAnswers
  go red. PickedThatAnswers and Canceled pass, as they should on code
  that never falls back.
- The ctx.Err() check removed from describeWith: Canceled goes red (a
  vision row for other/bigeye appears).
- describeWith made to ask the next model after a success:
  PickedThatAnswers goes red ("eye asked 1 times, bigeye 1").

Not tried:
- The GUI files in WebKit. Playwright's WebKit launch timed out at 180s
  while mote was at load ~25 from other suites. To be rerun.
- vision-instead against the old Routing client, to watch it go red.
- No real account: the fallback was run only against fake upstreams.
2026-10-31 02:28:18 +08:00
..