mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #7486] [MERGED] fix(llm): retry strict-template role alternation errors with merged turns #7755
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#7755
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/7486
Author: @SpicyMarinara
Created: 10/12/2026
Status: ✅ Merged
Merged: 10/12/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/7457-custom-alternate-roles-retry📝 Commits (3)
eae3acafix(llm): retry strict-template role alternation errors with merged turns2499fdefix(llm): narrow the previous turn before merging for tsca0790effix(llm): retry llama.cpp's two-assistant prefill rejection and log the retried prompt📊 Changes
3 files changed (+290 additions, -43 deletions)
View changed files
📝
docs/TROUBLESHOOTING.md(+1 -0)📝
packages/server/src/services/llm/providers/openai.provider.ts(+115 -43)📝
scripts/regressions/provider-compat.regression.ts(+174 -0)📄 Description
Linked issue
Closes #7457
Why this change
What changed
[Start]user turn goes before an opening assistant greeting (the same placeholder the Anthropic provider uses);chat()/chatComplete().postChatCompletionshelper instead of repeating the fetch-and-throw code.DEBUG_AGENTSon, the retried messages are logged at the visible level, so the debug log shows the prompt the model actually received.Validation
pnpm checkpasses locallyCONTRIBUTING.mdNotes (agent-run commands):
Head
a0790ef70(validated after the review fixes):pnpm install --frozen-lockfile --prefer-offlineandpnpm build:shared: OK.pnpm check: exit 0.node ./scripts/run-regressions.mjs --filter scripts/regressions/provider-compat.regression.ts: PASSED. The #7457 block runs a fake OpenAI-compatible server that follows llama.cpp's order. It runs the prefill check first, which returns "Cannot have 2 or more assistant messages at the end of the list." for two trailing assistant messages. Then it runs the Mistral v3 Tekken alternation check and returns llama.cpp's real 400 body. The block covers:debugMode: trueatwarn, which asserts the retried messages are logged;2499fded5):Custom OpenAI-compatible endpoint error 400: Cannot have 2 or more assistant messages at the end of the list.debug mode logs the retried messagesfails;'Previous reply.\n\nPrefillmerged'instead of'merged'.node ./scripts/run-regressions.mjs --filter mistral-reasoning-outputand--filter generation-parameter-relevance: PASSED (they covernormalizeMistralRequest, which changed).coderabbit review --agent --committed --base-commit 9fd6e0900(merge-base with staging) ona0790ef70: completed, 0 findings in the 3 reviewed files. The first two attempts were rate limited, and the third ran. GitHub CodeRabbit was also rate limited on this push.Manual verification notes
Rocinante-X-12B-v1b-Q5_K_M.ggufwith nochat-template-file, so its built-in Tekken template applies) and add it as a Custom (OAI-Compatible) connection.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)Docs:
docs/TROUBLESHOOTING.mdgains one bullet. Translation follow-up: #7485. No CHANGELOG edit, per the 2026-10-12 release-notes policy.UI evidence (if applicable)
No UI changes. The only user-visible text is the server error message.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.