[GH-ISSUE #1785] [Issue]: Knowledge agents drop file sources and active-lorebook controls #868

Closed
opened 2026-10-21 05:22:38 +07:00 by bsakaguchi · 1 comment
Owner

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

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Knowledge Retrieval and Knowledge Router still expose knowledge-source setup, but several legacy-backed workflows appear broken in the current refactor runtime/UI:

  • Uploaded knowledge-source files can be selected for Knowledge Retrieval and are stored by Tauri, but the generation runtime only loads lorebook entries, so sourceFileIds never become retrieval material.
  • The runtime still honors useChatActiveLorebooks === false, but the Agent Editor no longer exposes the chat-active-lorebooks toggle. Users cannot choose active-chat lorebooks vs fixed manual sources from the UI.
  • The editor warning says Knowledge Retrieval and Knowledge Router run in parallel, but the current runtime executes them sequentially.

Expected behavior

Knowledge Retrieval should include selected uploaded files in its source material. Knowledge Retrieval and Knowledge Router should expose the chat-active lorebook source toggle when configuring the built-in agents. If both knowledge agents are enabled, the UI copy and runtime behavior should agree: either they run in parallel, or the warning should say they run sequentially.

Actual behavior

Static comparison found these gaps:

  • src/features/catalog/agents/components/AgentEditor.tsx persists sourceFileIds for Knowledge Retrieval, and src-tauri/src/commands/storage/knowledge.rs can extract knowledge-source text. However, src/engine/generation/agent-runner.ts only loads lorebook entries through loadKnowledgeSourceLorebookEntries() and passes only formatted lorebook content into executeKnowledgeRetrieval().
  • src/engine/generation/agent-runner.ts still has settings.useChatActiveLorebooks === false handling, but the current Agent Editor only loads/saves sourceLorebookIds and sourceFileIds; it does not expose the active-lorebook toggle that existed in the legacy editor.
  • The current Agent Editor warning says both knowledge agents "will run in parallel", but runKnowledgePreGenerationAgents() loops through knowledge agents with sequential await calls.

Steps to reproduce

  1. Configure the Knowledge Retrieval built-in agent.
  2. Upload and select a knowledge-source file, with no source lorebook selected or with file content that should clearly affect retrieval.
  3. Generate a response with agents enabled.
  4. Inspect the generation path or resulting knowledge injection.
  5. Open Knowledge Retrieval or Knowledge Router settings and look for the "use this chat's active lorebooks" source toggle.
  6. Enable both knowledge agents and compare the UI warning to the runtime path.

Impact area

  • Catalog resources
  • Runtime systems: generation, world-state, visuals, tracker, or haptics
  • React-free engine behavior, contracts, agents, or capability ports
  • Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime
  • App shell, navigation, startup, or providers
  • Chat mode
  • Roleplay mode
  • Game mode
  • Shared mode UI
  • Professor Mari or shell tools
  • Shared API wrapper or remote runtime routing
  • Docs, contributor workflow, or templates

Environment

  • Branch or commit: refactor checkout at cc81eb44
  • Run mode: static code audit; Tauri app not run
  • OS + version: not checked
  • Node + pnpm versions: not checked
  • Rust version, if relevant: not checked
  • Remote Runtime URL configured? not relevant
  • Provider, model, or integration, if relevant: not relevant

Logs, screenshots, or video

No runtime logs or screenshots. Evidence is from static code inspection.

Relevant current refactor paths:

  • src/features/catalog/agents/components/AgentEditor.tsx
  • src/engine/generation/agent-runner.ts
  • src-tauri/src/commands/storage/knowledge.rs
  • src-tauri/src/commands/storage/prompts.rs

Relevant legacy comparison paths:

  • packages/client/src/components/agents/AgentEditor.tsx
  • packages/server/src/routes/generate.routes.ts
  • packages/server/src/routes/generate/generate-route-utils.ts

Regression notes

Legacy generation loaded settings.sourceFileIds, resolved uploaded files, extracted file text, and appended it to Knowledge Retrieval material. Legacy Agent Editor also exposed a "Use this chat's active lorebooks" toggle and persisted useChatActiveLorebooks.

Issue #1050 previously covered making Knowledge Retrieval and Router use chat-active lorebooks. This report is about the remaining/current UI and runtime parity gaps after that closed work.

Additional context

Suggested repair direction:

  • Add a generation-runtime capability for reading selected knowledge-source text, then include settings.sourceFileIds in Knowledge Retrieval source material without importing Tauri or shared API adapters into engine code.
  • Restore the Agent Editor toggle for useChatActiveLorebooks for both Knowledge Retrieval and Knowledge Router.
  • Either run Knowledge Retrieval and Knowledge Router in parallel or change the warning copy to match sequential execution.

The local sidecar embedding difference appears intentional in the current refactor and is not included in this issue.

Template check

Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Xelvanis on GitHub (Jun 1, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1785 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Knowledge Retrieval and Knowledge Router still expose knowledge-source setup, but several legacy-backed workflows appear broken in the current refactor runtime/UI: - Uploaded knowledge-source files can be selected for Knowledge Retrieval and are stored by Tauri, but the generation runtime only loads lorebook entries, so `sourceFileIds` never become retrieval material. - The runtime still honors `useChatActiveLorebooks === false`, but the Agent Editor no longer exposes the chat-active-lorebooks toggle. Users cannot choose active-chat lorebooks vs fixed manual sources from the UI. - The editor warning says Knowledge Retrieval and Knowledge Router run in parallel, but the current runtime executes them sequentially. ## Expected behavior Knowledge Retrieval should include selected uploaded files in its source material. Knowledge Retrieval and Knowledge Router should expose the chat-active lorebook source toggle when configuring the built-in agents. If both knowledge agents are enabled, the UI copy and runtime behavior should agree: either they run in parallel, or the warning should say they run sequentially. ## Actual behavior Static comparison found these gaps: - `src/features/catalog/agents/components/AgentEditor.tsx` persists `sourceFileIds` for Knowledge Retrieval, and `src-tauri/src/commands/storage/knowledge.rs` can extract knowledge-source text. However, `src/engine/generation/agent-runner.ts` only loads lorebook entries through `loadKnowledgeSourceLorebookEntries()` and passes only formatted lorebook content into `executeKnowledgeRetrieval()`. - `src/engine/generation/agent-runner.ts` still has `settings.useChatActiveLorebooks === false` handling, but the current Agent Editor only loads/saves `sourceLorebookIds` and `sourceFileIds`; it does not expose the active-lorebook toggle that existed in the legacy editor. - The current Agent Editor warning says both knowledge agents "will run in parallel", but `runKnowledgePreGenerationAgents()` loops through knowledge agents with sequential `await` calls. ## Steps to reproduce 1. Configure the Knowledge Retrieval built-in agent. 2. Upload and select a knowledge-source file, with no source lorebook selected or with file content that should clearly affect retrieval. 3. Generate a response with agents enabled. 4. Inspect the generation path or resulting knowledge injection. 5. Open Knowledge Retrieval or Knowledge Router settings and look for the "use this chat's active lorebooks" source toggle. 6. Enable both knowledge agents and compare the UI warning to the runtime path. ## Impact area - [x] Catalog resources - [x] Runtime systems: generation, world-state, visuals, tracker, or haptics - [x] React-free engine behavior, contracts, agents, or capability ports - [x] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime - [ ] App shell, navigation, startup, or providers - [ ] Chat mode - [ ] Roleplay mode - [ ] Game mode - [ ] Shared mode UI - [ ] Professor Mari or shell tools - [ ] Shared API wrapper or remote runtime routing - [ ] Docs, contributor workflow, or templates ## Environment - Branch or commit: refactor checkout at `cc81eb44` - Run mode: static code audit; Tauri app not run - OS + version: not checked - Node + pnpm versions: not checked - Rust version, if relevant: not checked - Remote Runtime URL configured? not relevant - Provider, model, or integration, if relevant: not relevant ## Logs, screenshots, or video No runtime logs or screenshots. Evidence is from static code inspection. Relevant current refactor paths: - `src/features/catalog/agents/components/AgentEditor.tsx` - `src/engine/generation/agent-runner.ts` - `src-tauri/src/commands/storage/knowledge.rs` - `src-tauri/src/commands/storage/prompts.rs` Relevant legacy comparison paths: - `packages/client/src/components/agents/AgentEditor.tsx` - `packages/server/src/routes/generate.routes.ts` - `packages/server/src/routes/generate/generate-route-utils.ts` ## Regression notes Legacy generation loaded `settings.sourceFileIds`, resolved uploaded files, extracted file text, and appended it to Knowledge Retrieval material. Legacy Agent Editor also exposed a "Use this chat's active lorebooks" toggle and persisted `useChatActiveLorebooks`. Issue #1050 previously covered making Knowledge Retrieval and Router use chat-active lorebooks. This report is about the remaining/current UI and runtime parity gaps after that closed work. ## Additional context Suggested repair direction: - Add a generation-runtime capability for reading selected knowledge-source text, then include `settings.sourceFileIds` in Knowledge Retrieval source material without importing Tauri or shared API adapters into engine code. - Restore the Agent Editor toggle for `useChatActiveLorebooks` for both Knowledge Retrieval and Knowledge Router. - Either run Knowledge Retrieval and Knowledge Router in parallel or change the warning copy to match sequential execution. The local sidecar embedding difference appears intentional in the current refactor and is not included in this issue. ## Template check Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:22:38 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Jun 1, 2026):

Fixed on refactor in ccce568e.\n\nWhat changed:\n- Added a storage-gateway capability for reading extracted knowledge-source text and wired the shared API adapter to the existing knowledge_source_text command.\n- Knowledge Retrieval now builds source material from both selected lorebook entries and selected uploaded knowledge-source files.\n- Restored the Agent Editor control for useChatActiveLorebooks on Knowledge Retrieval and Knowledge Router, including explicit persistence and default built-in settings.\n- Updated the dual-knowledge-agent warning so the UI no longer claims the agents run in parallel while the runtime executes them in the pre-generation pass.\n\nVerification:\n- pnpm typecheck\n- pnpm check:architecture\n- git diff --check

<!-- gh-comment-id:4591812135 --> @SpicyMarinara commented on GitHub (Jun 1, 2026): Fixed on `refactor` in `ccce568e`.\n\nWhat changed:\n- Added a storage-gateway capability for reading extracted knowledge-source text and wired the shared API adapter to the existing `knowledge_source_text` command.\n- Knowledge Retrieval now builds source material from both selected lorebook entries and selected uploaded knowledge-source files.\n- Restored the Agent Editor control for `useChatActiveLorebooks` on Knowledge Retrieval and Knowledge Router, including explicit persistence and default built-in settings.\n- Updated the dual-knowledge-agent warning so the UI no longer claims the agents run in parallel while the runtime executes them in the pre-generation pass.\n\nVerification:\n- `pnpm typecheck`\n- `pnpm check:architecture`\n- `git diff --check`
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#868
No description provided.