[PR #5976] [MERGED] fix(lorebook): keep location-budget drops out of later scans #7009

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5976
Author: @SpicyMarinara
Created: 9/8/2026
Status: ✅ Merged
Merged: 9/9/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/lorebook-location-budget-5943


📝 Commits (6)

  • 1d8f84e chore: begin lorebook location budget fix for #5943
  • 0843eb4 fix(lorebook): preserve location budget through recursive scans
  • b68f47b Merge remote-tracking branch 'origin/staging' into fix/lorebook-location-budget-5943
  • c040215 Merge remote-tracking branch 'origin/staging' into fix/lorebook-location-budget-5943
  • 6bc286c Merge remote-tracking branch 'origin/staging' into fix/lorebook-location-budget-5943
  • 4724b4c docs: keep the lore budget fix beside related game fixes

📊 Changes

3 files changed (+55 additions, -7 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 packages/server/src/services/lorebook/index.ts (+8 -7)
📝 scripts/regressions/experience-lore-entries.regression.ts (+46 -0)

📄 Description

Linked issue

Closes #5943

Why this change

A forced constant entry dropped by the location budget is reintroduced by the ordinary or recursive scan. Its debug record then says it was skipped even though the prompt includes it.

What changed

Use the existing skipped-entry diagnostics to exclude location-budget drops from the ordinary and recursive scan inputs. Ambient and recursive lore still activates normally. Add a regression to the existing real-storage experience-lore suite and an Unreleased changelog entry.

Validation

Automated: pnpm check, pnpm regression:prompt, and node scripts/run-regressions.mjs --filter experience-lore-entries passed. The new regression failed on unchanged staging because the rejected constant entry was present; it passes with both ordinary and recursive scans after the fix.

  • pnpm check
  • Prompt regression proving ordinary and recursive scans respect the same location-budget drop.
  • Manually verify location lore diagnostics agree with the assembled prompt.

Docs and release impact

Unreleased changelog entry; no new setting or version change.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed location lorebook token-budget handling so entries rejected for exceeding the current-location budget remain excluded from keyword and recursive scans.
    • Prevented over-budget forced entries from being reactivated later in processing.
    • Improved consistency between skipped-entry diagnostics and the entries included in generated prompts.
    • Preserved existing behavior for eligible ambient entries and recursive child entries.
    • Ensured entries skipped due to budget limits are reported accurately and only once.

🔄 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/5976 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 9/8/2026 **Status:** ✅ Merged **Merged:** 9/9/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/lorebook-location-budget-5943` --- ### 📝 Commits (6) - [`1d8f84e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1d8f84e9e02727600765b6aaff7d17ee18a6fe37) chore: begin lorebook location budget fix for #5943 - [`0843eb4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0843eb4e2819e33d1f18b2cf0124deac0960d5b7) fix(lorebook): preserve location budget through recursive scans - [`b68f47b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b68f47b49e9a95173f1dbd7dece66ccb631c677b) Merge remote-tracking branch 'origin/staging' into fix/lorebook-location-budget-5943 - [`c040215`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c0402159a715ffa50717c61f693fad60b45bf0a6) Merge remote-tracking branch 'origin/staging' into fix/lorebook-location-budget-5943 - [`6bc286c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6bc286cc6537de49286f868ab9f55f586467111f) Merge remote-tracking branch 'origin/staging' into fix/lorebook-location-budget-5943 - [`4724b4c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4724b4ce91589fe71202095665e47016286a87f6) docs: keep the lore budget fix beside related game fixes ### 📊 Changes **3 files changed** (+55 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `packages/server/src/services/lorebook/index.ts` (+8 -7) 📝 `scripts/regressions/experience-lore-entries.regression.ts` (+46 -0) </details> ### 📄 Description ## Linked issue Closes #5943 ## Why this change A forced constant entry dropped by the location budget is reintroduced by the ordinary or recursive scan. Its debug record then says it was skipped even though the prompt includes it. ## What changed Use the existing skipped-entry diagnostics to exclude location-budget drops from the ordinary and recursive scan inputs. Ambient and recursive lore still activates normally. Add a regression to the existing real-storage experience-lore suite and an Unreleased changelog entry. ## Validation Automated: `pnpm check`, `pnpm regression:prompt`, and `node scripts/run-regressions.mjs --filter experience-lore-entries` passed. The new regression failed on unchanged staging because the rejected constant entry was present; it passes with both ordinary and recursive scans after the fix. - [ ] `pnpm check` - [ ] Prompt regression proving ordinary and recursive scans respect the same location-budget drop. - [ ] Manually verify location lore diagnostics agree with the assembled prompt. ## Docs and release impact Unreleased changelog entry; no new setting or version change. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Fixed location lorebook token-budget handling so entries rejected for exceeding the current-location budget remain excluded from keyword and recursive scans. - Prevented over-budget forced entries from being reactivated later in processing. - Improved consistency between skipped-entry diagnostics and the entries included in generated prompts. - Preserved existing behavior for eligible ambient entries and recursive child entries. - Ensured entries skipped due to budget limits are reported accurately and only once. <!-- 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:15:42 +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#7009
No description provided.