mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2694] [Issue]: Knowledge-router never excludes constant lorebook entries, double-injecting always-on lore #1340
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#1340
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 @kolacheee on GitHub (Jun 21, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2694
Originally assigned to: @SpicyMarinara on GitHub.
Summary
The knowledge-router is passed the full set of context-eligible lorebook entries including
constant: true(always-on) entries, even though the router's own contract says the route layer must drop constant entries (they are already injected unconditionally elsewhere). The result is that constant lorebook entries can be injected twice into the prompt.Expected behavior
Constant (always-on) lorebook entries are injected unconditionally by the normal lorebook pipeline; they should be excluded from the knowledge-router candidate set so they aren't injected a second time.
Actual behavior
The route builds
knowledgeRouterEntriesby filtering forenabled/ non-exhausted-ephemeral / context-filter-passing entries, then passes that set verbatim intoexecuteKnowledgeRouter. It never drops entries withconstant: true. The knowledge-router docstring explicitly states the route layer is responsible for droppingconstant: trueentries because they're already injected unconditionally — but that filtering step is missing, so a constant entry that also matches the router can be injected both by the constant path and by the router.How it breaks the pipeline
Code trace (staging @
b826f8f4):packages/server/src/routes/generate.routes.ts:4465-4488— buildsknowledgeRouterEntries(enabled / ephemeral / context-filter checks; noconstantfilter); passed toexecuteKnowledgeRouterat:4921.packages/server/src/services/agents/knowledge-router.ts:255-257— docstring stating the route layer must dropconstant: trueentries.keyword-scanner.ts:445-454.Steps to reproduce
constant: trueand content that the knowledge-router would also select as relevant.Suggested fix
Filter out
constant: trueentries when buildingknowledgeRouterEntries(generate.routes.ts:4465-4488), honoring the router's documented contract, so constant entries are injected only by the unconditional path.Environment
b826f8f4)Additional context
Found via a systematic multi-agent audit of conditional prompt insertion. Wastes context budget and double-weights always-on lore. Part of a set of conditional-injection issues filed together.
Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:
@SpicyMarinara commented on GitHub (Jun 21, 2026):
Fixed in branch
codex/spicy-issue-sweep-2026-06-21.What changed:
constant: truelorebook entries.Final repo checks will run after the full issue sweep.