[PR #2253] [MERGED] Fix Game Lorebook Keeper after session conclusion #5514

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2253
Author: @Promansis
Created: 6/4/2026
Status: ✅ Merged
Merged: 6/5/2026
Merged by: @Promansis

Base: refactor ← Head: fix/issue-2193-game-session-lorebook-keeper


📝 Commits (9)

  • 8076f1f Fix game session lorebook keeper conclusion
  • 9eff311 Harden game lorebook keeper regeneration
  • f425b3a Keep keeper regeneration cleanup atomic
  • dc02b67 Preserve keeper replacements after cleanup starts
  • f6a506a Stage keeper entries before finalizing
  • 9147932 Commit keeper replacements before stale cleanup
  • 7e947a6 Treat stale keeper cleanup as best effort
  • b0925fd Guard keeper replacement commit boundary
  • d2e4013 Confirm stale keeper entries inactive

📊 Changes

1 file changed (+356 additions, -78 deletions)

View changed files

📝 src/features/modes/game/api/game-api.ts (+356 -78)

📄 Description

Linked issue

Closes #2193

Why this change

  • Game session conclusion stopped running Game Lorebook Keeper automatically, so enabled game lorebooks were not created or updated after End Session. Setup also stored the keeper toggle under the wrong metadata key, leaving setup-created games disabled from the UI/runtime contract.

What changed

  • Store gameLorebookKeeperEnabled during game setup so setup-created games use the same key as settings, history, and runtime code.
  • Carry Game Lorebook Keeper metadata into new sessions.
  • Run Game Lorebook Keeper from the session conclusion path when enabled, recording running, success, or failed in gameLorebookKeeperLastRun.
  • Create or reuse the game-scoped keeper lorebook, attach it to the chat, and activate it.
  • Reuse the same keeper path for manual regenerate/retry and replace existing entries for the requested session.

Refactor impact

Primary owner:

Game mode

Impact areas reviewed:

  • Game setup metadata
  • Game session conclusion
  • Game session carryover
  • Game Lorebook Keeper regenerate/retry
  • Lorebook and lorebook-entry storage writes from the game feature API

Boundary notes:

  • Kept the change inside the game feature API owner.
  • Used existing shared storage and LLM API wrappers.
  • Did not add raw Tauri calls, remote-runtime routing, Rust commands, or cross-mode imports.

Pressure points touched:

  • src/features/modes/game/api/game-api.ts

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

  • pnpm typecheck passed locally.
  • pnpm check:architecture passed locally.
  • pnpm check passed locally.
  • No browser/provider runtime validation was performed.

Feature Discoverability

Check exactly one:

  • Updated src/features/shell/discovery/ because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool.
  • N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find.

Reason:

  • Restores existing Game Lorebook Keeper behavior; does not add a new discoverable feature.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

UI evidence

  • No visible UI changes.

🔄 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/2253 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 6/4/2026 **Status:** ✅ Merged **Merged:** 6/5/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `refactor` ← **Head:** `fix/issue-2193-game-session-lorebook-keeper` --- ### 📝 Commits (9) - [`8076f1f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8076f1f1aff860773dfb814d5fbd22a503a24e3a) Fix game session lorebook keeper conclusion - [`9eff311`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9eff311d0903d80e9b1db7ffad8c3781dd2d35b0) Harden game lorebook keeper regeneration - [`f425b3a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f425b3a55e3dd666d5a6a42545805aeab5089e9f) Keep keeper regeneration cleanup atomic - [`dc02b67`](https://github.com/Pasta-Devs/Marinara-Engine/commit/dc02b675a935afb4663535aef090fb2849775451) Preserve keeper replacements after cleanup starts - [`f6a506a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f6a506ab7f3b9e6633c7278f282fce4f35d649c9) Stage keeper entries before finalizing - [`9147932`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9147932c961fd1ace26e370dae79727fd852621a) Commit keeper replacements before stale cleanup - [`7e947a6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7e947a6a9813ec8544bae93c9100ff844f5f5268) Treat stale keeper cleanup as best effort - [`b0925fd`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b0925fd6bd49d322355abd1b85a91103c6550451) Guard keeper replacement commit boundary - [`d2e4013`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d2e40138f1c9f8554a96d43a61af694c666182cf) Confirm stale keeper entries inactive ### 📊 Changes **1 file changed** (+356 additions, -78 deletions) <details> <summary>View changed files</summary> 📝 `src/features/modes/game/api/game-api.ts` (+356 -78) </details> ### 📄 Description ## Linked issue Closes #2193 ## Why this change - Game session conclusion stopped running Game Lorebook Keeper automatically, so enabled game lorebooks were not created or updated after End Session. Setup also stored the keeper toggle under the wrong metadata key, leaving setup-created games disabled from the UI/runtime contract. ## What changed - Store `gameLorebookKeeperEnabled` during game setup so setup-created games use the same key as settings, history, and runtime code. - Carry Game Lorebook Keeper metadata into new sessions. - Run Game Lorebook Keeper from the session conclusion path when enabled, recording `running`, `success`, or `failed` in `gameLorebookKeeperLastRun`. - Create or reuse the game-scoped keeper lorebook, attach it to the chat, and activate it. - Reuse the same keeper path for manual regenerate/retry and replace existing entries for the requested session. ## Refactor impact Primary owner: Game mode Impact areas reviewed: - Game setup metadata - Game session conclusion - Game session carryover - Game Lorebook Keeper regenerate/retry - Lorebook and lorebook-entry storage writes from the game feature API Boundary notes: - Kept the change inside the game feature API owner. - Used existing shared storage and LLM API wrappers. - Did not add raw Tauri calls, remote-runtime routing, Rust commands, or cross-mode imports. Pressure points touched: - `src/features/modes/game/api/game-api.ts` ## Validation - [x] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [x] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes - `pnpm typecheck` passed locally. - `pnpm check:architecture` passed locally. - `pnpm check` passed locally. - No browser/provider runtime validation was performed. ## Feature Discoverability Check exactly one: - [ ] Updated `src/features/shell/discovery/` because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool. - [x] N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find. Reason: - Restores existing Game Lorebook Keeper behavior; does not add a new discoverable feature. ## Docs and release impact - [x] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [x] Confirmed this PR does not restore old staging/package-workspace/release claims ## UI evidence - No visible UI changes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:16:58 +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#5514
No description provided.