Skip to content

fix(EVO-2181): judge the inline mime exactly as ADK does - #45

Merged
gomessguii merged 1 commit into
developfrom
fix/EVO-2178-review-mime-guard
Jul 21, 2026
Merged

fix(EVO-2181): judge the inline mime exactly as ADK does#45
gomessguii merged 1 commit into
developfrom
fix/EVO-2178-review-mime-guard

Conversation

@gomessguii

Copy link
Copy Markdown
Member

Review follow-up to EVO-2181 (PR #44, already merged). Finding from the EVO-2178 review of the merged media path.

The guard judged the mime differently from ADK

_inline_skip_reason normalized the content type before checking it (lowercase, parameters dropped) while the Blob kept it verbatim, so the guard and ADK were answering different questions. _get_content (google-adk 1.19) matches the raw value with a case-sensitive startswith and an exact-match set, which means IMAGE/PNG and application/pdf; charset=binary cleared the guard and then raised ValueError inside ADK — the 500 that costs the customer the whole turn, caption included, and precisely what the guard was added to prevent.

Checking the verbatim value closes the gap without changing any accepted case: audio/webm;codecs=opus still matches the audio/ prefix with its parameter attached.

The new tests assert both halves — that those types are skipped, and that ADK really does raise on them — so an ADK bump that widens what it accepts fails here instead of quietly dropping readable media.

Also in this PR

  • .github/workflows/ci.yml. Nothing ran pytest on a PR, including the PR this fixes. tests/unit/test_exception_handlers.py is excluded there with the reason written down: it fails at collection because generic_exception_handler no longer exists in src/core/exception_handlers.py (removed in e02a229) and is no longer registered in src/main.py. That is a separate regression (EVO-972 kept internal class names out of 500 bodies) and needs its own card — drop the exclusion when it is restored.

Verification

pytest tests/unit/test_media_file_parts.py → 22 passed. Full pytest tests/unit (with the documented --ignore) → 244 passed. Run inside the processor image (google-adk==1.19.0).

Part of EVO-2178 · follow-up to EVO-2181.

🤖 Generated with Claude Code

Review follow-up to EVO-2181. _inline_skip_reason normalized the content type
before checking it (lowercase, parameters dropped) while the Blob kept it
verbatim, so the guard and ADK were answering different questions.
_get_content matches the raw value with a case-sensitive startswith and an
exact-match set, which means "IMAGE/PNG" and "application/pdf; charset=binary"
cleared the guard and then raised ValueError inside ADK — the 500 that costs
the customer the whole turn, caption included, and precisely what the guard
was added to prevent.

Checking the verbatim value closes the gap without changing any accepted case:
"audio/webm;codecs=opus" still matches the audio/ prefix with its parameter
attached. The new tests assert both halves — that those types are skipped, and
that ADK really does raise on them — so an ADK bump that widens what it
accepts fails here instead of quietly dropping readable media.

Also adds .github/workflows/ci.yml: nothing ran pytest on a PR, including the
PR this fixes. tests/unit/test_exception_handlers.py is excluded there with
the reason written down — it fails at collection because
generic_exception_handler no longer exists, which is a separate regression.

@sourcery-ai sourcery-ai 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.

Sorry @gomessguii, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@gomessguii
gomessguii merged commit 29dc2f4 into develop Jul 21, 2026
5 checks passed
@gomessguii
gomessguii deleted the fix/EVO-2178-review-mime-guard branch July 21, 2026 22:14
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