mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #7552] [MERGED] fix(gemini): keep unnamed safety categories off when Custom Parameters set some #7789
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#7789
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?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7552
Author: @SpicyMarinara
Created: 10/13/2026
Status: ✅ Merged
Merged: 10/13/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/gemini-safety-partial-list📝 Commits (2)
b29628efix(gemini): keep unnamed safety categories off when Custom Parameters set somecef4cc8fix(gemini): leave a body with both safety spellings as the user wrote it📊 Changes
3 files changed (+26 additions, -4 deletions)
View changed files
📝
docs/connections/providers-reference.md(+1 -1)📝
packages/server/src/services/llm/providers/google.provider.ts(+10 -2)📝
scripts/regressions/provider-compat.regression.ts(+15 -1)📄 Description
Linked issue
Closes #7542
This follows up #7544, which was merged and closed #7542. A review of #7544 found one gap against the requirement that Gemini safety filters are always off.
Why this change
{"safety_settings":[{"category":"HARM_CATEGORY_HARASSMENT","threshold":"BLOCK_ONLY_HIGH"}]}sent only that entry. Hate speech, sexually explicit and dangerous content then went back to Google's defaults. On Vertex that default isBLOCK_MEDIUM_AND_ABOVEfor models before gemini-3.5-flash (Vertex safety filters), and Gemini 4 Argon has no documented default (Gemini safety settings).What changed
applyGeminiSafetySettingsOffingoogle.provider.ts(the one helper both Gemini request builders use) now merges by category. It keeps the user's own entries and addsOFFfor each of the four adjustable categories the user did not name. The result goes under the spelling the user used (safetySettingsorsafety_settings), so the field is never sent twice.docs/connections/providers-reference.mdnow says filters are off "except for any category you set yourself in Custom Parameters". #7543 is updated to the new sentence.OFFentries, and the pinned Gemini 3 bytes are unchanged.Known gaps (corrected record from #7544)
These routes are still unchanged. #7544 and the #7542 comment are corrected to match.
provider.optionsobject keyed by provider slug, includinggoogle-ai-studioandgoogle-vertex, each open-ended. Only options for the matched provider are forwarded, and unrecognised keys are silently dropped. #7544 said this object existed only for video, which was wrong. No Gemini safety key is documented under it, so adding one would be a guess. OpenRouter bodies stay unchanged.gemini_image, Gemini Omni (Interactions API), Veo, embeddings and model listing are unchanged, for the reasons recorded in #7544.Validation
pnpm checkpasses locallyCONTRIBUTING.mdCommands the agent ran (results only; the boxes above are for a human to tick):
pnpm check: exit 0.node ./scripts/run-regressions.mjs --filter provider-compat: passed. The existing Gemini 4 Argon block now expects a one-categorysafety_settingslist to arrive with the user's entry plusOFFfor the other three categories (VertexstreamGenerateContent). A new assertion pins a body with both spellings as sent exactly as written. Each assertion was run against the code without its fix and failed: the #7544 helper and the helper without the both-spellings guard.--filter provider-caching,generation-parameter-relevance,agent-connection-parameters,open-issues,agent-activation.regression,agent-activation-questions,spatial-context: all passed.coderabbit review --agent --committed --base-commit 27b4cc004), one run on the first commit: 1 minor finding. With both spellings present, both were serialized. I did not apply the suggested fix, which deletessafety_settings, because it would silently drop categories the user named only there. The finding did show that the merge could add an Off entry contradicting the user's other spelling, so the second commit leaves that body as written. It was not re-run after that guard.fetch.Manual verification notes
{"safety_settings":[{"category":"HARM_CATEGORY_HARASSMENT","threshold":"BLOCK_ONLY_HIGH"}]}. With debug mode on, confirm the logged request has that entry plusOFFfor hate speech, sexually explicit and dangerous content, and nosafetySettingsfield.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)Docs follow-up: #7543 (
[docs-i18n] docs/connections/providers-reference.md), updated to the new sentence.UI evidence (if applicable)
Not applicable (server request bodies and one docs sentence).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.