mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #1549] [Issue]: search_lorebook tool returns disabled and out-of-scope lorebook entries #794
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#794
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Xelvanis on GitHub (May 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1549
Originally assigned to: @Promansis on GitHub.
Summary
The built-in
search_lorebooktool still searches every stored lorebook entry, so disabled or out-of-scope lorebooks can be returned to tool-using agents.Expected behavior
search_lorebookshould only return entries that are allowed for the active chat/generation context, or its contract should clearly distinguish a global library search from active lorebook retrieval. Disabled lorebooks, disabled folders, and unrelated chat/character/persona scopes should not leak into agent tool results by default.Actual behavior
Native Tauri QA on
origin/refactorshowedsearch_lorebookreturning an entry from a disabled lorebook whenactivatedLorebookEntrieswas empty. Source inspection matches the behavior:src/engine/generation/tools-runtime.tsloads alllorebook-entries, merges them with activated entries, and scores them without checking the parent lorebook enabled/scope/folder state.Steps to reproduce
search_lorebooktool with a query matching that marker and an emptyactivatedLorebookEntriesinput.source: "stored".src/engine/generation/agent-runner.ts, which now scopes source lorebooks before loading entries.Impact area
Environment
origin/refactoratf120eb33v24.16.0, pnpm10.33.2rustc 1.95.0Logs, screenshots, or video
No public screenshot needed. Native QA proof returned the disabled-book entry from
search_lorebookwithsource: "stored". The relevant code path issrc/engine/generation/tools-runtime.ts, wheresearchLorebookTool(...)callsstorage.list("lorebook-entries")and scores all rows.Regression notes
Related to #1505, which was closed after the dedicated Knowledge Retrieval/Router executors were scoped. This appears to be a remaining built-in tool path rather than the exact executor path fixed for that issue.
Additional context
Acceptance criteria could be either:
search_lorebookis explicitly a global library search, then make that behavior visible and opt-in enough that disabled/out-of-scope entries are not surprising.Add regression coverage for disabled and unrelated lorebooks once the intended contract is chosen.
Template check
Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: