mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2289] [Issue]: strictRoleFormatting is gated to roleplay mode, producing malformed Anthropic and Google requests in conversation/game/visual_novel modes #1127
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#1127
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 @Romuromylus on GitHub (Jun 5, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2289
Originally assigned to: @Romuromylus on GitHub.
Summary
The refactor only enforces strict role formatting when chatMode is roleplay, but the default preset ships strictRoleFormatting true and the default chat mode is conversation. When a depth-injected system message lands between two same-role turns, the Anthropic and Google request builders emit adjacent same-role turns and the API rejects them.
Expected behavior
strictRoleFormatting should apply whenever the parameter is true regardless of chat mode (as on main), coercing mid-history system messages and forcing user/assistant alternation, so Anthropic/Google requests stay valid.
Actual behavior
In conversation/game/visual_novel modes the refactor takes the mergeAdjacentMessages branch, which only merges literally adjacent same-role messages and never coerces system to user. The Rust providers do not compensate (Anthropic hoists system and appends the rest with no consecutive-role merge; Google filters system with no merge), so author-note and lorebook depth injections can yield two adjacent same-role turns and a provider rejection ("roles must alternate").
Steps to reproduce
Impact area
Regression notes
Worked on main. Main runs
enforceStrictRoleswheneverstrictRoleFormattingis true with no mode condition (packages/server/src/services/prompt/assembler.ts:470-472,724-726), the default preset ships it true (db/default-preset.json:14), and the Anthropic provider also merges consecutive messages as a safety net (anthropic.provider.ts:42-43,267-284). The refactor gates it tochatMode === "roleplay" && !individualGroupTarget(src/engine/generation/prompt-assembly.ts:3099-3100), default mode is conversation (:2839), andmergeAdjacentMessagesnever coerces system to user (src/engine/generation-core/prompt/merger.ts:29-31). Rust builders do not merge consecutive roles (crates/llm/src/lib.rs:2116-2147Anthropic,:2456-2483Google). Conditional on a hoisted system sitting between same-role neighbors, which author notes (default depth 4) and lorebook depth entries make realistic.Environment
5ddb9840(compared against main @b4ab97f)Template check
Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:
@Romuromylus commented on GitHub (Jun 6, 2026):
Fixed by #2395, merged into
refactor.