Skip to content

An input_image reaches the agent; an image URL or an unreadable part is refused by name - #733

Open
eric-epsilla wants to merge 1 commit into
HarnessRouter:mainfrom
eric-epsilla:input-image-reaches-agent
Open

eric-epsilla wants to merge 1 commit into
HarnessRouter:mainfrom
eric-epsilla:input-image-reaches-agent

Conversation

@eric-epsilla

Copy link
Copy Markdown
Contributor

The problem

An input_image part, the OpenAI Responses shape for an image, never reaches the agent. _parse_input keeps it in the turn's record and nowhere else, so nothing is written to the working directory. The request still answers 200 with ignored_fields: [], and the agent answers as if no image was sent. The same image sent as input_file works. Tasks §2 lists input_image as "an image, inline or by file_id".

Reproduced on main (93994cf):

>>> gw._parse_input([{"role": "user", "content": [{"type": "input_text", "text": "What is in this screenshot?"},
...                                               {"type": "input_image", "image_url": PNG}]}])[1]
[]                                   # nothing for the agent
>>> gw._parse_input([... {"type": "input_file", "filename": "s.png", "file_data": PNG} ...])[1]
['s.png']

The fix

_parse_input turns an input_image into a file spec, the same way it already does for an input_file.

  • Inline. A base64 data URL, either as a string or as {"url": ...}, the Chat Completions spelling. The file is named image-<sha256[:12]>.<ext> from its bytes, unless the part gives a filename. The same picture sent in two turns becomes one file. The record keeps the name, not the bytes.
  • By file_id. Resolved by _resolve_uploads, with its existing organization check and 404s.
  • Refused with a 400 invalid_input that says what to send. This covers an http(s) URL, which is not fetched because the server would be reaching an address the caller picked. It also covers a data URL that is not a base64 image, and a part with neither field.

One behaviour change: a client that sends an image URL now gets a 400 instead of a 200 with the image silently dropped.

Verified

$ python -m pytest -q gateway/tests/test_input_image.py gateway/tests/test_input_history.py
94 passed in 2.37s

test_input_image.py against main's app.py:

14 failed in 1.27s

The full gateway suite on this branch:

13 failed, 3043 passed, 13 skipped

The 13 failures are all in test_database_mcp.py, and the same 13 fail on main on my machine, which has no database server for those tests. main's CI is green on them, so CI on this PR should be the real check.

🤖 Generated with Claude Code

…rectory, as an input_file does; a URL or an unreadable part is refused by name

An input_image part was kept in the turn's record and nowhere else: nothing reached the working
directory, the request answered 200 with ignored_fields [], and the agent said no image was attached.
The same image sent as input_file was read. Tasks §2 lists input_image, "an image, inline or by file_id".

- Inline: a base64 data URL, as a string or {"url": ...}, named image-<sha256[:12]>.<ext> from its bytes
  unless the part names a file. The record keeps the name, not the bytes.
- By file_id: resolved by _resolve_uploads, with its organization check and 404s.
- A URL is not fetched (an address the caller picked), and a non-image or non-base64 data URL, or a part
  with neither, answers 400 invalid_input naming what to send.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
unified-harness-protocol Ready Ready Preview Nov 22, 2026 1:21pm UTC

Request Review

@eric-epsilla

Copy link
Copy Markdown
Contributor Author

@richard-epsilla could you review this when you have a moment?

Problem. An input_image part never reaches the agent. The request answers 200 with ignored_fields: [], and the agent says no image was attached. The same image sent as input_file works. Tasks §2 lists input_image as inline or by file_id.

Approach. input_image now goes through the same path as input_file. A data URL or a file_id becomes a file in the working directory. An image URL is not fetched, and anything that is not a base64 image is refused with a 400 that says what to send.

What I'd like from you:

  1. Confirm the one behaviour change is fine: an image URL used to be dropped with a 200 and now gets a 400.
  2. If you'd rather the server fetch https image URLs, say so, and I'll add it behind the same SSRF guard the media tools use. I left it out on purpose.
  3. Otherwise, merge once CI is green. CI is the real check for test_database_mcp.py, which I can't run locally.

This branch was successfully deployed

1 active deployment
Preview — 8728212c Deployed Nov 22, 2026 by vercel[bot]
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