v3.2.1 — image-strip oversized-image guard
Image-strip: oversized-image guard
Adds CACHE_FIX_IMAGE_MAX_DIM=<pixels> to the existing image-strip extension. When an image's pixel dimensions exceed the cap, the image is replaced with a forensic placeholder noting the original dimensions and tool_use_id. Covers both user-message direct images and tool_result-nested images. Pure-JS PNG and JPEG header parsing in new proxy/image-dimensions.mjs — no native dependencies.
The trigger this addresses: Anthropic's per-image dimension ceiling for many-image requests is 2000px. Workflows hitting this include hi-res manuscript scans, retina screenshots, and full-resolution photography.
export CACHE_FIX_IMAGE_MAX_DIM=2000Composes with CACHE_FIX_IMAGE_KEEP_LAST
Two pressure axes, two env vars:
CACHE_FIX_IMAGE_KEEP_LAST=N— count axis (drops images from older messages, keeps the last N)CACHE_FIX_IMAGE_MAX_DIM=N— size axis (replaces oversized images with placeholders)
When both are set, KEEP_LAST runs first (drops the count), then MAX_DIM runs on what remains (caps the size of the kept ones).
Tests
526 → 553 passing (27 new).
Credits
Requested by @X-15 (Alexander) for hi-res manuscript scan workflows. Diff reviewed by the Codex review agent.
No migration
No behavior change for users not setting CACHE_FIX_IMAGE_MAX_DIM. No migration required.
Full changelog: v3.2.0...v3.2.1