Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Suksham-sharma
Copy link
Contributor

Summary

Fixes #2271 - Images >5MB cause infinite retry loop and block session completely.

Problem

When a user sends an image larger than 5MB:

  1. The image gets stored in session context
  2. Anthropic API rejects it with "image exceeds 5 MB maximum"
  3. The error wasn't classified as non-retriable, causing infinite retry
  4. Session becomes completely blocked

Solution

  1. Align MAX_IMAGE_BYTES constant with Anthropic's actual 5MB limit (was incorrectly set to 6MB)
  2. Detect image size errors and return a user-friendly message instead of retrying
  3. Prevent failover for image size errors since they're not retriable

@moltbot-barnacle moltbot-barnacle bot added the agents Agent runtime and tooling label Jan 27, 2026
@Suksham-sharma Suksham-sharma force-pushed the fix/image-size-infinite-loop branch from 44aba22 to 1611624 Compare January 27, 2026 16:56
@thewilloftheshadow thewilloftheshadow self-assigned this Jan 27, 2026
Suksham-sharma and others added 3 commits January 27, 2026 16:00
- Change MAX_IMAGE_BYTES from 6MB to 5MB to match Anthropic API limit
- Add isImageSizeError() to detect image size errors from API
- Handle image size errors with user-friendly message instead of retry
- Prevent failover for image size errors (not retriable)

Fixes openclaw#2271
@thewilloftheshadow thewilloftheshadow force-pushed the fix/image-size-infinite-loop branch from af117fe to a4093c1 Compare January 27, 2026 22:02
@thewilloftheshadow thewilloftheshadow merged commit 0b1c8db into openclaw:main Jan 27, 2026
19 of 23 checks passed
@thewilloftheshadow
Copy link
Member

Landed via temp rebase onto main.

  • Related tests: pnpm vitest run --config vitest.unit.config.ts src/agents/pi-embedded-helpers.image-size-error.test.ts src/agents/pi-embedded-helpers.classifyfailoverreason.test.ts
  • Land commit: a4093c1
  • Merge commit: 0b1c8db

Thanks @Suksham-sharma!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Images >5MB cause infinite retry loop and block session completely

2 participants