[PR #2404] [MERGED] Fix conversation system prompt assembly #5588

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

📋 Pull Request Information

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

Base: refactor ← Head: fix/conversation-system-prompt


📝 Commits (2)

  • af91afe Fix conversation system prompt assembly
  • 78fd1d1 Fix conversation prompt review findings

📊 Changes

4 files changed (+109 additions, -33 deletions)

View changed files

➕ src/engine/contracts/constants/conversation-prompt.ts (+26 -0)
📝 src/engine/contracts/types/chat.ts (+2 -0)
📝 src/engine/generation/prompt-assembly.ts (+68 -8)
📝 src/features/modes/shared/chat-ui/components/ChatSettingsDrawer.tsx (+13 -25)

📄 Description

Linked issue

Closes #2391

Why this change

Conversation mode exposed a chat-scoped system prompt in the settings drawer and setup flow, but prompt assembly ignored metadata.customSystemPrompt and fell back to a generic conversation prompt. That meant the prompt preview/generation context did not include the configured conversation-mode prompt users expected.

What changed

  • Added a shared conversation default prompt constant under engine contracts so the settings UI and prompt assembly use the same built-in text.
  • Updated conversation fallback prompt assembly to use metadata.customSystemPrompt when present, otherwise the built-in conversation prompt.
  • Resolved conversation prompt and character card macros in the fallback path so {{charName}}, {{userName}}, and character system-prompt macros expand in conversation mode.
  • Reordered conversation group prompt characters around the selected responder for macro scoping while preserving the other attached character cards as context.

Refactor impact

Primary owner:

Engine generation / conversation prompt assembly.

Impact areas reviewed:

  • Conversation mode prompt assembly and prompt settings storage.
  • Shared chat settings drawer default prompt display/edit path.
  • Roleplay/game fallback prompt branches for accidental sibling-mode behavior.
  • Prompt macro resolution for character card fields and selected conversation responders.

Boundary notes:

  • Engine behavior stays in src/engine; React UI only imports a contract-level constant.
  • No shared API, Tauri/Rust, storage command, or remote runtime boundary changes.
  • No raw Tauri or remote-runtime calls added.

Pressure points touched:

  • Shared mode UI settings drawer touched for the prompt default constant only.
  • No ModeSurface, GameSurface, src-tauri/src/lib.rs, or import-module pressure points touched.

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 exec vitest run src/engine/generation/conversation-prompt-fix.tmp.test.ts --config vitest.config.ts passed 3 focused prompt-assembly cases; temporary test file was deleted before this PR diff.
  • pnpm typecheck passed.
  • pnpm check:architecture passed.
  • pnpm check passed after the final diff.
  • No native Tauri prompt-preview/manual UI screenshot proof was run.

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:

Bugfix for an existing conversation prompt setting; no new discoverable workflow or surface.

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 screenshots. This is an engine prompt assembly fix with command-level validation; manual prompt-preview UI proof remains open.

Summary by CodeRabbit

  • New Features
    • Added per-chat conversation prompt customization. Users can now override the system prompt behavior on individual chats, with automatic fallback to the built-in default prompt when not customized.

🔄 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/2404 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 6/6/2026 **Status:** ✅ Merged **Merged:** 6/6/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `fix/conversation-system-prompt` --- ### 📝 Commits (2) - [`af91afe`](https://github.com/Pasta-Devs/Marinara-Engine/commit/af91afe80ed63ce0fd07ebc9fa400a31872188c0) Fix conversation system prompt assembly - [`78fd1d1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/78fd1d1b792ae8f227fb53be1c32be0530a7b4f7) Fix conversation prompt review findings ### 📊 Changes **4 files changed** (+109 additions, -33 deletions) <details> <summary>View changed files</summary> ➕ `src/engine/contracts/constants/conversation-prompt.ts` (+26 -0) 📝 `src/engine/contracts/types/chat.ts` (+2 -0) 📝 `src/engine/generation/prompt-assembly.ts` (+68 -8) 📝 `src/features/modes/shared/chat-ui/components/ChatSettingsDrawer.tsx` (+13 -25) </details> ### 📄 Description ## Linked issue Closes #2391 ## Why this change Conversation mode exposed a chat-scoped system prompt in the settings drawer and setup flow, but prompt assembly ignored `metadata.customSystemPrompt` and fell back to a generic conversation prompt. That meant the prompt preview/generation context did not include the configured conversation-mode prompt users expected. ## What changed - Added a shared conversation default prompt constant under engine contracts so the settings UI and prompt assembly use the same built-in text. - Updated conversation fallback prompt assembly to use `metadata.customSystemPrompt` when present, otherwise the built-in conversation prompt. - Resolved conversation prompt and character card macros in the fallback path so `{{charName}}`, `{{userName}}`, and character system-prompt macros expand in conversation mode. - Reordered conversation group prompt characters around the selected responder for macro scoping while preserving the other attached character cards as context. ## Refactor impact Primary owner: Engine generation / conversation prompt assembly. Impact areas reviewed: - Conversation mode prompt assembly and prompt settings storage. - Shared chat settings drawer default prompt display/edit path. - Roleplay/game fallback prompt branches for accidental sibling-mode behavior. - Prompt macro resolution for character card fields and selected conversation responders. Boundary notes: - Engine behavior stays in `src/engine`; React UI only imports a contract-level constant. - No shared API, Tauri/Rust, storage command, or remote runtime boundary changes. - No raw Tauri or remote-runtime calls added. Pressure points touched: - Shared mode UI settings drawer touched for the prompt default constant only. - No `ModeSurface`, `GameSurface`, `src-tauri/src/lib.rs`, or import-module pressure points touched. ## 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) - [x] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes - `pnpm exec vitest run src/engine/generation/conversation-prompt-fix.tmp.test.ts --config vitest.config.ts` passed 3 focused prompt-assembly cases; temporary test file was deleted before this PR diff. - `pnpm typecheck` passed. - `pnpm check:architecture` passed. - `pnpm check` passed after the final diff. - No native Tauri prompt-preview/manual UI screenshot proof was run. ## 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: Bugfix for an existing conversation prompt setting; no new discoverable workflow or surface. ## 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 screenshots. This is an engine prompt assembly fix with command-level validation; manual prompt-preview UI proof remains open. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added per-chat conversation prompt customization. Users can now override the system prompt behavior on individual chats, with automatic fallback to the built-in default prompt when not customized. <!-- 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:17:36 +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#5588
No description provided.