mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #3205] [MERGED] [codex] Fix Knowledge Router prompt injection #5842
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#5842
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?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/3205
Author: @SpicyMarinara
Created: 7/4/2026
Status: ✅ Merged
Merged: 7/4/2026
Merged by: @SpicyMarinara
Base:
staging← Head:codex/fix-knowledge-router-injection📝 Commits (1)
a2441c6Fix Knowledge Router prompt injection📊 Changes
3 files changed (+119 additions, -19 deletions)
View changed files
📝
packages/server/src/services/agents/knowledge-router.ts(+52 -14)📝
packages/server/src/services/generation/runtime-agent-sections.ts(+11 -3)📝
scripts/regressions/prompt.regression.ts(+56 -2)📄 Description
Why
Knowledge Router could run successfully from the provider perspective while its prompt section disappeared from the main generation. Issue #3190 reports that a preset section like
This is where additional lore will be... {{agent::knowledge-router}}vanished when the agent was enabled, and selected lore was not visible in the assembled writing prompt.Closes #3190
Root Cause
Runtime agent cleanup treated an unresolved Knowledge Router placeholder as a reason to remove the entire wrapped prompt section. If the router returned an empty parsed result, or returned selected IDs under a common alias the parser did not recognize, the cleanup removed both the macro and the user's surrounding static prompt text.
What Changed
selectedEntryIds,selectedEntries,entries,entry_id, and array responses.Validation
{{agent::knowledge-router}}resolves empty.Local proof runs:
pnpm regression:promptpnpm --filter @marinara-engine/server lint🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.