[PR #3562] [MERGED] Fix duplicate Game Mode NPC portrait descriptions #5994

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

📋 Pull Request Information

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

Base: staging ← Head: fix/3561-game-portrait-prompt-duplication


📝 Commits (2)

  • 9031666 fix(game): deduplicate NPC portrait descriptions (#3561)
  • 24b3277 test(game): cover noncanonical portrait descriptions

📊 Changes

3 files changed (+163 additions, -19 deletions)

View changed files

📝 packages/server/src/routes/game.routes.ts (+18 -14)
📝 packages/server/src/services/game/game-asset-generation.ts (+45 -5)
📝 scripts/regressions/prompt.regression.ts (+100 -0)

📄 Description

Linked issue

Closes #3561

Why this change

  • Game Mode NPC portrait prompts can repeat the same canonical character description during server-side appearance aggregation and again after image prompt compilation. Besides wasting prompt space, the duplication can overemphasize individual traits and reduce the room available for composition and style guidance.
  • The existing canonical prefix cannot simply be removed because it protects identity details that tagged prompt compilation may otherwise distill away.

What changed

  • Deduplicate NPC appearance inputs by their normalized raw values before applying source labels.
  • Add the protected canonical appearance prefix only when the compiled provider prompt no longer contains that appearance.
  • Add prompt regressions covering metadata/request/tracker aggregation, unstyled and Z-Image prompts, tagged prompts, dynamic prompt rewrites, omitted identity details, and short-description token boundaries.

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 regression:prompt passes, including the new Game Mode portrait prompt cases.
  • pnpm check passes, including TypeScript, ESLint, and production builds.
  • The contributor confirmed in the app that Game Mode portrait generation no longer duplicates the character description.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

No documentation or release metadata changes are needed; this is an internal prompt-assembly bug fix.

UI evidence (if applicable)

Not applicable. The UI is unchanged; the affected behavior is the server-generated image prompt.

Summary by CodeRabbit

  • Bug Fixes

    • Improved NPC portrait generation by removing repeated appearance details across descriptions, outfits, moods, and notes.
    • Prevented canonical NPC visual profiles from being duplicated in generated image prompts.
    • Improved consistency of NPC appearances across portrait generation styles and prompt formats.
  • Tests

    • Added regression coverage to verify deduplication and consistent canonical NPC descriptions.

🔄 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/3562 **Author:** [@JurijPietrowicz](https://github.com/JurijPietrowicz) **Created:** 7/13/2026 **Status:** ✅ Merged **Merged:** 7/13/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/3561-game-portrait-prompt-duplication` --- ### 📝 Commits (2) - [`9031666`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9031666b172ae70823da309acf4ab55e36d327c2) fix(game): deduplicate NPC portrait descriptions (#3561) - [`24b3277`](https://github.com/Pasta-Devs/Marinara-Engine/commit/24b3277a0b3e0641a994d0e97ee859cb260c8c59) test(game): cover noncanonical portrait descriptions ### 📊 Changes **3 files changed** (+163 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/routes/game.routes.ts` (+18 -14) 📝 `packages/server/src/services/game/game-asset-generation.ts` (+45 -5) 📝 `scripts/regressions/prompt.regression.ts` (+100 -0) </details> ### 📄 Description ## Linked issue Closes #3561 ## Why this change - Game Mode NPC portrait prompts can repeat the same canonical character description during server-side appearance aggregation and again after image prompt compilation. Besides wasting prompt space, the duplication can overemphasize individual traits and reduce the room available for composition and style guidance. - The existing canonical prefix cannot simply be removed because it protects identity details that tagged prompt compilation may otherwise distill away. ## What changed - Deduplicate NPC appearance inputs by their normalized raw values before applying source labels. - Add the protected canonical appearance prefix only when the compiled provider prompt no longer contains that appearance. - Add prompt regressions covering metadata/request/tracker aggregation, unstyled and Z-Image prompts, tagged prompts, dynamic prompt rewrites, omitted identity details, and short-description token boundaries. ## Validation - [x] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [x] 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 regression:prompt` passes, including the new Game Mode portrait prompt cases. - `pnpm check` passes, including TypeScript, ESLint, and production builds. - The contributor confirmed in the app that Game Mode portrait generation no longer duplicates the character description. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) No documentation or release metadata changes are needed; this is an internal prompt-assembly bug fix. ## UI evidence (if applicable) Not applicable. The UI is unchanged; the affected behavior is the server-generated image prompt. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved NPC portrait generation by removing repeated appearance details across descriptions, outfits, moods, and notes. - Prevented canonical NPC visual profiles from being duplicated in generated image prompts. - Improved consistency of NPC appearances across portrait generation styles and prompt formats. - **Tests** - Added regression coverage to verify deduplication and consistent canonical NPC descriptions. <!-- 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:00 +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#5994
No description provided.