[PR #5246] [MERGED] Add semantic retrieval to Roleplay Chat Summaries #6686

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5246
Author: @SpicyMarinara
Created: 8/19/2026
Status: ✅ Merged
Merged: 8/19/2026
Merged by: @SpicyMarinara

Base: staging ← Head: agent/roleplay-summary-semantic-retrieval


📝 Commits (2)

  • e09facc Start Roleplay summary semantic retrieval
  • b42754a Add semantic retrieval to Roleplay summaries

📊 Changes

12 files changed (+407 additions, -37 deletions)

View changed files

📝 CHANGELOG.md (+1 -1)
📝 e2e/core-flows.e2e.ts (+71 -0)
📝 packages/client/src/components/chat/ChatRoleplaySurface.tsx (+7 -0)
📝 packages/client/src/components/chat/SummaryPopover.tsx (+17 -0)
📝 packages/client/src/localization/locales/en.json (+2 -0)
📝 packages/server/src/routes/generate.routes.ts (+10 -2)
📝 packages/server/src/routes/generate/dry-run-route.ts (+36 -2)
📝 packages/server/src/routes/generate/generate-route-utils.ts (+4 -23)
📝 packages/server/src/routes/generate/retry-agents-route.ts (+33 -6)
➕ packages/server/src/services/generation/roleplay-summary-retrieval.ts (+132 -0)
📝 packages/shared/src/types/chat.ts (+2 -2)
📝 scripts/regressions/regeneration-context.regression.ts (+92 -1)

📄 Description

Linked issue

Closes #5240

Why this change

  • The first #5240 implementation exposed semantic summary retrieval only in Conversation mode, while the request is specifically motivated by long-running Roleplay chats.
  • Roleplay users need the same bounded-context behavior inside the Chat Summaries workflow they already use, without losing manually curated or recent narrative context.

What changed

  • Added a compact Semantic retrieval switch to Roleplay’s existing Automatic Summaries card; the setting persists per chat and remains usable in the mobile popover.
  • Kept every enabled manual/legacy summary and the two newest enabled automatic summaries in context, then semantically selected up to three relevant older automatic summaries using the existing calibrated embedding path.
  • Kept the full summary as a safe fallback when semantic retrieval is off, unavailable, empty, or fails.
  • Applied the selected summary consistently to normal Roleplay generation, dry-run prompt assembly, and retried Agent context.
  • Updated the shared metadata description, English UI catalog, and Unreleased changelog entry.
  • Added deterministic retrieval coverage and desktop/mobile Playwright coverage for persistence, viewport overflow, reload, and light-theme rendering.

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

Manual verification notes

  • Ran pnpm check.
  • Ran pnpm regression:prompt.
  • Ran the focused scripts/regressions/regeneration-context.regression.ts regression.
  • Ran the Roleplay semantic-summary Playwright flow against desktop Chromium and a Pixel 7 viewport.
  • Verified the switch persists after reload, the mobile panel has no horizontal overflow, and the control remains legible in dark and light themes.
  • Verified unavailable embeddings retain the complete summary instead of dropping context.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

CHANGELOG.md is updated. No version-bearing files or user guides changed.

UI evidence (if applicable)

  • Captured and inspected local desktop and Pixel 7 screenshots in both dark and light themes; evidence files are intentionally not committed under the project’s PR-evidence policy.

Summary by CodeRabbit

  • New Features

    • Added an optional semantic retrieval setting for chat summaries, available in supported chats.
    • When enabled, summaries can surface older, relevant conversation details while preserving manual and recent summaries.
    • The setting is saved per chat and remains enabled after reopening or reloading.
    • Added localized descriptions and responsive settings-panel behavior.
  • Bug Fixes

    • Improved summary retrieval during generation, retries, and regeneration, with reliable fallback behavior when semantic retrieval is unavailable.
    • Clarified that automatic summaries apply to both Conversation and Roleplay chats.

🔄 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/5246 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 8/19/2026 **Status:** ✅ Merged **Merged:** 8/19/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `agent/roleplay-summary-semantic-retrieval` --- ### 📝 Commits (2) - [`e09facc`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e09faccc099ac84000cd5a1e2b1b82db36662136) Start Roleplay summary semantic retrieval - [`b42754a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b42754a3cae0363301b0153bf710e5f97adbb1a1) Add semantic retrieval to Roleplay summaries ### 📊 Changes **12 files changed** (+407 additions, -37 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -1) 📝 `e2e/core-flows.e2e.ts` (+71 -0) 📝 `packages/client/src/components/chat/ChatRoleplaySurface.tsx` (+7 -0) 📝 `packages/client/src/components/chat/SummaryPopover.tsx` (+17 -0) 📝 `packages/client/src/localization/locales/en.json` (+2 -0) 📝 `packages/server/src/routes/generate.routes.ts` (+10 -2) 📝 `packages/server/src/routes/generate/dry-run-route.ts` (+36 -2) 📝 `packages/server/src/routes/generate/generate-route-utils.ts` (+4 -23) 📝 `packages/server/src/routes/generate/retry-agents-route.ts` (+33 -6) ➕ `packages/server/src/services/generation/roleplay-summary-retrieval.ts` (+132 -0) 📝 `packages/shared/src/types/chat.ts` (+2 -2) 📝 `scripts/regressions/regeneration-context.regression.ts` (+92 -1) </details> ### 📄 Description ## Linked issue Closes #5240 ## Why this change - The first #5240 implementation exposed semantic summary retrieval only in Conversation mode, while the request is specifically motivated by long-running Roleplay chats. - Roleplay users need the same bounded-context behavior inside the Chat Summaries workflow they already use, without losing manually curated or recent narrative context. ## What changed - Added a compact **Semantic retrieval** switch to Roleplay’s existing Automatic Summaries card; the setting persists per chat and remains usable in the mobile popover. - Kept every enabled manual/legacy summary and the two newest enabled automatic summaries in context, then semantically selected up to three relevant older automatic summaries using the existing calibrated embedding path. - Kept the full summary as a safe fallback when semantic retrieval is off, unavailable, empty, or fails. - Applied the selected summary consistently to normal Roleplay generation, dry-run prompt assembly, and retried Agent context. - Updated the shared metadata description, English UI catalog, and Unreleased changelog entry. - Added deterministic retrieval coverage and desktop/mobile Playwright coverage for persistence, viewport overflow, reload, and light-theme rendering. ## 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` ### Manual verification notes - Ran `pnpm check`. - Ran `pnpm regression:prompt`. - Ran the focused `scripts/regressions/regeneration-context.regression.ts` regression. - Ran the Roleplay semantic-summary Playwright flow against desktop Chromium and a Pixel 7 viewport. - Verified the switch persists after reload, the mobile panel has no horizontal overflow, and the control remains legible in dark and light themes. - Verified unavailable embeddings retain the complete summary instead of dropping context. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) `CHANGELOG.md` is updated. No version-bearing files or user guides changed. ## UI evidence (if applicable) - Captured and inspected local desktop and Pixel 7 screenshots in both dark and light themes; evidence files are intentionally not committed under the project’s PR-evidence policy. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added an optional semantic retrieval setting for chat summaries, available in supported chats. - When enabled, summaries can surface older, relevant conversation details while preserving manual and recent summaries. - The setting is saved per chat and remains enabled after reopening or reloading. - Added localized descriptions and responsive settings-panel behavior. - **Bug Fixes** - Improved summary retrieval during generation, retries, and regeneration, with reliable fallback behavior when semantic retrieval is unavailable. - Clarified that automatic summaries apply to both Conversation and Roleplay chats. <!-- 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:12:45 +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#6686
No description provided.