mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #6147] A Game turn that rolled real dice can tell the rewrite step that no dice were rolled #3420
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#3420
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kolacheee on GitHub (Sep 13, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6147
Originally assigned to: @SpicyMarinara on GitHub.
On a connection with tool support, a Game turn can throw a real die, show its dice card, and then send a follow-up request that tells the model "No dice were rolled." The model is asked to rewrite the whole narration on that basis, so the new prose can end up disagreeing with the dice card sitting on the same message.
How to reproduce (try it yourself)
roll_dicetool attaches by itself on Game turns, so nothing else needs enabling.When the player attacks, call roll_dice for the attack and do not write its number as a [skill_check:] record. Request the damage by writing exactly [dice: 4d6kh3] in your narration and write no numbers yourself.I swing my greatsword at the ogre.What you'll see: that request reads
The engine has now rolled the requested dice:followed byNo dice were rolled., and then lists4d6kh3as unreadable notation. Meanwhile the attack roll's dice card is on the swipe and its result is in the Logs. The model is told nothing was rolled and asked to re-author the narration around that.What should happen: the list should name every roll the turn keeps, including the
roll_diceresult, so the rewrite is done with the numbers the player can actually see.A milder version of the same bug: swap the unreadable request for a readable one such as
[dice: 3d6]. The follow-up then fires and lists only the 3d6 damage. The attack roll's notation and total still appear nowhere in the request, while its card stays on the swipe.Worth knowing before trying: if the Game Master echoes the tool roll as a complete
[skill_check: ... rolls=... total=... result=...]record, which its own instructions ask it to do, nothing goes wrong. Either no rewrite fires at all, or the echoed numbers do reach the list. The problem only appears on mixed turns where a real tool roll is not written up as a record.Where it is
Staging
ac14dd704,packages/server/src/routes/generate.routes.ts, the Game outcome rewrite block::7974-7978resolvedSummaryis built from exactly three arrays:rolled.results,generalRolls.checkResults,generalRolls.diceRolls.toolDiceRollResultsis not one of them.:7984the prompt lineThe engine has now rolled the requested dice:\n${resolvedSummary || "No dice were rolled."}.:7970the gate, nowif (rolled.resolved || generalRolls.rolled || generalRolls.unresolved.length || rolled.sparse).:6961let narratorMessages = initialProviderMessages;, reassigned only inside theif (gameToolPlan)branch at:7318, so on the ordinary tool loop the follow-up prompt contains no tool call and no tool result.:8500extraUpdate.diceRollResults = [...retainedRolls, ...toolDiceRollResults];, which is where those same tool rolls get saved onto the swipe.What's happening
The rewrite's result list is assembled only from dice the engine rolled for text tags. Dice thrown through the
roll_dicetool live in a separate list that the summary never reads, even though that list is what gets persisted on the message and drawn as cards. When the turn's only text tag is unreadable notation, the summary comes out empty, and the empty-summary fallback string states that no dice were rolled. The rewrite prompt is also built from the pre-tool message list, so the tool round itself is not in context either.Suggested fix
Feed the tool rolls into the summary: add the
toolDiceRollResultsentries that were not already echoed as records toresolvedSummaryat:7974-7978. That fixes both halves at once, since a non-empty summary also stops theNo dice were rolled.fallback from firing on a turn that rolled dice.Please do not build the follow-up on the tool loop's message list instead. That list carries
toolrole entries and assistant tool calls, and the follow-up goes through the text-streamingprovider.chatinterface. The codebase's own pattern for getting tool results into that path is to flatten them into a user message, which is what thegameToolPlanbranch does at:7319-7322.Worth pinning with the first case in
scripts/regressions/game-text-dice.regression.tsthat attaches native tools. Every assertion in that lane today assertsoptions.tools === undefined, and its unsupported-notation case at:121-126pinsNo dice were rolledas correct, so the lane structurally cannot see this shape.Context
The missing tool rolls date to PR #5979 (issue #5961), which added the outcome rewrite for text tags. PR #6137 touched both
generate.routes.tsanddice.service.tsbut not this mechanism, and one sub-case got worse: the fix for #6128 widened the rewrite trigger to include unreadable notation and added theNo dice were rolled.fallback string, so a turn that rolls a real die and also writes unreadable notation now fires a follow-up that states no dice were rolled. Before #6137 that turn fired no follow-up at all. Related but different code paths: #6118 (the separate Game tool connection branch losing verbs) and #6127 (what happens when the follow-up request fails).Unreleased on staging: this landed after v2.4.4.
Found by an AI-assisted sweep and re-verified against staging
ac14dd704on 2026-09-13. Please verify before fixing.@SpicyMarinara commented on GitHub (Sep 13, 2026):
Codex is addressing this report on behalf of @SpicyMarinara in draft PR #6168 as part of the requested issue sweep. I will verify the reported path against staging and preserve existing behavior outside the narrow fix.