[GH-ISSUE #3427] [Issue]: Turn-game bot narration leaks model chain-of-thought as the character's chat message #1854

Closed
opened 2026-10-21 05:43:17 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Romuromylus on GitHub (Jul 10, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3427

Originally assigned to: @Romuromylus on GitHub.

Summary

Turn-game bot narration (character table talk and dealer/announcer lines) saves the model's chain-of-thought as the character's chat message when the connected model emits inline reasoning (e.g. a leading <think> block). With a reasoning-heavy model, the short maxTokens budget is often consumed entirely by the reasoning, so the persisted message is a truncated meta monologue instead of a spoken line.

Expected behavior

After a bot move (UNO, chess, poker, 8-ball), the character speaks one short in-character line; the announcer voices one short announcement. Inline reasoning from the model is never persisted or shown, matching how the main generation pipeline strips leading thinking blocks before saving.

Actual behavior

The character's message in chat reads like this (real example, truncated mid-sentence by the 100-token cap):

The user wants me to say one short, natural line as Rias Gremory after making my move in 8-ball pool. I should react naturally - maybe a confident quip, a flourish, something in character. I should NOT explain strategy, reveal hidden info, or recite board state. Just a natural pool table reaction.

Let me think of something Rias would say - she's confident, regal, a bit playful, competitive. She just made a good move after getting ball in

Steps to reproduce

  1. Connect a model that emits inline reasoning in content (a leading <think>/<thinking> block) rather than a provider-native thinking channel.
  2. Start any turn game against a character (e.g. /poker or another turn-game command) and make a move so the bot takes its turn.
  3. The bot's post-move line and/or the announcer's line contains the raw reasoning, often cut off mid-sentence.

Environment

  • Marinara Engine version: staging (a624b957)
  • Install type: docker
  • OS + version: Linux host
  • Browser or app shell: Chrome

Logs, screenshots, or video

See the quoted chat message above (bot seat "Rias Gremory" during an 8-ball game; identical mechanism applies to poker/chess/UNO narration and dealer announcements).

Additional context

Root cause: narrateOutcome() and narrateAnnouncements() in packages/server/src/services/turn-games/turn-game-bot-runner.service.ts return res.content verbatim, while the generation pipeline (e.g. generate.routes.ts, game.routes.ts) runs model output through extractLeadingThinkingBlocks() before persisting. Two compounding factors:

  • No inline-thinking strip at all on the narration paths.
  • maxTokens: 100 / 120 is routinely exhausted by the reasoning itself, so the closing tag never arrives and the message is truncated mid-thought — even a strip of closed blocks would not recover a spoken line in that case (the correct behavior is falling back to the factual event summary, which both call sites already support for empty narration).

The bot move call is unaffected (it only consumes res.toolCalls).

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Romuromylus on GitHub (Jul 10, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3427 Originally assigned to: @Romuromylus on GitHub. ## Summary Turn-game bot narration (character table talk and dealer/announcer lines) saves the model's chain-of-thought as the character's chat message when the connected model emits inline reasoning (e.g. a leading `<think>` block). With a reasoning-heavy model, the short `maxTokens` budget is often consumed entirely by the reasoning, so the persisted message is a truncated meta monologue instead of a spoken line. ## Expected behavior After a bot move (UNO, chess, poker, 8-ball), the character speaks one short in-character line; the announcer voices one short announcement. Inline reasoning from the model is never persisted or shown, matching how the main generation pipeline strips leading thinking blocks before saving. ## Actual behavior The character's message in chat reads like this (real example, truncated mid-sentence by the 100-token cap): > The user wants me to say one short, natural line as Rias Gremory after making my move in 8-ball pool. I should react naturally - maybe a confident quip, a flourish, something in character. I should NOT explain strategy, reveal hidden info, or recite board state. Just a natural pool table reaction. > > Let me think of something Rias would say - she's confident, regal, a bit playful, competitive. She just made a good move after getting ball in ## Steps to reproduce 1. Connect a model that emits inline reasoning in `content` (a leading `<think>`/`<thinking>` block) rather than a provider-native thinking channel. 2. Start any turn game against a character (e.g. `/poker` or another turn-game command) and make a move so the bot takes its turn. 3. The bot's post-move line and/or the announcer's line contains the raw reasoning, often cut off mid-sentence. ## Environment - Marinara Engine version: staging (a624b957) - Install type: docker - OS + version: Linux host - Browser or app shell: Chrome ## Logs, screenshots, or video See the quoted chat message above (bot seat "Rias Gremory" during an 8-ball game; identical mechanism applies to poker/chess/UNO narration and dealer announcements). ## Additional context Root cause: `narrateOutcome()` and `narrateAnnouncements()` in `packages/server/src/services/turn-games/turn-game-bot-runner.service.ts` return `res.content` verbatim, while the generation pipeline (e.g. `generate.routes.ts`, `game.routes.ts`) runs model output through `extractLeadingThinkingBlocks()` before persisting. Two compounding factors: - No inline-thinking strip at all on the narration paths. - `maxTokens: 100` / `120` is routinely exhausted by the reasoning itself, so the closing tag never arrives and the message is truncated mid-thought — even a strip of *closed* blocks would not recover a spoken line in that case (the correct behavior is falling back to the factual event summary, which both call sites already support for empty narration). The bot **move** call is unaffected (it only consumes `res.toolCalls`). ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:43:17 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Jul 10, 2026):

Fixed in #3419 and merged to staging.

<!-- gh-comment-id:4937429682 --> @SpicyMarinara commented on GitHub (Jul 10, 2026): Fixed in #3419 and merged to staging.
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#1854
No description provided.