Skip to content

test(vision): test_vision_ollama CI path sends images to non-vision model, causing 400 Bad Request #1185

Closed

Description

@planetf1

Observed behaviour

In CI, test/backends/test_vision_ollama.py::test_image_block_in_instruction and ::test_image_block_in_chat both fail with an Ollama 400 Bad Request error:

```
ollama._client.ResponseError: model does not support vision
r = <Response [400 Bad Request]>
kwargs = {'json': {'model': 'granite4.1:3b', 'messages': [{'role': 'user', 'images': [...]}], ...}}
```

These tests are marked @pytest.mark.ollama, @pytest.mark.e2e (not qualitative), so CI runs them against the live Ollama server. They were observed failing on PR #1168.

Root cause

The m_session fixture has two branches:

```python
if gh_run == 1:
m = start_session(model_options={ModelOption.MAX_NEW_TOKENS: 5}) # no model_id
else:
m = start_session("ollama", model_id="granite3.2-vision", ...)
```

The CI branch (gh_run == 1) calls start_session() with no backend or model ID, which resolves to the CI default — granite4.1:3b. That model does not support vision. The else branch correctly specifies granite3.2-vision.

The Ollama instance in CI is started with granite4.1:3b (the standard non-vision default); granite3.2-vision is not pulled there.

This was introduced in commit a93949a5 (2026-01-26), whose message noted "Issue to be created" but it was never filed.

Expected behaviour

Either:

  1. The CI fixture branch also specifies granite3.2-vision, and the CI workflow pulls that model before running the vision tests; or
  2. The tests skip when no vision-capable model is available (detected via the Ollama model list or a dedicated fixture check).

Option 2 is safer — it degrades gracefully if the model is absent rather than hard-coding a specific model name in two places.

Notes

  • The structural assertions (checking that images were correctly embedded in the Ollama prompt payload) are the real value of these tests; they are not qualitative.
  • The quality assertion ("yes" or "no" in the response) is already gated behind if not gh_run == 1:, so option 1 would unlock that too.

Activity

  1. added
    area/backends
    on Jun 2, 2026
  2. planetf1 commented on Jun 2, 2026

    @planetf1
    ContributorAuthor

    Failure mechanism

    m_session picks the model from the CICD env var:

    • CICD=1 (CI): start_session(...) is called with no model_id, so it falls through to the default IBM_GRANITE_4_1_3B (granite4.1:3b) — text-only. The tests then attach an image and Ollama rejects it with 400 model does not support vision.
    • CICD unset (local): the else branch explicitly names granite3.2-vision, so it passes — provided that model is pulled.

    CI only pulls granite4.1:3b (quality.yml), so no vision model exists there, even though conftest's warmup loop attempts granite3.2-vision (that attempt fails silently). Because the 400 aborts before _generate_log.prompt is populated, the structural assertions — the real value of these tests — never run in CI at all.

    Root cause: the CI branch of the fixture forgot to name a vision model and fell back to the text-only default. Introduced in a93949a5.

  3. added a commit that references this issue on Jun 2, 2026
    862182c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/backendstesting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions