[PR #2254] [MERGED] Fix Lorebook Keeper built-in fallback #5515

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/2254
Author: @Promansis
Created: 6/4/2026
Status: ✅ Merged
Merged: 6/5/2026
Merged by: @Promansis

Base: refactor ← Head: fix/issue-2194-lorebook-keeper-fallback


📝 Commits (1)

  • fd23be9 Fix Lorebook Keeper built-in fallback

📊 Changes

3 files changed (+81 additions, -45 deletions)

View changed files

📝 src/engine/generation/agent-runner.ts (+9 -38)
➕ src/engine/generation/built-in-agent-fallback.ts (+57 -0)
📝 src/engine/generation/start-generation.ts (+15 -7)

📄 Description

Linked issue

Closes #2194

Why this change

Lorebook Keeper backfill and automatic cadence could silently do nothing when a chat explicitly enabled the built-in lorebook-keeper but no saved agent config row existed.

Normal agent resolution already had built-in fallback behavior for explicit built-ins, but the Keeper-specific backfill lookup only scanned persisted agents rows. That made the backfill/cadence path miss the same built-in Keeper config users selected in chat metadata.

What changed

  • Added a shared engine helper for built-in agent fallback rows.
  • Updated normal generation agent resolution to use the shared fallback helper for explicit built-ins.
  • Updated the Lorebook Keeper backfill lookup to synthesize builtin:lorebook-keeper when chat metadata explicitly enables it and no persisted Keeper row exists.
  • Recognized both lorebook-keeper and builtin:lorebook-keeper active IDs in the Keeper backfill path.

Refactor impact

Primary owner:

engine generation

Impact areas reviewed:

  • Runtime generation agent resolution
  • Lorebook Keeper retry/backfill path
  • Automatic post-generation Keeper cadence, via the same backfill helper

Boundary notes:

  • Product behavior stays in src/engine/generation.
  • No React, shared API, Tauri, Rust storage, remote runtime, or persisted schema boundaries changed.

Pressure points touched:

  • None.

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 exec vitest run src/engine/generation/built-in-agent-fallback.temp.test.ts passed with a temporary local proof file that verified disabled built-ins remain opt-in by default and explicit Lorebook Keeper fallback resolves to builtin:lorebook-keeper; the temporary proof file was removed before commit.
  • pnpm typecheck passed.
  • pnpm check:architecture passed.
  • pnpm check passed.

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:

Bugfix only. This restores the existing Lorebook Keeper selection behavior for backfill/cadence paths and 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

Not applicable; 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/2254 **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-2194-lorebook-keeper-fallback` --- ### 📝 Commits (1) - [`fd23be9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fd23be97d29c7c42f773087b58a33d0f2f00f55c) Fix Lorebook Keeper built-in fallback ### 📊 Changes **3 files changed** (+81 additions, -45 deletions) <details> <summary>View changed files</summary> 📝 `src/engine/generation/agent-runner.ts` (+9 -38) ➕ `src/engine/generation/built-in-agent-fallback.ts` (+57 -0) 📝 `src/engine/generation/start-generation.ts` (+15 -7) </details> ### 📄 Description ## Linked issue Closes #2194 ## Why this change Lorebook Keeper backfill and automatic cadence could silently do nothing when a chat explicitly enabled the built-in `lorebook-keeper` but no saved agent config row existed. Normal agent resolution already had built-in fallback behavior for explicit built-ins, but the Keeper-specific backfill lookup only scanned persisted `agents` rows. That made the backfill/cadence path miss the same built-in Keeper config users selected in chat metadata. ## What changed - Added a shared engine helper for built-in agent fallback rows. - Updated normal generation agent resolution to use the shared fallback helper for explicit built-ins. - Updated the Lorebook Keeper backfill lookup to synthesize `builtin:lorebook-keeper` when chat metadata explicitly enables it and no persisted Keeper row exists. - Recognized both `lorebook-keeper` and `builtin:lorebook-keeper` active IDs in the Keeper backfill path. ## Refactor impact Primary owner: engine generation Impact areas reviewed: - Runtime generation agent resolution - Lorebook Keeper retry/backfill path - Automatic post-generation Keeper cadence, via the same backfill helper Boundary notes: - Product behavior stays in `src/engine/generation`. - No React, shared API, Tauri, Rust storage, remote runtime, or persisted schema boundaries changed. Pressure points touched: - None. ## 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 exec vitest run src/engine/generation/built-in-agent-fallback.temp.test.ts` passed with a temporary local proof file that verified disabled built-ins remain opt-in by default and explicit Lorebook Keeper fallback resolves to `builtin:lorebook-keeper`; the temporary proof file was removed before commit. - `pnpm typecheck` passed. - `pnpm check:architecture` passed. - `pnpm check` passed. ## 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: Bugfix only. This restores the existing Lorebook Keeper selection behavior for backfill/cadence paths and 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 Not applicable; 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#5515
No description provided.