[GH-ISSUE #2171] [Issue]: Agent injection-review trigger lost three guards (writer-only filter, regenerate skip, mode gate) #1080

Closed
opened 2026-10-21 05:26:27 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Romuromylus on GitHub (Jun 4, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2171

Originally assigned to: @cha1latte on GitHub.

Summary

The Writer Agent Review (agent injection review) feature lost three guards that the legacy app enforced on the server: (1) the reviewable list was filtered to writer-category pre-generation agents (excluding knowledge-retrieval / knowledge-router and HTML/static-context injections); (2) the pause was skipped on regenerate/swipe; (3) the pause only fired in roleplay/visual_novel modes. The refactor's shouldPauseForAgentInjectionReview checks none of these.

Expected behavior

  • Only writer-category pre-generation agents (e.g. Prose Guardian, Narrative Director) appear in the review modal; knowledge agents and HTML/static injections are never offered for review.
  • Regenerating/swiping a message generates immediately without re-opening the modal.
  • The review pause is confined to roleplay/visual_novel chats.

Actual behavior

  • runtime.preInjections is passed to the modal unfiltered, so knowledge-retrieval/router and the HTML/static injection surface as editable "writer guidance" textareas.
  • The gate never consults regenerateMessageId, so with the setting on, every swipe/regenerate re-opens the review modal.
  • The gate has no chat-mode condition, so any mode carrying the metadata flag with non-empty preInjections would pause (the toggle UI under Writer Agents limits real-world exposure, but the server guard is weaker than legacy).

Steps to reproduce

  1. Enable "review writer agent outputs" in a roleplay chat.
  2. Generate: the review modal lists knowledge-retrieval/router and HTML injections alongside writer agents.
  3. Regenerate/swipe: the modal re-opens every time instead of generating immediately.

Impact area

  • Roleplay mode
  • React-free engine behavior, contracts, agents, or capability ports

Environment

  • Branch or commit: refactor @ 93555d4b
  • Run mode: Tauri desktop
  • OS + version: Windows 11
  • Node + pnpm versions: n/a (static parity audit, main vs refactor)
  • Rust version, if relevant: n/a
  • Remote Runtime URL configured? not relevant

Regression notes

Worked in legacy (main @ c49f1d95). main: packages/server/src/routes/generate.routes.ts:783-790,6500-6504 (REVIEWABLE_WRITER_AGENT_TYPES filter), :6497 (mode gate roleplay||visual_novel), :6500 (!input.regenerateMessageId). refactor @ 93555d4b: src/engine/generation/start-generation.ts:210-218 (shouldPauseForAgentInjectionReview checks only overrides + non-empty + reviewWriterAgentOutputs flag) + :2687-2698 (event maps runtime.preInjections directly, no filter). All three guards absent.

Originally created by @Romuromylus on GitHub (Jun 4, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2171 Originally assigned to: @cha1latte on GitHub. ## Summary The Writer Agent Review (agent injection review) feature lost three guards that the legacy app enforced on the server: (1) the reviewable list was filtered to writer-category pre-generation agents (excluding knowledge-retrieval / knowledge-router and HTML/static-context injections); (2) the pause was skipped on regenerate/swipe; (3) the pause only fired in roleplay/visual_novel modes. The refactor's `shouldPauseForAgentInjectionReview` checks none of these. ## Expected behavior - Only writer-category pre-generation agents (e.g. Prose Guardian, Narrative Director) appear in the review modal; knowledge agents and HTML/static injections are never offered for review. - Regenerating/swiping a message generates immediately without re-opening the modal. - The review pause is confined to roleplay/visual_novel chats. ## Actual behavior - `runtime.preInjections` is passed to the modal unfiltered, so knowledge-retrieval/router and the HTML/static injection surface as editable "writer guidance" textareas. - The gate never consults `regenerateMessageId`, so with the setting on, every swipe/regenerate re-opens the review modal. - The gate has no chat-mode condition, so any mode carrying the metadata flag with non-empty preInjections would pause (the toggle UI under Writer Agents limits real-world exposure, but the server guard is weaker than legacy). ## Steps to reproduce 1. Enable "review writer agent outputs" in a roleplay chat. 2. Generate: the review modal lists knowledge-retrieval/router and HTML injections alongside writer agents. 3. Regenerate/swipe: the modal re-opens every time instead of generating immediately. ## Impact area - [x] Roleplay mode - [x] React-free engine behavior, contracts, agents, or capability ports ## Environment - Branch or commit: refactor @ 93555d4b - Run mode: Tauri desktop - OS + version: Windows 11 - Node + pnpm versions: n/a (static parity audit, main vs refactor) - Rust version, if relevant: n/a - Remote Runtime URL configured? not relevant ## Regression notes Worked in legacy (main @ c49f1d95). main: `packages/server/src/routes/generate.routes.ts:783-790,6500-6504` (REVIEWABLE_WRITER_AGENT_TYPES filter), `:6497` (mode gate `roleplay||visual_novel`), `:6500` (`!input.regenerateMessageId`). refactor @ 93555d4b: `src/engine/generation/start-generation.ts:210-218` (shouldPauseForAgentInjectionReview checks only overrides + non-empty + reviewWriterAgentOutputs flag) + `:2687-2698` (event maps runtime.preInjections directly, no filter). All three guards absent.
bsakaguchi 2026-10-21 05:26:27 +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#1080
No description provided.