[PR #455] [MERGED] fix(agents): anchor director cadence to first group reply #4625

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/455
Author: @Xelvanis
Created: 5/6/2026
Status: ✅ Merged
Merged: 5/6/2026
Merged by: @SpicyMarinara

Base: main ← Head: fix/director-group-chat-intervals


📝 Commits (1)

  • aab8bd0 fix(agents): anchor director cadence to first group reply

📊 Changes

1 file changed (+9 additions, -3 deletions)

View changed files

📝 packages/server/src/routes/generate.routes.ts (+9 -3)

📄 Description

Linked issue

Closes #

Why this change

  • Narrative Director run intervals were counted incorrectly in group chats because successful pre-generation Director runs were anchored to the last generated assistant reply in a multi-character turn. That made cadence tracking drift when multiple characters replied in one generation.

What changed

  • Track the first saved assistant message produced during a generation turn.
  • Persist successful Narrative Director pre-generation runs against that first assistant message, so group-chat interval counting starts from the beginning of the generated group response.
  • Skip persisting these pre-generation Director cadence rows during regenerations, so retries/swipes do not incorrectly reset the interval.

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 validation run locally by Codex: pnpm check
  • Automated test suite run locally by Codex: pnpm test
  • Production build runs normally.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

Summary by CodeRabbit

  • Improvements
    • Better handling of multi-character/group interactions during generation, reducing cross-character confusion.
    • More consistent regeneration behavior through improved anchoring of pre-generation content.
    • More reliable collection and organization of in-turn commands and out-of-character messages for downstream processing and provenance.

🔄 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/455 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 5/6/2026 **Status:** ✅ Merged **Merged:** 5/6/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `main` ← **Head:** `fix/director-group-chat-intervals` --- ### 📝 Commits (1) - [`aab8bd0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/aab8bd06e5bc713676cd6ef8282419f3f3c7abf9) fix(agents): anchor director cadence to first group reply ### 📊 Changes **1 file changed** (+9 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/routes/generate.routes.ts` (+9 -3) </details> ### 📄 Description ## Linked issue <!-- Every PR should reference a feature request or issue report. If there isn't one yet, open one first to gather opinions: --> <!-- https://github.com/Pasta-Devs/Marinara-Engine/issues/new/choose --> Closes # ## Why this change <!-- What user problem, bug, or goal does this solve? --> - Narrative Director run intervals were counted incorrectly in group chats because successful pre-generation Director runs were anchored to the last generated assistant reply in a multi-character turn. That made cadence tracking drift when multiple characters replied in one generation. ## What changed <!-- List the key changes in this PR --> - Track the first saved assistant message produced during a generation turn. - Persist successful Narrative Director pre-generation runs against that first assistant message, so group-chat interval counting starts from the beginning of the generated group response. - Skip persisting these pre-generation Director cadence rows during regenerations, so retries/swipes do not incorrectly reset the interval. ## Validation <!-- Required: include commands run and/or manual checks performed --> - [X] `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) - [X] Above manual verification completed (describe below) - [X] Read and followed `CONTRIBUTING.md` ### Manual verification notes <!-- Describe exactly what you tested in a real browser/app, step by step. --> <!-- ⚠️ If an AI agent filled out or ticked these boxes for you, treat them --> <!-- as a TO-DO LIST, not as proof the work is done. Verify each item yourself --> <!-- before submitting. If you haven't verified it, untick the box. --> - Automated validation run locally by Codex: `pnpm check` - Automated test suite run locally by Codex: `pnpm test` - Production build runs normally. ## Docs and release impact - [X] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Improvements** * Better handling of multi-character/group interactions during generation, reducing cross-character confusion. * More consistent regeneration behavior through improved anchoring of pre-generation content. * More reliable collection and organization of in-turn commands and out-of-character messages for downstream processing and provenance. <!-- 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:09:16 +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#4625
No description provided.