[PR #3914] [MERGED] Fix scoped lore, Professor Mari commands, and dialogue defaults #6156

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

📋 Pull Request Information

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

Base: staging ← Head: agent/assigned-issues-3909-3913


📝 Commits (5)

  • fca520f fix: scope group lore and recover Mari commands
  • 6971e85 feat: add default dialogue color preference
  • 3ad9b9b Address CodeRabbit review feedback
  • 9f20389 Merge remote-tracking branch 'origin/staging' into codex/review-3914
  • affb0d0 Merge remote-tracking branch 'origin/staging' into codex/review-3914

📊 Changes

15 files changed (+610 additions, -41 deletions)

View changed files

📝 e2e/core-flows.e2e.ts (+99 -0)
📝 packages/client/src/components/characters/CharacterEditor.tsx (+1 -1)
📝 packages/client/src/components/chat/ChatMessage.tsx (+11 -2)
📝 packages/client/src/components/game/GameNarration.tsx (+22 -12)
📝 packages/client/src/components/panels/SettingsPanel.tsx (+38 -0)
📝 packages/client/src/components/personas/PersonaEditor.tsx (+1 -1)
📝 packages/client/src/stores/ui.store.ts (+28 -1)
📝 packages/server/package.json (+1 -0)
📝 packages/server/src/routes/generate.routes.ts (+67 -1)
📝 packages/server/src/services/lorebook/index.ts (+84 -0)
📝 packages/server/src/services/professor-mari/workspace-agent.service.ts (+119 -20)
📝 packages/server/src/services/prompt/assembler.ts (+3 -0)
📝 packages/server/src/services/storage/lorebooks.storage.ts (+5 -2)
📝 pnpm-lock.yaml (+9 -0)
📝 scripts/regressions/prompt.regression.ts (+122 -1)

📄 Description

Linked issue

Closes #3913
Closes #3909

The default dialogue color is a maintainer-requested follow-up added to this PR; it does not have a separate issue.

Why this change

  • Individual group generations build one shared prompt before the responding character is known. Character-tag lorebook filters were evaluated against the union of the whole roster, so responder-specific entries leaked into every character prompt.
  • Small local models can return a recognizable but malformed Professor Mari app-data call. The runtime repaired the protocol by asking the model again instead of executing the recoverable command, which could lead to repeated generations. The unsafe Unix launcher .env sourcing reported in #3909 is already fixed on staging by #3814; this PR addresses the remaining Professor Mari failure path.
  • Cards without their own dialogue highlight color had no user-selectable global fallback. Users should be able to choose one default while retaining per-character and per-persona overrides.

What changed

  • Preserve the shared lorebook activation, probability, and budget decision, then scope its selected entries to the actual responder before each Individual group generation.
  • Keep unfiltered lore shared while enforcing character ID and character-tag include/exclude filters for Conversation and Roleplay Individual prompts.
  • Expose the assembler lorebook scan so custom-preset prompt placement can be scoped without rebuilding or relocating user sections.
  • Recover conservatively malformed JSON envelopes, direct app-data action shapes, action names used as tool names, and common textual tool-call wrappers.
  • Keep the existing repeated-failure and maximum-round loop brakes in place.
  • Add a persisted Default Dialogue Color switch and color picker under Appearance → Chat Text Color.
  • Apply that fallback in Roleplay and Game dialogue only when the responding character/persona card has no dialogue color; card-level colors remain authoritative.
  • Update character/persona color help text and add a browser regression for precedence, persistence, and disabling the fallback.
  • Add deterministic regressions for the reported pasta-tag split and malformed Stheno-style command shapes.

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

Additional automated validation already run:

  • pnpm check
  • pnpm --filter @marinara-engine/server lint
  • pnpm regression:prompt
  • node scripts/regressions/launcher-env.regression.mjs
  • Focused Playwright regression: default dialogue fallback and card override precedence
  • Full Playwright suite: 74 passed and 48 skipped; two unrelated existing smoke failures reproduced independently (Noodle's duplicate account-menu accessible name and the Roleplay side-panel 70 ms animation timing assertion)
  • git diff --check

Manual verification notes

  • Manual provider testing with L3-8B-Stheno-v3.2-IQ4_XS was not available. The parser recovery and prompt-scoping paths are covered by deterministic regressions.
  • The dialogue color control and precedence behavior are covered in a real browser against an isolated temporary app data directory.

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)

The new Appearance control includes inline help and updates the character/persona Colors help copy. No release metadata changed.

UI evidence (if applicable)

Automated browser coverage verifies the enabled fallback, card-level override, persisted preference value, and disabled state. No screenshot is attached.

Summary by CodeRabbit

  • New Features

    • Lorebook content is now more accurately tailored to the responding character in individual group conversations.
    • Improved support for recognizing workspace commands expressed in text, JSON, XML, and bracket-based formats.
    • Workspace actions can now be recovered from incomplete or imperfectly formatted command payloads.
  • Bug Fixes

    • Reduced unrelated lorebook content being included in character-specific responses.
    • Improved reliability when processing malformed workspace command data.

🔄 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/3914 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 7/21/2026 **Status:** ✅ Merged **Merged:** 7/21/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `agent/assigned-issues-3909-3913` --- ### 📝 Commits (5) - [`fca520f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fca520f9e862176b9133eb4ef218db01e3d2cc53) fix: scope group lore and recover Mari commands - [`6971e85`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6971e85e27d0ccab8c9a9518421d1f38a23e3442) feat: add default dialogue color preference - [`3ad9b9b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3ad9b9b983501652f31689085c5fb576dff58357) Address CodeRabbit review feedback - [`9f20389`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9f203895ac1aebb5bef2552965a17a3abebdbb79) Merge remote-tracking branch 'origin/staging' into codex/review-3914 - [`affb0d0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/affb0d006b4222a036dc6fef5228d287fddc58bb) Merge remote-tracking branch 'origin/staging' into codex/review-3914 ### 📊 Changes **15 files changed** (+610 additions, -41 deletions) <details> <summary>View changed files</summary> 📝 `e2e/core-flows.e2e.ts` (+99 -0) 📝 `packages/client/src/components/characters/CharacterEditor.tsx` (+1 -1) 📝 `packages/client/src/components/chat/ChatMessage.tsx` (+11 -2) 📝 `packages/client/src/components/game/GameNarration.tsx` (+22 -12) 📝 `packages/client/src/components/panels/SettingsPanel.tsx` (+38 -0) 📝 `packages/client/src/components/personas/PersonaEditor.tsx` (+1 -1) 📝 `packages/client/src/stores/ui.store.ts` (+28 -1) 📝 `packages/server/package.json` (+1 -0) 📝 `packages/server/src/routes/generate.routes.ts` (+67 -1) 📝 `packages/server/src/services/lorebook/index.ts` (+84 -0) 📝 `packages/server/src/services/professor-mari/workspace-agent.service.ts` (+119 -20) 📝 `packages/server/src/services/prompt/assembler.ts` (+3 -0) 📝 `packages/server/src/services/storage/lorebooks.storage.ts` (+5 -2) 📝 `pnpm-lock.yaml` (+9 -0) 📝 `scripts/regressions/prompt.regression.ts` (+122 -1) </details> ### 📄 Description ## Linked issue Closes #3913 Closes #3909 The default dialogue color is a maintainer-requested follow-up added to this PR; it does not have a separate issue. ## Why this change - Individual group generations build one shared prompt before the responding character is known. Character-tag lorebook filters were evaluated against the union of the whole roster, so responder-specific entries leaked into every character prompt. - Small local models can return a recognizable but malformed Professor Mari app-data call. The runtime repaired the protocol by asking the model again instead of executing the recoverable command, which could lead to repeated generations. The unsafe Unix launcher `.env` sourcing reported in #3909 is already fixed on staging by #3814; this PR addresses the remaining Professor Mari failure path. - Cards without their own dialogue highlight color had no user-selectable global fallback. Users should be able to choose one default while retaining per-character and per-persona overrides. ## What changed - Preserve the shared lorebook activation, probability, and budget decision, then scope its selected entries to the actual responder before each Individual group generation. - Keep unfiltered lore shared while enforcing character ID and character-tag include/exclude filters for Conversation and Roleplay Individual prompts. - Expose the assembler lorebook scan so custom-preset prompt placement can be scoped without rebuilding or relocating user sections. - Recover conservatively malformed JSON envelopes, direct app-data action shapes, action names used as tool names, and common textual tool-call wrappers. - Keep the existing repeated-failure and maximum-round loop brakes in place. - Add a persisted **Default Dialogue Color** switch and color picker under Appearance → Chat Text Color. - Apply that fallback in Roleplay and Game dialogue only when the responding character/persona card has no dialogue color; card-level colors remain authoritative. - Update character/persona color help text and add a browser regression for precedence, persistence, and disabling the fallback. - Add deterministic regressions for the reported pasta-tag split and malformed Stheno-style command shapes. ## 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` Additional automated validation already run: - `pnpm check` - `pnpm --filter @marinara-engine/server lint` - `pnpm regression:prompt` - `node scripts/regressions/launcher-env.regression.mjs` - Focused Playwright regression: default dialogue fallback and card override precedence - Full Playwright suite: 74 passed and 48 skipped; two unrelated existing smoke failures reproduced independently (Noodle's duplicate account-menu accessible name and the Roleplay side-panel 70 ms animation timing assertion) - `git diff --check` ### Manual verification notes - Manual provider testing with L3-8B-Stheno-v3.2-IQ4_XS was not available. The parser recovery and prompt-scoping paths are covered by deterministic regressions. - The dialogue color control and precedence behavior are covered in a real browser against an isolated temporary app data directory. ## 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) The new Appearance control includes inline help and updates the character/persona Colors help copy. No release metadata changed. ## UI evidence (if applicable) Automated browser coverage verifies the enabled fallback, card-level override, persisted preference value, and disabled state. No screenshot is attached. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Lorebook content is now more accurately tailored to the responding character in individual group conversations. * Improved support for recognizing workspace commands expressed in text, JSON, XML, and bracket-based formats. * Workspace actions can now be recovered from incomplete or imperfectly formatted command payloads. * **Bug Fixes** * Reduced unrelated lorebook content being included in character-specific responses. * Improved reliability when processing malformed workspace command data. <!-- 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:38 +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#6156
No description provided.