Skip to content

fix(cli): reject unsupported webfetch images - #10901

Merged
chrarnoldus merged 4 commits into
mainfrom
fix/webfetch-unsupported-images
Jun 5, 2026
Merged

fix(cli): reject unsupported webfetch images#10901
chrarnoldus merged 4 commits into
mainfrom
fix/webfetch-unsupported-images

Conversation

@chrarnoldus

@chrarnoldus chrarnoldus commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Exclude ICO MIME variants from images returned as webfetch attachments so they cannot reach vision providers that reject icon containers. Other image formats remain attachments, while SVG and FastBidSheet responses retain their existing text behavior.

This prevents provider-level invalid request errors for fetched icons without introducing a restrictive image-format allowlist.

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
@chrarnoldus chrarnoldus self-assigned this Jun 4, 2026
@kilo-code-bot

kilo-code-bot Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Other Observations (not in diff)

Issues found in unchanged code that cannot receive inline comments:

File Line Issue
packages/opencode/src/tool/read.ts 28 SUPPORTED_IMAGE_MIMES hardcodes four MIME types (jpeg, png, gif, webp) that are now a strict subset of what isImageAttachment accepts. Now that isImageAttachment uses a broad allowlist (all image/* except svg, fastbidsheet, and icons), read.ts could import and use isImageAttachment instead of maintaining a divergent set — adding a new supported type to media.ts would silently leave read.ts unaffected.
Incremental Review Notes

The new commit (714f920b) moves the icon rejection earlier and changes it from returning a soft { output: "Unsupported image format..." } result to throwing new Error(...). This is consistent with how other error conditions (oversized responses, invalid URLs) are handled in the same Effect generator — thrown errors surface as tool-level failures rather than LLM-visible output strings. The test is correctly updated to rejects.toThrow().

Files Reviewed (4 files)
  • .changeset/calm-icons-fetch.md
  • packages/opencode/src/tool/webfetch.ts
  • packages/opencode/src/util/media.ts
  • packages/opencode/test/tool/webfetch.test.ts

Reviewed by claude-4.6-sonnet-20260217 · 414,562 tokens

Review guidance: REVIEW.md from base branch main

chrarnoldus and others added 2 commits June 4, 2026 10:45
Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
johnnyeric
johnnyeric previously approved these changes Jun 4, 2026
Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
@chrarnoldus
chrarnoldus merged commit b198441 into main Jun 5, 2026
21 checks passed
@chrarnoldus
chrarnoldus deleted the fix/webfetch-unsupported-images branch June 5, 2026 08:56
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
…ted-images

fix(cli): reject unsupported webfetch images
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.

2 participants