[PR #3818] [MERGED] Fix character and persona prompt field order #6116

Closed
opened 2026-10-23 04:07:14 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/3818
Author: @SpicyMarinara
Created: 7/19/2026
Status: ✅ Merged
Merged: 7/19/2026
Merged by: @SpicyMarinara

Base: staging ← Head: agent/character-persona-field-order


📝 Commits (3)

  • 5ed074f chore: start prompt field ordering fix
  • 54b4cc0 fix: align prompt card field order
  • e2f2e8c Merge branch 'staging' into agent/character-persona-field-order

📊 Changes

11 files changed (+223 additions, -34 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 packages/server/src/routes/chats.routes.ts (+9 -9)
📝 packages/server/src/routes/game.routes.ts (+6 -6)
📝 packages/server/src/routes/generate/dry-run-route.ts (+6 -2)
📝 packages/server/src/routes/scene.routes.ts (+1 -1)
📝 packages/server/src/services/agents/agent-executor.ts (+1 -1)
📝 packages/server/src/services/generation/character-prompt-context.ts (+1 -1)
📝 packages/server/src/services/generation/game-gm-prompt-runtime.ts (+1 -1)
📝 packages/server/src/services/generation/professor-mari-command-runtime.ts (+4 -4)
📝 packages/server/src/services/prompt/marker-expander.ts (+28 -8)
📝 scripts/regressions/prompt.regression.ts (+165 -1)

📄 Description

Linked issue

Closes #3817

Why this change

Character and Persona sections should reach models in the same top-to-bottom order users see in their editors. Several serializers placed Scenario before Backstory and Appearance, while agent and Game card contexts had their own ordering drift.

Root cause

The canonical order was repeated manually across marker expansion, fallback injection, prompt preview, agents, and Game helpers. The Characters marker default itself encoded the old order, and saved custom marker selections were emitted in their stored order.

What changed

  • Canonicalize selected Characters marker fields as Description, Personality, Backstory, Appearance, Scenario, then Example Dialogue when selected.
  • Apply the same relative order to no-marker identity fallbacks, Peek Prompt, and legacy dry-run assembly while continuing to omit blank fields.
  • Align Persona prompt previews with the existing canonical Persona marker, fallback, and macro order.
  • Correct ordering in agent lore, Game setup/runtime cards, scene context, and Professor Mari card fetches.
  • Add regressions for Character and Persona field order, blank-section omission, custom marker selections, and agent lore.

Automated evidence

  • pnpm regression:prompt
  • pnpm check

Manual verification

  • Inspect Peek Prompt in Roleplay with a Characters marker and every Character card section populated.
  • Inspect Conversation and Game prompts with partially populated Character and Persona cards.
  • Confirm custom marker field selections still include only the selected fields.

Risk

This is a provider-facing prompt-order change. Field content, labels, wrappers, preset section placement, advanced instructions, and macro behavior are unchanged. Existing custom marker selections are preserved but their standard card fields now follow the editor order.

Summary by CodeRabbit

  • Bug Fixes
    • Standardized Character and Persona prompt sections to follow the editor’s field order across previews, generated prompts, fallback contexts, agent lore, and game/scene cards.
    • Ensured Example Dialogue appears last when present.
    • Added missing Backstory and Appearance details to character prompt previews.
    • Corrected formatting and ordering inconsistencies in generated character and persona content.
  • Tests
    • Added regression coverage verifying consistent field ordering and omission of empty sections.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/3818 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 7/19/2026 **Status:** ✅ Merged **Merged:** 7/19/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `agent/character-persona-field-order` --- ### 📝 Commits (3) - [`5ed074f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5ed074f085d22a3a759e07c03872b9f316447d56) chore: start prompt field ordering fix - [`54b4cc0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/54b4cc0ab616ea1a094607c00a8ae4048c7e572e) fix: align prompt card field order - [`e2f2e8c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e2f2e8c4b8478a320cd3bdde755fdc043ce70143) Merge branch 'staging' into agent/character-persona-field-order ### 📊 Changes **11 files changed** (+223 additions, -34 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `packages/server/src/routes/chats.routes.ts` (+9 -9) 📝 `packages/server/src/routes/game.routes.ts` (+6 -6) 📝 `packages/server/src/routes/generate/dry-run-route.ts` (+6 -2) 📝 `packages/server/src/routes/scene.routes.ts` (+1 -1) 📝 `packages/server/src/services/agents/agent-executor.ts` (+1 -1) 📝 `packages/server/src/services/generation/character-prompt-context.ts` (+1 -1) 📝 `packages/server/src/services/generation/game-gm-prompt-runtime.ts` (+1 -1) 📝 `packages/server/src/services/generation/professor-mari-command-runtime.ts` (+4 -4) 📝 `packages/server/src/services/prompt/marker-expander.ts` (+28 -8) 📝 `scripts/regressions/prompt.regression.ts` (+165 -1) </details> ### 📄 Description ## Linked issue Closes #3817 ## Why this change Character and Persona sections should reach models in the same top-to-bottom order users see in their editors. Several serializers placed Scenario before Backstory and Appearance, while agent and Game card contexts had their own ordering drift. ## Root cause The canonical order was repeated manually across marker expansion, fallback injection, prompt preview, agents, and Game helpers. The Characters marker default itself encoded the old order, and saved custom marker selections were emitted in their stored order. ## What changed - Canonicalize selected Characters marker fields as Description, Personality, Backstory, Appearance, Scenario, then Example Dialogue when selected. - Apply the same relative order to no-marker identity fallbacks, Peek Prompt, and legacy dry-run assembly while continuing to omit blank fields. - Align Persona prompt previews with the existing canonical Persona marker, fallback, and macro order. - Correct ordering in agent lore, Game setup/runtime cards, scene context, and Professor Mari card fetches. - Add regressions for Character and Persona field order, blank-section omission, custom marker selections, and agent lore. ## Automated evidence - pnpm regression:prompt - pnpm check ## Manual verification - [ ] Inspect Peek Prompt in Roleplay with a Characters marker and every Character card section populated. - [ ] Inspect Conversation and Game prompts with partially populated Character and Persona cards. - [ ] Confirm custom marker field selections still include only the selected fields. ## Risk This is a provider-facing prompt-order change. Field content, labels, wrappers, preset section placement, advanced instructions, and macro behavior are unchanged. Existing custom marker selections are preserved but their standard card fields now follow the editor order. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Standardized Character and Persona prompt sections to follow the editor’s field order across previews, generated prompts, fallback contexts, agent lore, and game/scene cards. * Ensured Example Dialogue appears last when present. * Added missing Backstory and Appearance details to character prompt previews. * Corrected formatting and ordering inconsistencies in generated character and persona content. * **Tests** * Added regression coverage verifying consistent field ordering and omission of empty sections. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:07:14 +07:00
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#6116
No description provided.