← Back to PRs

#2958: fix(media): wire tools.media.image.maxBytes config to image processin…

by shamsulalam1114 open 2026-01-27 21:10 View on GitHub →
agents
…g pipeline Fixes #2954 The configuration setting tools.media.image.maxBytes was defined but not wired through the image sanitization pipeline. This resulted in hardcoded constants being used instead of the user-configured value. Changes: - Modified sanitizeSessionMessagesImages() to accept maxBytes in options - Modified sanitizeSessionHistory() to accept and pass maxBytes parameter - Updated attempt.ts to pass config value through the sanitization chain - All sanitizeContentBlocksImages() calls now receive the configured maxBytes This ensures that when users configure a custom image size limit, it is actually used throughout the image processing pipeline instead of being ignored. <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR wires the `tools.media.image.maxBytes` configuration through the Pi embedded image handling pipeline so the configured limit is applied consistently (session history sanitization via `sanitizeSessionHistory()` → `sanitizeSessionMessagesImages()` → `sanitizeContentBlocksImages()`, and prompt image loading via `detectAndLoadPromptImages()`). Net effect: oversized base64 images and auto-loaded prompt images should now be resized/dropped based on user configuration instead of relying only on hardcoded defaults. <h3>Confidence Score: 3/5</h3> - Mostly safe to merge, but there are a couple of correctness/scope concerns worth addressing first. - The maxBytes wiring itself is straightforward and matches existing sanitizer APIs, but passing raw config values through can create surprising behavior for invalid/non-positive values (effectively dropping all images). Also, the changelog entry appears unrelated to the PR’s described change, suggesting scope creep or an accidental addition. - src/agents/pi-embedded-runner/run/attempt.ts, CHANGELOG.md <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs