[GH-ISSUE #6127] When the follow-up request that rewrites a turn with the real dice fails, the turn becomes a bare list of numbers and shows every result twice #3403

Closed
opened 2026-10-21 06:02:44 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @kolacheee on GitHub (Sep 13, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6127

Originally assigned to: @SpicyMarinara on GitHub.

When the Game Master's turn needs dice, the engine rolls them and then makes one more request asking the model to rewrite the turn using the real results. If that second request fails - a dropped connection, a rate limit, a local model that died - the saved turn becomes a bare list of numbers ("Might check (DC 30): [12] = 12. Failure.") with the Game Master's writing gone, and the same numbers then appear a second time as log lines directly above it. Nothing tells the player the turn is degraded, and it stays that way after a reload.

Keeping the real results instead of the model's guessed outcome is the intended behaviour and should stay. What this issue asks for is a better-looking failure: don't print the results as the turn's prose when the log already shows them, and tell the player a retry would help.

How to reproduce (try it yourself)

  1. Settings > Connections: select a local model connection you can stop by hand (Ollama, KoboldCpp, any sidecar). Open or create a Game-mode chat and turn Tools off in the chat's game settings.
  2. Type I try to force the rusted gate open. and send.
  3. Watch the reply stream in. When the words stop arriving and a dice card pops in, the screen sits completely still - that is the second request running, and it streams nothing. That still period is your window.
  4. During that still period, stop the local model server (or pull the network). Timing inside the window does not matter: killing it before any rewrite text arrives and killing it after some has arrived give identical results.

What you'll see: the whole turn is replaced by lines like Might check (DC 30): [12] = 12. Failure. and 3d1+2 = 5, and the Game Master's prose you just watched stream in is gone. The identical results appear again as system log lines directly above that text. No error toast, no retry prompt - the turn just looks like a numbers-only reply, and it is still there after you reload the chat.

What should happen: the rolls stay real and nothing guessed survives, but the turn should not read as a duplicated stat dump, and the player should be told the Game Master could not narrate the outcome so they know to swipe or regenerate.

Control: run the same turn without killing the model. The turn is normal prose and each result is shown once, as log lines only.

Deterministic variant, no timing needed: point a custom (OpenAI-compatible) connection at a small stub server that answers the first request normally (prose plus a [dice: 3d1+2] request) and destroys the socket for any request whose body contains The engine has now rolled the requested dice. Fires every time.

Where it is

packages/server/src/routes/generate.routes.ts at staging 52799569c, in the Game-mode roll-resolution block gated at :7937 (chatMode === "game" && !input.impersonate):

  • :8012-8024 - the catch around the rewrite request logs a warning and ends with narration = "";. Nothing is sent to the client, so the stream carries no error frame.
  • :8037 - narration = narration.replace(createGameRollTagRegex(), "").trim() || resolvedSummary; then :8038 joins it with the record tags. With narration empty, the summary string becomes the turn body.

packages/client/src/components/game/GameNarration.tsx:938-975 (formatSkillCheckLogContent, call sites :2563 and :2598) renders one system log line per dice roll and per check on every turn - that is where the second copy comes from.

What's happening

The summary string is built as a safety net so the real results are never lost. On the failure path it is written into the turn's visible text, and the client strips only the record tags, so the summary is what the player reads as narration. The per-turn log lines then render the same results again. Because the catch sends nothing to the client, the player gets a normal-looking saved turn with no sign that a request failed.

Suggested fix

Keep the rule that no guessed or partial outcome survives, and change only how the failure is presented:

  • On the failure path, stop using the summary as the turn's prose. The record tags already carry the results and the log already renders them, so the turn body can be empty or a single short neutral line; the summary stays as the durable record.
  • Send the client a notice when the rewrite request fails, so the turn can be marked as degraded with a retry affordance instead of looking like the Game Master answered in numbers.

Both halves live in the same catch block and the same fallback line, so they belong in one change. Any change here must also move scripts/regressions/game-text-dice.regression.ts (its failed-continuation branch asserts the draft prose does not survive and that no error frame is emitted) and the sentence at docs/game/dice-and-skill-checks.md:74.

Context

Introduced deliberately by PR #5979 (merged to staging 2026-09-09), which closed #5956, #5959, #5960 and #5961; #5961 is the closest relative - it is the contradiction bug whose fix produced this fallback, so the draft's prose must not simply be kept. The behaviour is currently intended and documented (docs/game/dice-and-skill-checks.md:74) and pinned by the regression lane, so this is a request to soften a decided contract, not a broken invariant - please treat the test and doc updates as part of the change rather than closing it as working as designed. Unreleased on staging: v2.4.4 was tagged 2026-08-25, before the merge.

Found by an AI-assisted sweep of merged PR #5979 against its original issues, then re-verified against staging 52799569c on 2026-09-13. Please verify before fixing.

Originally created by @kolacheee on GitHub (Sep 13, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6127 Originally assigned to: @SpicyMarinara on GitHub. When the Game Master's turn needs dice, the engine rolls them and then makes one more request asking the model to rewrite the turn using the real results. If that second request fails - a dropped connection, a rate limit, a local model that died - the saved turn becomes a bare list of numbers ("Might check (DC 30): [12] = 12. Failure.") with the Game Master's writing gone, and the same numbers then appear a second time as log lines directly above it. Nothing tells the player the turn is degraded, and it stays that way after a reload. Keeping the real results instead of the model's guessed outcome is the intended behaviour and should stay. What this issue asks for is a better-looking failure: don't print the results as the turn's prose when the log already shows them, and tell the player a retry would help. ## How to reproduce (try it yourself) 1. Settings > Connections: select a local model connection you can stop by hand (Ollama, KoboldCpp, any sidecar). Open or create a Game-mode chat and turn Tools off in the chat's game settings. 2. Type `I try to force the rusted gate open.` and send. 3. Watch the reply stream in. When the words stop arriving and a dice card pops in, the screen sits completely still - that is the second request running, and it streams nothing. That still period is your window. 4. During that still period, stop the local model server (or pull the network). Timing inside the window does not matter: killing it before any rewrite text arrives and killing it after some has arrived give identical results. **What you'll see:** the whole turn is replaced by lines like `Might check (DC 30): [12] = 12. Failure.` and `3d1+2 = 5`, and the Game Master's prose you just watched stream in is gone. The identical results appear again as system log lines directly above that text. No error toast, no retry prompt - the turn just looks like a numbers-only reply, and it is still there after you reload the chat. **What should happen:** the rolls stay real and nothing guessed survives, but the turn should not read as a duplicated stat dump, and the player should be told the Game Master could not narrate the outcome so they know to swipe or regenerate. Control: run the same turn without killing the model. The turn is normal prose and each result is shown once, as log lines only. Deterministic variant, no timing needed: point a `custom` (OpenAI-compatible) connection at a small stub server that answers the first request normally (prose plus a `[dice: 3d1+2]` request) and destroys the socket for any request whose body contains `The engine has now rolled the requested dice`. Fires every time. ## Where it is `packages/server/src/routes/generate.routes.ts` at staging 52799569c, in the Game-mode roll-resolution block gated at :7937 (`chatMode === "game" && !input.impersonate`): - :8012-8024 - the catch around the rewrite request logs a warning and ends with `narration = "";`. Nothing is sent to the client, so the stream carries no error frame. - :8037 - `narration = narration.replace(createGameRollTagRegex(), "").trim() || resolvedSummary;` then :8038 joins it with the record tags. With `narration` empty, the summary string becomes the turn body. `packages/client/src/components/game/GameNarration.tsx:938-975` (`formatSkillCheckLogContent`, call sites :2563 and :2598) renders one system log line per dice roll and per check on every turn - that is where the second copy comes from. ## What's happening The summary string is built as a safety net so the real results are never lost. On the failure path it is written into the turn's visible text, and the client strips only the record tags, so the summary is what the player reads as narration. The per-turn log lines then render the same results again. Because the catch sends nothing to the client, the player gets a normal-looking saved turn with no sign that a request failed. ## Suggested fix Keep the rule that no guessed or partial outcome survives, and change only how the failure is presented: - On the failure path, stop using the summary as the turn's prose. The record tags already carry the results and the log already renders them, so the turn body can be empty or a single short neutral line; the summary stays as the durable record. - Send the client a notice when the rewrite request fails, so the turn can be marked as degraded with a retry affordance instead of looking like the Game Master answered in numbers. Both halves live in the same catch block and the same fallback line, so they belong in one change. Any change here must also move `scripts/regressions/game-text-dice.regression.ts` (its failed-continuation branch asserts the draft prose does not survive and that no error frame is emitted) and the sentence at `docs/game/dice-and-skill-checks.md:74`. ## Context Introduced deliberately by PR #5979 (merged to staging 2026-09-09), which closed #5956, #5959, #5960 and #5961; #5961 is the closest relative - it is the contradiction bug whose fix produced this fallback, so the draft's prose must not simply be kept. The behaviour is currently intended and documented (`docs/game/dice-and-skill-checks.md:74`) and pinned by the regression lane, so this is a request to soften a decided contract, not a broken invariant - please treat the test and doc updates as part of the change rather than closing it as working as designed. Unreleased on staging: v2.4.4 was tagged 2026-08-25, before the merge. Found by an AI-assisted sweep of merged PR #5979 against its original issues, then re-verified against staging 52799569c on 2026-09-13. Please verify before fixing.
bsakaguchi 2026-10-21 06:02:44 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Sep 13, 2026):

@SpicyMarinara is taking this report through the issue sweep in draft PR #6137, with Codex assisting. The affected current-code path has been checked; implementation and focused regression verification are in progress.

<!-- gh-comment-id:5651923698 --> @SpicyMarinara commented on GitHub (Sep 13, 2026): @SpicyMarinara is taking this report through the issue sweep in draft PR #6137, with Codex assisting. The affected current-code path has been checked; implementation and focused regression verification are in progress.
Author
Owner

@SpicyMarinara commented on GitHub (Sep 13, 2026):

Fixed in #6137, now merged to staging (e044997a2). Failed dice correction preserves actual rolls and shows a retry notice instead of duplicated bare results.

<!-- gh-comment-id:5652784291 --> @SpicyMarinara commented on GitHub (Sep 13, 2026): Fixed in #6137, now merged to staging (`e044997a2`). Failed dice correction preserves actual rolls and shows a retry notice instead of duplicated bare results.
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#3403
No description provided.