[GH-ISSUE #6123] A check written with dice the app cannot read keeps the Game Master's made-up roll in the saved story #3400

Closed
opened 2026-10-21 06:02:42 +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/6123

Originally assigned to: @SpicyMarinara on GitHub.

When the Game Master writes a check using dice notation the app does not understand - a keep-highest pool like 6d10kh3, Fate dice 4dF, exploding dice 3d6! - the app quietly declines to roll it, but the numbers the Game Master invented for that check stay in the saved message. Nothing on screen shows those numbers, so the player never sees them, but they are read back to the model on every later turn as if the app had rolled them, and the narration built on that invented success is saved uncorrected.

How to reproduce (try it yourself)

  1. Start a Game Mode chat on a connection that reaches a real model. It has to be a normal Game Master turn (not an impersonated one).
  2. In the message box, type exactly:

I lean on the smuggler until he talks. (OOC: this world uses a d10 keep-highest pool, written as 6d10kh3. Put the check in the dice= attribute using that notation, fill in the rolls/modifier/total/result yourself, and narrate that I succeeded.)

Send it. (The instruction only makes it happen on the first try - a Game Master running Fate, World of Darkness or Cortex writes these notations on its own.)
3. Send any follow-up, for example I search him., then press Peek Prompt on that new turn.

What you'll see: the narration reads as a clean success. Above it, a bare line Intimidation check (DC 4) - no roll, no total, no success or failure word. No dice card and no check card appears, and nothing says the app declined to roll. But in step 3's Peek Prompt, the previous Game Master message still carries dice="6d10kh3" rolls="9|9" modifier="0" total="99" result="success" word for word. That is the model's own invention being handed back to it as fact. (There is no raw-text view of a Game Master message in Game Mode, so Peek Prompt is the only place in the app where this is visible.)

What should happen: the saved check should keep the request and drop the numbers - [skill_check: skill="Intimidation" dc="4" dice="6d10kh3"] - so nothing the app did not roll survives into the transcript or the next turn's prompt. The visible check line can stay exactly as it is.

For contrast, repeat step 2 asking for dice="6d10" instead. That notation parses, so the app rolls it for real, replaces the numbers, shows a card, and makes the Game Master rewrite the narration against the real outcome. The only difference is whether the dice label can be read.

Where it is

packages/server/src/services/game/dice.service.ts, resolveGameDiceRequests (staging 52799569c):

  • Lines 98-107: const notation = declared ? clampParsedDiceToLimits(declared) : null; then if (!notation || …) return original; - an unreadable dice= falls into the same blanket bail-out as everything else, and the tag comes back byte for byte.
  • Lines 117-124: the rewrite that strips invented numbers (return serializeSparseSkillCheckTag(tag)…, commented "Keep the request, but never keep numbers the model invented for it") sits after that return, so it is never reached for this shape.

Downstream: packages/server/src/routes/generate.routes.ts:7938-7960 - with no roll registered, if (rolled.resolved || generalRolls.rolled) is false, so the corrective narration pass never runs either.

What's happening

Before anything is rolled, the app tries to read the dice= label with its NdM+K grammar. If it cannot read it, it hands the whole check back untouched - request, invented rolls, invented total, invented success. That is the right call for the rolling part (the app does not implement keep-highest or exploding dice and should not pretend to), but it also skips the step that removes numbers nobody rolled, which the neighbouring case - a pool declared without its per-die threshold - already does. The same bail-out catches a check that says resolution="successes" with no dice= at all; that shape comes back with its invented numbers intact too, for the same reason and with the same one-branch fix.

Suggested fix

In resolveGameDiceRequests, split the unreadable-dice case out of the blanket return original. When the app cannot read the notation but the check carries rolls=, total= or result= it cannot vouch for, fall through to the sparse rewrite already used at line 123 instead of returning the original. The app still does not roll 6d10kh3 - it just stops preserving numbers nobody rolled. The existing lane scripts/regressions/game-text-dice.regression.ts already owns this contract (the threshold-less pool assertion at lines 52-59) and is the natural home for one more assertion.

One thing to decide before coding, because it is a judgement call: the code comment at packages/server/src/services/game/skill-check-resolution.service.ts:284-289 says non-d20 pools are "never audited and never rewritten … That holds for a malformed pool tag as much as a tidy one", and a check asking for advantage and disadvantage at once behaves identically and is documented as intended in docs/game/dice-and-skill-checks.md and CHANGELOG.md. So this may be the posture working as written. The argument for changing it is that a durable fabricated total="99" result="success" in the transcript is the exact thing the server-rolled work was built to end; the argument against is that for a system the app will never roll, the Game Master's own numbers are the only record of that roll, and blanking them costs the Game Master its continuity across turns without giving the player real dice. Note also that this change does not remove the larger half of the problem - the narrated success stays invented either way, since no roll means no corrective rewrite.

Context

Merged PR #5979 (which closed #5956, #5959, #5960 and #5961) added this file and introduced the sparse rewrite for a pool declared without its threshold; this is the remaining variant of the same complaint from #5959, best treated as a follow-up on it. Unreleased on staging (latest release tag is v2.4.4). The distinguishing line, so this is not read as already fixed by #5979: the whole difference is whether parseDiceNotation accepts the label at dice.service.ts:98 - dice="6d10" is rolled, dice="6d10" resolution="successes" with no threshold is rewritten sparse, dice="6d10kh3" keeps the invention, and dice="3d6+2" (the example the Game Master prompt gives at gm-prompts.ts:778) parses and works fine. A separate issue covers the same parse failure in a bare [dice: ...] request, where nothing is rolled and nothing is logged.

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

Related issue from the same sweep: #6128 (the bare [dice: ...] variant of the same parse failure).

Originally created by @kolacheee on GitHub (Sep 13, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6123 Originally assigned to: @SpicyMarinara on GitHub. When the Game Master writes a check using dice notation the app does not understand - a keep-highest pool like `6d10kh3`, Fate dice `4dF`, exploding dice `3d6!` - the app quietly declines to roll it, but the numbers the Game Master invented for that check stay in the saved message. Nothing on screen shows those numbers, so the player never sees them, but they are read back to the model on every later turn as if the app had rolled them, and the narration built on that invented success is saved uncorrected. ## How to reproduce (try it yourself) 1. Start a Game Mode chat on a connection that reaches a real model. It has to be a normal Game Master turn (not an impersonated one). 2. In the message box, type exactly: `I lean on the smuggler until he talks. (OOC: this world uses a d10 keep-highest pool, written as 6d10kh3. Put the check in the dice= attribute using that notation, fill in the rolls/modifier/total/result yourself, and narrate that I succeeded.)` Send it. (The instruction only makes it happen on the first try - a Game Master running Fate, World of Darkness or Cortex writes these notations on its own.) 3. Send any follow-up, for example `I search him.`, then press Peek Prompt on that new turn. **What you'll see:** the narration reads as a clean success. Above it, a bare line `Intimidation check (DC 4)` - no roll, no total, no success or failure word. No dice card and no check card appears, and nothing says the app declined to roll. But in step 3's Peek Prompt, the previous Game Master message still carries `dice="6d10kh3" rolls="9|9" modifier="0" total="99" result="success"` word for word. That is the model's own invention being handed back to it as fact. (There is no raw-text view of a Game Master message in Game Mode, so Peek Prompt is the only place in the app where this is visible.) **What should happen:** the saved check should keep the request and drop the numbers - `[skill_check: skill="Intimidation" dc="4" dice="6d10kh3"]` - so nothing the app did not roll survives into the transcript or the next turn's prompt. The visible check line can stay exactly as it is. For contrast, repeat step 2 asking for `dice="6d10"` instead. That notation parses, so the app rolls it for real, replaces the numbers, shows a card, and makes the Game Master rewrite the narration against the real outcome. The only difference is whether the dice label can be read. ## Where it is `packages/server/src/services/game/dice.service.ts`, `resolveGameDiceRequests` (staging 52799569c): - Lines 98-107: `const notation = declared ? clampParsedDiceToLimits(declared) : null;` then `if (!notation || …) return original;` - an unreadable `dice=` falls into the same blanket bail-out as everything else, and the tag comes back byte for byte. - Lines 117-124: the rewrite that strips invented numbers (`return serializeSparseSkillCheckTag(tag)…`, commented "Keep the request, but never keep numbers the model invented for it") sits *after* that return, so it is never reached for this shape. Downstream: `packages/server/src/routes/generate.routes.ts:7938-7960` - with no roll registered, `if (rolled.resolved || generalRolls.rolled)` is false, so the corrective narration pass never runs either. ## What's happening Before anything is rolled, the app tries to read the `dice=` label with its `NdM+K` grammar. If it cannot read it, it hands the whole check back untouched - request, invented rolls, invented total, invented success. That is the right call for the *rolling* part (the app does not implement keep-highest or exploding dice and should not pretend to), but it also skips the step that removes numbers nobody rolled, which the neighbouring case - a pool declared without its per-die threshold - already does. The same bail-out catches a check that says `resolution="successes"` with no `dice=` at all; that shape comes back with its invented numbers intact too, for the same reason and with the same one-branch fix. ## Suggested fix In `resolveGameDiceRequests`, split the unreadable-dice case out of the blanket `return original`. When the app cannot read the notation but the check carries `rolls=`, `total=` or `result=` it cannot vouch for, fall through to the sparse rewrite already used at line 123 instead of returning the original. The app still does not roll `6d10kh3` - it just stops preserving numbers nobody rolled. The existing lane `scripts/regressions/game-text-dice.regression.ts` already owns this contract (the threshold-less pool assertion at lines 52-59) and is the natural home for one more assertion. One thing to decide before coding, because it is a judgement call: the code comment at `packages/server/src/services/game/skill-check-resolution.service.ts:284-289` says non-d20 pools are "never audited and never rewritten … That holds for a malformed pool tag as much as a tidy one", and a check asking for advantage and disadvantage at once behaves identically and is documented as intended in `docs/game/dice-and-skill-checks.md` and `CHANGELOG.md`. So this may be the posture working as written. The argument for changing it is that a durable fabricated `total="99" result="success"` in the transcript is the exact thing the server-rolled work was built to end; the argument against is that for a system the app will never roll, the Game Master's own numbers are the only record of that roll, and blanking them costs the Game Master its continuity across turns without giving the player real dice. Note also that this change does not remove the larger half of the problem - the narrated success stays invented either way, since no roll means no corrective rewrite. ## Context Merged PR #5979 (which closed #5956, #5959, #5960 and #5961) added this file and introduced the sparse rewrite for a pool declared without its threshold; this is the remaining variant of the same complaint from #5959, best treated as a follow-up on it. Unreleased on staging (latest release tag is v2.4.4). The distinguishing line, so this is not read as already fixed by #5979: the whole difference is whether `parseDiceNotation` accepts the label at dice.service.ts:98 - `dice="6d10"` is rolled, `dice="6d10" resolution="successes"` with no threshold is rewritten sparse, `dice="6d10kh3"` keeps the invention, and `dice="3d6+2"` (the example the Game Master prompt gives at `gm-prompts.ts:778`) parses and works fine. A separate issue covers the same parse failure in a bare `[dice: ...]` request, where nothing is rolled and nothing is logged. Found by an AI-assisted sweep of merged PR #5979 against issue #5959, then re-verified against staging 52799569c on 2026-09-13. Please verify before fixing. Related issue from the same sweep: #6128 (the bare `[dice: ...]` variant of the same parse failure).
bsakaguchi 2026-10-21 06:02:42 +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:5651923308 --> @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). Unsupported dice notation no longer saves invented roll outcomes.

<!-- gh-comment-id:5652783400 --> @SpicyMarinara commented on GitHub (Sep 13, 2026): Fixed in #6137, now merged to staging (`e044997a2`). Unsupported dice notation no longer saves invented roll outcomes.
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#3400
No description provided.