[PR #1754] [MERGED] fix(gacha-forge): keep Auto and Formation edits through background work; Send-only chat (1.24.8) #1951

Closed
opened 2026-11-07 16:38:16 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: staging ← Head: fix/gacha-forge-autoplay-formation-lag


📝 Commits (8)

  • 2fbb929 fix(gacha-forge): keep Auto and Formation edits through background work (1.24.8)
  • 621d40e fix(gacha-forge): only Send sends a character chat message (1.24.8)
  • 67f0a89 test(gacha-forge): pin Auto, Formation and refreshes through background work
  • 041cdd4 chore(gacha-forge): rebuild 1.24.8 catalog notes with the chat Enter change
  • f620673 fix(gacha-forge): address 1.24.8 review findings
  • 00b4078 fix(gacha-forge): don't start a battle after a failed Formation save
  • eaf6081 fix(gacha-forge): address second-round review of the 1.24.8 fixes
  • 597734a fix(gacha-forge): a throwing Formation save request cannot stall the queue

📊 Changes

19 files changed (+777 additions, -73 deletions)

View changed files

📝 .github/workflows/pull-request-checks.yml (+1 -0)
➕ artifacts/gacha-forge-1.24.8.zip (+0 -0)
📝 catalog/catalog.json (+10 -10)
📝 catalog/notes.json (+6 -6)
📝 catalog/v2/catalog.json (+10 -10)
📝 catalog/v2/notes.json (+6 -6)
📝 catalog/v3/catalog.json (+10 -10)
📝 catalog/v3/notes.json (+6 -6)
📝 packages/gacha-forge/CHANGELOG.md (+6 -0)
📝 packages/gacha-forge/bundle-patches.json (+116 -0)
📝 packages/gacha-forge/client.js (+107 -7)
📝 packages/gacha-forge/manifest.json (+7 -7)
📝 packages/gacha-forge/server.mjs (+6 -6)
📝 packages/gacha-forge/src/browser-presentation.mjs (+16 -0)
📝 packages/gacha-forge/src/formation-combat-client.mjs (+84 -0)
➕ tests/gacha-forge-background-work.regression.mjs (+311 -0)
📝 tests/gacha-forge-persona-voices.regression.mjs (+8 -5)
📝 tests/package-gacha-forge-audio.e2e.ts (+59 -0)
📝 tests/package-gacha-forge-formation.e2e.ts (+8 -0)

📄 Description

Pull request

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch to main.

Linked issue

Fixes #1752
Fixes #1753

The Enter-to-send change was requested by the maintainer in the same session. It has no separate issue.

Why this change

Three reports from playing Gacha Forge:

  • Story Auto turns itself off. In a scene, Auto switched itself off at random moments outside choices, and had to be turned on again.
  • Formation and lag during background generation. While a story generated in the background, Formation changes didn't stick and the whole UI was laggy.
  • Accidental sends. Enter in a character chat sent the message, so a stray Enter sent drafts early.

The first two share one root cause. The "working on…" chip's labels were part of every screen's render key. Whenever background work started or finished, the whole screen was rebuilt. That work includes scenes written ahead, expression portraits, portraits, combat guides and /state refreshes. Each rebuild:

  • remounted the story reader with Auto off and replayed the current line's voice;
  • reset the Formation editor, losing the picked unit, any drag in progress and the bench scroll position;
  • re-parsed all of the shell's CSS.

Hiding the tab also sent /beat/mark, which was mislabelled as "Writing the next scene". That rebuilt the reader twice.

What changed

Package gacha-forge 1.24.8. client.js and server.mjs are rebuilt from the new bundle-patches.json entries. The artifact, manifest and catalog are regenerated.

Client

  • The chip updates in place (syncForgeBusyChip). Only the worlds list, which shows the tasks, still redraws for them.
  • The reader keeps Auto per scene across any remount.
  • /beat/mark no longer shows a chip.
  • The chapter map's 4 s pre-forge poll redraws only when the status changed.
  • Formation saves run one at a time per world, and only the newest waiting edit is sent. If the last save fails, the saved team is reloaded.
  • A battle waits for a pending save before it reads the team, and loads whichever battle is open when the save ends. If the save failed, the battle doesn't start. You go back to where its team is picked (battle Formation, or the tower), which shows the saved team.
  • Reopening Formation waits, once per save, for edits still being saved.
  • The Chapters list reloads in place when the chip changes, so a chapter forged in the background (Keep playing) appears when it lands. It refills only when the reply brings different chapters, so cards don't re-deal for unrelated work.
  • Refreshes send /state?light=1.
  • The chat box no longer sends on Enter. Enter adds a new line, and only Send sends.

Server

  • /formation/save retries through the existing xn() re-read helper, rechecking the roster on each attempt, instead of failing on the first concurrent session write.
  • /state?light=1 skips Yr(), the full-history context-token count. Only boot uses it.
  • Served beats compute contextTokens outside the shared generation dedupe. The pre-forge chain skips it, because nothing reads it there.

Tests

  • New tests/gacha-forge-background-work.regression.mjs, registered in PR checks. It covers:
    • the save queue, the battle wait (including re-entry, backing out, a failed save, tower fights and run switches) and the reopen wait;
    • the shipped client.js chapters reload;
    • the shipped server's save retry and light refresh. The server case fails on the 1.24.7 bundle.
  • New audio e2e: Auto keeps playing the same reader through a busy start and end and a hidden tab, and stays on across a forced rebuild.
  • New formation e2e: a seat picked before background work starts still moves.
  • gacha-forge-persona-voices.regression.mjs now sends with the Send button and pins that Enter is unbound.

Package and security impact

  • Affected package IDs: gacha-forge
  • Engine compatibility impact: none; same Engine minimum.
  • New or changed permissions/entrypoints: none. GET /state accepts an optional light=1 query. Older clients without it get the same response as before.
  • Restart, storage, update, or uninstall impact: none. No storage format change.

Validation

  • node scripts/validate-catalog.mjs passes locally
  • git diff --check passes locally
  • Rebuilt every affected manifest, payload, artifact, and catalog entry
  • Installed or updated the affected package through Marinara Engine
  • Checked supported modes, restart behavior, and uninstall cleanup
  • Read and followed CONTRIBUTING.md

Manual verification notes

Agent-side checks:

  • All 68 tests/gacha-forge-*.regression.mjs files pass locally.
  • git diff --check is clean.
  • Review record.
    • Local CodeRabbit: the first run had 0 findings. After the review fixes it raised one major finding, reported twice: a failed save still started the waiting battle. That is fixed in 00b4078b1.
    • Adversarial review, round 1: four skeptic-verified areas. Three findings were confirmed and fixed in f6206738b: the chapters list was stale after Keep playing, the battle wait was latched to its first node, and a Formation reopen didn't wait for queued saves.
    • Rejected in round 1, with reasons:
      • The pre-forge revision still increases on unchanged polls. That is 1.24.7 code; it only causes an occasional extra chapter-map rebuild and never affects the reader or Formation.
      • Auto keeps advancing in a hidden tab. Hidden-tab timers are throttled, and voiced lines wait for the page to return, so nothing is lost. The release note now says Auto stays on.
    • Round 2 on the fixes: three findings confirmed and fixed in eaf60814c: the chapters list re-dealt its cards on every chip change, Formation reopens queued duplicate reads, and a failed save sent tower fights to Formation and could act on a world the player had left.
    • Final local CodeRabbit pass on eaf60814c: 0 findings.
    • Left pre-existing: a stale /battle reply can replace a re-entered fight. That race dates from 1.1.0 and this PR doesn't change it.
  • validate-catalog passes the changelog/notes check locally. The sparse worktree lacks other packages' zips, so the full run is left to CI.
  • The new e2e cases could not run locally because the local Engine checkout is not on staging. CI runs them in the Gacha Forge browser suites.

To verify by hand:

  • Turn Auto on in a story scene with Expression portraits on, and let it play through lines where new speakers appear. Auto stays on and keeps advancing.
  • With Auto on, switch to another tab and back. Auto is still on, and the current line's voice doesn't replay.
  • Start a chapter that pre-forges in the background (Keep playing), then open Formation. Pick a unit, wait for a background task to start or finish, then tap a seat. The unit moves, and it's still there after reopening Formation.
  • Make several quick Formation edits, then press Into battle at once. The battle preview shows the last team.
  • Stay on the chapter map while it pre-forges. It doesn't flicker or lose its scroll position every few seconds, and the beat marks and count still update.
  • In a character chat, press Enter. A new line is added and nothing is sent. Send still sends.
  • The worlds list still shows running tasks and still blocks switching while something generates.

Documentation impact

  • No documentation changes needed
  • Updated this README catalog and package guidance
  • Updated linked Marinara Engine documentation

UI evidence (if applicable)

No layout changes. The chip, reader and editor render as before.

🤖 Generated with Claude Code


🔄 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/1754 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/gacha-forge-autoplay-formation-lag` --- ### 📝 Commits (8) - [`2fbb929`](https://github.com/Pasta-Devs/Marinara-Agents/commit/2fbb9293401177250b9dc9f2420bbfc7587d4e90) fix(gacha-forge): keep Auto and Formation edits through background work (1.24.8) - [`621d40e`](https://github.com/Pasta-Devs/Marinara-Agents/commit/621d40ed5b841a03b2de2e41b3f8e60c2524a586) fix(gacha-forge): only Send sends a character chat message (1.24.8) - [`67f0a89`](https://github.com/Pasta-Devs/Marinara-Agents/commit/67f0a89c0bfc656fb89140e0f25a9b97e56b1713) test(gacha-forge): pin Auto, Formation and refreshes through background work - [`041cdd4`](https://github.com/Pasta-Devs/Marinara-Agents/commit/041cdd49e597f52bdbc40180a924aa8482d92d09) chore(gacha-forge): rebuild 1.24.8 catalog notes with the chat Enter change - [`f620673`](https://github.com/Pasta-Devs/Marinara-Agents/commit/f6206738bcc88e4f11993f7325329ff3c78b3920) fix(gacha-forge): address 1.24.8 review findings - [`00b4078`](https://github.com/Pasta-Devs/Marinara-Agents/commit/00b4078b15973cbd388c337660666973e98bb6f7) fix(gacha-forge): don't start a battle after a failed Formation save - [`eaf6081`](https://github.com/Pasta-Devs/Marinara-Agents/commit/eaf60814c291bb9f74460f4c518042387943de0d) fix(gacha-forge): address second-round review of the 1.24.8 fixes - [`597734a`](https://github.com/Pasta-Devs/Marinara-Agents/commit/597734a935a1dd84bdb85792599303fa824e9bb4) fix(gacha-forge): a throwing Formation save request cannot stall the queue ### 📊 Changes **19 files changed** (+777 additions, -73 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/pull-request-checks.yml` (+1 -0) ➕ `artifacts/gacha-forge-1.24.8.zip` (+0 -0) 📝 `catalog/catalog.json` (+10 -10) 📝 `catalog/notes.json` (+6 -6) 📝 `catalog/v2/catalog.json` (+10 -10) 📝 `catalog/v2/notes.json` (+6 -6) 📝 `catalog/v3/catalog.json` (+10 -10) 📝 `catalog/v3/notes.json` (+6 -6) 📝 `packages/gacha-forge/CHANGELOG.md` (+6 -0) 📝 `packages/gacha-forge/bundle-patches.json` (+116 -0) 📝 `packages/gacha-forge/client.js` (+107 -7) 📝 `packages/gacha-forge/manifest.json` (+7 -7) 📝 `packages/gacha-forge/server.mjs` (+6 -6) 📝 `packages/gacha-forge/src/browser-presentation.mjs` (+16 -0) 📝 `packages/gacha-forge/src/formation-combat-client.mjs` (+84 -0) ➕ `tests/gacha-forge-background-work.regression.mjs` (+311 -0) 📝 `tests/gacha-forge-persona-voices.regression.mjs` (+8 -5) 📝 `tests/package-gacha-forge-audio.e2e.ts` (+59 -0) 📝 `tests/package-gacha-forge-formation.e2e.ts` (+8 -0) </details> ### 📄 Description # Pull request > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch to `main`. ## Linked issue Fixes #1752 Fixes #1753 The Enter-to-send change was requested by the maintainer in the same session. It has no separate issue. ## Why this change Three reports from playing Gacha Forge: - **Story Auto turns itself off.** In a scene, Auto switched itself off at random moments outside choices, and had to be turned on again. - **Formation and lag during background generation.** While a story generated in the background, Formation changes didn't stick and the whole UI was laggy. - **Accidental sends.** Enter in a character chat sent the message, so a stray Enter sent drafts early. The first two share one root cause. The "working on…" chip's labels were part of every screen's render key. Whenever background work started or finished, the whole screen was rebuilt. That work includes scenes written ahead, expression portraits, portraits, combat guides and /state refreshes. Each rebuild: - remounted the story reader with Auto off and replayed the current line's voice; - reset the Formation editor, losing the picked unit, any drag in progress and the bench scroll position; - re-parsed all of the shell's CSS. Hiding the tab also sent `/beat/mark`, which was mislabelled as "Writing the next scene". That rebuilt the reader twice. ## What changed Package `gacha-forge` 1.24.8. `client.js` and `server.mjs` are rebuilt from the new `bundle-patches.json` entries. The artifact, manifest and catalog are regenerated. **Client** - The chip updates in place (`syncForgeBusyChip`). Only the worlds list, which shows the tasks, still redraws for them. - The reader keeps Auto per scene across any remount. - `/beat/mark` no longer shows a chip. - The chapter map's 4 s pre-forge poll redraws only when the status changed. - Formation saves run one at a time per world, and only the newest waiting edit is sent. If the last save fails, the saved team is reloaded. - A battle waits for a pending save before it reads the team, and loads whichever battle is open when the save ends. If the save failed, the battle doesn't start. You go back to where its team is picked (battle Formation, or the tower), which shows the saved team. - Reopening Formation waits, once per save, for edits still being saved. - The Chapters list reloads in place when the chip changes, so a chapter forged in the background (Keep playing) appears when it lands. It refills only when the reply brings different chapters, so cards don't re-deal for unrelated work. - Refreshes send `/state?light=1`. - The chat box no longer sends on Enter. Enter adds a new line, and only **Send** sends. **Server** - `/formation/save` retries through the existing `xn()` re-read helper, rechecking the roster on each attempt, instead of failing on the first concurrent session write. - `/state?light=1` skips `Yr()`, the full-history context-token count. Only boot uses it. - Served beats compute `contextTokens` outside the shared generation dedupe. The pre-forge chain skips it, because nothing reads it there. **Tests** - New `tests/gacha-forge-background-work.regression.mjs`, registered in PR checks. It covers: - the save queue, the battle wait (including re-entry, backing out, a failed save, tower fights and run switches) and the reopen wait; - the shipped `client.js` chapters reload; - the shipped server's save retry and light refresh. The server case fails on the 1.24.7 bundle. - New audio e2e: Auto keeps playing the same reader through a busy start and end and a hidden tab, and stays on across a forced rebuild. - New formation e2e: a seat picked before background work starts still moves. - `gacha-forge-persona-voices.regression.mjs` now sends with the Send button and pins that Enter is unbound. ## Package and security impact - Affected package IDs: `gacha-forge` - Engine compatibility impact: none; same Engine minimum. - New or changed permissions/entrypoints: none. `GET /state` accepts an optional `light=1` query. Older clients without it get the same response as before. - Restart, storage, update, or uninstall impact: none. No storage format change. ## Validation - [ ] `node scripts/validate-catalog.mjs` passes locally - [ ] `git diff --check` passes locally - [ ] Rebuilt every affected manifest, payload, artifact, and catalog entry - [ ] Installed or updated the affected package through Marinara Engine - [ ] Checked supported modes, restart behavior, and uninstall cleanup - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes Agent-side checks: - All 68 `tests/gacha-forge-*.regression.mjs` files pass locally. - `git diff --check` is clean. - **Review record.** - **Local CodeRabbit:** the first run had 0 findings. After the review fixes it raised one major finding, reported twice: a failed save still started the waiting battle. That is fixed in 00b4078b1. - **Adversarial review, round 1:** four skeptic-verified areas. Three findings were confirmed and fixed in f6206738b: the chapters list was stale after Keep playing, the battle wait was latched to its first node, and a Formation reopen didn't wait for queued saves. - **Rejected in round 1, with reasons:** - The pre-forge revision still increases on unchanged polls. That is 1.24.7 code; it only causes an occasional extra chapter-map rebuild and never affects the reader or Formation. - Auto keeps advancing in a hidden tab. Hidden-tab timers are throttled, and voiced lines wait for the page to return, so nothing is lost. The release note now says Auto *stays on*. - **Round 2 on the fixes:** three findings confirmed and fixed in eaf60814c: the chapters list re-dealt its cards on every chip change, Formation reopens queued duplicate reads, and a failed save sent tower fights to Formation and could act on a world the player had left. - **Final local CodeRabbit pass** on eaf60814c: 0 findings. - **Left pre-existing:** a stale `/battle` reply can replace a re-entered fight. That race dates from 1.1.0 and this PR doesn't change it. - `validate-catalog` passes the changelog/notes check locally. The sparse worktree lacks other packages' zips, so the full run is left to CI. - The new e2e cases could not run locally because the local Engine checkout is not on staging. CI runs them in the Gacha Forge browser suites. To verify by hand: - Turn Auto on in a story scene with Expression portraits on, and let it play through lines where new speakers appear. Auto stays on and keeps advancing. - With Auto on, switch to another tab and back. Auto is still on, and the current line's voice doesn't replay. - Start a chapter that pre-forges in the background (Keep playing), then open Formation. Pick a unit, wait for a background task to start or finish, then tap a seat. The unit moves, and it's still there after reopening Formation. - Make several quick Formation edits, then press Into battle at once. The battle preview shows the last team. - Stay on the chapter map while it pre-forges. It doesn't flicker or lose its scroll position every few seconds, and the beat marks and count still update. - In a character chat, press Enter. A new line is added and nothing is sent. Send still sends. - The worlds list still shows running tasks and still blocks switching while something generates. ## Documentation impact - [ ] No documentation changes needed - [ ] Updated this README catalog and package guidance - [ ] Updated linked Marinara Engine documentation ## UI evidence (if applicable) No layout changes. The chip, reader and editor render as before. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:38:16 +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#1951
No description provided.