[PR #4507] [MERGED] Fix grouped speaker parsing and add ID Macro Cards placement #6404

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4507
Author: @SpicyMarinara
Created: 8/3/2026
Status: ✅ Merged
Merged: 8/3/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/4504-id-macro-cards-marker


📝 Commits (3)

  • a5bc629 chore: start grouped conversation and ID marker work
  • 6496ff1 fix: preserve grouped speakers and place ID macro cards
  • e5a3c75 fix: address ID marker review edge cases

📊 Changes

9 files changed (+171 additions, -21 deletions)

View changed files

📝 e2e/core-flows.e2e.ts (+5 -0)
📝 packages/client/src/components/presets/PresetEditor.tsx (+9 -4)
📝 packages/client/src/localization/locales/en.json (+2 -0)
📝 packages/server/src/services/conversation/character-commands.ts (+7 -5)
📝 packages/server/src/services/prompt/assembler.ts (+25 -2)
📝 packages/shared/src/schemas/prompt.schema.ts (+1 -0)
📝 packages/shared/src/types/prompt.ts (+1 -0)
📝 packages/shared/src/utils/speaker-segments.ts (+12 -7)
📝 scripts/regressions/open-issues.regression.ts (+109 -3)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository staging branch or a same-repository hotfix branch to main.

Linked issue

Closes #4504
Closes #4506

Why this change

  • Grouped Conversation replies can put response text on the line after a character name. The previous parser missed that speaker boundary, so text and embedded character commands could be attributed to the wrong character.
  • Preset authors need control over where dynamically referenced character cards enter the prompt, while legacy presets must retain their current fallback placement.

What changed

  • Accept Name: followed by LF or CRLF content in grouped Conversation parsing and keep server command attribution aligned with the rendered bubble.
  • Add the localized ID Macro Cards marker to the Presets section menu and shared marker schema.
  • Materialize referenced character context at the explicit marker after lorebook discovery; without an enabled marker, retain the existing leading system fallback.
  • Add regression coverage for newline speaker labels, command ownership, lorebook-discovered card placement, fallback compatibility, non-duplication, and marker visibility.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • pnpm check passed.
  • pnpm localization:check passed.
  • pnpm regression:prompt passed.
  • The open-issues regression passed with focused LF/CRLF speaker and ID-card placement assertions.
  • The targeted desktop Playwright Presets case passed and confirmed ID Macro Cards appears in the Add Section menu.
  • The full pnpm smoke:ui run completed 183 passing tests, 97 skipped, and 4 unrelated failures in stale What’s New copy, an intercepted Characters row click, and a timing-sensitive Roleplay panel animation.
  • In-app browser initialization failed before navigation, so no manual screenshot was captured.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a docs-i18n follow-up issue opened
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

  • Automated desktop browser proof is included in the focused Playwright assertion. Manual screenshot unavailable because the in-app browser connection failed during initialization.

Summary by CodeRabbit

  • New Features

    • Added an “ID Macro Cards” section option to the preset editor.
    • Character-card content can now be inserted at a designated prompt location, with a fallback when no location is selected.
    • Added localized labels and descriptions for the new section.
  • Bug Fixes

    • Improved speaker command recognition for Name: formats with inline or newline-separated text.
    • Prevented duplicated character-card content during prompt assembly.
    • Preserved correct character attribution across grouped speaker commands.

🔄 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/4507 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 8/3/2026 **Status:** ✅ Merged **Merged:** 8/3/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/4504-id-macro-cards-marker` --- ### 📝 Commits (3) - [`a5bc629`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a5bc6292b1cf252cb865012608b5b463caf24094) chore: start grouped conversation and ID marker work - [`6496ff1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6496ff1d25e15614fc346f42d14595bceecc9720) fix: preserve grouped speakers and place ID macro cards - [`e5a3c75`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e5a3c75e861d2c71dc6e3e7c3fbe825af7c14302) fix: address ID marker review edge cases ### 📊 Changes **9 files changed** (+171 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `e2e/core-flows.e2e.ts` (+5 -0) 📝 `packages/client/src/components/presets/PresetEditor.tsx` (+9 -4) 📝 `packages/client/src/localization/locales/en.json` (+2 -0) 📝 `packages/server/src/services/conversation/character-commands.ts` (+7 -5) 📝 `packages/server/src/services/prompt/assembler.ts` (+25 -2) 📝 `packages/shared/src/schemas/prompt.schema.ts` (+1 -0) 📝 `packages/shared/src/types/prompt.ts` (+1 -0) 📝 `packages/shared/src/utils/speaker-segments.ts` (+12 -7) 📝 `scripts/regressions/open-issues.regression.ts` (+109 -3) </details> ### 📄 Description > [!IMPORTANT] > Contributions target staging. Only SpicyMarinara may promote this repository staging branch or a same-repository hotfix branch to main. ## Linked issue Closes #4504 Closes #4506 ## Why this change - Grouped Conversation replies can put response text on the line after a character name. The previous parser missed that speaker boundary, so text and embedded character commands could be attributed to the wrong character. - Preset authors need control over where dynamically referenced character cards enter the prompt, while legacy presets must retain their current fallback placement. ## What changed - Accept Name: followed by LF or CRLF content in grouped Conversation parsing and keep server command attribution aligned with the rendered bubble. - Add the localized ID Macro Cards marker to the Presets section menu and shared marker schema. - Materialize referenced character context at the explicit marker after lorebook discovery; without an enabled marker, retain the existing leading system fallback. - Add regression coverage for newline speaker labels, command ownership, lorebook-discovered card placement, fallback compatibility, non-duplication, and marker visibility. ## Validation - [ ] pnpm check passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed CONTRIBUTING.md ### Manual verification notes - pnpm check passed. - pnpm localization:check passed. - pnpm regression:prompt passed. - The open-issues regression passed with focused LF/CRLF speaker and ID-card placement assertions. - The targeted desktop Playwright Presets case passed and confirmed ID Macro Cards appears in the Add Section menu. - The full pnpm smoke:ui run completed 183 passing tests, 97 skipped, and 4 unrelated failures in stale What’s New copy, an intercepted Characters row click, and a timing-sensitive Roleplay panel animation. - In-app browser initialization failed before navigation, so no manual screenshot was captured. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the docs-i18n branch updated to match, or a docs-i18n follow-up issue opened - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) - Automated desktop browser proof is included in the focused Playwright assertion. Manual screenshot unavailable because the in-app browser connection failed during initialization. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added an “ID Macro Cards” section option to the preset editor. - Character-card content can now be inserted at a designated prompt location, with a fallback when no location is selected. - Added localized labels and descriptions for the new section. - **Bug Fixes** - Improved speaker command recognition for `Name:` formats with inline or newline-separated text. - Prevented duplicated character-card content during prompt assembly. - Preserved correct character attribution across grouped speaker commands. <!-- 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:10:06 +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#6404
No description provided.