Skip to content

fix(agent): evict images before compression on 413 recovery (#47339) - #47441

Closed
kyssta-exe wants to merge 1 commit into
NousResearch:mainfrom
kyssta-exe:auto-fix/issue-47339
Closed

fix(agent): evict images before compression on 413 recovery (#47339)#47441
kyssta-exe wants to merge 1 commit into
NousResearch:mainfrom
kyssta-exe:auto-fix/issue-47339

Conversation

@kyssta-exe

Copy link
Copy Markdown
Contributor

Fixes #47339. When a 413 (Payload Too Large) error occurs, context compression reduces token count but does not evict base64 image data from protected tail messages. A single 2MB screenshot in the tail can trigger 413 even with low token counts. Added evict_images_for_413() which strips image/base64 payloads from ALL messages (including protected tail) as a first-pass before full compression. If images were evicted, retries without compression. If no images, falls through to full compression.

@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P1 High — major feature broken, no workaround labels Jun 16, 2026
@teknium1 teknium1 added sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:risk-caching Sweeper risk: may break/degrade prompt caching or cache-key stability (invariant) sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jun 21, 2026
@teknium1

teknium1 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Closing as a duplicate — this is one of several PRs fixing #47339 (413 image eviction). We're consolidating the cluster (#47397, #47412, #47441) and working the fix elsewhere. Thanks for the contribution and the clear root-cause writeup, @kyssta-exe — your analysis matched the issue exactly.

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

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P1 High — major feature broken, no workaround sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-caching Sweeper risk: may break/degrade prompt caching or cache-key stability (invariant) sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

413 Request Entity Too Large: context compression doesn't evict image/vision payloads — fails even at ~44k tokens on Copilot

3 participants