[PR #3937] [MERGED] Fix Roleplay generation stop and Chat Summary regressions #6166

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

📋 Pull Request Information

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

Base: staging ← Head: agent/fix-roleplay-stop-generation


📝 Commits (1)

  • 96f1185 fix roleplay generation and summary regressions

📊 Changes

7 files changed (+113 additions, -47 deletions)

View changed files

📝 CHANGELOG.md (+3 -0)
📝 packages/client/src/components/chat/SummaryPopover.tsx (+19 -25)
📝 packages/client/src/stores/chat.store.ts (+2 -5)
📝 packages/server/src/services/prompt/assembler.ts (+11 -7)
📝 packages/server/src/services/prompt/marker-expander.ts (+16 -6)
📝 scripts/regressions/prompt.regression.ts (+15 -4)
📝 scripts/regressions/roleplay-streaming.regression.ts (+47 -0)

📄 Description

Why

Several Roleplay regressions made stopping generation unreliable and made Chat Summary customization either misleading or slow:

  • Stop closed the browser stream but could leave the server generation running.
  • Renaming the Chat Summary preset marker did not rename its generated wrapper.
  • Editing a summary rerendered the full popover on every keystroke.
  • Character-dependent summary conditionals resolved before the individual group responder was known.

These regressions were reported directly by the maintainer. There is no linked tracking issue; one should be opened per the contribution policy.

What changed

  • Send explicit generation cancellation through the shared authenticated API client so CSRF and admin-auth headers are present.
  • Use the authored Chat Summary marker name for XML/Markdown wrapping.
  • Keep summary editor drafts local to the editor and publish them upward only on Save.
  • Defer character-dependent macros in both explicit and fallback summary insertion paths until the responder-specific provider prompt is finalized.
  • Add regression coverage for abort headers, summary editor state isolation, renamed wrappers, and responder-scoped summary conditionals.
  • Document the fixes under Unreleased in CHANGELOG.md.

Root causes

The abort request used raw fetch, bypassing shared request headers. The summary marker separately overrode its saved name with Chat Summary. Summary drafts lived in popover-level state, invalidating the entire render tree on each input event. Finally, summaries resolved macros during shared prompt assembly instead of using the existing deferred character-macro pass used by individual group generation.

Validation

  • pnpm check
  • pnpm regression:prompt
  • pnpm regression:roleplay
  • pnpm version:check
  • git diff --check
  • pnpm smoke:ui: 80 passed and 52 skipped; two unrelated desktop side-panel tests failed. The Tracker test passed when rerun alone. The side-panel close-animation width assertion still fails and is outside this patch.

Manual verification

  • Manually verify Stop ends a streaming Roleplay response without the completed response reappearing.
  • Manually rename a Chat Summary marker to Past Events and verify Peek Prompt uses <past_events>.
  • Manually edit a long summary and confirm typing stays responsive while Save and Cancel retain their behavior.
  • Manually verify {{#if character == "Powers That Be"}}...{{/if}} appears only in that character's individual group prompt.
  • Manually verify the affected Roleplay flow on a mobile viewport.

No visual design changes were made, so no before/after screenshot is included.

Summary by CodeRabbit

  • Bug Fixes

    • Stopping roleplay generation now cancels immediately through the authenticated request flow.
    • Chat Summary markers now preserve their configured names and correctly resolve character-specific macros.
    • Improved Chat Summary editing responsiveness by limiting updates to the editor until changes are saved.
  • Tests

    • Added regression coverage for generation cancellation, summary editing performance, marker placement, and deferred character-specific macros.

🔄 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/3937 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 7/22/2026 **Status:** ✅ Merged **Merged:** 7/22/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `agent/fix-roleplay-stop-generation` --- ### 📝 Commits (1) - [`96f1185`](https://github.com/Pasta-Devs/Marinara-Engine/commit/96f1185cb17d517be99ed89315dad90bc413cf66) fix roleplay generation and summary regressions ### 📊 Changes **7 files changed** (+113 additions, -47 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+3 -0) 📝 `packages/client/src/components/chat/SummaryPopover.tsx` (+19 -25) 📝 `packages/client/src/stores/chat.store.ts` (+2 -5) 📝 `packages/server/src/services/prompt/assembler.ts` (+11 -7) 📝 `packages/server/src/services/prompt/marker-expander.ts` (+16 -6) 📝 `scripts/regressions/prompt.regression.ts` (+15 -4) 📝 `scripts/regressions/roleplay-streaming.regression.ts` (+47 -0) </details> ### 📄 Description ## Why Several Roleplay regressions made stopping generation unreliable and made Chat Summary customization either misleading or slow: - **Stop** closed the browser stream but could leave the server generation running. - Renaming the Chat Summary preset marker did not rename its generated wrapper. - Editing a summary rerendered the full popover on every keystroke. - Character-dependent summary conditionals resolved before the individual group responder was known. These regressions were reported directly by the maintainer. There is no linked tracking issue; one should be opened per the contribution policy. ## What changed - Send explicit generation cancellation through the shared authenticated API client so CSRF and admin-auth headers are present. - Use the authored Chat Summary marker name for XML/Markdown wrapping. - Keep summary editor drafts local to the editor and publish them upward only on Save. - Defer character-dependent macros in both explicit and fallback summary insertion paths until the responder-specific provider prompt is finalized. - Add regression coverage for abort headers, summary editor state isolation, renamed wrappers, and responder-scoped summary conditionals. - Document the fixes under `Unreleased` in `CHANGELOG.md`. ## Root causes The abort request used raw `fetch`, bypassing shared request headers. The summary marker separately overrode its saved name with `Chat Summary`. Summary drafts lived in popover-level state, invalidating the entire render tree on each input event. Finally, summaries resolved macros during shared prompt assembly instead of using the existing deferred character-macro pass used by individual group generation. ## Validation - `pnpm check` - `pnpm regression:prompt` - `pnpm regression:roleplay` - `pnpm version:check` - `git diff --check` - `pnpm smoke:ui`: 80 passed and 52 skipped; two unrelated desktop side-panel tests failed. The Tracker test passed when rerun alone. The side-panel close-animation width assertion still fails and is outside this patch. ## Manual verification - [ ] Manually verify **Stop** ends a streaming Roleplay response without the completed response reappearing. - [ ] Manually rename a Chat Summary marker to **Past Events** and verify Peek Prompt uses `<past_events>`. - [ ] Manually edit a long summary and confirm typing stays responsive while Save and Cancel retain their behavior. - [ ] Manually verify `{{#if character == "Powers That Be"}}...{{/if}}` appears only in that character's individual group prompt. - [ ] Manually verify the affected Roleplay flow on a mobile viewport. No visual design changes were made, so no before/after screenshot is included. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Stopping roleplay generation now cancels immediately through the authenticated request flow. * Chat Summary markers now preserve their configured names and correctly resolve character-specific macros. * Improved Chat Summary editing responsiveness by limiting updates to the editor until changes are saved. * **Tests** * Added regression coverage for generation cancellation, summary editing performance, marker placement, and deferred character-specific macros. <!-- 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:07:44 +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#6166
No description provided.