[PR #375] [MERGED] fix(game): instruct GM to use plain quotes in [choices:] options #4590

Closed
opened 2026-10-22 04:08:58 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/375
Author: @cha1latte
Created: 5/3/2026
Status: ✅ Merged
Merged: 5/3/2026
Merged by: @cha1latte

Base: main ← Head: fix/gm-choice-quote-format


📝 Commits (1)

  • 9e861d0 fix(game): instruct GM to use plain quotes in [choices:] options

📊 Changes

2 files changed (+1 additions, -21 deletions)

View changed files

📝 packages/client/src/components/game/GameChoiceCards.tsx (+0 -20)
📝 packages/server/src/services/game/gm-prompts.ts (+1 -1)

📄 Description

Summary

Tighten the [choices:] format guidance in the GM prompt so models don't emit
JSON-style escaped quotes inside choice values. Also remove a dead duplicate
of the choice parser that was sitting unused in GameChoiceCards.tsx.

Why

Some models (reported on GLM) emit [choices: "\"Suzuki, wait—\"" | ... ]
with backslash-escaped inner quotes. The live parser in
packages/client/src/lib/game-tag-parser.ts strips one outer quote per option
but doesn't unescape \", so the literal backslashes survive into the choice
strings and get rendered on the CHOOSE YOUR ACTION card via
AnimatedText / dangerouslySetInnerHTML. End-state: users see
\"Suzuki, wait—\" on screen. Discord mirror happens to look clean because
Discord's markdown swallows \", but the underlying bytes are the same.

The simplest, root-cause fix is the prompt: explicitly tell the GM to use
plain straight quotes around each option and not to escape inner quotes with
backslashes. This solves it for any model that follows instructions, without
adding a defensive-parsing maintenance surface.

The dead parseChoiceTag function in GameChoiceCards.tsx had zero imports
across the codebase — the real parser is parseGmTags in
lib/game-tag-parser.ts. Removing it now to prevent drift.

Changes

  • packages/server/src/services/game/gm-prompts.ts — append plain-quote /
    no-escape guidance to the [choices:] line in the format reminder
    (~10 words added).
  • packages/client/src/components/game/GameChoiceCards.tsx — delete unused
    parseChoiceTag export (and its // ── Tag Parser ── divider).

Known limitations

  • Tested for regression on Gemini in the dual-install setup — choices
    still emit and render cleanly. Not yet verified end-to-end on GLM (the
    model that exhibited the original bug). Original reporter to confirm
    on their setup post-merge — happy to follow up with parser-side hardening
    if GLM still escapes despite the prompt change.
  • The prompt fix only helps models that respect instructions. A future PR
    could add a small unescape pass in the parser as defense-in-depth, but
    that's deferred until we see a second model report this.

Test plan

Reviewer / merger: please verify rather than checking these blindly.

  • Manually verify choice cards render with plain quotes on a flagship
    model in GM mode (Claude / GPT-4 class / Gemini).
  • Manually verify choices still emit at all (no regression — model
    isn't confused by the tighter wording).
  • pnpm check passes.

Screenshots

image image

Docs touched

None. No user-facing config or behavior change documented anywhere.

Summary by CodeRabbit

  • Chores

    • Removed an internal utility function from the game component; existing functionality unchanged.
  • Documentation

    • Updated choice formatting guidance in game master prompts for clearer quote handling instructions.

🔄 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/375 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/3/2026 **Status:** ✅ Merged **Merged:** 5/3/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `main` ← **Head:** `fix/gm-choice-quote-format` --- ### 📝 Commits (1) - [`9e861d0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9e861d07b2ab179604a4719f5c115fa38a11b3ed) fix(game): instruct GM to use plain quotes in [choices:] options ### 📊 Changes **2 files changed** (+1 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/game/GameChoiceCards.tsx` (+0 -20) 📝 `packages/server/src/services/game/gm-prompts.ts` (+1 -1) </details> ### 📄 Description ## Summary Tighten the `[choices:]` format guidance in the GM prompt so models don't emit JSON-style escaped quotes inside choice values. Also remove a dead duplicate of the choice parser that was sitting unused in `GameChoiceCards.tsx`. ## Why Some models ([reported on GLM](https://discord.com/channels/1417099416812392641/1500526584870866985)) emit `[choices: "\"Suzuki, wait—\"" | ... ]` with backslash-escaped inner quotes. The live parser in `packages/client/src/lib/game-tag-parser.ts` strips one outer quote per option but doesn't unescape `\"`, so the literal backslashes survive into the choice strings and get rendered on the **CHOOSE YOUR ACTION** card via `AnimatedText` / `dangerouslySetInnerHTML`. End-state: users see `\"Suzuki, wait—\"` on screen. Discord mirror happens to look clean because Discord's markdown swallows `\"`, but the underlying bytes are the same. The simplest, root-cause fix is the prompt: explicitly tell the GM to use plain straight quotes around each option and not to escape inner quotes with backslashes. This solves it for any model that follows instructions, without adding a defensive-parsing maintenance surface. The dead `parseChoiceTag` function in `GameChoiceCards.tsx` had zero imports across the codebase — the real parser is `parseGmTags` in `lib/game-tag-parser.ts`. Removing it now to prevent drift. ## Changes - `packages/server/src/services/game/gm-prompts.ts` — append plain-quote / no-escape guidance to the `[choices:]` line in the format reminder (~10 words added). - `packages/client/src/components/game/GameChoiceCards.tsx` — delete unused `parseChoiceTag` export (and its `// ── Tag Parser ──` divider). ## Known limitations - Tested for **regression** on Gemini in the dual-install setup — choices still emit and render cleanly. Not yet verified end-to-end on GLM (the model that exhibited the original bug). Original reporter to confirm on their setup post-merge — happy to follow up with parser-side hardening if GLM still escapes despite the prompt change. - The prompt fix only helps models that respect instructions. A future PR could add a small unescape pass in the parser as defense-in-depth, but that's deferred until we see a second model report this. ## Test plan Reviewer / merger: please verify rather than checking these blindly. - [x] Manually verify choice cards render with plain quotes on a flagship model in GM mode (Claude / GPT-4 class / Gemini). - [x] Manually verify choices still emit at all (no regression — model isn't confused by the tighter wording). - [x] `pnpm check` passes. ## Screenshots <img width="516" height="182" alt="image" src="https://github.com/user-attachments/assets/66c19a57-e3b1-42ef-9816-df35e25ebdf5" /> <img width="391" height="325" alt="image" src="https://github.com/user-attachments/assets/644fd42a-bf2c-4aec-bcaf-72d97f6280bf" /> ## Docs touched None. No user-facing config or behavior change documented anywhere. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Removed an internal utility function from the game component; existing functionality unchanged. * **Documentation** * Updated choice formatting guidance in game master prompts for clearer quote handling instructions. <!-- 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-22 04:08:58 +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#4590
No description provided.