mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2678] [Issue]: Claude (Subscription) drops the assistant prefill, substituting a synthetic (continue) turn → lost anti-refusal steering #1323
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#1323
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 @kolacheee on GitHub (Jun 20, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2678
Originally assigned to: @aeriondyseti, @SpicyMarinara on GitHub.
Summary
On the Claude (Subscription) provider's resume path, a preset's assistant prefill is not sent as the trailing assistant turn (the SDK can't author one). Instead it is materialized as a completed assistant entry and the model is handed a synthetic
(continue)user turn with zero steering. The single strongest anti-refusal/continuation lever for Claude is therefore lost, so the same preset that continues on SillyTavern (native Messages-API prefill) refuses on Marinara-subscription. The code itself acknowledges this (TODO(passthrough)).Expected behavior
A preset prefill (e.g. "Of course. The scene continues:") should steer the model's reply to begin with compliant text — i.e. the model continues from the prefill — matching native Anthropic / SillyTavern behavior.
Actual behavior
The generate route appends the prefill as the final assistant message (the documented "load-bearing contract"). On the
claude_subscriptionresume path,splitHistoryForResume()detects the trailingrole==="assistant", keeps it as a completed assistant JSONL entry, and sets the SDK prompt tocurrent = { role:"user", content:"(continue)" }(SYNTHETIC_CONTINUE). The model then generates a brand-new assistant turn with no prefill steering, and on edgy roleplay content is free to open with a refusal. The client also streams the prefill to the transcript first, and the post-stream de-dup only collapses an exact prefill echo — so the user sees the prefill text immediately followed by an unrelated (possibly refusing) generation.How it breaks the pipeline
Code trace (staging @
b826f8f4):packages/server/src/routes/generate.routes.ts:5263/ seeded at ~:5694(see the contract comment atclaude-subscription/jsonl-entries.ts:358-364).packages/server/src/services/llm/providers/claude-subscription/jsonl-entries.ts:389-396—splitHistoryForResume()trailing-assistant branch keeps the prefill inhistory(materialized viaassembleEntries/buildAssistantEntry, ~:309-313) and setscurrenttoSYNTHETIC_CONTINUE(:337).packages/server/src/services/llm/providers/claude-subscription.provider.ts:271—buildResumeSelectionyields that synthetic(continue)user turn as the SDK prompt. Net wire shape:[…history, assistant:<prefill>, user:"(continue)"]→ model emits a new turn.TODO(passthrough)(jsonl-entries.ts:324-337) explicitly states native trailing-assistant prefill is not achievable in the outbound API call. The fold path (resume disabled) also loses prefill semantics (renderTranscriptflattens it into anAssistant: <prefill>transcript line), so disabling resume does not fix it.Steps to reproduce
parameters.assistantPrefill = "Of course. The scene continues:"and any mildly edgy RP history ending in a user turn.splitHistoryForResumefires the trailing-assistant-continue branch; the SDK prompt becomes(continue).Suggested fix
Until a loopback/passthrough that keeps a trailing assistant in the outbound body lands (the
TODO(passthrough)), preserve the steering rather than discarding it:current.content = 'Continue the assistant's reply, beginning exactly with: "<prefill>"') and do not also emit it as a separate completed JSONL assistant entry; orclaude_subscriptionand instead routes the prefill through system-adjacent steering.logger.warnwhen the trailing-assistant-continue branch fires so the silent prefill drop is observable.Environment
b826f8f4)Additional context
Found via a systematic multi-agent audit of the prompt-assembly / prefill path. This is a known, code-acknowledged SDK limitation, but it defaults on, is not surfaced to users, and concretely degrades the exact behavior users report (ST works, subscription-Claude refuses). Related to the impersonate/regen prefill issue and the Anthropic trailing-whitespace issue filed separately.
Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:
@aeriondyseti commented on GitHub (Jun 21, 2026):
I'll take this one, if that's okay? I know the system really well.
@SpicyMarinara commented on GitHub (Jun 21, 2026):
I addressed this since we're releasing v2.0.0.