[PR #2554] [MERGED] [codex] Refactor generation pipeline services #5652

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

📋 Pull Request Information

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

Base: staging ← Head: codex/refactor-generate-pipeline


📝 Commits (3)

  • 36a3ea6 refactor generation pipeline services
  • 4819ee6 address coderabbit generation hardening
  • d3432b5 merge staging into generation pipeline refactor

📊 Changes

28 files changed (+3908 additions, -3246 deletions)

View changed files

📝 packages/server/src/routes/generate.routes.ts (+250 -3231)
📝 packages/server/src/routes/generate/retry-agents-route.ts (+1 -15)
➕ packages/server/src/services/generation/agent-cadence.ts (+44 -0)
➕ packages/server/src/services/generation/agent-event-dispatcher.ts (+39 -0)
➕ packages/server/src/services/generation/agent-resolution.ts (+407 -0)
➕ packages/server/src/services/generation/assistant-preset-utils.ts (+119 -0)
➕ packages/server/src/services/generation/character-prompt-context.ts (+214 -0)
➕ packages/server/src/services/generation/committed-tracker-context.ts (+164 -0)
➕ packages/server/src/services/generation/conversation-context-utils.ts (+28 -0)
➕ packages/server/src/services/generation/conversation-memory-context.ts (+62 -0)
➕ packages/server/src/services/generation/game-gm-prompt-runtime.ts (+342 -0)
➕ packages/server/src/services/generation/game-journal-runtime.ts (+26 -0)
➕ packages/server/src/services/generation/game-party-utils.ts (+19 -0)
➕ packages/server/src/services/generation/generation-parameters.ts (+58 -0)
➕ packages/server/src/services/generation/generation-text-utils.ts (+84 -0)
➕ packages/server/src/services/generation/haptic-runtime.ts (+61 -0)
➕ packages/server/src/services/generation/lorebook-generation-runtime.ts (+94 -0)
➕ packages/server/src/services/generation/memory-recall-context.ts (+68 -0)
➕ packages/server/src/services/generation/memory-recall-pack.ts (+65 -0)
➕ packages/server/src/services/generation/message-history.ts (+19 -0)

...and 8 more files

📄 Description

Summary

  • Split generation-route helper clusters into focused services under packages/server/src/services/generation.
  • Centralized agent/tool resolution, prompt scoping, tracker/memory context, game GM/runtime helpers, Spotify, haptics, and runtime agent section utilities.
  • Shared message-history lookup with the retry agents route and moved Spotify tool availability into the generation service layer.

Why

generate.routes.ts had grown into a large critical route with many route-local helper responsibilities. This PR moves cohesive logic into named modules so future generation, agent, lorebook, game, and Spotify changes have clearer ownership and smaller edit surfaces.

Validation

  • pnpm check passed locally.
  • git diff --check passed locally.

Manual verification needed

  • Manually verify conversation, roleplay, and game generation paths.
  • Manually verify post-processing agents, Spotify DJ, haptics, lorebook context, tracker context, and game journal updates.

Tracking

No linked issue was provided for this refactor. A maintainer should link or create a tracking issue before merge if required by project policy.

Summary by CodeRabbit

  • New Features
    • Added agent cadence controls, improved generation agent pipeline resolution, and more flexible agent event dispatch/deferral (including expression updates)
    • Introduced assistant preset utilities and stronger prompt context injections (character identity, committed tracker, memory recall, scene context, and GM runtime)
    • Expanded lorebook runtime, haptic command normalization, roleplay DM target parsing, and runtime agent section handling
    • Enhanced Spotify runtime playback fallbacks and end-to-end generation tool resolution
  • Refactor
    • Shared message-history lookup logic across retry handling

🔄 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/2554 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 6/14/2026 **Status:** ✅ Merged **Merged:** 6/14/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `codex/refactor-generate-pipeline` --- ### 📝 Commits (3) - [`36a3ea6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/36a3ea67c0258bf95bba359c59d2e5b1fd90caed) refactor generation pipeline services - [`4819ee6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4819ee6d75a7712c85cc7fe1853f108c6708f6c1) address coderabbit generation hardening - [`d3432b5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d3432b52ab4008f1f513153ca6736b27619ccdbb) merge staging into generation pipeline refactor ### 📊 Changes **28 files changed** (+3908 additions, -3246 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/routes/generate.routes.ts` (+250 -3231) 📝 `packages/server/src/routes/generate/retry-agents-route.ts` (+1 -15) ➕ `packages/server/src/services/generation/agent-cadence.ts` (+44 -0) ➕ `packages/server/src/services/generation/agent-event-dispatcher.ts` (+39 -0) ➕ `packages/server/src/services/generation/agent-resolution.ts` (+407 -0) ➕ `packages/server/src/services/generation/assistant-preset-utils.ts` (+119 -0) ➕ `packages/server/src/services/generation/character-prompt-context.ts` (+214 -0) ➕ `packages/server/src/services/generation/committed-tracker-context.ts` (+164 -0) ➕ `packages/server/src/services/generation/conversation-context-utils.ts` (+28 -0) ➕ `packages/server/src/services/generation/conversation-memory-context.ts` (+62 -0) ➕ `packages/server/src/services/generation/game-gm-prompt-runtime.ts` (+342 -0) ➕ `packages/server/src/services/generation/game-journal-runtime.ts` (+26 -0) ➕ `packages/server/src/services/generation/game-party-utils.ts` (+19 -0) ➕ `packages/server/src/services/generation/generation-parameters.ts` (+58 -0) ➕ `packages/server/src/services/generation/generation-text-utils.ts` (+84 -0) ➕ `packages/server/src/services/generation/haptic-runtime.ts` (+61 -0) ➕ `packages/server/src/services/generation/lorebook-generation-runtime.ts` (+94 -0) ➕ `packages/server/src/services/generation/memory-recall-context.ts` (+68 -0) ➕ `packages/server/src/services/generation/memory-recall-pack.ts` (+65 -0) ➕ `packages/server/src/services/generation/message-history.ts` (+19 -0) _...and 8 more files_ </details> ### 📄 Description ## Summary - Split generation-route helper clusters into focused services under `packages/server/src/services/generation`. - Centralized agent/tool resolution, prompt scoping, tracker/memory context, game GM/runtime helpers, Spotify, haptics, and runtime agent section utilities. - Shared message-history lookup with the retry agents route and moved Spotify tool availability into the generation service layer. ## Why `generate.routes.ts` had grown into a large critical route with many route-local helper responsibilities. This PR moves cohesive logic into named modules so future generation, agent, lorebook, game, and Spotify changes have clearer ownership and smaller edit surfaces. ## Validation - `pnpm check` passed locally. - `git diff --check` passed locally. ## Manual verification needed - Manually verify conversation, roleplay, and game generation paths. - Manually verify post-processing agents, Spotify DJ, haptics, lorebook context, tracker context, and game journal updates. ## Tracking No linked issue was provided for this refactor. A maintainer should link or create a tracking issue before merge if required by project policy. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added agent cadence controls, improved generation agent pipeline resolution, and more flexible agent event dispatch/deferral (including expression updates) * Introduced assistant preset utilities and stronger prompt context injections (character identity, committed tracker, memory recall, scene context, and GM runtime) * Expanded lorebook runtime, haptic command normalization, roleplay DM target parsing, and runtime agent section handling * Enhanced Spotify runtime playback fallbacks and end-to-end generation tool resolution * **Refactor** * Shared message-history lookup logic across retry handling <!-- 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:18:10 +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#5652
No description provided.