mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
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#5712
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/2669
Author: @kolacheee
Created: 6/20/2026
Status: ✅ Merged
Merged: 6/21/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/connection-preset-send-tier1📝 Commits (2)
70a34c6fix(llm): harden connection auth, clamp Anthropic temperature, wire stop sequencesbef00a9fix(llm): address review — trim/filter stop sequences and whitespace-only keys📊 Changes
5 files changed (+70 additions, -9 deletions)
View changed files
📝
packages/server/src/routes/generate.routes.ts(+10 -0)📝
packages/server/src/services/llm/providers/anthropic.provider.ts(+16 -4)📝
packages/server/src/services/llm/providers/google.provider.ts(+8 -2)📝
packages/server/src/services/llm/providers/openai.provider.ts(+5 -1)📝
packages/server/src/utils/crypto.ts(+31 -2)📄 Description
Linked issue
Closes #2656
Closes #2657
Closes #2658
Why this change
All three bugs sit on the hot path that defines the product — turning a user's connection settings + preset into an actual API request — and each one silently breaks core usage:
ENCRYPTION_KEYchange) or an endpoint is intentionally keyless, providers sent a blankBearer/x-api-key:header → opaque 401 on every generation, with no hint that the real cause is "re-enter your key." A wrong-lengthENCRYPTION_KEYwas worse still: an uncaughtInvalid key length500 on save and a silently-blanked key on read.temperature > 1(valid on OpenAI, common for SillyTavern migrants, and even suggested by our own tuning docs) was sent unclamped to Anthropic, which only accepts0–1, so every Anthropic generation 400'd.What changed
getEncryptionKey()validates the resolved key is exactly 32 bytes and fails with a clear, actionable message instead of a crypticInvalid key length/ silent blank. (The wrong-length-key crash was an adjacent bug found while reviewing this code and folded in.)clampAnthropicTemperature()clamps to[0, 1]at serialization time only — the stored preset is never mutated, so the same preset still sends e.g.1.6to OpenAI-compatible backends that accept0–2.stopSequences(preset → connection → chat precedence) intoChatOptions.stop, and added the provider mappings — Anthropicstop_sequences, GooglegenerationConfig.stopSequences(OpenAI already consumedoptions.stop).5 files, +64 / −9. No schema, client, or docs changes.
Validation
Automated (done by the agent):
pnpm checkpassed locally — full TypeScript + ESLint + build; the servertscbuild exited0.Not done (needs a human): the app/container was not run and the providers were not exercised against live APIs. Please complete the manual checks below before marking this ready for review.
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Suggested checks, each mapped to a fix:
temperature: 1.5and send a message → should succeed (outgoing body carriestemperature: 1.0), and the preset should still read1.5. On an OpenAI connection the same preset should still send1.5.\nUser:) and confirm generation halts at it on OpenAI, Anthropic, and Gemini connections (inspect the outgoing request body /logPromptSentToModel).Authorizationheader. Simulate a decrypt failure (changeENCRYPTION_KEYafter saving a key) → generation should fail cleanly rather than sendingBearer.ENCRYPTION_KEY=abc123(wrong length), restart, save a connection key → expect a clear "must be 64 hexadecimal characters" error, not anInvalid key length500.Docs and release impact
No docs/version changes are included. A follow-up note in
docs/GENERATION_PARAMETERS.md(Anthropic now clampstemperature > 1rather than erroring) would be a nice addition but isn't required for this fix.UI evidence (if applicable)
N/A — server-only change.
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.