Skip to content

fix(transform): cap rendered image bytes per request - #168

Open
mkhalid-s wants to merge 4 commits into
teamchong:mainfrom
mkhalid-s:fix/image-byte-budget
Open

fix(transform): cap rendered image bytes per request#168
mkhalid-s wants to merge 4 commits into
teamchong:mainfrom
mkhalid-s:fix/image-byte-budget

Conversation

@mkhalid-s

@mkhalid-s mkhalid-s commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Closes #157.

What changed

  • enforce an 18 MiB default decoded-image budget for Anthropic Messages requests
  • count caller-supplied base64 images before admitting pxpipe PNG groups
  • admit static slabs, tool results, and history atomically; keep a complete group as native text when it would cross the remaining budget
  • preserve caller images unchanged and flag requests that are already over budget
  • expose PXPIPE_MAX_IMAGE_BYTES consistently in Node and Workers
  • persist generated bytes, caller-image bytes, skipped-group telemetry, and exact serialized request bytes
  • warn in host logs and in the dashboard, including a near-budget warning at 90%

Validation

  • 930 tests passed
  • typecheck passed
  • production build passed
  • focused coverage includes exact byte boundaries, caller and nested images, static/tool/history fallback, invalid Worker configuration, tracker fields, and dashboard warnings

Scope

The limit follows the decoded image-byte metric behind the observed reliability cliff; exact serialized request size is reported separately. pxpipe does not delete caller images or automatically retry upstream failures without compression.

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.

Imaged payloads above ~20 MiB fail unpredictably, and /compact cannot escape (no image-byte budget)

1 participant