[PR #6226] [MERGED] feat: make roleplay agent summaries opt-in and cost help tappable #7094

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6226
Author: @SpicyMarinara
Created: 9/15/2026
Status: ✅ Merged
Merged: 9/15/2026
Merged by: @SpicyMarinara

Base: staging ← Head: feat/roleplay-agent-summary-toggle


📝 Commits (2)

  • 90a0474 chore: track roleplay agent summary control
  • 506e636 feat: make roleplay agent summaries opt-in and cost help tappable

📊 Changes

12 files changed (+278 additions, -16 deletions)

View changed files

📝 CHANGELOG.md (+4 -0)
📝 docs/agents/agents-overview.md (+2 -1)
📝 e2e/chat-sweep.e2e.ts (+133 -0)
📝 packages/client/src/components/chat/ChatSettingsDrawer.tsx (+23 -5)
📝 packages/client/src/localization/locales/en.json (+2 -0)
📝 packages/server/src/routes/generate.routes.ts (+2 -1)
📝 packages/server/src/routes/generate/retry-agents-route.ts (+10 -7)
📝 packages/server/src/services/generation/roleplay-summary-retrieval.ts (+5 -0)
📝 packages/server/src/services/generation/tool-resolution-runtime.ts (+6 -1)
📝 packages/shared/src/types/chat.ts (+2 -0)
📝 scripts/regressions/agent-context-generation.regression.ts (+72 -1)
📝 scripts/regressions/manual-agent-retry-resolution.regression.ts (+17 -0)

📄 Description

Linked issue

Closes #6225
Closes #6228

Why this change

An agent’s recent-message limit only limits chat messages. Roleplay agent requests also attach the saved chat summary separately, which can add thousands of tokens even with a five-message window. Chat Settings → Agents now offers Attach chat summaries, off by default as requested by the maintainer, including for existing chats without a saved choice. The adjacent cost explanation also used a native hover title that could not be opened on mobile; it now uses the existing tappable help component.

What changed

  • Reuse the existing drawer toggle and metadata save path, with localized copy and Chroma styling.
  • Replace the non-interactive cost information symbol with the existing HelpTooltip, a 44px touch target, and viewport-aware positioning.
  • Gate shared agent summary context with one small predicate reused by normal generation, retries/manual runs, and tool metadata refreshes. Only explicit true enables attachment in Roleplay.
  • Preserve summary storage, main-reply context, dedicated summary generation, and behavior in other modes. Agents explicitly granted full main-prompt access retain that capability.
  • Update the Agents guide and Unreleased changelog. Translation follow-up: #6227.

Validation

  • pnpm check passes: localization, formatting, lint/types, E2E types, and production build.

  • pnpm regression:prompt passes all three suites after the final default-off change.

  • Existing real Fastify/provider regression passes with omitted, false, and true settings; it covers pre-generation, parallel, grouped post-processing, manual retries, the five-message window, summary storage, and the main request retaining its summary. The pre-fix run reproduced unwanted summary attachment.

  • Existing tool-runtime regression passes: omitted/false stays excluded through later metadata writes; true attaches it; Game and Conversation behavior is unchanged. The pre-fix run reproduced reattachment after a tool write.

  • Default-off browser flow passes desktop Chromium, mobile Chromium, and mobile WebKit: absent setting starts off, both choices persist after reload, control stays configurable with Enable Agents off, and Conversation/Game drawers omit it. The same case verifies tap-to-open cost help, a 44px touch target, viewport bounds, and second-tap/outside dismissal. Final combined run: 3/3 passed.

  • 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

Manually verify with installed agents in a real Roleplay chat containing large summaries. Compare agent input with the switch off and on, including manual retries. Manually verify tapping and dismissing the cost help in an iPhone Home Screen app. Automated payload tests use a local fixture provider; no paid model or physical iPhone testing is claimed. This setting controls shared chat-summary attachment, not all other agent instructions, character details, or explicit full-prompt access.

Docs and release impact

English Agents guide and CHANGELOG updated; #6227 tracks the matching changes for all ten downloadable documentation packs. No migration, dependency, or version changes.

UI evidence

Before/after screenshots (self-contained HTML; download to view) include desktop light and mobile WebKit dark views. The old mobile info span reproduced a tap with no visible help; the final tooltip opens and remains inside the viewport.

Summary by CodeRabbit

  • New Features
    • Added an Attach chat summaries toggle under Chat Settings → Agents for Roleplay chats. It is off by default and applies to agent requests, retries, and post-processing.
    • Chat summaries remain available to the main reply and continue being generated.
    • Made the agent-token estimate help available by tapping and ensured it stays within the mobile viewport.
  • Documentation
    • Documented the new summary setting and token estimate help 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/6226 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 9/15/2026 **Status:** ✅ Merged **Merged:** 9/15/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `feat/roleplay-agent-summary-toggle` --- ### 📝 Commits (2) - [`90a0474`](https://github.com/Pasta-Devs/Marinara-Engine/commit/90a0474881e7fb1e239185808bdc8a0fef7fd6ab) chore: track roleplay agent summary control - [`506e636`](https://github.com/Pasta-Devs/Marinara-Engine/commit/506e6369e8830595580b23701b8eb9b415404aec) feat: make roleplay agent summaries opt-in and cost help tappable ### 📊 Changes **12 files changed** (+278 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+4 -0) 📝 `docs/agents/agents-overview.md` (+2 -1) 📝 `e2e/chat-sweep.e2e.ts` (+133 -0) 📝 `packages/client/src/components/chat/ChatSettingsDrawer.tsx` (+23 -5) 📝 `packages/client/src/localization/locales/en.json` (+2 -0) 📝 `packages/server/src/routes/generate.routes.ts` (+2 -1) 📝 `packages/server/src/routes/generate/retry-agents-route.ts` (+10 -7) 📝 `packages/server/src/services/generation/roleplay-summary-retrieval.ts` (+5 -0) 📝 `packages/server/src/services/generation/tool-resolution-runtime.ts` (+6 -1) 📝 `packages/shared/src/types/chat.ts` (+2 -0) 📝 `scripts/regressions/agent-context-generation.regression.ts` (+72 -1) 📝 `scripts/regressions/manual-agent-retry-resolution.regression.ts` (+17 -0) </details> ### 📄 Description ## Linked issue Closes #6225 Closes #6228 ## Why this change An agent’s recent-message limit only limits chat messages. Roleplay agent requests also attach the saved chat summary separately, which can add thousands of tokens even with a five-message window. Chat Settings → Agents now offers **Attach chat summaries**, off by default as requested by the maintainer, including for existing chats without a saved choice. The adjacent cost explanation also used a native hover title that could not be opened on mobile; it now uses the existing tappable help component. ## What changed - Reuse the existing drawer toggle and metadata save path, with localized copy and Chroma styling. - Replace the non-interactive cost information symbol with the existing HelpTooltip, a 44px touch target, and viewport-aware positioning. - Gate shared agent summary context with one small predicate reused by normal generation, retries/manual runs, and tool metadata refreshes. Only explicit true enables attachment in Roleplay. - Preserve summary storage, main-reply context, dedicated summary generation, and behavior in other modes. Agents explicitly granted full main-prompt access retain that capability. - Update the Agents guide and Unreleased changelog. Translation follow-up: #6227. ## Validation - `pnpm check` passes: localization, formatting, lint/types, E2E types, and production build. - `pnpm regression:prompt` passes all three suites after the final default-off change. - Existing real Fastify/provider regression passes with omitted, false, and true settings; it covers pre-generation, parallel, grouped post-processing, manual retries, the five-message window, summary storage, and the main request retaining its summary. The pre-fix run reproduced unwanted summary attachment. - Existing tool-runtime regression passes: omitted/false stays excluded through later metadata writes; true attaches it; Game and Conversation behavior is unchanged. The pre-fix run reproduced reattachment after a tool write. - Default-off browser flow passes desktop Chromium, mobile Chromium, and mobile WebKit: absent setting starts off, both choices persist after reload, control stays configurable with Enable Agents off, and Conversation/Game drawers omit it. The same case verifies tap-to-open cost help, a 44px touch target, viewport bounds, and second-tap/outside dismissal. Final combined run: 3/3 passed. - [ ] `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 Manually verify with installed agents in a real Roleplay chat containing large summaries. Compare agent input with the switch off and on, including manual retries. Manually verify tapping and dismissing the cost help in an iPhone Home Screen app. Automated payload tests use a local fixture provider; no paid model or physical iPhone testing is claimed. This setting controls shared chat-summary attachment, not all other agent instructions, character details, or explicit full-prompt access. ## Docs and release impact English Agents guide and CHANGELOG updated; #6227 tracks the matching changes for all ten downloadable documentation packs. No migration, dependency, or version changes. ## UI evidence [Before/after screenshots (self-contained HTML; download to view)](https://gist.github.com/SpicyMarinara/dcb6e5ef2be775000e2140d6021d8c3f) include desktop light and mobile WebKit dark views. The old mobile info span reproduced a tap with no visible help; the final tooltip opens and remains inside the viewport. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added an **Attach chat summaries** toggle under Chat Settings → Agents for Roleplay chats. It is off by default and applies to agent requests, retries, and post-processing. - Chat summaries remain available to the main reply and continue being generated. - Made the agent-token estimate help available by tapping and ensured it stays within the mobile viewport. - **Documentation** - Documented the new summary setting and token estimate help 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:16:28 +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#7094
No description provided.