mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2703] [Issue]: ST preset import drops stop sequences, assistant prefill, custom params, and nulls verbosity/serviceTier/reasoning_effort #1348
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#1348
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 21, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2703
Originally assigned to: @SpicyMarinara on GitHub.
Summary
Importing a SillyTavern chat-completion preset drops several fields: custom stop sequences, assistant prefill / continue-postfix, provider-specific custom params, and it unconditionally nulls verbosity/serviceTier and mis-maps
reasoning_effortmin/max. So an imported ST preset doesn't reproduce the source's sampling/stop/prefill configuration.Expected behavior
Importing an ST preset should carry over all of its generation settings — stop sequences, assistant prefill, custom parameters, verbosity/service tier, and reasoning effort — so it behaves like the source preset.
Actual behavior
st-prompt.importer.ts:custom_stopping_strings/stopare discarded;stopSequencesis hardcoded to[].assistant_prefill/continue_postfixare discarded;assistantPrefillis hardcoded to"".customParametersis hardcoded to{}.nullon import regardless of the source.minandmaxmap tonullinstead of the nearest supported level.How it breaks the pipeline
Code trace (staging @
b826f8f4) —packages/server/src/services/import/st-prompt.importer.ts:stopSequences: [](custom_stopping_strings/stop not read).assistantPrefill: ""(assistant_prefill/continue_postfix not read).customParameters: {}(provider custom params not read).verbosity/serviceTierunconditionallynull.reasoning_effortmin/max→null(nearest-level mapping missing).(The ST preset prompt-order / system / jailbreak mapping is filed under #2676/#2690 — this issue is about the generation-parameter field completeness.)
Steps to reproduce
Import an ST chat-completion preset that sets
custom_stopping_strings, anassistant_prefill, a provider custom param,verbosity, andreasoning_effort: "max". The imported preset has empty stop sequences, empty prefill, no custom params, null verbosity/serviceTier, and null reasoning effort.Suggested fix
Read and map each field on import:
custom_stopping_strings/stop→stopSequences;assistant_prefill/continue_postfix→assistantPrefill; provider custom params →customParameters; preserveverbosity/serviceTierwhen present; mapreasoning_effortmin→lowandmax→high/maximum(nearest supported level) instead of null.Environment
b826f8f4)Additional context
Found via a systematic multi-agent audit of import/export round-trips. Part of a set of import/export fidelity issues filed together; complements the preset prompt-order work in #2676/#2690.
Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:
@kolacheee commented on GitHub (Jun 21, 2026):
Clarifications for the fixer (core bug confirmed present at packages/server/src/services/import/st-prompt.importer.ts L103-110 + toReasoningEffort L29-34; importer untouched on the current branch, so not already-fixed). The suggested fix as written would ship a buggy importer — apply the following nuance:
custom_stopping_strings is a JSON-serialized array stored as a STRING in ST (e.g. '["\n","\nUser:"]'), NOT a native array. Do not assign it directly to stopSequences (typed string[]). JSON.parse inside try/catch, keep only string entries, default to [] on failure. Also accept a native
stoparray if present.verbosity: ST verbosity_levels are auto/low/medium/high, but Marinara's type is "low"|"medium"|"high"|null. Map "auto" (and anything unrecognized) to null; pass through low/medium/high only. Passing "auto" through would be an invalid value.
serviceTier: ST chat-completion presets have NO service_tier field; Marinara's serviceTier is "flex"|"priority" (OpenRouter-only). There is no source to preserve — leaving serviceTier null on import is correct. Drop the "preserve serviceTier" part of the suggested fix.
customParameters: ST exposes custom_include_body / custom_exclude_body (text/YAML blobs) and custom_include_headers (HTTP headers, not body params). These do NOT map 1:1 to Marinara's customParameters (Record<string,unknown> merged into the request body). At minimum parse custom_include_body into the record; custom_exclude_body and custom_include_headers have no customParameters equivalent — implement separately or explicitly note them as unsupported. A flat passthrough/assignment is wrong.
assistant_prefill → assistantPrefill is the correct primary mapping (assistantPrefill is injected as the final assistant message, generate.routes.ts:5262-5273). continue_postfix is a continue-only SUFFIX enum ('', ' ', '\n', '\n\n'), semantically distinct from a first-message prefill — do NOT fold it into assistantPrefill. Drop it or handle continue separately.
reasoning_effort: ST reasoning_effort_types include min and max, which currently fall through to null. Add min→"low" and max→"maximum" (nearest supported levels, both already in VALID_REASONING) to toReasoningEffort. The issue's "max→high/maximum" should be precisely max→"maximum".
Note: STPreset already has an index signature ([key: string]: unknown, L67), so reading these fields needs no interface change.
@SpicyMarinara commented on GitHub (Jun 21, 2026):
Fixed on the issue sweep branch, using the corrected scope from the follow-up comment. ST preset import now parses JSON-string custom_stopping_strings plus native stop arrays into stopSequences, maps assistant_prefill to assistantPrefill without folding in continue_postfix, parses custom_include_body into customParameters when it is a JSON object or simple key/value body, maps verbosity low/medium/high while leaving auto/unrecognized as null, and maps reasoning_effort min -> low and max -> maximum. serviceTier remains null because ST presets do not provide a compatible field; custom_exclude_body and custom_include_headers are intentionally not mapped into request-body customParameters. Final pnpm validation is deferred until the full sweep is complete.