docs(rfc): add RFC-0059 image attachment normalization - #375
Merged
Conversation
Proposes inserting the existing resize_image_if_needed() normalization (the read tool / fsspec toolset path, Pillow-based, default 2000px / 4.5MB) into the protocol user-upload conversion points: Python API run_agent, ACP attachments, and OpenCode server FilePartInput. Distinct failure semantics for user input vs tool-result over-limit; model failure behavior based on opencode's image.ts reference. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
… points Implement RFC-0059 Option 1: insert the existing resize_image_if_needed() normalization into the protocol user-upload path so Python API, ACP, and OpenCode server all constrain image attachments within the same limits as the tool-read path. - Add AttachmentImageConfig (auto_resize/max_width/max_height/ max_base64_bytes, defaults mirroring opencode: 2000x2000px, 5MB base64) - Add ImageNormalizer reusing resize_image_if_needed from the fsspec toolset; only data: URIs are processed (no SSRF); failures degrade to pass-through so sessions are never interrupted - Wire into OpenCode extract_user_prompt_from_parts, ACP from_acp_content, and functional run_agent(image_url=...) - auto_resize: false raises ImageSizeError for over-limit user input Co-authored-by: Sisyphus <sisyphus@ohmyopen.com>
…zation Cover the three RFC-0059 user-upload entry points with integration-style unit tests: OpenCode extract_user_prompt_from_parts, ACP from_acp_content, and functional run_agent image-url helpers. Each verifies oversized images are resized, small images pass through, non-image parts are untouched, and the no-normalizer path stays backward compatible.
coderlihong
pushed a commit
to coderlihong/wolfharness
that referenced
this pull request
Aug 18, 2026
…l-worker-tools Integrate upstream wolf1069b#364/wolf1069b#356/wolf1069b#368/wolf1069b#372/wolf1069b#374/wolf1069b#375/wolf1069b#367 changes. Resolved: - pyproject/uv.lock: openviking-sdk 0.1.8 (keep local; image download_bytes comment) - mcp_server_cap.py: keep fork's self._tool_prefix logic - viking/tools.py: combine imports (PurePosixPath + json/Path/shutil/tempfile) - test_viking*.py: accept upload_tree (local wiki feature), 4→5 / 12→13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds RFC-0059: Image Attachment Normalization (DRAFT), which proposes inserting the existing
resize_image_if_needed()normalization into the protocol user-upload path.Context
AgentPool already normalizes images on the tool-read path:
resize_image_if_needed()insrc/wolfharness_toolsets/fsspec_toolset/image_utils.py(Pillow-based, default 2000px / 4.5MB) is wired intoreadtool and the fsspec toolset.However, the protocol user-upload paths bypass it entirely:
run_agent(image_url=...)→ImageUrlImageContentBlock/BlobResourceContents→BinaryImageFilePartInput→BinaryContent.from_data_uri()Oversized field photos (4000×3000px, 10–20MB) get forwarded to the model unchanged, risking context overflow and opaque provider errors.
What the RFC proposes
resize_image_if_needed()rather than building a new resizerFilePart → pydantic-ai contentconversion points across all three protocol entriesattachment.image.{auto_resize, max_width, max_height, max_base64_bytes})Files
docs/rfcs/draft/RFC-0059-image-attachment-normalization.md(new, 477 lines)Note
Following repo convention, STATUS.md is maintained separately from individual RFC commits (per RFC-0058 precedent) — not touched in this PR.
Reviewers
@yuchen.liu (pending)