[PR #6216] [MERGED] feat(game): finish rolled turns in one request #7095

Closed
opened 2026-10-23 04:16:29 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6216
Author: @kolacheee
Created: 9/14/2026
Status: ✅ Merged
Merged: 9/15/2026
Merged by: @kolacheee

Base: staging ← Head: feat/one-request-dice


📝 Commits (10+)

  • 29e9d99 feat(game): add the one-request dice pass, wrapper and narration gate
  • 0c9f0d5 feat(game): roll and substitute one-request dice placeholders
  • fc3fba5 feat(game): hide streaming dice placeholders and mark the rolled number
  • 86050ad feat(game): keep the half a one-request dice roll selects
  • 6b915c6 feat(game): teach the one-request dice forms in the GM reminder
  • 577e1b7 feat(game): add the one-request dice switch, its notices and docs
  • 0db91d3 feat(game): add the sighted dice pool as a one-request dice sub-option
  • db052c3 test(game): close the mobile actions menu the one-request dice proof opens
  • 35a39a8 fix(game): correct one-request dice offsets, holds and continuation records
  • 15e6409 fix(game): hold the inline dice marker until the typewriter has revealed the segment

📊 Changes

51 files changed (+7973 additions, -126 deletions)

View changed files

📝 CHANGELOG.md (+5 -0)
📝 docs/game/dice-and-skill-checks.md (+44 -0)
📝 docs/game/getting-started.md (+2 -0)
➕ e2e/game-one-request-dice.e2e.ts (+574 -0)
📝 packages/client/src/components/chat/ChatSettingsDrawer.tsx (+27 -1)
📝 packages/client/src/components/game/AnimatedText.tsx (+2 -2)
📝 packages/client/src/components/game/GameNarration.tsx (+162 -15)
📝 packages/client/src/components/game/GameSurface.tsx (+12 -1)
📝 packages/client/src/components/game/game-narration-format.ts (+3 -1)
📝 packages/client/src/features/chat-settings/sections/FunctionCallingSection.tsx (+102 -1)
📝 packages/client/src/hooks/use-generate.ts (+17 -0)
➕ packages/client/src/lib/game-dice-markers.ts (+197 -0)
📝 packages/client/src/lib/game-tag-parser.ts (+15 -0)
📝 packages/client/src/localization/locales/en.json (+21 -0)
📝 packages/client/src/styles/globals.css (+11 -0)
📝 packages/server/src/db/file-backed-store.ts (+9 -0)
➕ packages/server/src/db/schema/game-dice-pools.ts (+38 -0)
📝 packages/server/src/db/schema/index.ts (+1 -0)
📝 packages/server/src/routes/generate.routes.ts (+250 -15)
➕ packages/server/src/services/game/chance-stream-filter.ts (+204 -0)

...and 31 more files

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #6215

Why this change

  • A Game turn that rolls dice costs two provider requests: the draft, then a full-context rewrite with the real numbers. The rewrite resends every message, so one skill check roughly doubles that turn's input tokens. The only lever today, turning off Narrate dice outcomes immediately, keeps one request by not narrating the outcome until the next turn.
  • This adds a per-chat switch, Finish rolled turns in one request, that removes the rewrite without showing the model a number first. The Game Master commits its prose blind, in one of three forms picked by what the outcome is, and the engine rolls afterwards. The model cannot steer an outcome it has not seen.
  • Both switches ship off. The parent switch is off per chat, and the sighted pool sub-option is off under it. The parent's default is meant to flip once playtests show two things the turn log can measure: that models reliably pick the right form from the prompt rule, and that the cost of the discarded half is acceptable on long narrations. The sub-option's default stays off independently of that.
  • The sparse-tag contract holds everywhere. Nothing here invents a die result, a modifier, a total or an outcome. An unreadable placeholder becomes a visible "(roll unavailable)" notice, never a number. An unreadable branch keeps the recorded roll and drops both halves. An overflowed or unrecognised check goes back sparse and is narrated next turn. A pass that throws saves the turn with the affected tags left sparse. In none of those paths is a second provider request made.
  • A turn can still cost more than one request in two cases, and the docs say so. With Enable Tool Use on and no tool filter, roll_dice is still in the resolved tool set, and a call to it is a full extra round. A Game tool connection other than Same as narrator always makes its own planning request. Neither is the rewrite this PR removes. The switch withdraws only the mode default that auto-attached roll_dice; a tool the user turned on is honoured as-is.
  • The sighted pool is the one mechanism that shows the model a number before it decides. It exists for an outcome where the number itself has to pick between three or more endings, which neither blind form can narrate in one pass. The Game Master can pick a DC it already knows the die will clear, and it can avoid calling for a check while holding a bad number. The engine cannot detect either. That is why it ships off and why its help text names the trade-off to the player.
  • Nothing changes how an already-saved transcript reads. Every parser change is additive: branch= and pool= are unknown attributes to every existing reader, the substituted number is saved bare, and the marker and notice ride on the message extra. With the switch off every touched path renders the bytes it renders today, and the lanes pin that. The one exception worth knowing: the display strippers on both sides now remove the four branch delimiter strings wherever they appear, keeping the prose between them, so a historical turn that happened to contain the literal text [on success] or [/branch] would render without it.
  • The prompt-caching findings gathered while measuring this are deliberately out of scope and will come as their own PR, so this one is reviewable as the dice mechanism alone.

What changed

  • The switch. gameOneRequestDice on chat metadata, rendered in Function Calling directly above Narrate dice outcomes immediately. While it is on, the narration toggle is shown disabled with a note and its stored value is never written, so turning the switch back off gives the player their old setting back. With a separate Game tool connection set, a line says the planning request still applies.
  • The pass. One session per turn with two insertion points in generate.routes.ts: the branch arm runs before spatial extraction and the package-verb strip, so a discarded half's commands are never collected; the placeholder arm runs right after the verb strip, so a placeholder inside a verb argument goes away with the verb. A throw-safe wrapper implements the failure contract. The narration-rewrite gate reads through shouldNarrateGameDiceOutcome, which returns false while the switch is on. Logic lives in packages/server/src/services/game/one-request-dice.ts so the lanes can drive it without HTTP.
  • Placeholders (packages/shared/src/utils/dice-placeholder.ts). An opener walk over [[roll:, not a bounded regex: every opener produces a bounded span, and every span is either rolled or replaced with the notice, so no raw span survives for a downstream stripper to half-eat. One NdM term, at most one flat number and at most one sheet name (2d6+3, 1d8+STR, 2d6+STR+3); an attribute name adds the attribute modifier, a skill name adds the skill bonus plus its governing attribute, exactly as a check does. Rolled with crypto.randomInt at parse time. Each roll is recorded in the dice history, the session log's dice line, and an audit record on the message extra.
  • Branch blocks (packages/shared/src/utils/dice-branch.ts). [skill_check ... branch="label"] followed by [branch: label] [on success] ... [on failure] ... [/branch]. Matching is by label and must be one-to-one; a nested block, a check tag inside a block, a missing or duplicated half, or an unmatched label drops the block and re-emits any check tag that sat inside it, so the ask is never lost. The matched check is rolled through the shipped resolver with the session's crypto roller and written back resolved, never left sparse for the client to roll a second time. Closer offsets are taken on the original string, not a lowercased copy. One stated cost: a block that wrote a half marker and never closed runs to the end of the turn and is dropped whole, because keeping one unrolled half would invent the outcome and keeping both would save two contradictory ones. The raw block is logged.
  • Streaming (chance-stream-filter.ts). A placeholder or branch block is held back from the token stream and the finished sentence arrives through content_replace. A malformed candidate releases only its own bounded prefix and the rest is re-scanned, so the output does not depend on how the provider chunks tokens.
  • Rendering. The substituted number is saved bare. A quiet dotted underline is reattached at render time from the audit record, with the dice breakdown as a hover, and only when the text says unambiguously which number it is; otherwise the plain number stands. title is added to the narration sanitizer's allowed attributes. The session log gains one plain line per thing the engine could not roll, and a toast fires only when something was declined.
  • The prompt rule (gm-prompts.ts). With the switch on, the DICE block is replaced by the case-by-case rule: branch block for a two-way outcome, placeholder for a bare number, sparse tag for a three-way outcome. The sheet-modifier sentence renders only when the chat has names to resolve, the roll_dice line only when the tool is actually in the resolved set, and the "stop at the attempt" line is dropped because it is the instruction the second request exists to serve. With the switch off the block is byte-identical to today.
  • roll reserved. roll, branch and on join RESERVED_GM_TAG_NAMES so a package verb cannot shadow the placeholder's inner tag or the block opener.
  • The sighted pool (dice-pool.ts, dice-pool.service.ts, game_dice_pools). Six values per size for d4 through d20 and two for d100, thrown with crypto.randomInt. The prompt shows the next value of each size (window 1 by default). The engine spends from the head in reading order, re-derives every number in the record from the queue and the sheet, bounds the DC to 1 to 40, records any disagreement with what the model wrote in pool= or rolls= without obeying it, and refills once per accepted turn so a swipe, a regenerate and a continuation all face the same queue. A size that goes three accepted turns unspent is rethrown (gameDicePoolAgeTurns, 0 turns it off). Overflow leaves the tag sparse with every number dropped; the client's own skill-check fallback is gated off in pool mode so an overflowed check cannot be rolled live.
  • Storage. A new game_dice_pools table, one row per chat, message and swipe, registered in the schema, the built-in table list, the shard key map, the lazy-unit set, both cascades and the launcher's sharded-table list, and deleted with the chat and on rewind. No STORAGE_VERSION bump: the table is additive and an older build simply does not read it, which is how the last five table additions were handled.
  • Coverage. Six new lanes (one-request-dice-gate, -placeholders, -branch, -rendering, -prompt, -pool) over the switch gate, the scanner cases, the branch matching and ordering proof, the marker matching, the prompt on and off, and the pool's consumption, refill, window, aging, overflow, mismatch and rewind rules. A new e2e, e2e/game-one-request-dice.e2e.ts, drives a scripted Game Master through a fake provider and asserts one request, one half kept, both numbers substituted, the markers, the dice history and the log, then the pool spending six values in order and leaving the seventh check unrolled with no live roll issued.
  • Docs. docs/game/dice-and-skill-checks.md gains the one-request section with all three forms, the caveats and the pool's trade-off; docs/game/getting-started.md gains a paragraph in the AI-calls section; CHANGELOG.md carries the entries under [Unreleased].

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

Run before opening: every piece of pnpm check separately, pnpm version:check, git diff --check, the six new lanes plus game-text-dice, capability-gm-verbs, capability-gm-verb-runtime, game-mode-dice-tool, gm-skill-check-resolution, message-sharding, prompt, experience-setup-config and the launcher format guard, e2e/game-one-request-dice.e2e.ts on desktop and mobile Chromium, e2e/game-native-dice.e2e.ts on desktop Chromium as a regression guard, and a local CodeRabbit sweep. Mobile WebKit cannot launch on the author's Fedora host, so CI proves that lane.

Still to verify by hand:

  • Manually verify that turning Finish rolled turns in one request on disables Narrate dice outcomes immediately with its note, leaves the stored value alone, and that turning it back off re-enables the toggle at the old value.
  • Manually verify with a real connection that a turn whose reply carries a branch block and a placeholder costs one provider request, that one half is kept and the delimiters are gone, that the number is substituted and underlined with the breakdown on hover, and that the roll appears under Logs.
  • Manually verify that a reply carrying a malformed placeholder (no closing ]]) saves "(roll unavailable)" in its place, shows the warning toast once, and adds the log line.
  • Manually verify that a reply carrying a sparse check with no branch block ends the turn without the outcome and that no second request is made.
  • Manually verify with Enable Tool Use on that roll_dice is still offered and that a call to it still works.
  • Manually verify the pool sub-option: the two number fields hold their defaults of 1 and 3, the prompt carries <dice_pool>, six d20 checks in one reply spend slots 1 to 6 in order, and a seventh is left sparse with the log line.
  • Manually verify a swipe of a pool turn faces the same shown values, and that a rewind past a pool turn does not resume from that turn's queue.
  • Check light and dark mode and a narrow viewport for the new switches, the indented pool block and the underlined numbers.

Docs and release impact

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

docs/game/dice-and-skill-checks.md and docs/game/getting-started.md changed and CHANGELOG.md gained entries under [Unreleased]. The [docs-i18n] follow-up for both pages is batched with the other pending pages rather than filed per PR. No version bump. No storage-format.json change, for the reason under Storage above.

UI evidence (if applicable)

Screenshots of the Function Calling section with the switch and the pool block, an underlined substituted number with its hover, and the session log with the dice lines, to be added by the author.

Summary by CodeRabbit

  • New Features

    • Added an optional Finish rolled turns in one request setting for Game chats, off by default.
    • Added blind dice placeholders and success/failure outcome branches.
    • Added an optional sighted dice pool with configurable pool size and aging.
    • Dice results appear inline with hover details and session-log entries.
    • Added notices when rolls or branches cannot be resolved.
  • Bug Fixes

    • Unreadable or unrollable content now displays a clear notice instead of an invented result.
  • Documentation

    • Updated Game Mode and dice/skill-check guides with setup instructions and behavior details.

🔄 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/6216 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 9/14/2026 **Status:** ✅ Merged **Merged:** 9/15/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/one-request-dice` --- ### 📝 Commits (10+) - [`29e9d99`](https://github.com/Pasta-Devs/Marinara-Engine/commit/29e9d9929acc71c3a35770f1e9c01deaacda0b19) feat(game): add the one-request dice pass, wrapper and narration gate - [`0c9f0d5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0c9f0d5b12c2438f0dbc9ff3345943505d2cb82b) feat(game): roll and substitute one-request dice placeholders - [`fc3fba5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fc3fba5f4be3c527b8c2866614caf60cb5406087) feat(game): hide streaming dice placeholders and mark the rolled number - [`86050ad`](https://github.com/Pasta-Devs/Marinara-Engine/commit/86050adf1406b068e14fa432fa0fdd042cae9bfc) feat(game): keep the half a one-request dice roll selects - [`6b915c6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6b915c60161ec14ec1f802080e23fdd8aadfdd7a) feat(game): teach the one-request dice forms in the GM reminder - [`577e1b7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/577e1b717ef2585edb6d8acec300ac0a3a7d2904) feat(game): add the one-request dice switch, its notices and docs - [`0db91d3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0db91d313a5560dd611030143cef9f61a2c8b30b) feat(game): add the sighted dice pool as a one-request dice sub-option - [`db052c3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/db052c31cd9f14681e9b19e3e17d970d0aa09779) test(game): close the mobile actions menu the one-request dice proof opens - [`35a39a8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/35a39a893ca9936adbf6da434378d15ca9048ea2) fix(game): correct one-request dice offsets, holds and continuation records - [`15e6409`](https://github.com/Pasta-Devs/Marinara-Engine/commit/15e640947889cf135aee49785b7e81f767083d1d) fix(game): hold the inline dice marker until the typewriter has revealed the segment ### 📊 Changes **51 files changed** (+7973 additions, -126 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+5 -0) 📝 `docs/game/dice-and-skill-checks.md` (+44 -0) 📝 `docs/game/getting-started.md` (+2 -0) ➕ `e2e/game-one-request-dice.e2e.ts` (+574 -0) 📝 `packages/client/src/components/chat/ChatSettingsDrawer.tsx` (+27 -1) 📝 `packages/client/src/components/game/AnimatedText.tsx` (+2 -2) 📝 `packages/client/src/components/game/GameNarration.tsx` (+162 -15) 📝 `packages/client/src/components/game/GameSurface.tsx` (+12 -1) 📝 `packages/client/src/components/game/game-narration-format.ts` (+3 -1) 📝 `packages/client/src/features/chat-settings/sections/FunctionCallingSection.tsx` (+102 -1) 📝 `packages/client/src/hooks/use-generate.ts` (+17 -0) ➕ `packages/client/src/lib/game-dice-markers.ts` (+197 -0) 📝 `packages/client/src/lib/game-tag-parser.ts` (+15 -0) 📝 `packages/client/src/localization/locales/en.json` (+21 -0) 📝 `packages/client/src/styles/globals.css` (+11 -0) 📝 `packages/server/src/db/file-backed-store.ts` (+9 -0) ➕ `packages/server/src/db/schema/game-dice-pools.ts` (+38 -0) 📝 `packages/server/src/db/schema/index.ts` (+1 -0) 📝 `packages/server/src/routes/generate.routes.ts` (+250 -15) ➕ `packages/server/src/services/game/chance-stream-filter.ts` (+204 -0) _...and 31 more files_ </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #6215 ## Why this change - A Game turn that rolls dice costs two provider requests: the draft, then a full-context rewrite with the real numbers. The rewrite resends every message, so one skill check roughly doubles that turn's input tokens. The only lever today, turning off **Narrate dice outcomes immediately**, keeps one request by not narrating the outcome until the next turn. - This adds a per-chat switch, **Finish rolled turns in one request**, that removes the rewrite without showing the model a number first. The Game Master commits its prose blind, in one of three forms picked by what the outcome is, and the engine rolls afterwards. The model cannot steer an outcome it has not seen. - **Both switches ship off.** The parent switch is off per chat, and the sighted pool sub-option is off under it. The parent's default is meant to flip once playtests show two things the turn log can measure: that models reliably pick the right form from the prompt rule, and that the cost of the discarded half is acceptable on long narrations. The sub-option's default stays off independently of that. - **The sparse-tag contract holds everywhere.** Nothing here invents a die result, a modifier, a total or an outcome. An unreadable placeholder becomes a visible "(roll unavailable)" notice, never a number. An unreadable branch keeps the recorded roll and drops both halves. An overflowed or unrecognised check goes back sparse and is narrated next turn. A pass that throws saves the turn with the affected tags left sparse. In none of those paths is a second provider request made. - **A turn can still cost more than one request in two cases, and the docs say so.** With **Enable Tool Use** on and no tool filter, `roll_dice` is still in the resolved tool set, and a call to it is a full extra round. A **Game tool connection** other than **Same as narrator** always makes its own planning request. Neither is the rewrite this PR removes. The switch withdraws only the mode default that auto-attached `roll_dice`; a tool the user turned on is honoured as-is. - **The sighted pool is the one mechanism that shows the model a number before it decides.** It exists for an outcome where the number itself has to pick between three or more endings, which neither blind form can narrate in one pass. The Game Master can pick a DC it already knows the die will clear, and it can avoid calling for a check while holding a bad number. The engine cannot detect either. That is why it ships off and why its help text names the trade-off to the player. - **Nothing changes how an already-saved transcript reads.** Every parser change is additive: `branch=` and `pool=` are unknown attributes to every existing reader, the substituted number is saved bare, and the marker and notice ride on the message extra. With the switch off every touched path renders the bytes it renders today, and the lanes pin that. The one exception worth knowing: the display strippers on both sides now remove the four branch delimiter strings wherever they appear, keeping the prose between them, so a historical turn that happened to contain the literal text `[on success]` or `[/branch]` would render without it. - The prompt-caching findings gathered while measuring this are deliberately out of scope and will come as their own PR, so this one is reviewable as the dice mechanism alone. ## What changed - **The switch.** `gameOneRequestDice` on chat metadata, rendered in Function Calling directly above **Narrate dice outcomes immediately**. While it is on, the narration toggle is shown disabled with a note and its stored value is never written, so turning the switch back off gives the player their old setting back. With a separate Game tool connection set, a line says the planning request still applies. - **The pass.** One session per turn with two insertion points in `generate.routes.ts`: the branch arm runs before spatial extraction and the package-verb strip, so a discarded half's commands are never collected; the placeholder arm runs right after the verb strip, so a placeholder inside a verb argument goes away with the verb. A throw-safe wrapper implements the failure contract. The narration-rewrite gate reads through `shouldNarrateGameDiceOutcome`, which returns false while the switch is on. Logic lives in `packages/server/src/services/game/one-request-dice.ts` so the lanes can drive it without HTTP. - **Placeholders** (`packages/shared/src/utils/dice-placeholder.ts`). An opener walk over `[[roll:`, not a bounded regex: every opener produces a bounded span, and every span is either rolled or replaced with the notice, so no raw span survives for a downstream stripper to half-eat. One NdM term, at most one flat number and at most one sheet name (`2d6+3`, `1d8+STR`, `2d6+STR+3`); an attribute name adds the attribute modifier, a skill name adds the skill bonus plus its governing attribute, exactly as a check does. Rolled with `crypto.randomInt` at parse time. Each roll is recorded in the dice history, the session log's dice line, and an audit record on the message extra. - **Branch blocks** (`packages/shared/src/utils/dice-branch.ts`). `[skill_check ... branch="label"]` followed by `[branch: label] [on success] ... [on failure] ... [/branch]`. Matching is by label and must be one-to-one; a nested block, a check tag inside a block, a missing or duplicated half, or an unmatched label drops the block and re-emits any check tag that sat inside it, so the ask is never lost. The matched check is rolled through the shipped resolver with the session's crypto roller and written back resolved, never left sparse for the client to roll a second time. Closer offsets are taken on the original string, not a lowercased copy. One stated cost: a block that wrote a half marker and never closed runs to the end of the turn and is dropped whole, because keeping one unrolled half would invent the outcome and keeping both would save two contradictory ones. The raw block is logged. - **Streaming** (`chance-stream-filter.ts`). A placeholder or branch block is held back from the token stream and the finished sentence arrives through `content_replace`. A malformed candidate releases only its own bounded prefix and the rest is re-scanned, so the output does not depend on how the provider chunks tokens. - **Rendering.** The substituted number is saved bare. A quiet dotted underline is reattached at render time from the audit record, with the dice breakdown as a hover, and only when the text says unambiguously which number it is; otherwise the plain number stands. `title` is added to the narration sanitizer's allowed attributes. The session log gains one plain line per thing the engine could not roll, and a toast fires only when something was declined. - **The prompt rule** (`gm-prompts.ts`). With the switch on, the DICE block is replaced by the case-by-case rule: branch block for a two-way outcome, placeholder for a bare number, sparse tag for a three-way outcome. The sheet-modifier sentence renders only when the chat has names to resolve, the `roll_dice` line only when the tool is actually in the resolved set, and the "stop at the attempt" line is dropped because it is the instruction the second request exists to serve. With the switch off the block is byte-identical to today. - **`roll` reserved.** `roll`, `branch` and `on` join `RESERVED_GM_TAG_NAMES` so a package verb cannot shadow the placeholder's inner tag or the block opener. - **The sighted pool** (`dice-pool.ts`, `dice-pool.service.ts`, `game_dice_pools`). Six values per size for d4 through d20 and two for d100, thrown with `crypto.randomInt`. The prompt shows the next value of each size (window 1 by default). The engine spends from the head in reading order, re-derives every number in the record from the queue and the sheet, bounds the DC to 1 to 40, records any disagreement with what the model wrote in `pool=` or `rolls=` without obeying it, and refills once per accepted turn so a swipe, a regenerate and a continuation all face the same queue. A size that goes three accepted turns unspent is rethrown (`gameDicePoolAgeTurns`, 0 turns it off). Overflow leaves the tag sparse with every number dropped; the client's own skill-check fallback is gated off in pool mode so an overflowed check cannot be rolled live. - **Storage.** A new `game_dice_pools` table, one row per chat, message and swipe, registered in the schema, the built-in table list, the shard key map, the lazy-unit set, both cascades and the launcher's sharded-table list, and deleted with the chat and on rewind. No `STORAGE_VERSION` bump: the table is additive and an older build simply does not read it, which is how the last five table additions were handled. - **Coverage.** Six new lanes (`one-request-dice-gate`, `-placeholders`, `-branch`, `-rendering`, `-prompt`, `-pool`) over the switch gate, the scanner cases, the branch matching and ordering proof, the marker matching, the prompt on and off, and the pool's consumption, refill, window, aging, overflow, mismatch and rewind rules. A new e2e, `e2e/game-one-request-dice.e2e.ts`, drives a scripted Game Master through a fake provider and asserts one request, one half kept, both numbers substituted, the markers, the dice history and the log, then the pool spending six values in order and leaving the seventh check unrolled with no live roll issued. - **Docs.** `docs/game/dice-and-skill-checks.md` gains the one-request section with all three forms, the caveats and the pool's trade-off; `docs/game/getting-started.md` gains a paragraph in the AI-calls section; `CHANGELOG.md` carries the entries under `[Unreleased]`. ## 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 Run before opening: every piece of `pnpm check` separately, `pnpm version:check`, `git diff --check`, the six new lanes plus `game-text-dice`, `capability-gm-verbs`, `capability-gm-verb-runtime`, `game-mode-dice-tool`, `gm-skill-check-resolution`, `message-sharding`, `prompt`, `experience-setup-config` and the launcher format guard, `e2e/game-one-request-dice.e2e.ts` on desktop and mobile Chromium, `e2e/game-native-dice.e2e.ts` on desktop Chromium as a regression guard, and a local CodeRabbit sweep. Mobile WebKit cannot launch on the author's Fedora host, so CI proves that lane. Still to verify by hand: - Manually verify that turning **Finish rolled turns in one request** on disables **Narrate dice outcomes immediately** with its note, leaves the stored value alone, and that turning it back off re-enables the toggle at the old value. - Manually verify with a real connection that a turn whose reply carries a branch block and a placeholder costs one provider request, that one half is kept and the delimiters are gone, that the number is substituted and underlined with the breakdown on hover, and that the roll appears under Logs. - Manually verify that a reply carrying a malformed placeholder (no closing `]]`) saves "(roll unavailable)" in its place, shows the warning toast once, and adds the log line. - Manually verify that a reply carrying a sparse check with no branch block ends the turn without the outcome and that no second request is made. - Manually verify with **Enable Tool Use** on that `roll_dice` is still offered and that a call to it still works. - Manually verify the pool sub-option: the two number fields hold their defaults of 1 and 3, the prompt carries `<dice_pool>`, six d20 checks in one reply spend slots 1 to 6 in order, and a seventh is left sparse with the log line. - Manually verify a swipe of a pool turn faces the same shown values, and that a rewind past a pool turn does not resume from that turn's queue. - Check light and dark mode and a narrow viewport for the new switches, the indented pool block and the underlined numbers. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) 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) `docs/game/dice-and-skill-checks.md` and `docs/game/getting-started.md` changed and `CHANGELOG.md` gained entries under `[Unreleased]`. The `[docs-i18n]` follow-up for both pages is batched with the other pending pages rather than filed per PR. No version bump. No `storage-format.json` change, for the reason under Storage above. ## UI evidence (if applicable) Screenshots of the Function Calling section with the switch and the pool block, an underlined substituted number with its hover, and the session log with the dice lines, to be added by the author. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added an optional **Finish rolled turns in one request** setting for Game chats, off by default. * Added blind dice placeholders and success/failure outcome branches. * Added an optional sighted dice pool with configurable pool size and aging. * Dice results appear inline with hover details and session-log entries. * Added notices when rolls or branches cannot be resolved. * **Bug Fixes** * Unreadable or unrollable content now displays a clear notice instead of an invented result. * **Documentation** * Updated Game Mode and dice/skill-check guides with setup instructions and behavior details. <!-- 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-23 04:16:29 +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#7095
No description provided.