Skip to content

fix(web): warn before sending images a bot's model can't read - #145

Merged
cheetahbyte merged 1 commit into
mainfrom
fix/image-model-error
Nov 17, 2026
Merged

cheetahbyte merged 1 commit into
mainfrom
fix/image-model-error

Conversation

@lauragarden

Copy link
Copy Markdown
Contributor

Summary

When a bot's model can't read images and no vision model is set, the server now refuses the message before it records a turn, and the web composer warns as soon as such an image is attached. The error shows once, names the bot, and links to the fix.

before: POST /messages ─▶ create execution ─▶ admit ─▶ submit throws
                                              ├─▶ execution failed   → "The bot couldn't finish" alert
                                              └─▶ HTTP 400           → "Message was not confirmed: …"
after:  POST /messages ─▶ validateFiles ─▶ refuseUnreadableImages ─▶ HTTP 400 (no execution)
  • Server: refuseUnreadableImages in bots-submissions.ts checks the files with runtime.acceptsImages, the same check group chats use, and applies the same rule as resolveMessageFiles: only PNG, JPEG, GIF, and WebP up to 5 MB reach the model as images. assertImageSupport in runtime.ts stays as a backstop for other paths. Both use unreadableImages: "Atlas's model (flash) can't read images. Choose a model that accepts images in Atlas's profile, or set a vision model in Settings to describe images for it."
  • Contract: GET /v1/models returns images for each model (readsImages, so catalogs that list no input types count as true).
  • Web: ImageWarning (apps/web/features/bot-chat/image-warning.tsx) appears above the bot chat composer through a new notice prop on Composer. It links to the bot's profile (/bots/$botId/edit) and the vision model setting (/settings/vision-model). It stays hidden while the model or vision settings are loading, and when either can handle the image. Upload now records size.

Closes #80

Why

The owner saw the same error twice. Its button opened Provider settings, but the fix is the bot's model. The text said "agent's profile" and didn't name the bot, and the owner only found out after sending.

Evidence

  • bun run check passes on the branch: lint, format, typecheck, openapi:check, and 1316 tests, 0 failing. The apps/docs check passes.
  • chat.test.ts › "a text-only model rejects image blocks…" now also checks that the snapshot has no error and no user message after the refusal. Without the bots-submissions.ts change it fails, because error holds the image message.
  • New image-warning.dom.test.tsx: the warning names the bot and links to /bots/b1/edit and /settings/vision-model. It stays hidden when the model reads images, when a vision model is set, when no image is attached, and when the image is over 5 MB.
  • Not checked by hand: the warning and the refused send in a browser.

Risk and rollback

Reversibility: Reversible.

Blast radius: Bot chat sends with image files (web, native clients, and the Discord gateway, which all go through sendChat), the Model schema in the OpenAPI contract (adds a field), and the web bot chat composer.

  • The check now runs before admission, so acceptsImages may refresh the provider's model catalog on a send with images. That's the same refresh submit already did.
  • A refused send still shows the existing "Message was not confirmed: …" prefix under the composer. That wording is shared with group chats and isn't changed here.

The server refuses an unreadable image before recording a turn, so the
error shows once and names the bot. The composer warns as soon as such an
image is attached and links to the bot's profile and the vision model
setting. GET /v1/models returns images for each model.

Closes #80
@lauragarden lauragarden self-assigned this Nov 16, 2026
@github-actions

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit d9ffd50.

@cheetahbyte
cheetahbyte merged commit 724e2e0 into main Nov 17, 2026
10 checks passed
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.

Clearer error when a bot's model can't read images

2 participants