[PR #1675] [MERGED] Fix conversation group reply targeting #5203

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

📋 Pull Request Information

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

Base: refactor ← Head: fix/issue-1603-conversation-mode


📝 Commits (1)

  • a6fdb3f Fix conversation group reply targeting

📊 Changes

6 files changed (+238 additions, -17 deletions)

View changed files

📝 src/engine/generation/prompt-assembly.test.ts (+52 -0)
📝 src/engine/generation/prompt-assembly.ts (+34 -1)
📝 src/engine/generation/start-generation.test.ts (+114 -0)
📝 src/engine/generation/start-generation.ts (+36 -16)
📝 src/features/modes/conversation/hooks/autonomous/use-autonomous-messaging.ts (+1 -0)
📝 src/features/modes/conversation/hooks/autonomous/use-background-autonomous.ts (+1 -0)

📄 Description

Linked issue

Closes #1603

Why this change

  • Conversation chats with multiple characters could route replies as generic assistant turns instead of a concrete character turn. That made @mentions, sequential follow-up replies, and autonomous selected speakers behave inconsistently because prompt assembly did not hard-scope the responding character.

What changed

  • Extended group reply target resolution so conversation-mode chats with multiple active characters can resolve an explicit responding character from forCharacterId, @mentions, continuation, sequential order, or smart order.
  • Added conversation turn prompt scoping that keeps all attached character cards visible while instructing the model to respond only as the selected character for the current turn.
  • Passed the autonomous scheduler's selected character into foreground and background conversation generation.
  • Added regression coverage for @mentioned conversation replies, sequential conversation follow-up replies, and prompt/history scoping.

Refactor impact

Primary owner:

engine generation

Impact areas reviewed:

  • Conversation-mode generation routing
  • Prompt assembly for multi-character conversation chats
  • Roleplay individual group regression coverage
  • Foreground and background autonomous conversation generation callers

Boundary notes:

  • Product behavior stays in src/engine/generation.
  • Feature hooks only pass an existing selected characterId through the existing generation API.
  • No raw Tauri, shared API, Rust storage, schema, dependency, or release metadata changes.

Pressure points touched:

  • Runtime generation target selection
  • Prompt assembly role/history shaping
  • Conversation autonomous generation hooks

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

  • Codex reproduction before fix: targeted Vitest regression rows failed because conversation prompts lacked a hard selected-character turn instruction and saved multi-character conversation replies did not get the expected characterId.
  • Codex verification after fix: pnpm exec vitest run src/engine/generation/prompt-assembly.test.ts src/engine/generation/start-generation.test.ts passed with 121 tests, including the new issue #1603 regression rows.
  • Codex baseline: pnpm typecheck passed.
  • Codex baseline: pnpm check passed, including line endings, architecture, frontend typecheck, Rust cargo check, and docs.
  • Codex proof gate: node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json passed.
  • Bunny review: passed for the current diff before opening this PR.
  • Manual browser/app verification not performed because this is generation contract behavior covered by focused engine tests rather than a visible UI layout bug.

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

N/A. This is not a visible UI rendering change; the proof is the before/after generation contract regression suite and baseline checks above.

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Fixed group conversation character selection to ensure targeted characters respond appropriately while preserving conversation context.
    • Improved autonomous messaging to correctly associate generated responses with their intended characters.
  • Improvements

    • Unified character targeting logic across conversation and roleplay modes for consistent behavior.

Review Change Stack


🔄 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/1675 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/30/2026 **Status:** ✅ Merged **Merged:** 5/30/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/issue-1603-conversation-mode` --- ### 📝 Commits (1) - [`a6fdb3f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a6fdb3f61a17c5cbd4c9472bf78015004f7a3145) Fix conversation group reply targeting ### 📊 Changes **6 files changed** (+238 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `src/engine/generation/prompt-assembly.test.ts` (+52 -0) 📝 `src/engine/generation/prompt-assembly.ts` (+34 -1) 📝 `src/engine/generation/start-generation.test.ts` (+114 -0) 📝 `src/engine/generation/start-generation.ts` (+36 -16) 📝 `src/features/modes/conversation/hooks/autonomous/use-autonomous-messaging.ts` (+1 -0) 📝 `src/features/modes/conversation/hooks/autonomous/use-background-autonomous.ts` (+1 -0) </details> ### 📄 Description <!-- Target branch: `refactor`. Change the base to `refactor` before submitting unless a maintainer explicitly asked for another base. --> <!-- Keep all checkboxes unchecked until a human has actually verified them. --> ## Linked issue Closes #1603 ## Why this change - Conversation chats with multiple characters could route replies as generic assistant turns instead of a concrete character turn. That made @mentions, sequential follow-up replies, and autonomous selected speakers behave inconsistently because prompt assembly did not hard-scope the responding character. ## What changed - Extended group reply target resolution so conversation-mode chats with multiple active characters can resolve an explicit responding character from `forCharacterId`, @mentions, continuation, sequential order, or smart order. - Added conversation turn prompt scoping that keeps all attached character cards visible while instructing the model to respond only as the selected character for the current turn. - Passed the autonomous scheduler's selected character into foreground and background conversation generation. - Added regression coverage for @mentioned conversation replies, sequential conversation follow-up replies, and prompt/history scoping. ## Refactor impact Primary owner: engine generation Impact areas reviewed: - Conversation-mode generation routing - Prompt assembly for multi-character conversation chats - Roleplay individual group regression coverage - Foreground and background autonomous conversation generation callers Boundary notes: - Product behavior stays in `src/engine/generation`. - Feature hooks only pass an existing selected `characterId` through the existing generation API. - No raw Tauri, shared API, Rust storage, schema, dependency, or release metadata changes. Pressure points touched: - Runtime generation target selection - Prompt assembly role/history shaping - Conversation autonomous generation hooks ## Validation <!-- Check only what you personally ran or manually verified. Treat unchecked items as explicit TODOs. --> - [ ] `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 - Codex reproduction before fix: targeted Vitest regression rows failed because conversation prompts lacked a hard selected-character turn instruction and saved multi-character conversation replies did not get the expected `characterId`. - Codex verification after fix: `pnpm exec vitest run src/engine/generation/prompt-assembly.test.ts src/engine/generation/start-generation.test.ts` passed with 121 tests, including the new issue #1603 regression rows. - Codex baseline: `pnpm typecheck` passed. - Codex baseline: `pnpm check` passed, including line endings, architecture, frontend typecheck, Rust cargo check, and docs. - Codex proof gate: `node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json` passed. - Bunny review: passed for the current diff before opening this PR. - Manual browser/app verification not performed because this is generation contract behavior covered by focused engine tests rather than a visible UI layout bug. ## 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 N/A. This is not a visible UI rendering change; the proof is the before/after generation contract regression suite and baseline checks above. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **Bug Fixes** * Fixed group conversation character selection to ensure targeted characters respond appropriately while preserving conversation context. * Improved autonomous messaging to correctly associate generated responses with their intended characters. * **Improvements** * Unified character targeting logic across conversation and roleplay modes for consistent behavior. <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/Pasta-Devs/Marinara-Engine/pull/1675?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- 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:11 +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#5203
No description provided.