mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #2395] [MERGED] Apply strict role formatting in all chat modes #5576
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#5576
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/2395
Author: @Romuromylus
Created: 6/6/2026
Status: ✅ Merged
Merged: 6/6/2026
Merged by: @Romuromylus
Base:
refactor← Head:fix/strict-roles-all-modes📝 Commits (1)
8ea03d8Apply strict role formatting in all chat modes📊 Changes
1 file changed (+1 additions, -1 deletions)
View changed files
📝
src/engine/generation/prompt-assembly.ts(+1 -1)📄 Description
Linked issue
Closes #2289
Why this change
strictRoleFormattingships enabled by default, but the strict-role gate inassembleGenerationPromptadditionally requiredchatMode === "roleplay". In conversation/game/visual_novel modes the assembler fell back tomergeAdjacentMessages, which never coerces a leading assistant turn or alternates roles. Combined with the Rust Anthropic/Google builders (which hoist/strip system messages without merging), this produced malformed "roles must alternate" / leading-assistant requests in non-roleplay modes. Main runsenforceStrictRoleswheneverstrictRoleFormattingis true with no mode condition; this restores that parity.What changed
chatMode === "roleplay"conjunct fromshouldEnforceStrictRolesinsrc/engine/generation/prompt-assembly.ts. The!individualGroupTargetguard (per-character group targeting) is preserved, so only the over-narrow mode discrimination is dropped.enforceStrictRolesso the behavioral difference vsmergeAdjacentMessagescan be unit-tested directly.Refactor impact
Primary owner: engine generation
Impact areas reviewed:
src/engine/generation/prompt-assembly.ts(shouldEnforceStrictRolesgate)Boundary notes:
Pressure points touched:
Validation
pnpm checkpasses before PR push/handoffManual verification notes
pnpm vitest run src/engine/generation/prompt-assembly.test.ts— 10 passed (2 new:enforceStrictRolescoerces the leading turn touserand keeps alternation; the merge-only branch leaves a leading assistant turn that Anthropic/Google reject).pnpm vitest run src/engine/generation— 69 passed (no regression; existing assertions readpreviewMessages, computed before this branch).pnpm exec tsc -b— clean.Feature Discoverability
src/features/shell/discovery/Reason:
Docs and release impact
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.