mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3025] [Issue]: Duplicating a preset drops defaultChoices, so the copy uses wrong choice-variable defaults #1594
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#1594
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/3025
Originally assigned to: @SpicyMarinara on GitHub.
What's wrong
Duplicating a preset (
POST /api/prompts/:id/duplicate) copies its prompts, sections, groups, and choice blocks but not the source preset'sdefaultChoices. The copy is created with the DB default"{}", so when it is used as an override preset (or when its choice-selection modal pre-fills), choice variables fall back to each block's FIRST option, producing a different assembled prompt than the original whenever a saved default was not the first option.How to reproduce (try it yourself)
defaultChoices), callPOST /api/prompts/:id/duplicate.defaultChoices(it is"{}").You'll see: choice macros resolve to first options instead of the original saved defaults, changing the prompt sent to the model.
Expected: the duplicate carries the source preset's
defaultChoices.(Note: plain generation with the copy as the chat's ACTIVE preset and no per-chat choices does NOT reproduce — that path reads per-chat
presetChoices, not the preset'sdefaultChoices. The bug surfaces via the preset-override path and the modal pre-fill.)Where it is
packages/server/src/services/storage/prompts.storage.ts—duplicate()(128-211): thecreate()call (131-141) omitsdefaultChoices, and the finalupdate()at line 208 passes onlysectionOrder/groupOrder.update()already supports the key at lines 111-112. Impact paths:generate.routes.ts:1816-1822,dry-run-route.ts:829-837, assembler fallbackassembler.ts:276-279, clientChoiceSelectionModal.tsx:142-146,187.What's happening
duplicate()never reads or writes the source'sdefaultChoices.create()doesn't accept it, and the trailingupdate()only carries the order arrays, so the source's saved defaults are never propagated.Suggested fix
Carry
defaultChoicesinto the copy in the finalupdate()atpackages/server/src/services/storage/prompts.storage.ts:208:create()cannot acceptdefaultChoices, so this trailingupdate()is the only place to propagate it. The column isnotNull().default("{}"), sopreset.defaultChoicesis always a string and the parse is safe;update()re-stringifies it once (lines 111-112).Related: a sibling issue covers the same
defaultChoices-dropped bug on the preset IMPORT path (marinara.importer.tsimportPreset()) — same root-cause shape.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.