mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3023] [Issue]: Imported presets lose defaultChoices, so choice variables render with wrong values (first option instead of the author's saved default) #1593
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#1593
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 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3023
Originally assigned to: @SpicyMarinara on GitHub.
What's wrong
Exporting a preset and re-importing it silently loses the author's saved choice-variable defaults (
defaultChoices). At generation time the assembler then falls back to each choice block's FIRST option, so any choice variable whose intended default was not the first option (e.g.{{role}},{{pov}},{{length}}) resolves to a different value, changing the actual system prompt sent to the model.How to reproduce (try it yourself)
GET /api/prompts/:id/export. ItsdefaultChoicescontains non-first selections for role/guidelines/narration/pov/tense/length..marinara.jsonviaPOST /api/import(importMarinara->importPreset).You'll see: the imported preset's
defaultChoicesis{}, and choice macros (e.g.{{narration}},{{tense}}) resolve to each block's first option, producing a different assembled prompt than the original.Expected: the import round-trip preserves
defaultChoices, so choice variables resolve to the author's saved defaults.Where it is
packages/server/src/services/import/marinara.importer.ts— thestorage.create()call at lines 557-570 omitsdefaultChoices(andcreatePromptPresetSchemadoesn't accept it), and the finalstorage.update()at line 647 only setssectionOrder/groupOrder. Sop.defaultChoicesfrom the envelope is never written.Export includes it:
packages/server/src/routes/prompts.routes.ts:42-56(full row). Consumed atpackages/server/src/services/prompt/assembler.ts:251-280(first-option fallback at 276-279) andpackages/server/src/routes/generate.routes.ts:1817-1822. Storage already supports the key:packages/server/src/services/storage/prompts.storage.ts:111-112.What's happening
importPresetnever reads or writespreset.defaultChoices.create()cannot set it (schema omits it), and the post-create update only carries the order arrays, so the exported value is dropped on the floor and the DB column stays at its default"{}".Suggested fix
Persist
defaultChoicesby adding it to the finalstorage.update()call inimportPreset()atpackages/server/src/services/import/marinara.importer.ts:647:This uses the importer's existing
safeParseJsonhelper (lines 657-668) andstorage.update's existingdefaultChoicessupport (prompts.storage.ts:111-112). Legacy exports lacking the field yieldundefined, andsafeParseJson(undefined, {})returns{}, which is identical to the column default — so presets without choice defaults are unchanged. This is the same compensating step the seed path already performs (seed.ts:222-226).Related: a sibling issue covers the same
defaultChoices-dropped bug on the preset DUPLICATE path (prompts.storage.tsduplicate()) — same root-cause shape (create cannot acceptdefaultChoices; the trailingupdate()only carries the order arrays).AI-investigated against v2.0.6; cited lines read and confirmed. Please verify before fixing.
@SpicyMarinara commented on GitHub (Jun 29, 2026):
Fixed on staging in PR #3031 (merged as
f542e282). Closing manually because GitHub auto-close keywords only close issues when merged into the default branch (main), not staging.