[PR #1598] [MERGED] feat(gacha-forge): add player choices and canonical story branches #1596

Closed
opened 2026-10-24 04:02:27 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Agents/pull/1598
Author: @SpicyMarinara
Created: 10/22/2026
Status: ✅ Merged
Merged: 10/23/2026
Merged by: @SpicyMarinara

Base: staging ← Head: feat/gacha-player-choices


📝 Commits (10+)

  • 8792695 fix(gacha-forge): align the chapter fullscreen icon with its header
  • cabed6d feat(gacha-forge): polish chapter controls and Units presentation
  • 4a99dde fix(gacha-forge): stabilize visible portraits and chapter controls
  • 49fbc36 test(gacha-forge): verify native keyboard focus and chapter presentation
  • 527e3c1 chore: start Gacha Forge player choices
  • 3fe7149 feat(gacha-forge): add player choices and canonical story branches
  • bf62a97 fix(gacha-forge): keep cached choice scenes responsive
  • 0b343e1 ci(gacha-forge): run choice and bundle rebuild regressions
  • 73654c0 test(gacha-forge): cover saved choice settings restoration
  • 98d8e4e Merge branch 'staging' into feat/gacha-player-choices

📊 Changes

27 files changed (+3262 additions, -75 deletions)

View changed files

📝 .github/workflows/pull-request-checks.yml (+3 -1)
➕ artifacts/gacha-forge-1.10.0.zip (+0 -0)
➕ artifacts/gacha-forge-1.9.1.zip (+0 -0)
📝 catalog/catalog.json (+9 -9)
📝 catalog/notes.json (+12 -0)
📝 catalog/v2/catalog.json (+9 -9)
📝 catalog/v2/notes.json (+12 -0)
📝 catalog/v3/catalog.json (+9 -9)
📝 catalog/v3/notes.json (+12 -0)
📝 packages/gacha-forge/CHANGELOG.md (+13 -0)
📝 packages/gacha-forge/README.md (+12 -0)
📝 packages/gacha-forge/bundle-patches.json (+232 -4)
📝 packages/gacha-forge/client.js (+341 -6)
📝 packages/gacha-forge/manifest.json (+6 -6)
📝 packages/gacha-forge/server.mjs (+355 -10)
📝 packages/gacha-forge/src/browser-presentation.mjs (+53 -0)
➕ packages/gacha-forge/src/player-choices-client.mjs (+266 -0)
➕ packages/gacha-forge/src/player-choices-en.mjs (+13 -0)
➕ packages/gacha-forge/src/player-choices-server.mjs (+343 -0)
📝 scripts/gacha-forge-bundle-patches.mjs (+13 -7)

...and 7 more files

📄 Description

Linked issue

Closes #1597. Depends on #1594: this branch includes its reviewed Gacha Forge 1.9.1 UI fixes until that PR is merged. Implementation owner: @SpicyMarinara (Codex).

Why this change

Players need to shape their protagonist's dialogue and actions while preserving a consistent first-play history. Replaying an alternative scene must not rewrite the decisions used to generate future chapters.

What changed

  • Release Gacha Forge 1.10.0 with Allow choices enabled by default under Settings → Story → Continuity. Choice controls show 2–4 themed dialogue/action options above the dialogue box, with wrapping, scrolling, keyboard access and 44px touch targets.
  • Generate every small-choice branch in the same response, play the chosen branch, then rejoin the shared story. Save first-play choices as canon; completed replays can explore other small branches without changing it. Resume restores canon.
  • Allow at most one optional big choice, at the final line of the final story node of a chapter or Character Story. Its selection is permanent. Future generation waits for the decision, uses only the chosen outcome, and retains it after compression or summary folding.
  • Validate choice structure and progression on the server, save canon with revision checks, and prevent generation/completion requests from bypassing unresolved choices. Pre-forging pauses at a decision and lets the player enter to choose. Cached scenes remain readable during background generation.
  • Preserve existing linear scenes and saved decisions when choices are disabled. Save Continuity settings as partial updates so changing pre-forging does not reset the choice toggle.
  • Maintain the new client, server and English UI sources through the bundle patch builder; regenerate both payloads, manifest, ZIP, catalog lanes and release notes. Add the real-route and deterministic rebuild regressions to CI.

Package and security impact

  • Package: gacha-forge; client playback/settings and server narration, persistence and continuity routes. No Engine source changes.
  • Compatibility: unchanged Engine >=2.5.1 <4.0.0, capability API 1.376, built against Engine staging commit 1c8d6575af6d7c55a9c4ead54e5f1df6c2cc61cc.
  • Permissions/entrypoints: unchanged. Choice submissions contain IDs; the server owns option text, branches and canonical decisions. Model labels render as escaped text.
  • Storage: optional choices and canon fields in existing beat documents; no storage migration. Existing linear saves remain valid. Updating the installed package requires the usual Engine restart.
  • Generation: choices-enabled narration requests 8192 output tokens instead of 4096, subject to the existing connection/context cap. Existing provider routing and prompt logging remain in use.
  • Artifact: gacha-forge-1.10.0.zip, 7,888,709 bytes; SHA-256 d7f2ea8c98615b7667d5452ef6c954c42807d9bbb5ae8ef6eee37f014de6644a. Prior versioned archives are retained.

Validation

Completed locally against the final generated payloads:

  • npm ci, npm run check, catalog-lane tests, package localization validation, catalog/archive/hash validation, release-note regressions and whitespace checks passed.
  • 29 real server-route cases passed: the shipped module and parser run against isolated revision-checked documents and deterministic model responses. Coverage includes default/off/legacy behavior, bounds and malformed output, first-play/replay/resume canon, concurrent saves, progression and generation barriers, terminal big choices, Character Stories, pre-forge continuation, compression/folded fate continuity and cached reads during a held model call.
  • Bundle rebuild and existing location/layout regressions passed. Source edits regenerate their own payload sections; replay is deterministic and restoring sources restores the original bytes.
  • 18 Playwright cases passed across desktop Chromium, mobile Chromium and iPhone WebKit emulation. New coverage includes choices/retry/keyboard/replay/resume, locked major decisions, fullscreen, Settings interaction, all five themes and four 280-character options. Existing Forge fullscreen/screen and Units cases also passed. Saved-off settings now load through the real /state client path, remain off after page reload, enable with exactly one partial update, preserve pre-forging, and reload enabled. Persistence responses are mocked; this does not prove server disk persistence. Both installed test copies match the final client/server hashes.
  • Local CodeRabbit found one valid cache-queue regression; reproduced it, fixed it and added regression coverage. The follow-up review of the implementation returned zero findings. Binary ZIP contents were verified by the catalog validator, not reviewed as source by CodeRabbit. Review of the added settings regression identified direct state seeding as insufficient load-path proof; replacing it with the actual client load API and UI navigation addressed that gap. The final local review of this test-only delta returned zero findings.

Review response

The reported settings argument mix-up is disproven by the shipped renderer: ny({contextTokens:t,warnTokens:e,run:a}) passes its run as forgeChoiceSettings(a). Vh is a separate handler scope with different bindings. Executing the actual generated pane and its settings caller renders saved-off, saved-on and default fixtures correctly; changing a to the suggested e passes numeric warnTokens and makes saved-off render checked. The new browser regression passes on the unchanged payload. This follow-up changes only the test; package version, payload hashes and archive bytes remain unchanged.

The other review hypotheses were traced against the shipped payloads. Browser re-render stops the beat player and calls attach(null) before replacing its dock; an actual-function remount harness verified a fresh connected pending panel and one resumed branch. Pending canonical-segment filtering is used for continuity/completion, while /beat serves raw saved segments and choices; reactivating a pending save preserved resumeAt, paused pre-forging without locking playback, and made zero model calls or document writes. The supported legacy plan shape remains covered by the route regressions. Manifest runtime inventory declares the built payloads, not src/*.mjs, and catalog/hash validation passed. The two nonblocking notes were retained: the saved-fate status is noninteractive, and once-visible portraits intentionally remain loaded.

Manual verification notes

The browser harness installs the built package into disposable compatible Engine instances. It uses synthetic saves and model/API fixtures; it does not prove physical-device rendering or live-model storytelling quality. Interactive Download Agents update, restart/offline restart and uninstall cleanup were not manually exercised for this feature.

  • Manually verify choices on a physical phone in portrait/landscape and fullscreen.
  • Manually generate a chapter and Character Story with a real provider; verify dialogue/action quality, both small branches and the next chapter's response to a major decision.
  • Manually verify an installed-package update, restart/offline restart and uninstall cleanup.

Documentation impact

Updated the package README, 1.10.0 changelog, generated release-note sidecars and semantic English UI catalog. Catalog membership, Engine compatibility and installation steps are unchanged.

UI evidence

Desktop and landscape mobile choice/settings screenshots, captured from the final package with synthetic fixtures. All five themes also have automated layout coverage.


🔄 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-Agents/pull/1598 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/22/2026 **Status:** ✅ Merged **Merged:** 10/23/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `feat/gacha-player-choices` --- ### 📝 Commits (10+) - [`8792695`](https://github.com/Pasta-Devs/Marinara-Agents/commit/8792695e8d989d9514cf22c7f0edc39acc5842d3) fix(gacha-forge): align the chapter fullscreen icon with its header - [`cabed6d`](https://github.com/Pasta-Devs/Marinara-Agents/commit/cabed6d1ac48bfdacad9689b01758fd7478bf89e) feat(gacha-forge): polish chapter controls and Units presentation - [`4a99dde`](https://github.com/Pasta-Devs/Marinara-Agents/commit/4a99dde8a7d9b106a4d257e859134e392ad82b05) fix(gacha-forge): stabilize visible portraits and chapter controls - [`49fbc36`](https://github.com/Pasta-Devs/Marinara-Agents/commit/49fbc3665f61d80b1edbd14327a6399a5c1fa774) test(gacha-forge): verify native keyboard focus and chapter presentation - [`527e3c1`](https://github.com/Pasta-Devs/Marinara-Agents/commit/527e3c1636349d240c1e90eb32d61bd4f7ede91f) chore: start Gacha Forge player choices - [`3fe7149`](https://github.com/Pasta-Devs/Marinara-Agents/commit/3fe714968fb15743401900cdfbf5f18b914087af) feat(gacha-forge): add player choices and canonical story branches - [`bf62a97`](https://github.com/Pasta-Devs/Marinara-Agents/commit/bf62a97e4581eca196d8963d0f88105789ebfc63) fix(gacha-forge): keep cached choice scenes responsive - [`0b343e1`](https://github.com/Pasta-Devs/Marinara-Agents/commit/0b343e13b584e73646f8fa2e27ec27fa9dd22f97) ci(gacha-forge): run choice and bundle rebuild regressions - [`73654c0`](https://github.com/Pasta-Devs/Marinara-Agents/commit/73654c04a248db318099e9c97526690f997aea43) test(gacha-forge): cover saved choice settings restoration - [`98d8e4e`](https://github.com/Pasta-Devs/Marinara-Agents/commit/98d8e4e8d4de79a721f3fbf9b7359ec5ce0daf95) Merge branch 'staging' into feat/gacha-player-choices ### 📊 Changes **27 files changed** (+3262 additions, -75 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/pull-request-checks.yml` (+3 -1) ➕ `artifacts/gacha-forge-1.10.0.zip` (+0 -0) ➕ `artifacts/gacha-forge-1.9.1.zip` (+0 -0) 📝 `catalog/catalog.json` (+9 -9) 📝 `catalog/notes.json` (+12 -0) 📝 `catalog/v2/catalog.json` (+9 -9) 📝 `catalog/v2/notes.json` (+12 -0) 📝 `catalog/v3/catalog.json` (+9 -9) 📝 `catalog/v3/notes.json` (+12 -0) 📝 `packages/gacha-forge/CHANGELOG.md` (+13 -0) 📝 `packages/gacha-forge/README.md` (+12 -0) 📝 `packages/gacha-forge/bundle-patches.json` (+232 -4) 📝 `packages/gacha-forge/client.js` (+341 -6) 📝 `packages/gacha-forge/manifest.json` (+6 -6) 📝 `packages/gacha-forge/server.mjs` (+355 -10) 📝 `packages/gacha-forge/src/browser-presentation.mjs` (+53 -0) ➕ `packages/gacha-forge/src/player-choices-client.mjs` (+266 -0) ➕ `packages/gacha-forge/src/player-choices-en.mjs` (+13 -0) ➕ `packages/gacha-forge/src/player-choices-server.mjs` (+343 -0) 📝 `scripts/gacha-forge-bundle-patches.mjs` (+13 -7) _...and 7 more files_ </details> ### 📄 Description ## Linked issue Closes #1597. Depends on #1594: this branch includes its reviewed Gacha Forge 1.9.1 UI fixes until that PR is merged. Implementation owner: @SpicyMarinara (Codex). ## Why this change Players need to shape their protagonist's dialogue and actions while preserving a consistent first-play history. Replaying an alternative scene must not rewrite the decisions used to generate future chapters. ## What changed - Release Gacha Forge 1.10.0 with **Allow choices** enabled by default under Settings → Story → Continuity. Choice controls show 2–4 themed dialogue/action options above the dialogue box, with wrapping, scrolling, keyboard access and 44px touch targets. - Generate every small-choice branch in the same response, play the chosen branch, then rejoin the shared story. Save first-play choices as canon; completed replays can explore other small branches without changing it. Resume restores canon. - Allow at most one optional big choice, at the final line of the final story node of a chapter or Character Story. Its selection is permanent. Future generation waits for the decision, uses only the chosen outcome, and retains it after compression or summary folding. - Validate choice structure and progression on the server, save canon with revision checks, and prevent generation/completion requests from bypassing unresolved choices. Pre-forging pauses at a decision and lets the player enter to choose. Cached scenes remain readable during background generation. - Preserve existing linear scenes and saved decisions when choices are disabled. Save Continuity settings as partial updates so changing pre-forging does not reset the choice toggle. - Maintain the new client, server and English UI sources through the bundle patch builder; regenerate both payloads, manifest, ZIP, catalog lanes and release notes. Add the real-route and deterministic rebuild regressions to CI. ## Package and security impact - **Package:** `gacha-forge`; client playback/settings and server narration, persistence and continuity routes. No Engine source changes. - **Compatibility:** unchanged Engine `>=2.5.1 <4.0.0`, capability API 1.376, built against Engine staging commit `1c8d6575af6d7c55a9c4ead54e5f1df6c2cc61cc`. - **Permissions/entrypoints:** unchanged. Choice submissions contain IDs; the server owns option text, branches and canonical decisions. Model labels render as escaped text. - **Storage:** optional choices and canon fields in existing beat documents; no storage migration. Existing linear saves remain valid. Updating the installed package requires the usual Engine restart. - **Generation:** choices-enabled narration requests 8192 output tokens instead of 4096, subject to the existing connection/context cap. Existing provider routing and prompt logging remain in use. - **Artifact:** `gacha-forge-1.10.0.zip`, 7,888,709 bytes; SHA-256 `d7f2ea8c98615b7667d5452ef6c954c42807d9bbb5ae8ef6eee37f014de6644a`. Prior versioned archives are retained. ## Validation Completed locally against the final generated payloads: - `npm ci`, `npm run check`, catalog-lane tests, package localization validation, catalog/archive/hash validation, release-note regressions and whitespace checks passed. - **29 real server-route cases passed:** the shipped module and parser run against isolated revision-checked documents and deterministic model responses. Coverage includes default/off/legacy behavior, bounds and malformed output, first-play/replay/resume canon, concurrent saves, progression and generation barriers, terminal big choices, Character Stories, pre-forge continuation, compression/folded fate continuity and cached reads during a held model call. - Bundle rebuild and existing location/layout regressions passed. Source edits regenerate their own payload sections; replay is deterministic and restoring sources restores the original bytes. - **18 Playwright cases passed** across desktop Chromium, mobile Chromium and iPhone WebKit emulation. New coverage includes choices/retry/keyboard/replay/resume, locked major decisions, fullscreen, Settings interaction, all five themes and four 280-character options. Existing Forge fullscreen/screen and Units cases also passed. Saved-off settings now load through the real `/state` client path, remain off after page reload, enable with exactly one partial update, preserve pre-forging, and reload enabled. Persistence responses are mocked; this does not prove server disk persistence. Both installed test copies match the final client/server hashes. - Local CodeRabbit found one valid cache-queue regression; reproduced it, fixed it and added regression coverage. The follow-up review of the implementation returned zero findings. Binary ZIP contents were verified by the catalog validator, not reviewed as source by CodeRabbit. Review of the added settings regression identified direct state seeding as insufficient load-path proof; replacing it with the actual client load API and UI navigation addressed that gap. The final local review of this test-only delta returned zero findings. ### Review response The reported settings argument mix-up is disproven by the shipped renderer: `ny({contextTokens:t,warnTokens:e,run:a})` passes its run as `forgeChoiceSettings(a)`. `Vh` is a separate handler scope with different bindings. Executing the actual generated pane and its settings caller renders saved-off, saved-on and default fixtures correctly; changing `a` to the suggested `e` passes numeric `warnTokens` and makes saved-off render checked. The new browser regression passes on the unchanged payload. This follow-up changes only the test; package version, payload hashes and archive bytes remain unchanged. The other review hypotheses were traced against the shipped payloads. Browser re-render stops the beat player and calls `attach(null)` before replacing its dock; an actual-function remount harness verified a fresh connected pending panel and one resumed branch. Pending canonical-segment filtering is used for continuity/completion, while `/beat` serves raw saved segments and choices; reactivating a pending save preserved `resumeAt`, paused pre-forging without locking playback, and made zero model calls or document writes. The supported legacy plan shape remains covered by the route regressions. Manifest runtime inventory declares the built payloads, not `src/*.mjs`, and catalog/hash validation passed. The two nonblocking notes were retained: the saved-fate status is noninteractive, and once-visible portraits intentionally remain loaded. ### Manual verification notes The browser harness installs the built package into disposable compatible Engine instances. It uses synthetic saves and model/API fixtures; it does not prove physical-device rendering or live-model storytelling quality. Interactive Download Agents update, restart/offline restart and uninstall cleanup were not manually exercised for this feature. - [ ] Manually verify choices on a physical phone in portrait/landscape and fullscreen. - [ ] Manually generate a chapter and Character Story with a real provider; verify dialogue/action quality, both small branches and the next chapter's response to a major decision. - [ ] Manually verify an installed-package update, restart/offline restart and uninstall cleanup. ## Documentation impact Updated the package README, 1.10.0 changelog, generated release-note sidecars and semantic English UI catalog. Catalog membership, Engine compatibility and installation steps are unchanged. ## UI evidence [Desktop and landscape mobile choice/settings screenshots](https://gist.github.com/SpicyMarinara/375fa12f46281389e61fccb2247d459a), captured from the final package with synthetic fixtures. All five themes also have automated layout coverage. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:02:27 +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-Agents#1596
No description provided.