[PR #4051] [MERGED] Add AI retry for Game character sheets #6222

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4051
Author: @SpicyMarinara
Created: 7/24/2026
Status: ✅ Merged
Merged: 7/24/2026
Merged by: @SpicyMarinara

Base: staging ← Head: agent/4048-regenerate-character-sheet


📝 Commits (4)

  • 6d7b418 Add AI character sheet retry
  • fe4569c Add character sheet retry regression coverage
  • 36cb4dc Address character sheet retry review feedback
  • fbed9cf Align prompt regressions with localized UI

📊 Changes

9 files changed (+718 additions, -54 deletions)

View changed files

📝 CHANGELOG.md (+4 -0)
📝 e2e/core-flows.e2e.ts (+262 -3)
📝 packages/client/src/components/game/GameCharacterSheet.tsx (+40 -30)
📝 packages/client/src/components/game/GameSurface.tsx (+12 -0)
📝 packages/client/src/hooks/use-game.ts (+41 -0)
📝 packages/client/src/localization/locales/en.json (+5 -4)
📝 packages/server/src/routes/game.routes.ts (+299 -0)
📝 packages/server/src/services/game/gm-prompts.ts (+4 -0)
📝 scripts/regressions/prompt.regression.ts (+51 -17)

📄 Description

Closes #4048

Why

Game Mode can create a good sheet during setup, but a malformed or outdated sheet has required tedious manual cleanup. The missing piece was a scoped AI retry that rebuilds only the selected Persona or party member without overwriting the saved sheet before the user reviews it.

What changed

  • adds a Retry action inside Character Sheet → Edit Sheet
  • builds the regeneration request from only the selected Persona, library character, or tracked NPC plus campaign state and context-fitted game history
  • requests one JSON character card and preserves the sheet’s existing RPG stats instead of accepting model-authored replacements
  • stages the regenerated card in the editor so Cancel discards it and Save remains the only persistence boundary
  • adds localized Retry/loading/help/result copy and release notes
  • logs the fitted prompt and raw response when UI debug mode or DEBUG_AGENTS is enabled
  • adds prompt-contract coverage and a real-endpoint Playwright regression for both desktop and mobile

Automated validation

  • pnpm check — passed after rebasing onto current staging
  • pnpm regression:prompt — passed
  • pnpm exec playwright test -c playwright.config.ts e2e/core-flows.e2e.ts --project=desktop-chromium --project=mobile-chromium --workers=1 --grep "Game character sheet Retry remains a draft until Save" — 2 passed
  • focused browser proof verifies selected-card, transcript, and prior-session context reach the provider; Retry remains a draft; Cancel restores the saved sheet; Save persists the reviewed draft; and saved RPG stats survive a conflicting model response

Manual test plan

  • Manually verify Retry with a real configured model on desktop.
  • Manually verify Cancel restores the saved sheet and does not mutate chat metadata.
  • Manually verify Save persists the reviewed draft.
  • Manually verify Persona, library-character, and tracked-NPC sheets.
  • Manually verify loading, error, and narrow-screen states on mobile.

Summary by CodeRabbit

  • New Features

    • Added a Retry action for Game Mode character sheets.
    • Regenerates only the selected character using campaign history and presents the result as an unsaved draft.
    • Original character sheets remain unchanged until the user selects Save.
    • Added localized labels, loading states, success messages, and error guidance.
  • Bug Fixes

    • Prevented accidental persistence of regenerated character sheets before saving.

🔄 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/4051 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 7/24/2026 **Status:** ✅ Merged **Merged:** 7/24/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `agent/4048-regenerate-character-sheet` --- ### 📝 Commits (4) - [`6d7b418`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6d7b41830256ff41675df63f974c54974d2ccd0a) Add AI character sheet retry - [`fe4569c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fe4569cb88ec79e7039e836e410863e8fbf47639) Add character sheet retry regression coverage - [`36cb4dc`](https://github.com/Pasta-Devs/Marinara-Engine/commit/36cb4dca64561389cf7b80734c129d022c9eaeef) Address character sheet retry review feedback - [`fbed9cf`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fbed9cfd8803d13deb6dda4ad04c0d3f38302413) Align prompt regressions with localized UI ### 📊 Changes **9 files changed** (+718 additions, -54 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+4 -0) 📝 `e2e/core-flows.e2e.ts` (+262 -3) 📝 `packages/client/src/components/game/GameCharacterSheet.tsx` (+40 -30) 📝 `packages/client/src/components/game/GameSurface.tsx` (+12 -0) 📝 `packages/client/src/hooks/use-game.ts` (+41 -0) 📝 `packages/client/src/localization/locales/en.json` (+5 -4) 📝 `packages/server/src/routes/game.routes.ts` (+299 -0) 📝 `packages/server/src/services/game/gm-prompts.ts` (+4 -0) 📝 `scripts/regressions/prompt.regression.ts` (+51 -17) </details> ### 📄 Description Closes #4048 ## Why Game Mode can create a good sheet during setup, but a malformed or outdated sheet has required tedious manual cleanup. The missing piece was a scoped AI retry that rebuilds only the selected Persona or party member without overwriting the saved sheet before the user reviews it. ## What changed - adds a **Retry** action inside **Character Sheet → Edit Sheet** - builds the regeneration request from only the selected Persona, library character, or tracked NPC plus campaign state and context-fitted game history - requests one JSON character card and preserves the sheet’s existing RPG stats instead of accepting model-authored replacements - stages the regenerated card in the editor so **Cancel** discards it and **Save** remains the only persistence boundary - adds localized Retry/loading/help/result copy and release notes - logs the fitted prompt and raw response when UI debug mode or `DEBUG_AGENTS` is enabled - adds prompt-contract coverage and a real-endpoint Playwright regression for both desktop and mobile ## Automated validation - `pnpm check` — passed after rebasing onto current `staging` - `pnpm regression:prompt` — passed - `pnpm exec playwright test -c playwright.config.ts e2e/core-flows.e2e.ts --project=desktop-chromium --project=mobile-chromium --workers=1 --grep "Game character sheet Retry remains a draft until Save"` — 2 passed - focused browser proof verifies selected-card, transcript, and prior-session context reach the provider; Retry remains a draft; Cancel restores the saved sheet; Save persists the reviewed draft; and saved RPG stats survive a conflicting model response ## Manual test plan - [ ] Manually verify Retry with a real configured model on desktop. - [ ] Manually verify Cancel restores the saved sheet and does not mutate chat metadata. - [ ] Manually verify Save persists the reviewed draft. - [ ] Manually verify Persona, library-character, and tracked-NPC sheets. - [ ] Manually verify loading, error, and narrow-screen states on mobile. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a **Retry** action for Game Mode character sheets. * Regenerates only the selected character using campaign history and presents the result as an unsaved draft. * Original character sheets remain unchanged until the user selects **Save**. * Added localized labels, loading states, success messages, and error guidance. * **Bug Fixes** * Prevented accidental persistence of regenerated character sheets before saving. <!-- 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:08:19 +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#6222
No description provided.