[PR #3755] [MERGED] Fix Conversation context preset wrapping #6090

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

📋 Pull Request Information

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

Base: staging ← Head: fix/3753-conversation-wrap-format


📝 Commits (2)

  • 6d7d73a Fix conversation context preset wrapping
  • 8335c99 Apply Conversation context review fixes

📊 Changes

7 files changed (+400 additions, -118 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 packages/server/src/routes/generate.routes.ts (+5 -0)
📝 packages/server/src/routes/generate/conversation-connected-context.ts (+65 -43)
📝 packages/server/src/services/conversation/awareness.service.ts (+56 -20)
📝 packages/server/src/services/generation/conversation-memory-context.ts (+15 -5)
📝 packages/server/src/services/generation/memory-recall-context.ts (+15 -7)
📝 scripts/regressions/prompt.regression.ts (+243 -43)

📄 Description

Why

Conversation-generated context bypassed the active prompt preset formatter. Recalled memories, cross-chat awareness, character memories, and connected Roleplay/Game context could therefore emit XML tags and Markdown headings even when the preset selected Markdown or no automatic wrapping.

Closes #3753.

What changed

  • route recalled-memory, awareness, character-memory, and connected-chat structures through the shared XML/Markdown/unwrapped formatter
  • sanitize dynamic prompt leaves for the selected format while preserving literal <influence> and <note> command syntax
  • keep cross-chat awareness within its existing prompt budget after accounting for format wrappers
  • add regression coverage for XML, Markdown, and unwrapped output across the affected paths
  • document the fix in the changelog

Validation

Automated evidence:

  • PASS: pnpm regression:prompt
  • PASS: pnpm check

Manual verification remaining:

  • Generate a Conversation with an XML preset and inspect recalled/connected context
  • Generate a Conversation with a Markdown preset and confirm no structural XML wrappers are added
  • Generate a Conversation with wrapping set to None and confirm neither XML tags nor Markdown headings are added

Summary by CodeRabbit

  • Bug Fixes

    • Updated recalled memories, awareness context, and connected-chat information to honor the active Conversation preset’s XML, Markdown, or unwrapped format.
    • Improved escaping and formatting of inserted conversation content to prevent malformed prompt sections.
    • Preserved macro resolution while applying the selected formatting consistently.
  • Tests

    • Added regression coverage for formatting, escaping, and macro resolution across supported formats.

🔄 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/3755 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 7/17/2026 **Status:** ✅ Merged **Merged:** 7/17/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/3753-conversation-wrap-format` --- ### 📝 Commits (2) - [`6d7d73a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6d7d73aa70edb5ae1d496c0ace20a740c731527d) Fix conversation context preset wrapping - [`8335c99`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8335c99c2331db89980245ed7be532b90bdd9097) Apply Conversation context review fixes ### 📊 Changes **7 files changed** (+400 additions, -118 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `packages/server/src/routes/generate.routes.ts` (+5 -0) 📝 `packages/server/src/routes/generate/conversation-connected-context.ts` (+65 -43) 📝 `packages/server/src/services/conversation/awareness.service.ts` (+56 -20) 📝 `packages/server/src/services/generation/conversation-memory-context.ts` (+15 -5) 📝 `packages/server/src/services/generation/memory-recall-context.ts` (+15 -7) 📝 `scripts/regressions/prompt.regression.ts` (+243 -43) </details> ### 📄 Description ## Why Conversation-generated context bypassed the active prompt preset formatter. Recalled memories, cross-chat awareness, character memories, and connected Roleplay/Game context could therefore emit XML tags and Markdown headings even when the preset selected Markdown or no automatic wrapping. Closes #3753. ## What changed - route recalled-memory, awareness, character-memory, and connected-chat structures through the shared XML/Markdown/unwrapped formatter - sanitize dynamic prompt leaves for the selected format while preserving literal `<influence>` and `<note>` command syntax - keep cross-chat awareness within its existing prompt budget after accounting for format wrappers - add regression coverage for XML, Markdown, and unwrapped output across the affected paths - document the fix in the changelog ## Validation Automated evidence: - PASS: `pnpm regression:prompt` - PASS: `pnpm check` Manual verification remaining: - [ ] Generate a Conversation with an XML preset and inspect recalled/connected context - [ ] Generate a Conversation with a Markdown preset and confirm no structural XML wrappers are added - [ ] Generate a Conversation with wrapping set to None and confirm neither XML tags nor Markdown headings are added <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Updated recalled memories, awareness context, and connected-chat information to honor the active Conversation preset’s XML, Markdown, or unwrapped format. * Improved escaping and formatting of inserted conversation content to prevent malformed prompt sections. * Preserved macro resolution while applying the selected formatting consistently. * **Tests** * Added regression coverage for formatting, escaping, and macro resolution across supported formats. <!-- 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:06:59 +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#6090
No description provided.