[PR #2453] [MERGED] Fix group scenario prompt override #5610

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2453
Author: @Promansis
Created: 6/6/2026
Status: ✅ Merged
Merged: 6/6/2026
Merged by: @Promansis

Base: refactor ← Head: issue-2445-group-scenario


📝 Commits (1)

  • a811c50 Fix group scenario prompt override

📊 Changes

2 files changed (+451 additions, -16 deletions)

View changed files

📝 src/engine/generation/prompt-assembly.test.ts (+379 -0)
📝 src/engine/generation/prompt-assembly.ts (+72 -16)

📄 Description

Linked issue

Closes #2445

Why this change

  • Group scenario override metadata existed on refactor chats, but prompt assembly still used each character card's individual scenario. Legacy main replaced/suppressed per-character scenarios when a shared group scenario override was active.
  • Follow-up review found the first fix still treated non-empty group text as the override-active flag, rendered shared scenario blocks even when a marker excluded scenario, and left nested macros unresolved in appended group scenario blocks.

What changed

  • Threaded groupScenarioOverride as separate enabled/text facts through prompt macro context so blank overrides suppress stale character scenarios.
  • Suppressed per-character scenario marker rows whenever override is enabled, regardless of whether the shared text is blank.
  • Rendered the shared scenario block only when the marker's effective field list includes scenario.
  • Resolved shared group scenario text through prompt macros in character marker and fallback rendering.
  • Applied the shared scenario to character-scoped macro expansion, fallback character blocks, and character depth prompts.
  • Added focused regression tests for non-empty override, blank override, nested macros, fallback rendering, depth prompts, and custom marker field selection.

Refactor impact

Primary owner:

  • Engine generation / prompt assembly.

Impact areas reviewed:

  • Chat mode prompt context.
  • Roleplay mode prompt context.
  • Runtime generation prompt assembly.
  • React-free engine contracts already exposed the metadata; no storage/import parity work was needed.

Boundary notes:

  • Change stays inside src/engine/generation and uses existing chat metadata contracts.
  • No React, shared API, Tauri/Rust, import/export, or remote-runtime boundaries changed.

Pressure points touched:

  • Prompt assembly character marker rendering.
  • Prompt macro context and character-scoped macro context.
  • Fallback prompt character rendering.
  • Character depth prompt macro resolution.

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

  • pnpm vitest run src/engine/generation/prompt-assembly.test.ts passed: 1 file, 12 tests.
  • pnpm typecheck passed.
  • git diff --check passed.
  • Earlier on this PR branch, before the follow-up review fixes, pnpm check passed. It has not been rerun after the latest focused amendments.
  • Durable test rationale: this fixes a known regression from #2445 where group scenario override metadata was not consumed safely; existing prompt assembly tests did not cover override suppression/replacement, blank override behavior, nested group scenario macros, fallback rendering, or marker field selection; the new tests are narrow to prompt assembly output.

Feature Discoverability

Check exactly one:

  • Updated src/features/shell/discovery/ because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool.
  • N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find.

Reason:

  • Existing group scenario override setting is already discoverable in UI; this PR fixes runtime prompt consumption only.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

UI evidence

No visible UI changes; prompt assembly behavior only.


🔄 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/2453 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 6/6/2026 **Status:** ✅ Merged **Merged:** 6/6/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `refactor` ← **Head:** `issue-2445-group-scenario` --- ### 📝 Commits (1) - [`a811c50`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a811c50680ee0673225b7ec8d51f49116da61534) Fix group scenario prompt override ### 📊 Changes **2 files changed** (+451 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `src/engine/generation/prompt-assembly.test.ts` (+379 -0) 📝 `src/engine/generation/prompt-assembly.ts` (+72 -16) </details> ### 📄 Description ## Linked issue Closes #2445 ## Why this change - Group scenario override metadata existed on refactor chats, but prompt assembly still used each character card's individual scenario. Legacy `main` replaced/suppressed per-character scenarios when a shared group scenario override was active. - Follow-up review found the first fix still treated non-empty group text as the override-active flag, rendered shared scenario blocks even when a marker excluded `scenario`, and left nested macros unresolved in appended group scenario blocks. ## What changed - Threaded `groupScenarioOverride` as separate enabled/text facts through prompt macro context so blank overrides suppress stale character scenarios. - Suppressed per-character scenario marker rows whenever override is enabled, regardless of whether the shared text is blank. - Rendered the shared scenario block only when the marker's effective field list includes `scenario`. - Resolved shared group scenario text through prompt macros in character marker and fallback rendering. - Applied the shared scenario to character-scoped macro expansion, fallback character blocks, and character depth prompts. - Added focused regression tests for non-empty override, blank override, nested macros, fallback rendering, depth prompts, and custom marker field selection. ## Refactor impact Primary owner: - Engine generation / prompt assembly. Impact areas reviewed: - Chat mode prompt context. - Roleplay mode prompt context. - Runtime generation prompt assembly. - React-free engine contracts already exposed the metadata; no storage/import parity work was needed. Boundary notes: - Change stays inside `src/engine/generation` and uses existing chat metadata contracts. - No React, shared API, Tauri/Rust, import/export, or remote-runtime boundaries changed. Pressure points touched: - Prompt assembly character marker rendering. - Prompt macro context and character-scoped macro context. - Fallback prompt character rendering. - Character depth prompt macro resolution. ## Validation - [x] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [ ] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes - `pnpm vitest run src/engine/generation/prompt-assembly.test.ts` passed: 1 file, 12 tests. - `pnpm typecheck` passed. - `git diff --check` passed. - Earlier on this PR branch, before the follow-up review fixes, `pnpm check` passed. It has not been rerun after the latest focused amendments. - Durable test rationale: this fixes a known regression from #2445 where group scenario override metadata was not consumed safely; existing prompt assembly tests did not cover override suppression/replacement, blank override behavior, nested group scenario macros, fallback rendering, or marker field selection; the new tests are narrow to prompt assembly output. ## Feature Discoverability Check exactly one: - [ ] Updated `src/features/shell/discovery/` because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool. - [x] N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find. Reason: - Existing group scenario override setting is already discoverable in UI; this PR fixes runtime prompt consumption only. ## Docs and release impact - [x] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [x] Confirmed this PR does not restore old staging/package-workspace/release claims ## UI evidence No visible UI changes; prompt assembly behavior only. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:17:48 +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#5610
No description provided.