[PR #2392] [MERGED] Honor conversation start marker in generation history #5575

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

📋 Pull Request Information

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

Base: refactor ← Head: fix/conversation-start-marker


📝 Commits (2)

  • 004de10 Honor conversation start marker in generation history
  • 14dc3f0 Use boolish for the conversation start marker to tolerate boolish stored values

📊 Changes

2 files changed (+10 additions, -1 deletions)

View changed files

📝 src/engine/generation/context.ts (+1 -0)
📝 src/engine/generation/prompt-assembly.ts (+9 -1)

📄 Description

Linked issue

Closes #2281

Why this change

  • "Mark as new start" (isConversationStart) was a dead control during generation: the flag was both stripped by the generation message projection and ignored by the history builder, so messages before a user's new-start marker still entered the model context. This restores parity with main's generate.routes.ts and the engine's own auto-summary path.

What changed

  • Added isConversationStart to GENERATION_MESSAGE_EXTRA_FIELDS in src/engine/generation/context.ts so the flag survives the generation projection (previously stripped before prompt assembly ever saw it).
  • historyMessages in src/engine/generation/prompt-assembly.ts now scans storedMessages newest-to-oldest for the last extra.isConversationStart === true and slices history from that index before the existing hidden-filter + slice(-limit) tail. Mirrors the shipping pattern in auto-summary.service.ts:169.

Refactor impact

Primary owner: engine generation

Impact areas reviewed:

  • src/engine/generation/context.ts (projection allowlist)
  • src/engine/generation/prompt-assembly.ts (historyMessages)

Boundary notes:

  • None. Both edits stay inside the engine generation layer; no feature/shared-api/Rust boundary crossed. Mode-agnostic (honors a generic message-level marker, no roleplay/game/chat coupling).

Pressure points touched:

  • None.

Validation

  • Matching validation command passes locally
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

  • pnpm vitest run src/engine/generation/prompt-assembly.test.ts — 11 passed (3 new cases: marker slices pre-marker history, stringified-extra marker form, no-marker passthrough keeps full history).
  • pnpm exec tsc -b — clean.

Feature Discoverability

  • Updated src/features/shell/discovery/
  • N/A because this PR is a bugfix and does not add a new user-discoverable thing.

Reason:

  • Restores an existing control's intended behavior; nothing new to discover.

Docs and release impact

  • No docs changes needed

🔄 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/2392 **Author:** [@Romuromylus](https://github.com/Romuromylus) **Created:** 6/6/2026 **Status:** ✅ Merged **Merged:** 6/6/2026 **Merged by:** [@Romuromylus](https://github.com/Romuromylus) **Base:** `refactor` ← **Head:** `fix/conversation-start-marker` --- ### 📝 Commits (2) - [`004de10`](https://github.com/Pasta-Devs/Marinara-Engine/commit/004de10d9eb2301eab6646554995f2ad4ab5ced3) Honor conversation start marker in generation history - [`14dc3f0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/14dc3f07f10595ba774b3df0c048b83aa6a8f094) Use boolish for the conversation start marker to tolerate boolish stored values ### 📊 Changes **2 files changed** (+10 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/engine/generation/context.ts` (+1 -0) 📝 `src/engine/generation/prompt-assembly.ts` (+9 -1) </details> ### 📄 Description ## Linked issue Closes #2281 ## Why this change - "Mark as new start" (`isConversationStart`) was a dead control during generation: the flag was both stripped by the generation message projection and ignored by the history builder, so messages before a user's new-start marker still entered the model context. This restores parity with main's generate.routes.ts and the engine's own auto-summary path. ## What changed - Added `isConversationStart` to `GENERATION_MESSAGE_EXTRA_FIELDS` in `src/engine/generation/context.ts` so the flag survives the generation projection (previously stripped before prompt assembly ever saw it). - `historyMessages` in `src/engine/generation/prompt-assembly.ts` now scans `storedMessages` newest-to-oldest for the last `extra.isConversationStart === true` and slices history from that index before the existing hidden-filter + `slice(-limit)` tail. Mirrors the shipping pattern in `auto-summary.service.ts:169`. ## Refactor impact Primary owner: engine generation Impact areas reviewed: - `src/engine/generation/context.ts` (projection allowlist) - `src/engine/generation/prompt-assembly.ts` (`historyMessages`) Boundary notes: - None. Both edits stay inside the engine generation layer; no feature/shared-api/Rust boundary crossed. Mode-agnostic (honors a generic message-level marker, no roleplay/game/chat coupling). Pressure points touched: - None. ## Validation - [x] Matching validation command passes locally - [ ] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes - `pnpm vitest run src/engine/generation/prompt-assembly.test.ts` — 11 passed (3 new cases: marker slices pre-marker history, stringified-extra marker form, no-marker passthrough keeps full history). - `pnpm exec tsc -b` — clean. ## Feature Discoverability - [ ] Updated `src/features/shell/discovery/` - [x] N/A because this PR is a bugfix and does not add a new user-discoverable thing. Reason: - Restores an existing control's intended behavior; nothing new to discover. ## Docs and release impact - [x] No docs changes needed --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:17:29 +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#5575
No description provided.