Files
hermes-agent/agent
rodricksz4h5 7299015092 fix(agent): track image rejections per model across a fallback chain
The first head stored a single rejecting (provider, model) and kept the
turn-global `_vision_supported` as the recovery guard. In a fallback
chain that fails: model A rejects images and retries text-only, a later
error activates model B, the restart rebuilds api_messages from history
so B receives the images, and when B rejects them too the branch is
skipped because `_vision_supported` is already False — the request
falls through to generic error handling. Recording B also overwrote A,
so A was no longer treated as text-only on later turns.

`_image_rejecting_models` is now a set of every rejecting model, and it
is also the guard: each model's first rejection runs the recovery and a
repeat rejection from the same model still falls through, so the retry
cannot loop. image_model_key() names the key in one place.

Adds a test for the two-model sequence (fails on the previous head) and
one pinning that a repeat rejection from the same model does not retry.

Thanks to @ehz0ah for the review.

(cherry picked from commit 225fd76ccf90cd3ec509a9327f725ac02d996f24)
2026-09-21 21:43:51 +05:30
..
…
…
…