[PR #839] [MERGED] Fix depth zero lorebook prompt injection #4801

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

📋 Pull Request Information

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

Base: main ← Head: fix/lorebook-depth-zero-injection


📝 Commits (1)

  • e99bcff fix: include depth zero lorebook injections (#837)

📊 Changes

2 files changed (+27 additions, -1 deletions)

View changed files

📝 packages/server/src/services/lorebook/prompt-injector.ts (+1 -1)
📝 packages/server/test/lorebook-processing.test.ts (+26 -0)

📄 Description

Linked issue

Closes #837

Why this change

  • Lorebook entries configured for depth injection at depth: 0 can activate and appear in Active World Info, but are dropped before prompt injection because the server only keeps depth entries with depth > 0.

What changed

  • Allows depth-injected lorebook entries with depth: 0 to reach the prompt depth injector.
  • Adds a regression test covering processActivatedEntries() output for depth-0 lorebook entries.

Validation

  • 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

  • Automated validation run by Codex:
    • pnpm --filter @marinara-engine/shared build && pnpm --dir packages/server exec tsx --import ./test/setup-env.ts --test test/lorebook-processing.test.ts --test-name-pattern "depth 0 lorebook entries"
    • pnpm check
  • Manual app/browser verification not performed.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

N/A - server-side prompt injection fix.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed lorebook entry selection to now properly include entries with depth value of 0 during processing. This ensures the complete set of relevant entries are injected at the appropriate depth levels.

Review Change Stack


🔄 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/839 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 5/14/2026 **Status:** ✅ Merged **Merged:** 5/14/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `main` ← **Head:** `fix/lorebook-depth-zero-injection` --- ### 📝 Commits (1) - [`e99bcff`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e99bcff800333620b13af13115a18f66ef8279e0) fix: include depth zero lorebook injections (#837) ### 📊 Changes **2 files changed** (+27 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/services/lorebook/prompt-injector.ts` (+1 -1) 📝 `packages/server/test/lorebook-processing.test.ts` (+26 -0) </details> ### 📄 Description ## Linked issue Closes #837 ## Why this change - Lorebook entries configured for depth injection at `depth: 0` can activate and appear in Active World Info, but are dropped before prompt injection because the server only keeps depth entries with `depth > 0`. ## What changed - Allows depth-injected lorebook entries with `depth: 0` to reach the prompt depth injector. - Adds a regression test covering `processActivatedEntries()` output for depth-0 lorebook entries. ## Validation - [x] `pnpm check` passes locally - [x] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Automated validation run by Codex: - `pnpm --filter @marinara-engine/shared build && pnpm --dir packages/server exec tsx --import ./test/setup-env.ts --test test/lorebook-processing.test.ts --test-name-pattern "depth 0 lorebook entries"` - `pnpm check` - Manual app/browser verification not performed. ## Docs and release impact - [x] No docs changes needed - [x] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [x] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) N/A - server-side prompt injection fix. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Fixed lorebook entry selection to now properly include entries with depth value of 0 during processing. This ensures the complete set of relevant entries are injected at the appropriate depth levels. <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/Pasta-Devs/Marinara-Engine/pull/839) <!-- review_stack_entry_end --> <!-- 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-22 04:10:46 +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#4801
No description provided.