[GH-ISSUE #2194] [Issue]: Lorebook Keeper backfill misses built-in fallback agent #1093

Closed
opened 2026-10-21 05:26:35 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Promansis on GitHub (Jun 4, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2194

Originally assigned to: @Promansis on GitHub.

Summary

Lorebook Keeper backfill and automatic cadence can silently do nothing when the chat enables the built-in Keeper but no saved agent config row exists.

Expected behavior

If a chat explicitly enables the built-in lorebook-keeper, backfill and automatic keeper cadence should resolve the same built-in fallback config used by normal generation, then process eligible assistant messages.

Actual behavior

The refactor normal agent resolver can synthesize built-in fallback rows, but the backfill path calls a separate lorebookKeeperAgent() helper that only scans persisted agents rows. If there is no saved Lorebook Keeper config row, backfill returns an empty result even though the chat metadata explicitly selected the built-in Keeper.

Steps to reproduce

  1. Use a chat with metadata.activeAgentIds containing lorebook-keeper.
  2. Do not create a saved agents row for Lorebook Keeper.
  3. Trigger Lorebook Keeper backfill or rely on automatic post-generation keeper cadence.
  4. Observe no keeper result is produced because the backfill helper cannot resolve a built-in fallback agent.

Impact area

  • App shell, navigation, startup, or providers
  • Catalog resources
  • Chat mode
  • Roleplay mode
  • Game mode
  • Shared mode UI
  • Runtime systems: generation, world-state, visuals, tracker, or haptics
  • React-free engine behavior, contracts, agents, or capability ports
  • Shared API wrapper or remote runtime routing
  • Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime
  • Docs, contributor workflow, or templates

Environment

  • Branch or commit: refactor branch, static parityscan against legacy main
  • Run mode: not runtime-tested
  • OS + version: not runtime-tested
  • Node + pnpm versions: not runtime-tested
  • Rust version, if relevant: not relevant
  • Remote Runtime URL configured? not relevant
  • Provider, model, or integration, if relevant: any provider used for generation agents

Logs, screenshots, or video

Static trace:

  • Refactor built-in fallback exists in normal agent resolver: src/engine/generation/agent-runner.ts:633-648, src/engine/generation/agent-runner.ts:919-926
  • Refactor Keeper backfill uses separate persisted-row-only helper: src/engine/generation/start-generation.ts:2199-2211
  • Refactor backfill exits empty when that helper finds no row: src/engine/generation/start-generation.ts:2416-2428
  • Refactor automatic post-generation path calls that same backfill helper: src/engine/generation/start-generation.ts:2904-2916, src/engine/generation/start-generation.ts:3035-3048
  • Legacy retry path synthesized built-in fallback configs for explicitly requested built-ins: main:packages/server/src/routes/generate/retry-agents-route.ts:500-506, main:packages/server/src/routes/generate/retry-agents-route.ts:633-660

Regression notes

This appears to regress the legacy built-in fallback behavior for Keeper-specific retry/backfill paths while normal generation fallback support still exists in refactor.

Additional context

This came from parityscan batch 6, row 07-LB-RUNTIME-keeper-agent.

Template check

Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Promansis on GitHub (Jun 4, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2194 Originally assigned to: @Promansis on GitHub. ## Summary Lorebook Keeper backfill and automatic cadence can silently do nothing when the chat enables the built-in Keeper but no saved agent config row exists. ## Expected behavior If a chat explicitly enables the built-in `lorebook-keeper`, backfill and automatic keeper cadence should resolve the same built-in fallback config used by normal generation, then process eligible assistant messages. ## Actual behavior The refactor normal agent resolver can synthesize built-in fallback rows, but the backfill path calls a separate `lorebookKeeperAgent()` helper that only scans persisted `agents` rows. If there is no saved Lorebook Keeper config row, backfill returns an empty result even though the chat metadata explicitly selected the built-in Keeper. ## Steps to reproduce 1. Use a chat with `metadata.activeAgentIds` containing `lorebook-keeper`. 2. Do not create a saved `agents` row for Lorebook Keeper. 3. Trigger Lorebook Keeper backfill or rely on automatic post-generation keeper cadence. 4. Observe no keeper result is produced because the backfill helper cannot resolve a built-in fallback agent. ## Impact area - [ ] App shell, navigation, startup, or providers - [ ] Catalog resources - [ ] Chat mode - [x] Roleplay mode - [ ] Game mode - [x] Shared mode UI - [x] Runtime systems: generation, world-state, visuals, tracker, or haptics - [x] React-free engine behavior, contracts, agents, or capability ports - [ ] Shared API wrapper or remote runtime routing - [ ] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime - [ ] Docs, contributor workflow, or templates ## Environment - Branch or commit: refactor branch, static parityscan against legacy `main` - Run mode: not runtime-tested - OS + version: not runtime-tested - Node + pnpm versions: not runtime-tested - Rust version, if relevant: not relevant - Remote Runtime URL configured? not relevant - Provider, model, or integration, if relevant: any provider used for generation agents ## Logs, screenshots, or video Static trace: - Refactor built-in fallback exists in normal agent resolver: `src/engine/generation/agent-runner.ts:633-648`, `src/engine/generation/agent-runner.ts:919-926` - Refactor Keeper backfill uses separate persisted-row-only helper: `src/engine/generation/start-generation.ts:2199-2211` - Refactor backfill exits empty when that helper finds no row: `src/engine/generation/start-generation.ts:2416-2428` - Refactor automatic post-generation path calls that same backfill helper: `src/engine/generation/start-generation.ts:2904-2916`, `src/engine/generation/start-generation.ts:3035-3048` - Legacy retry path synthesized built-in fallback configs for explicitly requested built-ins: `main:packages/server/src/routes/generate/retry-agents-route.ts:500-506`, `main:packages/server/src/routes/generate/retry-agents-route.ts:633-660` ## Regression notes This appears to regress the legacy built-in fallback behavior for Keeper-specific retry/backfill paths while normal generation fallback support still exists in refactor. ## Additional context This came from parityscan batch 6, row `07-LB-RUNTIME-keeper-agent`. ## Template check Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:26:35 +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#1093
No description provided.