[PR #3875] [MERGED] fix: recover Noodle profiles and align lorebook match priority #6138

Closed
opened 2026-10-23 04:07:25 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/3875
Author: @SpicyMarinara
Created: 7/20/2026
Status: ✅ Merged
Merged: 7/20/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/lorebook-semantic-keyword-parity


📝 Commits (1)

  • 948b64a fix: align lorebook priority and recover Noodle profiles

📊 Changes

7 files changed (+87 additions, -12 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 docs/lorebooks/semantic-search.md (+2 -0)
📝 packages/server/src/services/lorebook/index.ts (+3 -3)
📝 packages/server/src/services/lorebook/keyword-scanner.ts (+9 -5)
📝 packages/server/src/services/noodle/noodle-generated-profiles.ts (+11 -3)
📝 scripts/regressions/noodle-prompt.regression.ts (+19 -0)
📝 scripts/regressions/prompt.regression.ts (+41 -1)

📄 Description

Linked issue

Closes #3871

Why this change

  • Noodle timeline refreshes can fail with HTTP 500 during first-time bio generation when a local model wraps the expected profile object in a one-element array.
  • Lorebook keyword matches could displace semantic matches under a tight context budget even when the semantic entry had the higher configured priority.

What changed

  • Unwrap only an unambiguous one-object array around generated Noodle profile payloads while continuing to reject multi-object arrays.
  • Give semantic matches from the current scan context the same budget-selection tier as current keyword matches, leaving configured lorebook entry order to decide which entry fits.
  • Add regression coverage for both fixes, document lorebook budget behavior, and update the changelog.

Validation

Automated commands run successfully:

  • pnpm regression:noodle

  • pnpm regression:prompt

  • pnpm check

  • pnpm version:check

  • git diff --check

  • 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

  • Manually verify a first-time Noodle refresh with the affected local Kobold setup when profile generation returns [{ "profiles": [...] }].
  • Manually verify a lorebook with semantic search enabled where current keyword and semantic matches compete for a budget that fits only one entry.

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 UI changes.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed HTTP 500 errors during first-time Noodle profile generation for supported single-object wrapper responses.
    • Improved lorebook entry prioritization when matching entries exceed the available context budget.
    • Keyword and semantic matches now receive equal current-context priority, with configured entry order determining selection when needed.
  • Documentation

    • Clarified lorebook activation and prioritization behavior.
  • Tests

    • Added regression coverage for profile response parsing and mixed keyword/semantic lorebook matching.

🔄 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/3875 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 7/20/2026 **Status:** ✅ Merged **Merged:** 7/20/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/lorebook-semantic-keyword-parity` --- ### 📝 Commits (1) - [`948b64a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/948b64a2df00d18e5d2eec3215bc417557ee26e9) fix: align lorebook priority and recover Noodle profiles ### 📊 Changes **7 files changed** (+87 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `docs/lorebooks/semantic-search.md` (+2 -0) 📝 `packages/server/src/services/lorebook/index.ts` (+3 -3) 📝 `packages/server/src/services/lorebook/keyword-scanner.ts` (+9 -5) 📝 `packages/server/src/services/noodle/noodle-generated-profiles.ts` (+11 -3) 📝 `scripts/regressions/noodle-prompt.regression.ts` (+19 -0) 📝 `scripts/regressions/prompt.regression.ts` (+41 -1) </details> ### 📄 Description ## Linked issue Closes #3871 ## Why this change - Noodle timeline refreshes can fail with HTTP 500 during first-time bio generation when a local model wraps the expected profile object in a one-element array. - Lorebook keyword matches could displace semantic matches under a tight context budget even when the semantic entry had the higher configured priority. ## What changed - Unwrap only an unambiguous one-object array around generated Noodle profile payloads while continuing to reject multi-object arrays. - Give semantic matches from the current scan context the same budget-selection tier as current keyword matches, leaving configured lorebook entry order to decide which entry fits. - Add regression coverage for both fixes, document lorebook budget behavior, and update the changelog. ## Validation Automated commands run successfully: - `pnpm regression:noodle` - `pnpm regression:prompt` - `pnpm check` - `pnpm version:check` - `git diff --check` - [ ] `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 - Manually verify a first-time Noodle refresh with the affected local Kobold setup when profile generation returns `[{ "profiles": [...] }]`. - Manually verify a lorebook with semantic search enabled where current keyword and semantic matches compete for a budget that fits only one entry. ## 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 UI changes. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Fixed HTTP 500 errors during first-time Noodle profile generation for supported single-object wrapper responses. * Improved lorebook entry prioritization when matching entries exceed the available context budget. * Keyword and semantic matches now receive equal current-context priority, with configured entry order determining selection when needed. * **Documentation** * Clarified lorebook activation and prioritization behavior. * **Tests** * Added regression coverage for profile response parsing and mixed keyword/semantic lorebook matching. <!-- 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-23 04:07:25 +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#6138
No description provided.