[PR #4496] [MERGED] fix: keep Game Mode party names canonical #6401

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

📋 Pull Request Information

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

Base: staging ← Head: agent/4495-game-name-canonicalization


📝 Commits (3)

  • d3bcdb9 chore: start issue 4495
  • 60f7eca fix: canonicalize Game Mode party aliases
  • c27bd3f fix: normalize persisted Game speaker labels

📊 Changes

5 files changed (+164 additions, -8 deletions)

View changed files

📝 packages/server/src/routes/generate.routes.ts (+11 -1)
📝 packages/server/src/routes/generate/generate-route-utils.ts (+89 -5)
📝 packages/server/src/routes/generate/retry-agents-route.ts (+1 -1)
📝 packages/server/src/services/game/gm-prompts.ts (+1 -0)
📝 scripts/regressions/prompt.regression.ts (+62 -1)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #4495

Why this change

  • Game Mode can accept a model-expanded full-name/nickname label for a party member whose saved card has a shorter canonical name.
  • Later turns may use the saved name again, allowing one party member to become two Character Tracker identities and duplicate downstream appearance/visible-character context.
  • Storyboard exposed the split identity, but the conflicting label originated in Game Mode narration/history.

What changed

  • Tell the Game Mode GM to use the exact saved party names in bracketed speaker labels instead of description-derived legal names, nicknames, aliases, or titles.
  • Canonicalize the structured Game Mode speaker label before persistence when an explicit quoted or parenthesized alias resolves uniquely to one saved party name; leave prose and ambiguous labels unchanged.
  • Canonicalize an explicit quoted or parenthesized nickname from Character Tracker output only when it resolves uniquely to one known character card.
  • Persist the card's canonical name and stable ID, and collapse duplicate tracker rows that resolve to the same card before UI fields and tracker locks are restored.
  • Apply the same canonicalization order to normal generation and retry-agent updates.
  • Add regression coverage for persisted speaker-label normalization, prose preservation, the expanded-name/canonical-name tracker pair, duplicate collapse, the exact-name GM reminder, and an unrelated longer-name negative control.

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

Validation evidence

  • pnpm install --frozen-lockfile completed.
  • pnpm regression:prompt passed, including prompt, attachment, and context-fit regressions. The first sandboxed attempt hit the host's known tsx IPC listen EPERM; the identical host-path rerun passed.
  • pnpm check passed (Impeccable context, localization, lint/type checks, shared/server/client builds).

Manual verification notes

  • Manual reproduction on the reporter's PC remains pending.
  • This does not migrate old narration rows that already contain a model-expanded label.
  • The separately observed intermittent Storyboard fallback/truncation is outside this PR.

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 (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

No user-facing docs or release metadata changed.

UI evidence (if applicable)

  • Not applicable; this is Game Mode prompt/tracker orchestration with no UI changes.

Summary by CodeRabbit

  • Bug Fixes

    • Improved generated game responses by consistently using canonical party member names for speaker labels.
    • Improved character-tracker matching for aliases and short names, reducing incorrect or duplicate character assignments.
    • Preserved character cards and avatar details more reliably during tracker updates and retries.
  • Reliability

    • Added safeguards to leave ambiguous or unmatched names unchanged, improving accuracy in generated game content.

🔄 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/4496 **Author:** [@thetopham](https://github.com/thetopham) **Created:** 8/3/2026 **Status:** ✅ Merged **Merged:** 8/3/2026 **Merged by:** [@thetopham](https://github.com/thetopham) **Base:** `staging` ← **Head:** `agent/4495-game-name-canonicalization` --- ### 📝 Commits (3) - [`d3bcdb9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d3bcdb94b5fb94b495c390f1a168c255e0a49766) chore: start issue 4495 - [`60f7eca`](https://github.com/Pasta-Devs/Marinara-Engine/commit/60f7eca304b542eb48ac738f8894976e34493a55) fix: canonicalize Game Mode party aliases - [`c27bd3f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c27bd3fc62174d9d79bfcb278986c8437a8b72ff) fix: normalize persisted Game speaker labels ### 📊 Changes **5 files changed** (+164 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/routes/generate.routes.ts` (+11 -1) 📝 `packages/server/src/routes/generate/generate-route-utils.ts` (+89 -5) 📝 `packages/server/src/routes/generate/retry-agents-route.ts` (+1 -1) 📝 `packages/server/src/services/game/gm-prompts.ts` (+1 -0) 📝 `scripts/regressions/prompt.regression.ts` (+62 -1) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue Closes #4495 ## Why this change - Game Mode can accept a model-expanded full-name/nickname label for a party member whose saved card has a shorter canonical name. - Later turns may use the saved name again, allowing one party member to become two Character Tracker identities and duplicate downstream appearance/visible-character context. - Storyboard exposed the split identity, but the conflicting label originated in Game Mode narration/history. ## What changed - Tell the Game Mode GM to use the exact saved party names in bracketed speaker labels instead of description-derived legal names, nicknames, aliases, or titles. - Canonicalize the structured Game Mode speaker label before persistence when an explicit quoted or parenthesized alias resolves uniquely to one saved party name; leave prose and ambiguous labels unchanged. - Canonicalize an explicit quoted or parenthesized nickname from Character Tracker output only when it resolves uniquely to one known character card. - Persist the card's canonical name and stable ID, and collapse duplicate tracker rows that resolve to the same card before UI fields and tracker locks are restored. - Apply the same canonicalization order to normal generation and retry-agent updates. - Add regression coverage for persisted speaker-label normalization, prose preservation, the expanded-name/canonical-name tracker pair, duplicate collapse, the exact-name GM reminder, and an unrelated longer-name negative control. ## Validation - [x] `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` ### Validation evidence - `pnpm install --frozen-lockfile` completed. - `pnpm regression:prompt` passed, including prompt, attachment, and context-fit regressions. The first sandboxed attempt hit the host's known `tsx` IPC `listen EPERM`; the identical host-path rerun passed. - `pnpm check` passed (Impeccable context, localization, lint/type checks, shared/server/client builds). ### Manual verification notes - Manual reproduction on the reporter's PC remains pending. - This does not migrate old narration rows that already contain a model-expanded label. - The separately observed intermittent Storyboard fallback/truncation is outside this PR. ## 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 (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) No user-facing docs or release metadata changed. ## UI evidence (if applicable) - Not applicable; this is Game Mode prompt/tracker orchestration with no UI changes. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved generated game responses by consistently using canonical party member names for speaker labels. * Improved character-tracker matching for aliases and short names, reducing incorrect or duplicate character assignments. * Preserved character cards and avatar details more reliably during tracker updates and retries. * **Reliability** * Added safeguards to leave ambiguous or unmatched names unchanged, improving accuracy in generated game content. <!-- 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:05 +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#6401
No description provided.