Skip to content

SWF(bug): reject Anthropic url images without a url - #82

Merged
maplepaladin73 merged 1 commit into
mainfrom
devin/1795399239-anthropic-url-image-required
Nov 23, 2026
Merged

maplepaladin73 merged 1 commit into
mainfrom
devin/1795399239-anthropic-url-image-required

Conversation

@maplepaladin73

@maplepaladin73 maplepaladin73 commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

Anthropic image blocks with source.type == "url" but no url now fail request deserialization, so /v1/messages returns HTTP 400 invalid_request_error instead of silently dropping the image.

Root cause: ImageSourceBlock stored every source field as Option, and maybe_get_image_uri() returned None for a url source with no url; both the user-block and tool-result lowering paths treated None as "skip this image". The wire request therefore parsed successfully and the malformed image disappeared before validation.

Test plan

Try it (CPU, with bash scripts/ci_gpu_stubs.sh run once):

ATLAS_SKIP_BUILD=1 CUDARC_CUDA_VERSION=13000 cargo test -p spark-server --bin spark url_image
  • Before: url_image_source_without_url_is_rejected ... FAILED — the malformed request deserialized as MessagesRequest { ... ImageSourceBlock { source_type: "url", ..., url: None } ... }.
  • After (rebased on main): url_image ... ok — 5 passed, including the handler test asserting HTTP 400 invalid_request_error.
  • CPU server suite: 3262 passed; 0 failed; 14 ignored (cargo test -p spark-server --bin spark with the same environment).
  • Anthropic adapter suite: 53 passed (cargo test -p spark-server --bin spark anthropic::).
  • cargo fmt --all -- --check
  • ATLAS_SKIP_BUILD=1 CUDARC_CUDA_VERSION=13000 cargo clippy --workspace --tests
  • bash scripts/check-license-headers.sh, python3 scripts/check_spdx.py, and typos
  • Added regression tests at the serde boundary and the /v1/messages handler.
  • Untested: live HTTP/model inference and GPU validation.

Notes for reviewers

ImageSourceBlock is now a tagged enum (base64 / url / unknown) with the fields each variant requires, matching the scout's suggested fix. Valid base64/url images are unchanged and still covered by the existing IR carry tests; the same malformed-source class for base64 now also fails deserialization instead of being silently dropped.

CLA


Software Factory opened this PR for Robert
Implemented in session Reject Anthropic url images without a url
Review with Devin · Open in Devin Desktop


@devin-ai-integration

Copy link
Copy Markdown

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/1795399239-anthropic-url-image-required branch from 2394110 to c14ea4b Compare November 23, 2026 02:26
@maplepaladin73
maplepaladin73 merged commit b77716b into main Nov 23, 2026
1 check passed
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.

1 participant