Skip to content

fix: map Gemini blocked finish reasons to content_filter - #3101

Merged
guillaumegay13 merged 1 commit into
mnfst:mainfrom
pcbeingused333:fix/gemini-blocked-finish-reasons
Nov 2, 2026
Merged

guillaumegay13 merged 1 commit into
mnfst:mainfrom
pcbeingused333:fix/gemini-blocked-finish-reasons

Conversation

@pcbeingused333

@pcbeingused333 pcbeingused333 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Gemini replies that Google blocks with BLOCKLIST, PROHIBITED_CONTENT, SPII or IMAGE_SAFETY were reported to clients as a normal stop.

Root cause

mapFinishReason in google-adapter.ts only mapped SAFETY and RECITATION to content_filter; every other blocking reason fell through to the ?? 'stop' default, so clients saw an empty reply that looked like a successful completion (non-streaming and streaming both use this function).

Fix

Add the four missing blocking reasons to the map as content_filter, plus a patch changeset.

Test

google-adapter.spec.ts: a parametrised test for the four reasons. It fails (4 failures) before the change and passes after; the whole spec file is green (138 tests).


This change was prepared with the assistance of an AI coding agent (Claude).


Summary by cubic

Fixes Gemini replies blocked by Google for BLOCKLIST, PROHIBITED_CONTENT, SPII, or IMAGE_SAFETY being reported to clients as a normal stop instead of content_filter.

  • Adds the four missing blocking reasons to mapFinishReason in google-adapter.ts so both streaming and non-streaming responses report them as content_filter.
  • Adds a parametrised test covering all four reasons.
  • Includes a patch changeset in manifest.

Written for commit 75544d3. Summary will update on new commits.

View guided diff

Signed-off-by: Alex Castillo <alex.castillog33@gmail.com>

@cubic-dev-ai cubic-dev-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.

No issues found across 3 files

View guided diff | Re-trigger cubic

@codecov

codecov Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.19%. Comparing base (7a6a8fc) to head (75544d3).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3101   +/-   ##
=======================================
  Coverage   96.19%   96.19%           
=======================================
  Files         673      673           
  Lines       39727    39727           
  Branches    11084    11084           
=======================================
  Hits        38217    38217           
  Misses        521      521           
  Partials      989      989           
Flag Coverage Δ
backend 95.19% <ø> (ø)
frontend 97.43% <ø> (ø)
shared 98.78% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@guillaumegay13
guillaumegay13 merged commit 394d9a9 into mnfst:main Nov 2, 2026
20 checks 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.

2 participants