[PR #2084] [MERGED] Fix neutral chat summary prompt #5428

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2084
Author: @cha1latte
Created: 6/3/2026
Status: ✅ Merged
Merged: 6/3/2026
Merged by: @cha1latte

Base: refactor ← Head: fix/issue-2064-neutral-auto-summary


📝 Commits (1)

  • 42f1265 Fix chat summary prompt neutrality

📊 Changes

2 files changed (+21 additions, -5 deletions)

View changed files

📝 src/engine/contracts/constants/agent-prompts.test.ts (+14 -0)
📝 src/engine/contracts/constants/agent-prompts.ts (+7 -5)

📄 Description

Linked issue

Closes #2064

Why this change

  • Auto Chat Summary could ask the model for summary text using wording that still invited scene continuation and style matching. In the reported failure, the generated summary read like persona/narrative output instead of a neutral recap.

What changed

  • Tightened the built-in chat-summary prompt so it asks for a neutral factual recap of new events only.
  • Removed the old "continuation" and "match tone/style" cues from the default summary prompt.
  • Added a regression test that requires the neutral-summary guardrails and forbids reintroducing the risky continuation/style wording.

Refactor impact

Primary owner:

engine generation

Impact areas reviewed:

  • Built-in chat-summary default prompt.
  • Manual/default summary prompt selection via getDefaultAgentPrompt("chat-summary").
  • Agent executor fallback behavior for built-in agents with empty promptTemplate.

Boundary notes:

  • Engine-only prompt contract change. No React UI, shared API, Tauri/Rust storage, remote runtime, schema, dependency, or migration changes.
  • Existing user-authored/custom summary prompt templates are intentionally not rewritten. Users who copied the old wording into a custom prompt template may still need to edit that custom text manually.

Pressure points touched:

  • None. This does not touch ModeSurface, GameSurface, shared mode UI, command registration, imports, or remote runtime.

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

  • Codex ran node scratch/check-chat-summary-prompt.mjs: passed after the fix, proving the default prompt now requires neutral recap behavior and blocks persona-style continuation cues.
  • Codex ran node scratch/capture-issue-2064-proof.mjs: before/base prompt failed for missing neutral/do-not-continue/do-not-speak/do-not-dialogue/do-not-match-roleplay guardrails and still contained continuation/style cues; current patch passed.
  • Codex ran pnpm exec vitest run src/engine/contracts/constants/agent-prompts.test.ts: 1 file passed, 3 tests passed.
  • Codex ran pnpm typecheck: passed.
  • Codex ran full pnpm check: passed line endings, architecture/import rules, frontend TypeScript, Rust cargo check, docs, discovery metadata, and unused-code checks.
  • Codex ran node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json: passed.
  • Bunny review before PR: pass. Diff is limited to the built-in prompt and its regression test; no dependency/schema/storage/auth/release/prompt-pipeline expansion beyond the intended summary prompt contract.

Feature Discoverability

Check exactly one:

  • Updated src/features/shell/discovery/ because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool.
  • N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find.

Reason:

  • Bugfix only. No new user-discoverable feature or workflow was added.

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 a non-visual prompt-contract fix; proof is command-based and recorded above.

Summary by CodeRabbit

  • Tests

    • Added comprehensive test validation for chat summary functionality, verifying enforcement of neutral, factual append-only summaries while preventing scene continuation, dialogue injection, or roleplay voice.
  • Bug Fixes

    • Updated chat summary prompt template to enforce strictly neutral, factual summarization with explicit constraints preventing scene advancement, new events, or stylistic matching requirements.

🔄 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/2084 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 6/3/2026 **Status:** ✅ Merged **Merged:** 6/3/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/issue-2064-neutral-auto-summary` --- ### 📝 Commits (1) - [`42f1265`](https://github.com/Pasta-Devs/Marinara-Engine/commit/42f126557e9faa9869a520dc12da711268e32c83) Fix chat summary prompt neutrality ### 📊 Changes **2 files changed** (+21 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `src/engine/contracts/constants/agent-prompts.test.ts` (+14 -0) 📝 `src/engine/contracts/constants/agent-prompts.ts` (+7 -5) </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 #2064 ## Why this change - Auto Chat Summary could ask the model for summary text using wording that still invited scene continuation and style matching. In the reported failure, the generated summary read like persona/narrative output instead of a neutral recap. ## What changed - Tightened the built-in `chat-summary` prompt so it asks for a neutral factual recap of new events only. - Removed the old "continuation" and "match tone/style" cues from the default summary prompt. - Added a regression test that requires the neutral-summary guardrails and forbids reintroducing the risky continuation/style wording. ## Refactor impact Primary owner: engine generation Impact areas reviewed: - Built-in chat-summary default prompt. - Manual/default summary prompt selection via `getDefaultAgentPrompt("chat-summary")`. - Agent executor fallback behavior for built-in agents with empty `promptTemplate`. Boundary notes: - Engine-only prompt contract change. No React UI, shared API, Tauri/Rust storage, remote runtime, schema, dependency, or migration changes. - Existing user-authored/custom summary prompt templates are intentionally not rewritten. Users who copied the old wording into a custom prompt template may still need to edit that custom text manually. Pressure points touched: - None. This does not touch ModeSurface, GameSurface, shared mode UI, command registration, imports, or remote runtime. ## Validation <!-- Check only what you personally ran or manually verified. Treat unchecked items as explicit TODOs. --> <!-- Do not submit *.test.ts or *.test.tsx files as PR proof; cite existing checks, command output, app/browser/Tauri verification, or manual notes instead. --> - [ ] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [ ] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes - Codex ran `node scratch/check-chat-summary-prompt.mjs`: passed after the fix, proving the default prompt now requires neutral recap behavior and blocks persona-style continuation cues. - Codex ran `node scratch/capture-issue-2064-proof.mjs`: before/base prompt failed for missing neutral/do-not-continue/do-not-speak/do-not-dialogue/do-not-match-roleplay guardrails and still contained continuation/style cues; current patch passed. - Codex ran `pnpm exec vitest run src/engine/contracts/constants/agent-prompts.test.ts`: 1 file passed, 3 tests passed. - Codex ran `pnpm typecheck`: passed. - Codex ran full `pnpm check`: passed line endings, architecture/import rules, frontend TypeScript, Rust cargo check, docs, discovery metadata, and unused-code checks. - Codex ran `node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json`: passed. - Bunny review before PR: pass. Diff is limited to the built-in prompt and its regression test; no dependency/schema/storage/auth/release/prompt-pipeline expansion beyond the intended summary prompt contract. ## Feature Discoverability Check exactly one: - [ ] Updated `src/features/shell/discovery/` because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool. - [ ] N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find. Reason: - Bugfix only. No new user-discoverable feature or workflow was added. ## 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 a non-visual prompt-contract fix; proof is command-based and recorded above. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Tests** * Added comprehensive test validation for chat summary functionality, verifying enforcement of neutral, factual append-only summaries while preventing scene continuation, dialogue injection, or roleplay voice. * **Bug Fixes** * Updated chat summary prompt template to enforce strictly neutral, factual summarization with explicit constraints preventing scene advancement, new events, or stylistic matching requirements. <!-- 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:16:13 +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#5428
No description provided.