[PR #4247] [MERGED] fix(chat): inherit contained summaries across branches #6300

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4247
Author: @Promansis
Created: 7/29/2026
Status: ✅ Merged
Merged: 7/29/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/chat-summary-branch-inheritance


📝 Commits (7)

  • 0aed579 fix(chat): inherit contained summaries across branches
  • 8e37b39 Merge remote-tracking branch 'upstream/staging' into codex/chat-summary-branch-inheritance
  • aceb85d fix(chat): preserve summary prompt contracts
  • af0df68 Merge branch 'staging' into fix/chat-summary-branch-inheritance
  • 4f66fa6 chore: wording on ltm prompt
  • 45e18c5 fix(chat): normalize summary prompt template IDs
  • c982031 Merge branch 'staging' into fix/chat-summary-branch-inheritance

📊 Changes

9 files changed (+269 additions, -35 deletions)

View changed files

📝 docs/chats/branches.md (+1 -1)
📝 packages/client/src/components/chat/ChatRoleplaySurface.tsx (+11 -0)
📝 packages/client/src/components/chat/SummaryPopover.tsx (+66 -29)
📝 packages/client/src/localization/locales/en.json (+1 -0)
📝 packages/server/src/routes/chats.routes.ts (+48 -3)
📝 packages/server/src/services/generation/roleplay-summary-runtime.ts (+10 -0)
📝 packages/shared/src/constants/agent-prompts.ts (+82 -0)
📝 packages/shared/src/utils/chat-summary-prompt-settings.ts (+15 -2)
📝 scripts/regressions/prompt.regression.ts (+35 -0)

📄 Description

Linked issue

Closes #4246

Why this change

  • Branching a chat should preserve rolling summary context only when the summary describes messages that are actually copied into the child branch.
  • Users also need an optional Long-Term Memory summary prompt without changing prompt behavior for chats where that agent is inactive.

What changed

  • Added the built-in Long-Term Memory chat-summary prompt and eligibility checks.
  • Persisted prompt selection through the existing global summary prompt settings.
  • Carried over parent summaries whose persisted source message IDs are fully contained in the copied branch range.
  • Remapped inherited source IDs, hidden IDs, summary metadata, alternate swipe hidden flags, and automatic-summary tracking.
  • Excluded summaries that cross the branch point or lack verifiable source message metadata.
  • Added prompt regression assertions and documented branch-summary inheritance.

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

  • Automated proof completed: pnpm regression:prompt, pnpm build, client ESLint, and git diff --check.
  • Manual browser/app verification and container verification were not performed.

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)

Translation follow-up: #4248

UI evidence (if applicable)

The PR changes the summary prompt selector UI. No screenshots or recordings were captured; browser evidence remains a manual follow-up.

Summary by CodeRabbit

  • New Features

    • Added a Long-Term Memory “Chat Summary” template for eligible chats.
    • Updated the chat summary picker/popover to gate the option based on chat settings, and to support consistent selection/editing/copying/duplication behavior.
  • Bug Fixes

    • Fixed chat branching to correctly inherit and re-map rolling summary metadata, including restoring message visibility when branch-cutoff coverage changes.
  • Documentation

    • Clarified how conversation summaries are carried over to chat branches, including which summary types are omitted or remapped.
  • Tests

    • Expanded regression coverage for long-term memory prompt resolution, template normalization, and agent-eligibility behavior.

🔄 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/4247 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 7/29/2026 **Status:** ✅ Merged **Merged:** 7/29/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/chat-summary-branch-inheritance` --- ### 📝 Commits (7) - [`0aed579`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0aed579bfa4a525ac104f355f9157beaf111391d) fix(chat): inherit contained summaries across branches - [`8e37b39`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8e37b39e880d2e827dde7c0c4d28ccc75554ca90) Merge remote-tracking branch 'upstream/staging' into codex/chat-summary-branch-inheritance - [`aceb85d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/aceb85d071b0eec5e7875d7f6c9fcf51dd0a10b9) fix(chat): preserve summary prompt contracts - [`af0df68`](https://github.com/Pasta-Devs/Marinara-Engine/commit/af0df6830c4e5234e338d60e0f53b753b533984a) Merge branch 'staging' into fix/chat-summary-branch-inheritance - [`4f66fa6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4f66fa660624dcc12f182454ee3c3e54b483a93c) chore: wording on ltm prompt - [`45e18c5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/45e18c5100e836dd0afb8c8e343cfe394eaf2513) fix(chat): normalize summary prompt template IDs - [`c982031`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c982031bd5b7cf4404031ca4d617af04343c3b7e) Merge branch 'staging' into fix/chat-summary-branch-inheritance ### 📊 Changes **9 files changed** (+269 additions, -35 deletions) <details> <summary>View changed files</summary> 📝 `docs/chats/branches.md` (+1 -1) 📝 `packages/client/src/components/chat/ChatRoleplaySurface.tsx` (+11 -0) 📝 `packages/client/src/components/chat/SummaryPopover.tsx` (+66 -29) 📝 `packages/client/src/localization/locales/en.json` (+1 -0) 📝 `packages/server/src/routes/chats.routes.ts` (+48 -3) 📝 `packages/server/src/services/generation/roleplay-summary-runtime.ts` (+10 -0) 📝 `packages/shared/src/constants/agent-prompts.ts` (+82 -0) 📝 `packages/shared/src/utils/chat-summary-prompt-settings.ts` (+15 -2) 📝 `scripts/regressions/prompt.regression.ts` (+35 -0) </details> ### 📄 Description ## Linked issue Closes #4246 ## Why this change - Branching a chat should preserve rolling summary context only when the summary describes messages that are actually copied into the child branch. - Users also need an optional Long-Term Memory summary prompt without changing prompt behavior for chats where that agent is inactive. ## What changed - Added the built-in Long-Term Memory chat-summary prompt and eligibility checks. - Persisted prompt selection through the existing global summary prompt settings. - Carried over parent summaries whose persisted source message IDs are fully contained in the copied branch range. - Remapped inherited source IDs, hidden IDs, summary metadata, alternate swipe hidden flags, and automatic-summary tracking. - Excluded summaries that cross the branch point or lack verifiable source message metadata. - Added prompt regression assertions and documented branch-summary inheritance. ## Validation - [x] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Automated proof completed: `pnpm regression:prompt`, `pnpm build`, client ESLint, and `git diff --check`. - Manual browser/app verification and container verification were not performed. ## Docs and release impact - [ ] No docs changes needed - [x] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [x] 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) Translation follow-up: #4248 ## UI evidence (if applicable) The PR changes the summary prompt selector UI. No screenshots or recordings were captured; browser evidence remains a manual follow-up. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added a Long-Term Memory “Chat Summary” template for eligible chats. - Updated the chat summary picker/popover to gate the option based on chat settings, and to support consistent selection/editing/copying/duplication behavior. - **Bug Fixes** - Fixed chat branching to correctly inherit and re-map rolling summary metadata, including restoring message visibility when branch-cutoff coverage changes. - **Documentation** - Clarified how conversation summaries are carried over to chat branches, including which summary types are omitted or remapped. - **Tests** - Expanded regression coverage for long-term memory prompt resolution, template normalization, and agent-eligibility behavior. <!-- 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:09:05 +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#6300
No description provided.