[GH-ISSUE #2703] [Issue]: ST preset import drops stop sequences, assistant prefill, custom params, and nulls verbosity/serviceTier/reasoning_effort #1348

Closed
opened 2026-10-21 05:31:58 +07:00 by bsakaguchi · 2 comments
Owner

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_effort min/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:

  • Stop sequences dropped: ST custom_stopping_strings / stop are discarded; stopSequences is hardcoded to [].
  • Assistant prefill dropped: ST assistant_prefill / continue_postfix are discarded; assistantPrefill is hardcoded to "".
  • Custom params dropped: ST provider-specific custom params are discarded; customParameters is hardcoded to {}.
  • verbosity/serviceTier nulled: both are unconditionally set to null on import regardless of the source.
  • reasoning_effort mis-mapped: ST values min and max map to null instead 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/serviceTier unconditionally null.
  • reasoning_effort min/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, an assistant_prefill, a provider custom param, verbosity, and reasoning_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; preserve verbosity/serviceTier when present; map reasoning_effort min→low and max→high/maximum (nearest supported level) instead of null.

Environment

  • Marinara Engine version: 2.0.0 (staging @ b826f8f4)
  • Install type: source
  • OS + version: All (code-level defect, platform-independent)
  • Browser or app shell: All

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:

  • I DID NOT read this template and provide the requested details.
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_effort` `min`/`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`: - **Stop sequences dropped:** ST `custom_stopping_strings` / `stop` are discarded; `stopSequences` is hardcoded to `[]`. - **Assistant prefill dropped:** ST `assistant_prefill` / `continue_postfix` are discarded; `assistantPrefill` is hardcoded to `""`. - **Custom params dropped:** ST provider-specific custom params are discarded; `customParameters` is hardcoded to `{}`. - **verbosity/serviceTier nulled:** both are unconditionally set to `null` on import regardless of the source. - **reasoning_effort mis-mapped:** ST values `min` and `max` map to `null` instead 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`/`serviceTier` unconditionally `null`. - `reasoning_effort` `min`/`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`, an `assistant_prefill`, a provider custom param, `verbosity`, and `reasoning_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`; preserve `verbosity`/`serviceTier` when present; map `reasoning_effort` `min`→`low` and `max`→`high`/`maximum` (nearest supported level) instead of null. ## Environment - Marinara Engine version: 2.0.0 (staging @ `b826f8f4`) - Install type: source - OS + version: All (code-level defect, platform-independent) - Browser or app shell: All ## 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: - [ ] I DID NOT read this template and provide the requested details.
Author
Owner

@kolacheee commented on GitHub (Jun 21, 2026):

Veracity self-review — correction / clarification
Automated post-filing review of this issue against the current working tree. The reported bug remains valid; the notes below refine its scope, accuracy, or suggested fix for whoever implements it.

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:

  1. 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 stop array if present.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

  6. 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.

<!-- gh-comment-id:4761102394 --> @kolacheee commented on GitHub (Jun 21, 2026): > **Veracity self-review — correction / clarification** > _Automated post-filing review of this issue against the current working tree. The reported bug remains valid; the notes below refine its scope, accuracy, or suggested fix for whoever implements it._ 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: 1. 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 `stop` array if present. 2. 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. 3. 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. 4. 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. 5. 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. 6. 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.
Author
Owner

@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.

<!-- gh-comment-id:4761578196 --> @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.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#1348
No description provided.