Skip to content

fix: shrink images to provider dimension limit - #45979

Merged
OutThisLife merged 1 commit into
mainfrom
bb/image-shrink-many-image
Jun 14, 2026
Merged

fix: shrink images to provider dimension limit#45979
OutThisLife merged 1 commit into
mainfrom
bb/image-shrink-many-image

Conversation

@OutThisLife

Copy link
Copy Markdown
Collaborator

Summary

  • Parse provider-reported image dimension ceilings from image-too-large errors.
  • Pass the parsed ceiling into image shrink recovery so many-image Anthropic requests can downscale Retina screenshots below 2000px before retrying.
  • Add regression coverage for the OpenRouter-wrapped Anthropic many-image rejection.

Test plan

  • scripts/run_tests.sh tests/run_agent/test_image_shrink_recovery.py
  • scripts/run_tests.sh tests/run_agent/test_image_shrink_recovery.py tests/run_agent/test_image_rejection_fallback.py tests/run_agent/test_multimodal_tool_content_recovery.py
  • ReadLints on edited files
  • git diff --check

Parse provider-reported image pixel ceilings so many-image Anthropic requests can recover by shrinking Retina screenshots below the stricter limit instead of retrying the same rejected payload.
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: bb/image-shrink-many-image vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 10889 on HEAD, 10889 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5724 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@OutThisLife
OutThisLife merged commit 4b5ba11 into main Jun 14, 2026
27 checks passed
@OutThisLife
OutThisLife deleted the bb/image-shrink-many-image branch June 14, 2026 06:07
@liuhao1024

Copy link
Copy Markdown
Contributor

Verification: Reviewed the full diff across 4 files. The _image_error_max_dimension() extraction from provider error messages is well-scoped — the regex anchors on "max allowed size" + "pixels" which limits false matches, and the 512–8000 sanity range prevents garbage values from passing through. The max_parameter threading through try_shrink_image_parts_in_messages_resize_image_for_vision is clean with a safe 8000 fallback. Tests cover the OpenRouter-wrapped Anthropic many-image case and verify the dimension propagates correctly to the resize call. No issues found.

AIalliAI pushed a commit to AIalliAI/Hermes that referenced this pull request Jun 14, 2026
…#45979)

Parse provider-reported image pixel ceilings so many-image Anthropic requests can recover by shrinking Retina screenshots below the stricter limit instead of retrying the same rejected payload.
T02200059 pushed a commit to T02200059/hermes-agent that referenced this pull request Jun 18, 2026
…#45979)

Parse provider-reported image pixel ceilings so many-image Anthropic requests can recover by shrinking Retina screenshots below the stricter limit instead of retrying the same rejected payload.
xyshanren pushed a commit to xyshanren/hermes-agent-cn that referenced this pull request Jun 25, 2026
…#45979)

Parse provider-reported image pixel ceilings so many-image Anthropic requests can recover by shrinking Retina screenshots below the stricter limit instead of retrying the same rejected payload.
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
…#45979)

Parse provider-reported image pixel ceilings so many-image Anthropic requests can recover by shrinking Retina screenshots below the stricter limit instead of retrying the same rejected payload.
Methodician added a commit to Methodician/hermes-agent that referenced this pull request Jul 4, 2026
…#45979)

Parse provider-reported image pixel ceilings so many-image Anthropic requests can recover by shrinking Retina screenshots below the stricter limit instead of retrying the same rejected payload.
habarmc1223-sudo pushed a commit to habarmc1223-sudo/hermes-agent-fluxmem that referenced this pull request Jul 8, 2026
…#45979)

Parse provider-reported image pixel ceilings so many-image Anthropic requests can recover by shrinking Retina screenshots below the stricter limit instead of retrying the same rejected payload.
santhreal pushed a commit to santhreal/hermes-agent that referenced this pull request Jul 13, 2026
…#45979)

Parse provider-reported image pixel ceilings so many-image Anthropic requests can recover by shrinking Retina screenshots below the stricter limit instead of retrying the same rejected payload.
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
…#45979)

Parse provider-reported image pixel ceilings so many-image Anthropic requests can recover by shrinking Retina screenshots below the stricter limit instead of retrying the same rejected payload.
leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 2026
…#45979)

Parse provider-reported image pixel ceilings so many-image Anthropic requests can recover by shrinking Retina screenshots below the stricter limit instead of retrying the same rejected payload.
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.

2 participants