[GH-ISSUE #2164] [Issue]: Knowledge-router semantic shortlist is disabled in refactor (no embeddingSource is threaded in) #1073

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

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

Originally assigned to: @Promansis on GitHub.

Summary

The knowledge router's semantic/embedding shortlist ranks candidate lorebook entries by cosine similarity to the conversation. In the refactor the live knowledge-agent runner calls executeKnowledgeRouter without an embeddingSource or localEmbedder, and the embeddings helper no longer defaults to a local embedder, so the query embedding is null and the router silently falls back to keyword/activated-entry candidates only.

Expected behavior

The knowledge router should embed the conversation query and candidate entries, then shortlist the top-K most semantically similar entries, as legacy did by passing embeddingSource: memoryRecallEmbeddingSource.

Actual behavior

runKnowledgePreGenerationAgents calls executeKnowledgeRouter with no embeddingSource/localEmbedder (the options block has only activated/keyword entries and scan options). embedQuery returns null, semanticShortlistLorebookEntries returns null, and prepareKnowledgeRouterCandidates uses only keyword-scan + activated entries. The fix is available but unwired: generationEmbeddingSource(llm, connection) already exists and is used for memory-recall and active-lorebook scanning, just not threaded into the knowledge runner.

Steps to reproduce

  1. Configure a large lorebook with entries that are semantically relevant but share no surface keywords with recent messages.
  2. Use the knowledge router agent.
  3. Those entries are never surfaced as routing candidates; routing degrades to keyword-only matching.

Impact area

  • React-free engine behavior, contracts, agents, or capability ports

Environment

  • Branch or commit: refactor @ 93555d4b
  • Run mode: Tauri desktop
  • OS + version: Windows 11
  • Node + pnpm versions: n/a (static parity audit, main vs refactor)
  • Rust version, if relevant: n/a
  • Remote Runtime URL configured? not relevant

Regression notes

Worked in legacy (main @ c49f1d95). main: packages/server/src/routes/generate.routes.ts:6406-6427 (executeKnowledgeRouter called with embeddingSource). refactor @ 93555d4b: src/engine/generation/agent-runner.ts:560-573 (call has no embeddingSource); compounded by src/engine/generation-core/lorebooks/embeddings.ts:39-49 (embedQuery dropped the ?? localEmbed default that legacy packages/server/src/services/lorebook/embeddings.ts:71-76 had). generationEmbeddingSource() exists unused for this path at src/engine/generation/start-generation.ts:220.

Originally created by @Romuromylus on GitHub (Jun 4, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2164 Originally assigned to: @Promansis on GitHub. ## Summary The knowledge router's semantic/embedding shortlist ranks candidate lorebook entries by cosine similarity to the conversation. In the refactor the live knowledge-agent runner calls `executeKnowledgeRouter` without an `embeddingSource` or `localEmbedder`, and the embeddings helper no longer defaults to a local embedder, so the query embedding is `null` and the router silently falls back to keyword/activated-entry candidates only. ## Expected behavior The knowledge router should embed the conversation query and candidate entries, then shortlist the top-K most semantically similar entries, as legacy did by passing `embeddingSource: memoryRecallEmbeddingSource`. ## Actual behavior `runKnowledgePreGenerationAgents` calls `executeKnowledgeRouter` with no `embeddingSource`/`localEmbedder` (the options block has only activated/keyword entries and scan options). `embedQuery` returns `null`, `semanticShortlistLorebookEntries` returns `null`, and `prepareKnowledgeRouterCandidates` uses only keyword-scan + activated entries. The fix is available but unwired: `generationEmbeddingSource(llm, connection)` already exists and is used for memory-recall and active-lorebook scanning, just not threaded into the knowledge runner. ## Steps to reproduce 1. Configure a large lorebook with entries that are semantically relevant but share no surface keywords with recent messages. 2. Use the knowledge router agent. 3. Those entries are never surfaced as routing candidates; routing degrades to keyword-only matching. ## Impact area - [x] React-free engine behavior, contracts, agents, or capability ports ## Environment - Branch or commit: refactor @ 93555d4b - Run mode: Tauri desktop - OS + version: Windows 11 - Node + pnpm versions: n/a (static parity audit, main vs refactor) - Rust version, if relevant: n/a - Remote Runtime URL configured? not relevant ## Regression notes Worked in legacy (main @ c49f1d95). main: `packages/server/src/routes/generate.routes.ts:6406-6427` (executeKnowledgeRouter called with embeddingSource). refactor @ 93555d4b: `src/engine/generation/agent-runner.ts:560-573` (call has no embeddingSource); compounded by `src/engine/generation-core/lorebooks/embeddings.ts:39-49` (embedQuery dropped the `?? localEmbed` default that legacy `packages/server/src/services/lorebook/embeddings.ts:71-76` had). `generationEmbeddingSource()` exists unused for this path at `src/engine/generation/start-generation.ts:220`.
bsakaguchi 2026-10-21 05:26:20 +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#1073
No description provided.