[PR #7932] [MERGED] fix(game-mode): keep GM planning out of the narration #8009

Closed
opened 2026-10-24 04:09:38 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7932
Author: @kolacheee
Created: 10/21/2026
Status: ✅ Merged
Merged: 10/21/2026
Merged by: @kolacheee

Base: staging ← Head: claude/game-mode-thinking-leak-sk2sor


📝 Commits (10+)

  • 47ec878 Keep Game Mode planning out of the narration
  • ac46ee2 Let a talk-to-GM turn answer out of character
  • 8a58cbe Keep a cut-off Game Mode reply's thinking out of the narration
  • 3563bd5 Point a talk-to-GM turn's language line at its answer
  • 834c83a Merge remote-tracking branch 'origin/staging' into claude/game-mode-thinking-leak-sk2sor
  • 8ed4c6c Merge remote-tracking branch 'origin/staging' into claude/game-mode-thinking-leak-sk2sor
  • bed57cf Merge remote-tracking branch 'origin/staging' into claude/game-mode-thinking-leak-sk2sor
  • a46c738 Merge remote-tracking branch 'origin/staging' into claude/game-mode-thinking-leak-sk2sor
  • d67efd3 fix(game-mode): never promote an earlier tool round's thinking as narration
  • e9ffaa2 test(game-mode): cover tool-round thinking through the generate route

📊 Changes

5 files changed (+307 additions, -43 deletions)

View changed files

📝 packages/server/src/routes/generate.routes.ts (+61 -41)
📝 packages/server/src/services/game/gm-prompts.ts (+5 -2)
📝 packages/server/src/services/generation/empty-response-reason.ts (+21 -0)
➕ scripts/regressions/game-gm-thinking-leak.regression.ts (+144 -0)
📝 scripts/regressions/game-tool-controls.regression.ts (+76 -0)

📄 Description

Linked issue

Closes #7931

Why this change

  • Every Game Mode turn's format reminder told the GM to "Think step by step" before the scene, with nowhere to put that thinking. A model without a native thinking channel, or with reasoning off, wrote its plan into the reply, and the player saw it as narration. A user reported this across models in a non-English game.
  • Separately, when a game turn came back with no visible text, Game Mode showed whatever thinking it had as the narration. That recovery exists for providers that put the answer in the reasoning field. But it also fired when a reasoning model spent its whole output budget thinking, and for thinking the model had tagged itself, so the player saw the GM's plan there too.

What changed

  • Game Mode no longer shows the Game Master's turn planning as narration. The GM is now asked to plan privately, and any plan it writes goes in one leading <think> block, which the game turn already moves into the message's thinking.
  • A [To the GM] turn is told to give only its out-of-character answer, so it isn't also told to write scene text only.
  • In non-English games, the language line now applies to the scene text, so models no longer read it as "write the plan out in this language".
  • When a reasoning model runs out of output tokens before writing anything, Game Mode now shows the empty-reply message ("Raise Max Tokens or lower Reasoning Effort") instead of the model's thinking. A finished reply whose provider put the answer in the reasoning field is still recovered as before.

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

  • New regression scripts/regressions/game-gm-thinking-leak.regression.ts checks:

    • the reminder in five language settings, plus a [To the GM] turn
    • that a German reply following the reminder loses its plan to the thinking slot
    • when a reply with no visible text may show its reasoning: never when cut off or tagged inline in Game Mode, still when a finished provider reply holds the answer, and unchanged in Conversation

    It fails on staging and passes on this branch.

  • All 141 regressions that import gm-prompts, generate.routes or empty-response-reason pass. Server lint (tsc) and Prettier pass. pnpm check passed on the first commit.

  • Not tried against a live model yet.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) 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)

UI evidence (if applicable)

None: prompt and server-side change.

Summary by CodeRabbit

  • Bug Fixes

    • GM responses now keep private planning separate from visible content.
    • Game Mode replies provide only the appropriate GM response or scene text, without extra notes, headings, or planning details.
    • Non-English instructions are applied consistently to generated scene text and out-of-character responses.
    • Empty or reasoning-only responses are handled more consistently across chat modes and tool-assisted interactions.
  • Tests

    • Added regression coverage for GM formatting, language handling, tool interactions, and private-planning leakage.

🔄 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/7932 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 10/21/2026 **Status:** ✅ Merged **Merged:** 10/21/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `claude/game-mode-thinking-leak-sk2sor` --- ### 📝 Commits (10+) - [`47ec878`](https://github.com/Pasta-Devs/Marinara-Engine/commit/47ec8785c2e84583ddbf85b073fab26b3810d84e) Keep Game Mode planning out of the narration - [`ac46ee2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ac46ee286357b6740f5b798f3466b11cfc5db4a7) Let a talk-to-GM turn answer out of character - [`8a58cbe`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8a58cbe426c4f1a056636d974f1ccec515a1cda2) Keep a cut-off Game Mode reply's thinking out of the narration - [`3563bd5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3563bd5c04d8a0850f78927e2da42cc791f7188b) Point a talk-to-GM turn's language line at its answer - [`834c83a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/834c83a019afc20486fa975b2cfc7d3f0a20af7f) Merge remote-tracking branch 'origin/staging' into claude/game-mode-thinking-leak-sk2sor - [`8ed4c6c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8ed4c6cc3706d1c4386e63cdc72c798038e17864) Merge remote-tracking branch 'origin/staging' into claude/game-mode-thinking-leak-sk2sor - [`bed57cf`](https://github.com/Pasta-Devs/Marinara-Engine/commit/bed57cfb2a96f58bdfa432c96bdb311563bf5300) Merge remote-tracking branch 'origin/staging' into claude/game-mode-thinking-leak-sk2sor - [`a46c738`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a46c7383b1e09bebd6dc7bf101e6f8f02769676b) Merge remote-tracking branch 'origin/staging' into claude/game-mode-thinking-leak-sk2sor - [`d67efd3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d67efd31a30d088d2dd74aa62b0e62192c751ca8) fix(game-mode): never promote an earlier tool round's thinking as narration - [`e9ffaa2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e9ffaa2a5b330b313eee9e648aef78e189e6caa8) test(game-mode): cover tool-round thinking through the generate route ### 📊 Changes **5 files changed** (+307 additions, -43 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/routes/generate.routes.ts` (+61 -41) 📝 `packages/server/src/services/game/gm-prompts.ts` (+5 -2) 📝 `packages/server/src/services/generation/empty-response-reason.ts` (+21 -0) ➕ `scripts/regressions/game-gm-thinking-leak.regression.ts` (+144 -0) 📝 `scripts/regressions/game-tool-controls.regression.ts` (+76 -0) </details> ### 📄 Description ## Linked issue Closes #7931 ## Why this change - Every Game Mode turn's format reminder told the GM to "Think step by step" before the scene, with nowhere to put that thinking. A model without a native thinking channel, or with reasoning off, wrote its plan into the reply, and the player saw it as narration. A user reported this across models in a non-English game. - Separately, when a game turn came back with no visible text, Game Mode showed whatever thinking it had as the narration. That recovery exists for providers that put the answer in the reasoning field. But it also fired when a reasoning model spent its whole output budget thinking, and for thinking the model had tagged itself, so the player saw the GM's plan there too. ## What changed - Game Mode no longer shows the Game Master's turn planning as narration. The GM is now asked to plan privately, and any plan it writes goes in one leading `<think>` block, which the game turn already moves into the message's thinking. - A `[To the GM]` turn is told to give only its out-of-character answer, so it isn't also told to write scene text only. - In non-English games, the language line now applies to the scene text, so models no longer read it as "write the plan out in this language". - When a reasoning model runs out of output tokens before writing anything, Game Mode now shows the empty-reply message ("Raise Max Tokens or lower Reasoning Effort") instead of the model's thinking. A finished reply whose provider put the answer in the reasoning field is still recovered as before. ## 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` ### Manual verification notes - New regression `scripts/regressions/game-gm-thinking-leak.regression.ts` checks: - the reminder in five language settings, plus a `[To the GM]` turn - that a German reply following the reminder loses its plan to the thinking slot - when a reply with no visible text may show its reasoning: never when cut off or tagged inline in Game Mode, still when a finished provider reply holds the answer, and unchanged in Conversation It fails on staging and passes on this branch. - All 141 regressions that import `gm-prompts`, `generate.routes` or `empty-response-reason` pass. Server lint (tsc) and Prettier pass. `pnpm check` passed on the first commit. - Not tried against a live model yet. ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) 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) ## UI evidence (if applicable) None: prompt and server-side change. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * GM responses now keep private planning separate from visible content. * Game Mode replies provide only the appropriate GM response or scene text, without extra notes, headings, or planning details. * Non-English instructions are applied consistently to generated scene text and out-of-character responses. * Empty or reasoning-only responses are handled more consistently across chat modes and tool-assisted interactions. * **Tests** * Added regression coverage for GM formatting, language handling, tool interactions, and private-planning leakage. <!-- 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-24 04:09:38 +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#8009
No description provided.