[PR #1053] [MERGED] Let knowledge agents use chat active lorebooks #4903

Closed
opened 2026-10-22 04:11:35 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1053
Author: @cha1latte
Created: 5/20/2026
Status: ✅ Merged
Merged: 5/20/2026
Merged by: @cha1latte

Base: staging ← Head: feat/issue-1050-active-lorebooks


📝 Commits (2)

  • ebc75ba Implement chat-active lorebooks for knowledge agents
  • a394be5 Address review feedback: label lorebook toggle state

📊 Changes

4 files changed (+101 additions, -8 deletions)

View changed files

📝 packages/client/src/components/agents/AgentEditor.tsx (+54 -6)
📝 packages/server/src/routes/generate.routes.ts (+9 -2)
📝 packages/server/src/routes/generate/generate-route-utils.ts (+34 -0)
📝 packages/shared/src/types/agent.ts (+4 -0)

📄 Description

Linked issue

Closes #1050

Why this change

Knowledge Retrieval and Knowledge Router required fixed lorebook selections in agent settings, which made chat-scoped agents feel broken when a chat already had active lorebooks attached.

What changed

  • Added a useChatActiveLorebooks setting for Knowledge Retrieval and Knowledge Router.
  • Defaulted both knowledge agents to use the current chat's active lorebooks when no fixed lorebook override is selected.
  • Kept the manual lorebook picker as a fixed-source override.
  • Updated the Agent Editor copy to explain chat-active lorebook behavior and clarify that entry descriptions help Knowledge Router choose entries but are not triggers by themselves.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Codex ran pnpm --filter @marinara-engine/server exec tsx ../../scratch/issue-1050-knowledge-sources.ts; source resolution passed for chat-active defaults, fixed manual overrides, explicit disable, and duplicate/invalid manual IDs.
  • Codex ran pnpm check; it passed.
  • Codex ran a headless Chromium/CDP UI check against http://localhost:5173; the Knowledge Router editor showed the chat-active toggle, fixed-source override label, and description-not-trigger copy.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

No reviewer-visible screenshot embedded. Codex verified the Agent Editor UI copy with a headless browser check.

Summary by CodeRabbit

  • New Features
    • Knowledge Retrieval and Knowledge Router agents can use the current chat's active lorebooks.
    • Agent editor adds a toggle to enable/disable chat-active lorebook usage; built-in agents default to enabled.
    • Knowledge source UI shows a "fixed source override" note when fixed lorebooks are selected and updates tips/descriptions to reflect active vs fixed lorebook routing.
  • Behavior
    • Generation now respects the chosen active vs fixed lorebook source when resolving lorebook entries.

Review Change Stack


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/1053 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/20/2026 **Status:** ✅ Merged **Merged:** 5/20/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `staging` ← **Head:** `feat/issue-1050-active-lorebooks` --- ### 📝 Commits (2) - [`ebc75ba`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ebc75bab076218d495b044c8ff057c5cfbd8ceef) Implement chat-active lorebooks for knowledge agents - [`a394be5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a394be58efa7e20223af9db6022c376b65972725) Address review feedback: label lorebook toggle state ### 📊 Changes **4 files changed** (+101 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/agents/AgentEditor.tsx` (+54 -6) 📝 `packages/server/src/routes/generate.routes.ts` (+9 -2) 📝 `packages/server/src/routes/generate/generate-route-utils.ts` (+34 -0) 📝 `packages/shared/src/types/agent.ts` (+4 -0) </details> ### 📄 Description <!-- Target branch: `staging`. The default base in this UI is `main` (release branch). --> <!-- Change the base to `staging` before submitting unless this is a maintainer-approved mainline change. --> <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #1050 ## Why this change Knowledge Retrieval and Knowledge Router required fixed lorebook selections in agent settings, which made chat-scoped agents feel broken when a chat already had active lorebooks attached. ## What changed - Added a `useChatActiveLorebooks` setting for Knowledge Retrieval and Knowledge Router. - Defaulted both knowledge agents to use the current chat's active lorebooks when no fixed lorebook override is selected. - Kept the manual lorebook picker as a fixed-source override. - Updated the Agent Editor copy to explain chat-active lorebook behavior and clarify that entry descriptions help Knowledge Router choose entries but are not triggers by themselves. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Codex ran `pnpm --filter @marinara-engine/server exec tsx ../../scratch/issue-1050-knowledge-sources.ts`; source resolution passed for chat-active defaults, fixed manual overrides, explicit disable, and duplicate/invalid manual IDs. - Codex ran `pnpm check`; it passed. - Codex ran a headless Chromium/CDP UI check against `http://localhost:5173`; the Knowledge Router editor showed the chat-active toggle, fixed-source override label, and description-not-trigger copy. ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) No reviewer-visible screenshot embedded. Codex verified the Agent Editor UI copy with a headless browser check. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Knowledge Retrieval and Knowledge Router agents can use the current chat's active lorebooks. * Agent editor adds a toggle to enable/disable chat-active lorebook usage; built-in agents default to enabled. * Knowledge source UI shows a "fixed source override" note when fixed lorebooks are selected and updates tips/descriptions to reflect active vs fixed lorebook routing. * **Behavior** * Generation now respects the chosen active vs fixed lorebook source when resolving lorebook entries. <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/Pasta-Devs/Marinara-Engine/pull/1053?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:11:35 +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#4903
No description provided.