mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2667] [Issue]: Gemini safety-blocked or empty responses are reported as a normal stop with no error #1318
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#1318
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kolacheee on GitHub (Jun 20, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2667
Originally assigned to: @SpicyMarinara on GitHub.
Summary
The non-streaming and streaming Gemini handlers only read
candidates[0].content.partsand never inspectpromptFeedback.blockReasonor a non-stopfinishReason(SAFETY/RECITATION/etc.). A safety-blocked or empty response (HTTP 200 with emptycandidates) is reported as a normal"stop"with empty content and no error.Expected behavior
When Gemini blocks a prompt or returns no content for a terminal non-stop reason, the user should get a clear error explaining the block, not a silent empty turn that looks like a successful (empty) completion.
Actual behavior
chatComplete()parsespartsand computesfinishReason: candidate?.finishReason ?? "stop"— when there is no candidate at all this becomes literally"stop". The streamingchat()path similarly yields nothing and returns normally.promptFeedback.blockReasonis never inspected.How it breaks the pipeline
Code trace (staging @
b826f8f4) —packages/server/src/services/llm/providers/google.provider.ts:chatComplete:parts~:434;finishReason: toolCalls.length > 0 ? "tool_calls" : (candidate?.finishReason ?? "stop")at:451.chat(streaming):parts~:602.promptFeedback/blockReasonhandling exists anywhere in the file.Result: a blocked prompt (
{ promptFeedback: { blockReason: "SAFETY" }, candidates: [] }) returns{ content: null, finishReason: "stop" }, and the streaming path returns empty with no error.Steps to reproduce
promptFeedback.blockReasonand emptycandidates).finishReasonis"stop"; no error surfaces explaining the block.Suggested fix
After computing
parts, ifpromptFeedback?.blockReasonis set, orcandidatesis empty, or the candidate'sfinishReasonis a non-stop terminal reason (SAFETY/RECITATION/PROHIBITED_CONTENT/MAX_TOKENS) and no text/tool parts were produced, throw an error that includes the block/finish reason so the caller can surface why no output was produced.Environment
b826f8f4)Additional context
Identified via systematic source review on staging (refs @
b826f8f4). Companion to the Gemini streaming-error-swallow issue filed concurrently — the non-streaming path has the same blind spot for blocked/empty responses.Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:
@SpicyMarinara commented on GitHub (Jun 20, 2026):
Implemented on branch codex/spicymarinara-assigned-issues: Gemini blocked/empty responses now surface clear errors instead of empty stop results. Final validation will run after the full assigned sweep per maintainer request.