[PR #1045] [MERGED] Fix group prompt target lorebook scope #4896

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

📋 Pull Request Information

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

Base: staging ← Head: fix/issue-1022-group-lorebooks


📝 Commits (1)

  • d8ebf59 Fix group prompt target lorebook scope

📊 Changes

3 files changed (+29 additions, -15 deletions)

View changed files

📝 packages/server/src/routes/generate.routes.ts (+7 -8)
📝 packages/server/src/routes/generate/dry-run-route.ts (+12 -7)
📝 packages/server/src/routes/generate/generate-route-utils.ts (+10 -0)

📄 Description

Linked issue

Closes #1022

Why this change

  • Group chats could assemble a single-character response prompt with the full group character scope, which let other characters' embedded lorebooks activate for the responder.

What changed

  • Added a shared prompt-scope helper that narrows prompt character IDs when a generation has an explicit target character.
  • Applied that scope to /api/generate so targeted group responses and regenerations build macros/lorebook scope for the responder instead of the whole group.
  • Applied the same scope to dry-run prompt assembly so debug/preview output mirrors targeted generation.

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 repro: pnpm --filter @marinara-engine/server exec tsx ../../scratch/issue-1022-repro.ts
    • Legacy route logic reproduced the bug by keeping john, billy, and bob in scope when the target was john.
    • Updated helper returned only john for the target response.
    • Edge cases passed: no target keeps the full group scope; invalid target keeps the full group scope.
  • Codex baseline: pnpm check passed.
  • Bunny review: passed locally before opening the PR.
  • No human-only verification blocker identified for this route-scope logic change.

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)

No docs or release metadata changes needed; this is a server prompt-scoping bugfix.

UI evidence (if applicable)

N/A - backend prompt assembly logic; no UI surface changed.


🔄 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/1045 **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:** `fix/issue-1022-group-lorebooks` --- ### 📝 Commits (1) - [`d8ebf59`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d8ebf59ff1c55fb29f6d460737b858928b39036e) Fix group prompt target lorebook scope ### 📊 Changes **3 files changed** (+29 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/routes/generate.routes.ts` (+7 -8) 📝 `packages/server/src/routes/generate/dry-run-route.ts` (+12 -7) 📝 `packages/server/src/routes/generate/generate-route-utils.ts` (+10 -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 <!-- Every PR should reference a feature request or issue report. If there isn't one yet, open one first to gather opinions: --> <!-- https://github.com/Pasta-Devs/Marinara-Engine/issues/new/choose --> Closes #1022 ## Why this change <!-- What user problem, bug, or goal does this solve? --> - Group chats could assemble a single-character response prompt with the full group character scope, which let other characters' embedded lorebooks activate for the responder. ## What changed <!-- List the key changes in this PR --> - Added a shared prompt-scope helper that narrows prompt character IDs when a generation has an explicit target character. - Applied that scope to `/api/generate` so targeted group responses and regenerations build macros/lorebook scope for the responder instead of the whole group. - Applied the same scope to dry-run prompt assembly so debug/preview output mirrors targeted generation. ## Validation <!-- Required: include commands run and/or manual checks performed --> - [ ] `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 <!-- Describe exactly what you tested in a real browser/app, step by step. --> <!-- ⚠️ If an AI agent filled out or ticked these boxes for you, treat them --> <!-- as a TO-DO LIST, not as proof the work is done. Verify each item yourself --> <!-- before submitting. If you haven't verified it, untick the box. --> - Codex repro: `pnpm --filter @marinara-engine/server exec tsx ../../scratch/issue-1022-repro.ts` - Legacy route logic reproduced the bug by keeping `john`, `billy`, and `bob` in scope when the target was `john`. - Updated helper returned only `john` for the target response. - Edge cases passed: no target keeps the full group scope; invalid target keeps the full group scope. - Codex baseline: `pnpm check` passed. - Bunny review: passed locally before opening the PR. - No human-only verification blocker identified for this route-scope logic change. ## 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) No docs or release metadata changes needed; this is a server prompt-scoping bugfix. ## UI evidence (if applicable) N/A - backend prompt assembly logic; no UI surface changed. --- <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:32 +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#4896
No description provided.