Skip to content

TD-5435: image input is on by default for models that support it - #298

Open
captcrock wants to merge 6 commits into
mainfrom
td/5435-vision-auto
Open

captcrock wants to merge 6 commits into
mainfrom
td/5435-vision-auto

Conversation

@captcrock

Copy link
Copy Markdown
Contributor

TD-5435 — Image input is on by default for models that support it

The owner's ask: "Please put that on by default for any model that supports it." Before, an image was refused ("…the active model does not accept images. Set vision: true on that tier…") unless the tier had vision: true, even when the provider says the model reads images.

What changes

  • A tier's vision is now three-way: true / false in config always win; unset is decided by what the model supports.
  • Support comes from the lists the daemon already fetches (Settings Refresh, the background pass, Add a model, loopback discovery): OpenRouter architecture.input_modalities, an OpenAI-compatible /v1/models row with "vision": true, LiteLLM supports_vision. Answers are cached in model-vision.json in the data folder, never written to config.yaml. No send waits on the network.
  • With no answer, a configurable vision_models name list (in the shipped config, not code), then off.
  • Images returned by tools stay out of role: "tool" messages on the wire: the tool message says the image follows, and one user message after that step's tool results carries the images in call order (OpenAI Chat Completions takes only text in tool messages: "For tool messages, only type text is supported."). The stored conversation is unchanged.
  • An image refused while the answer is unknown says "hasn't been checked yet" and starts one background check; an unlisted or unreachable model is remembered and said so, until Refresh. A role with no slug works after a restart and on Refresh. After the turn's slug lookup, attached images are re-judged, so a stale record can't send an image to a text-only model.
  • Delegate children judge at the credential host like the parent. Settings → Models shows each role's "Images: on/off" and where it came from.
  • One addition not in the ask: at most one background check per host and model at a time (de-duplication of identical requests, not a limit).

Repro

  • Before (dd2772c): a tier with no vision line on a mock OpenAI-compatible host whose /v1/models says "vision": true → image refused, attachment_no_vision.
  • After: the same tier accepts the image once the host's list is read (core/tests/test_vision_auto_repro.py).
  • Tool images: two fs_read image results in one batch → no image part in any tool message; both images follow in one user message, in order (fails with the move reverted).

Review

Independent reviews, three rounds:

  • Round 1: no blocker reproduced; asked for the tool-message wire fix (OpenAI), "not checked yet" wording with a background check, the slugless loopback case after restart, delegate credential host, docs. All fixed in 4431b46.
  • Round 2: nothing blocks; three low items (an unlisted/unreachable model staying "unchecked" and re-fetching; Refresh skipping slugless roles; a stale served-model record after a model swap) fixed in 1ae0e12.
  • Confirmation of 1ae0e12: all four pass; nothing blocks. Two low follow-ups, existing before this change: with brain_every_message, a worker vision: true and brain vision: false, the composer accepts an image that the brain turn then refuses cleanly; for a host the machine policy refuses, the refusal still suggests Refresh, which skips refused hosts.

Tests

  • Full core suite on 1ae0e12: 10325 passed, 13 skipped, 4 deselected. test_model_vision + repro: 127 passed.
  • ruff, ruff format, mypy clean. release_scan --git: 0 hits.
  • UI: tsc OK, vitest 263 files / 3333 tests passed, build OK.

🤖 Generated with Claude Code

captcrock and others added 6 commits December 2, 2026 01:00
What: a tier's vision is now true, false or unset. Set, it wins as before.
Unset, the tier takes images when its host's model list says the model
does; otherwise when the model's name matches the new top-level
vision_models list, shipped in config.yaml; otherwise not, as before.

Why: attaching an image failed with "the active model does not accept
images" on a tier whose OpenAI-compatible host lists the model with
"vision": true on its public /v1/models. The tier simply had no vision
line. The ask was to turn images on by default for any model that
supports it.

How:
- model_setup.parse_model_list reads image support from the rows hosts
  publish: OpenRouter's architecture.input_modalities (and its older
  modality string), a "vision" flag on an OpenAI-compatible row, and
  LiteLLM's model_info.supports_vision, on the row or from /model/info,
  which is asked only where it already was. EndpointModel gains an
  additive vision field (protocol.ts too).
- model_vision.py keeps the last answer per base_url and model. Lists are
  learned only where the daemon already fetches them: the model-card
  refresh (Settings and the background pass), Add a model's list, Find
  models on this computer, and loopback slug discovery. A row that says
  nothing keeps the answer; a failed listing changes nothing. Answers
  persist in model-vision.json in the data folder, like token ratios, so
  they hold after a restart. Deciding reads memory only: a send never
  waits on the network. Nothing is written to config.yaml.
- vision_models is config, not code (directive 7). It is filled from the
  shipped file into older copies, and lists only families whose every
  model reads images (GPT-4o/4.1/5, o1/o3/o4-mini, Claude 3 and 4+,
  Gemini 1.5-3, Gemma 3 4B+, Grok 4, Llama 4, and -vision, Qwen-VL,
  Pixtral, LLaVA, MiniCPM-V, Moondream names).
- The daemon's attachment gate, tier_state.vision, fs_read's image reads
  and a delegate child's reads all use the resolved answer. When a
  listing changes an answer, open native chats get a fresh tier_state.
  The Grok engine still takes images whatever the tier says.
- The refusal says why: the model does not report image support (and how
  to force it on), or the tier sets vision: false. The composer's copy
  covers both. Settings shows an unset vision switch as "Not set".

Tests: test_model_vision.py covers each list format, the name list, both
overrides, unknown models, the cache, persistence and no request on a
send. test_vision_auto_repro.py is the before/after: the same scenario
was refused on dd2772c and is accepted here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What: docs/configuration.md describes a tier's vision as true, false or
unset, adds the vision_models section (the order of answers, the three
list formats, where lists are read, the cache file, the shipped
families), and updates the attachment, backup and fs_read text that
said only vision: true turns images on. The backlog gets TD-5435 under
0.5.14, and DECISIONS.md records why this replaces TD-4705's "never
inferred" and why the name list lives in config.

Why: the default changed for every tier with no vision line, and the
reference must say exactly what decides it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What: VisionStore.learn now changes memory only, and the places that
learn (the card refresh, slug discovery, Add a model's list and the
local-server scan) await VisionStore.save, which writes the file in a
thread. Saves run one at a time and each writes what memory holds when
it starts.

Why: AGENTS.md keeps blocking filesystem calls off the event loop, and a
whole OpenRouter list is a few hundred rows. Serialising the saves keeps
an older snapshot from landing after a newer one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…i names

What: tier_state gains an additive vision_source (config, host, name or
none), set wherever tier_state is built and compared when an open chat
is told of a change. The composer takes it and words its image refusal
as the daemon does: "sets vision: false" only when the tier's own line
is why, otherwise "does not report image support" with how to turn
images on. The shipped vision_models list now names the Gemini 2.0
Flash and Gemini 3 ids it means instead of open-ended globs, so a speech
sibling of those families would stay off. protocol-fixtures.json is
regenerated for the two new fields.

Why: an outside review of the first commit found the composer's copy
named both causes at once because tier_state carried only the bool, and
that gemini-2.0-flash* and gemini-3-*-* would also match a -tts model,
against the list's own rule that every match reads images. The review
also checked that Settings' Clear returns a set vision to unset; a test
now covers it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lugless tiers

What and why, per review item:

1. A tool result's image now reaches the model in a user message right
   after that step's tool results, in call order, each under a line
   naming its call; the tool message keeps only text and says the image
   follows. OpenAI's Chat Completions reference says of tool message
   content: "For tool messages, only type text is supported", so with
   images on by default an OpenAI-hosted tier's fs_read of a picture
   would have failed, and kept failing while it stayed in history. Only
   the request body changes (ChatCompletionRequest.to_dict), for every
   provider; the stored conversation, image cap and history are as they
   were.
2. "Not checked yet" is now its own source ("unchecked"), apart from a
   list that named the model and said nothing ("none"). An image refused
   while unchecked says the model "hasn't been checked yet", points to
   Refresh from servers in Settings -> Models, and starts one background
   request for that tier's model list (model_cards.check_vision: the
   refresh's request, key rule and machine policy, nothing written to
   config), so a retry a moment later goes through. The composer stages
   such an image and lets the daemon decide.
3. A list that names exactly one model records it as served at that URL,
   persisted with the answers, so a loopback tier with no slug is judged
   by that model from the first message after a restart.
4. A delegated worker judges image support with the credential host
   applied, as the parent does.
5. A row that stops giving the field keeps the last answer, except on the
   person's own Refresh, which takes the row as it is. tier_cards gains
   vision and vision_source, and Settings -> Models shows each role's
   answer and where it came from. Docs, backlog and DECISIONS updated.

Tests: the wire body has no image in any tool message and the images
follow in call order; an unchecked refusal asks and a retry is accepted;
a silent server is not asked again; Refresh forgets, the background pass
keeps; a slugless loopback tier keeps its answer over a restart; a
worker child judges at its credential host; Settings' card fields; UI
staging and wording.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…roles, re-judge after discovery

What and why, per review item:

1. A check or refresh whose list does not name the model now records
   "unlisted", and one whose fetch fails records "unreachable" (keeping
   any older answer, since a failure says nothing new), in memory and in
   model-vision.json. Both are new vision_source values. Before, such a
   model stayed "unchecked" for ever: every image was refused with "send
   it again in a moment" and fired another GET /models. Now the refusal
   says which it is and how to set vision: true, and nothing is asked
   again until Refresh from servers (or, for a role with a slug, the
   background pass). The refusal promises a retry only when the daemon
   has a check running for it ("checking"); a host the machine policy
   refuses gets neither.
2. Refresh from servers now also asks the server of a role with no slug,
   through the same check the refused-image path uses, so the button the
   refusal points to works for the shipped local setup before its first
   turn. refresh_cards still makes no card for it.
3. Right after resolve_tier_slugs, a turn judges its attached images
   again for the tier it starts on (turn_images.py). A loopback server
   that swapped its vision model for a text one across a restart had its
   old served record let the image in at the gate; now the image comes
   out of the message before any request, a line takes its place, and the
   turn ends failed with attachment_no_vision, naming the model.
4. protocol.ts documents every vision_source value; the backlog line on
   silent listings now states the Refresh exception.

Tests: no-answer remembered for both cases, no repeat request, no retry
promise, Settings card and the cache file agree; Refresh asks a slugless
role's server and an image is then accepted; a swapped served model never
gets the image and no chat request is made; store and refresh unit tests;
refusal wording per source; UI wording and Settings line. Each new daemon
test fails with its fix reverted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant