[PR #1721] [MERGED] Fix impersonate prompt parity #5232

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1721
Author: @Xelvanis
Created: 5/31/2026
Status: ✅ Merged
Merged: 5/31/2026
Merged by: @Xelvanis

Base: refactor ← Head: bugfix/impersonate-prompt-parity


📝 Commits (1)

  • 7bdca8f Fix impersonate prompt parity

📊 Changes

3 files changed (+70 additions, -2 deletions)

View changed files

📝 src/engine/generation/start-generation.test.ts (+52 -0)
📝 src/engine/generation/start-generation.ts (+8 -1)
📝 src/engine/modes/chat/commands/impersonate-prompt.ts (+10 -1)

📄 Description

Linked issue

N/A - local parity bug report.

Why this change

  • Chat-scoped /impersonate_prompt metadata was persisted but ignored by refactor generation.
  • Legacy wrapped impersonation directions could be nested into the prompt instead of normalized before assembly.

What changed

  • Restored impersonate prompt precedence so request/global impersonatePromptTemplate wins, then chat metadata impersonatePrompt, then the built-in default.
  • Added the legacy impersonation-direction de-wrapper before rendering impersonate prompt templates.
  • Added engine tests for chat metadata fallback and legacy wrapper normalization.

Refactor impact

Primary owner:

  • Engine generation / chat impersonation.

Impact areas reviewed:

  • /impersonate prompt assembly in start-generation.ts.
  • Chat-owned impersonate prompt rendering helper.
  • Slash-command metadata write path for /impersonate_prompt.
  • Replay/direct generation callers and sibling roleplay/game exposure.

Boundary notes:

  • Engine-only change; no React feature, shared API, Tauri command, Rust capability, or remote runtime boundary changes.
  • Chat owns impersonation behavior; no cross-mode imports added.

Pressure points touched:

  • None.

Validation

  • pnpm check passes locally
  • pnpm typecheck passes locally
  • pnpm build passes locally
  • pnpm check:architecture passes locally
  • pnpm check:docs passes locally
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace passes locally
  • Rust clippy/tests were run for Rust behavior changes
  • Browser or Tauri app manual verification completed
  • Playwright, screenshot, or recording evidence added for UI changes
  • Remote runtime smoke checked when relevant

Manual verification notes

Automated proof run before opening PR:

  • pnpm exec vitest run src/engine/generation/start-generation.test.ts -t "impersonate" passed after reproducing the two parity failures before the fix.
  • pnpm exec vitest run src/engine/generation/start-generation.test.ts passed, 68 tests.
  • pnpm typecheck passed.
  • pnpm check:architecture passed.
  • pnpm check passed.

Manual app QA not run; this is covered at engine prompt assembly level.

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

No docs changes needed: internal parity bugfix with no workflow, architecture, or user-facing copy changes.

UI evidence

N/A - no visible UI changes.

Summary by CodeRabbit

  • Bug Fixes

    • Improved parsing and normalization of legacy impersonation instructions
    • Enhanced fallback behavior for impersonation prompts when custom templates are unavailable
  • Tests

    • Expanded test coverage for impersonation prompt template resolution with custom and default configurations

🔄 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/1721 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 5/31/2026 **Status:** ✅ Merged **Merged:** 5/31/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `bugfix/impersonate-prompt-parity` --- ### 📝 Commits (1) - [`7bdca8f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7bdca8f9b4a0b31b39de9b006515a0753486e625) Fix impersonate prompt parity ### 📊 Changes **3 files changed** (+70 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/engine/generation/start-generation.test.ts` (+52 -0) 📝 `src/engine/generation/start-generation.ts` (+8 -1) 📝 `src/engine/modes/chat/commands/impersonate-prompt.ts` (+10 -1) </details> ### 📄 Description ## Linked issue N/A - local parity bug report. ## Why this change - Chat-scoped `/impersonate_prompt` metadata was persisted but ignored by refactor generation. - Legacy wrapped impersonation directions could be nested into the prompt instead of normalized before assembly. ## What changed - Restored impersonate prompt precedence so request/global `impersonatePromptTemplate` wins, then chat metadata `impersonatePrompt`, then the built-in default. - Added the legacy impersonation-direction de-wrapper before rendering impersonate prompt templates. - Added engine tests for chat metadata fallback and legacy wrapper normalization. ## Refactor impact Primary owner: - Engine generation / chat impersonation. Impact areas reviewed: - `/impersonate` prompt assembly in `start-generation.ts`. - Chat-owned impersonate prompt rendering helper. - Slash-command metadata write path for `/impersonate_prompt`. - Replay/direct generation callers and sibling roleplay/game exposure. Boundary notes: - Engine-only change; no React feature, shared API, Tauri command, Rust capability, or remote runtime boundary changes. - Chat owns impersonation behavior; no cross-mode imports added. Pressure points touched: - None. ## Validation - [x] `pnpm check` passes locally - [x] `pnpm typecheck` passes locally - [x] `pnpm build` passes locally - [x] `pnpm check:architecture` passes locally - [x] `pnpm check:docs` passes locally - [ ] `cargo check --manifest-path src-tauri/Cargo.toml --workspace` passes locally - [ ] Rust clippy/tests were run for Rust behavior changes - [ ] Browser or Tauri app manual verification completed - [ ] Playwright, screenshot, or recording evidence added for UI changes - [ ] Remote runtime smoke checked when relevant ### Manual verification notes Automated proof run before opening PR: - `pnpm exec vitest run src/engine/generation/start-generation.test.ts -t "impersonate"` passed after reproducing the two parity failures before the fix. - `pnpm exec vitest run src/engine/generation/start-generation.test.ts` passed, 68 tests. - `pnpm typecheck` passed. - `pnpm check:architecture` passed. - `pnpm check` passed. Manual app QA not run; this is covered at engine prompt assembly level. ## 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 No docs changes needed: internal parity bugfix with no workflow, architecture, or user-facing copy changes. ## UI evidence N/A - no visible UI changes. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved parsing and normalization of legacy impersonation instructions * Enhanced fallback behavior for impersonation prompts when custom templates are unavailable * **Tests** * Expanded test coverage for impersonation prompt template resolution with custom and default configurations <!-- 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-22 04:14:27 +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#5232
No description provided.