[PR #6205] [MERGED] fix: address assigned tracker, Game lorebook and Gemini issues #7089

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

📋 Pull Request Information

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

Base: staging ← Head: fix/assigned-sweep-6202-6204


📝 Commits (4)

  • bc45c46 docs: track assigned issue sweep
  • 0d9262c fix: preserve tracker NPCs, Game lore placement and Gemini recovery
  • 33984bb Merge remote-tracking branch 'origin/staging' into fix/assigned-sweep-6202-6204
  • 31d1305 test(ui): retain tracker page for failure artifacts

📊 Changes

9 files changed (+485 additions, -28 deletions)

View changed files

📝 CHANGELOG.md (+4 -0)
📝 e2e/core-flows.e2e.ts (+99 -0)
📝 packages/client/src/features/tracker-panel/hooks/use-stat-icons.ts (+4 -2)
📝 packages/client/src/features/tracker-panel/hooks/use-tracker-sprite-lookup.ts (+4 -4)
📝 packages/server/src/routes/generate.routes.ts (+11 -8)
📝 packages/server/src/services/llm/providers/google.provider.ts (+27 -11)
📝 packages/server/src/services/professor-mari/workspace-agent.service.ts (+19 -2)
➕ scripts/regressions/game-lorebook-placement.regression.ts (+146 -0)
📝 scripts/regressions/mari-completion-frames.regression.ts (+171 -1)

📄 Description

Linked issue

Closes #6202
Closes #6203
Closes #6204

Why this change

Roleplay trackers can crash when a named NPC has no character-card ID. Game places both before/after lorebook entries after the Game Master context. Professor Mari can stop on an empty Gemini MALFORMED_FUNCTION_CALL response before her existing protocol repair loop can run.

This sweep covers the three open issues assigned to SpicyMarinara.

What changed

  • Reuse tracker string normalization and guard character IDs before trimming. Named NPCs, avatar name fallback, per-row stat ownership and saved tracker data are preserved.
  • Place Game before/after lore on the corresponding side of the Game Master context. Reuse the existing scanner and depth insertion; no new lorebook pipeline.
  • Request Mari's existing JSON command format from Google and Vertex, including uncatalogued models. Route only empty malformed-function-call failures into the existing bounded protocol repair loop, preserving reported usage and completed commands.
  • Record all three fixes in CHANGELOG.md under Unreleased. No dependency, version, translation or documentation changes.

Validation

  • Tracker regression reproduces the original undefined.trim crash before the fix. After the fix, desktop Chromium/light and mobile Chromium/dark pass, including reopen/reload, malformed IDs, avatar fallback, and exact stored-data preservation.

  • game-lorebook-placement.regression.ts: fails before the placement fix and passes afterward. Captures the final provider request through the real generation route for manual, Game-owned and Keeper-owned books, normal generation/regeneration, before/after placement, depths 0/1/2, role selection and duplicate suppression. Existing strict role formatting still folds mid-history system content into the prior user turn; disabling it preserves the authored role.

  • mari-completion-frames.regression.ts: reproduces the reported provider error before the fix and passes afterward. Covers Google/Vertex, streaming/buffered responses, successful recovery, retry exhaustion, cancellation, unrelated safety errors, visible output, billed usage and no replay of completed mutations.

  • Existing provider compatibility regression and server typecheck pass. Google/Vertex responses are mocked at the HTTP/SSE boundary; no paid/live model calls were made.

  • pnpm check passes (localization, formatting, lint/types and production build). pnpm regression:prompt passes all three prompt/attachment/context-fit suites.

  • 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

Manually verify the reporter's existing Roleplay chat in Firefox, inspect Game prompt placement with a real preset/provider, and use Professor Mari through the reported live Vertex model. No user data was used in the regression fixtures.

Local mobile WebKit proof is blocked by a native WebContent crash while resolving gradient color stops. An otherwise identical all-valid-ID control crashes too, separating this from the original JavaScript exception. The retained browser regression also runs on the hosted WebKit lane. Physical iPhone verification remains manual.

UI evidence

Synthetic tracker before/after screenshots (self-contained HTML; download and open to view the embedded images).

Summary by CodeRabbit

  • Bug Fixes
    • Roleplay Trackers now preserve named characters, avatars, and saved game data when character IDs are missing, invalid, or nonstandard.
    • Game lorebook entries remain correctly positioned before and after Game Master context, while depth and role settings continue to apply.
    • Professor Mari now requests structured JSON responses from Google and Vertex Gemini and more reliably recovers from malformed command responses without interrupting processing.

🔄 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/6205 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 9/14/2026 **Status:** ✅ Merged **Merged:** 9/14/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/assigned-sweep-6202-6204` --- ### 📝 Commits (4) - [`bc45c46`](https://github.com/Pasta-Devs/Marinara-Engine/commit/bc45c462fb984540d1f3c9ddcaedc80a757dc7ee) docs: track assigned issue sweep - [`0d9262c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0d9262c488cbc7c501bd40330b66eefc266251e8) fix: preserve tracker NPCs, Game lore placement and Gemini recovery - [`33984bb`](https://github.com/Pasta-Devs/Marinara-Engine/commit/33984bb6475420ddb46d48e9871a2b1bee137266) Merge remote-tracking branch 'origin/staging' into fix/assigned-sweep-6202-6204 - [`31d1305`](https://github.com/Pasta-Devs/Marinara-Engine/commit/31d130511db74f5e07a3593184879db35f45c4c5) test(ui): retain tracker page for failure artifacts ### 📊 Changes **9 files changed** (+485 additions, -28 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+4 -0) 📝 `e2e/core-flows.e2e.ts` (+99 -0) 📝 `packages/client/src/features/tracker-panel/hooks/use-stat-icons.ts` (+4 -2) 📝 `packages/client/src/features/tracker-panel/hooks/use-tracker-sprite-lookup.ts` (+4 -4) 📝 `packages/server/src/routes/generate.routes.ts` (+11 -8) 📝 `packages/server/src/services/llm/providers/google.provider.ts` (+27 -11) 📝 `packages/server/src/services/professor-mari/workspace-agent.service.ts` (+19 -2) ➕ `scripts/regressions/game-lorebook-placement.regression.ts` (+146 -0) 📝 `scripts/regressions/mari-completion-frames.regression.ts` (+171 -1) </details> ### 📄 Description ## Linked issue Closes #6202 Closes #6203 Closes #6204 ## Why this change Roleplay trackers can crash when a named NPC has no character-card ID. Game places both before/after lorebook entries after the Game Master context. Professor Mari can stop on an empty Gemini `MALFORMED_FUNCTION_CALL` response before her existing protocol repair loop can run. This sweep covers the three open issues assigned to SpicyMarinara. ## What changed - Reuse tracker string normalization and guard character IDs before trimming. Named NPCs, avatar name fallback, per-row stat ownership and saved tracker data are preserved. - Place Game before/after lore on the corresponding side of the Game Master context. Reuse the existing scanner and depth insertion; no new lorebook pipeline. - Request Mari's existing JSON command format from Google and Vertex, including uncatalogued models. Route only empty malformed-function-call failures into the existing bounded protocol repair loop, preserving reported usage and completed commands. - Record all three fixes in `CHANGELOG.md` under Unreleased. No dependency, version, translation or documentation changes. ## Validation - Tracker regression reproduces the original `undefined.trim` crash before the fix. After the fix, desktop Chromium/light and mobile Chromium/dark pass, including reopen/reload, malformed IDs, avatar fallback, and exact stored-data preservation. - `game-lorebook-placement.regression.ts`: fails before the placement fix and passes afterward. Captures the final provider request through the real generation route for manual, Game-owned and Keeper-owned books, normal generation/regeneration, before/after placement, depths 0/1/2, role selection and duplicate suppression. Existing strict role formatting still folds mid-history system content into the prior user turn; disabling it preserves the authored role. - `mari-completion-frames.regression.ts`: reproduces the reported provider error before the fix and passes afterward. Covers Google/Vertex, streaming/buffered responses, successful recovery, retry exhaustion, cancellation, unrelated safety errors, visible output, billed usage and no replay of completed mutations. - Existing provider compatibility regression and server typecheck pass. Google/Vertex responses are mocked at the HTTP/SSE boundary; no paid/live model calls were made. - `pnpm check` passes (localization, formatting, lint/types and production build). `pnpm regression:prompt` passes all three prompt/attachment/context-fit suites. - [ ] `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 Manually verify the reporter's existing Roleplay chat in Firefox, inspect Game prompt placement with a real preset/provider, and use Professor Mari through the reported live Vertex model. No user data was used in the regression fixtures. Local mobile WebKit proof is blocked by a native WebContent crash while resolving gradient color stops. An otherwise identical all-valid-ID control crashes too, separating this from the original JavaScript exception. The retained browser regression also runs on the hosted WebKit lane. Physical iPhone verification remains manual. ## UI evidence [Synthetic tracker before/after screenshots](https://gist.github.com/SpicyMarinara/dd55e6c671e83c94de26aeaff85bf297) (self-contained HTML; download and open to view the embedded images). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Roleplay Trackers now preserve named characters, avatars, and saved game data when character IDs are missing, invalid, or nonstandard. - Game lorebook entries remain correctly positioned before and after Game Master context, while depth and role settings continue to apply. - Professor Mari now requests structured JSON responses from Google and Vertex Gemini and more reliably recovers from malformed command responses without interrupting processing. <!-- 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:26 +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#7089
No description provided.