[GH-ISSUE #1897] Agent batching leaks post-processing turn data access across settings #921

Closed
opened 2026-10-21 05:23:35 +07:00 by bsakaguchi · 1 comment
Owner

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

Originally assigned to: @SpicyMarinara on GitHub.

Summary

src/engine/agents-runtime/pipeline/agent-pipeline.ts batches agents by connection/model only, then builds one shared batch context. For post-processing agents, that shared context unions per-agent turn data access settings such as includePreGenInjections and includeParallelResults.

Evidence

Refactor behavior:

  • groupByProviderModel keys groups as connectionId::model.
  • buildAgentContext enables preGenInjections when any agent in the batch has settings.includePreGenInjections.
  • buildAgentContext enables parallelResults when any agent in the batch has settings.includeParallelResults.
  • The resulting group context is passed to the whole batch.

Legacy behavior:

  • Legacy grouping included a post-processing data key.
  • Agents with different post-processing data access settings were split into separate groups before batching.

Current UI promise:

  • The agent editor describes these as optional current-turn data for custom post-processing agents, with existing agents isolated unless enabled.

Impact

A post-processing agent that did not opt into current-turn data can receive data because another agent in the same connection/model batch opted in. This weakens the per-agent isolation contract and can expose prompt/runtime context beyond the selected agent settings.

Expected

Agents with different post-processing data access flags should not share a batch context. Grouping should include the relevant data-access flags or otherwise build context per agent.

Candidate Fix

Restore a grouping key equivalent to the legacy post-processing data key, covering at least includePreGenInjections and includeParallelResults.

Originally created by @Xelvanis on GitHub (Jun 2, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1897 Originally assigned to: @SpicyMarinara on GitHub. ### Summary `src/engine/agents-runtime/pipeline/agent-pipeline.ts` batches agents by connection/model only, then builds one shared batch context. For post-processing agents, that shared context unions per-agent turn data access settings such as `includePreGenInjections` and `includeParallelResults`. ### Evidence Refactor behavior: - `groupByProviderModel` keys groups as `connectionId::model`. - `buildAgentContext` enables `preGenInjections` when any agent in the batch has `settings.includePreGenInjections`. - `buildAgentContext` enables `parallelResults` when any agent in the batch has `settings.includeParallelResults`. - The resulting group context is passed to the whole batch. Legacy behavior: - Legacy grouping included a post-processing data key. - Agents with different post-processing data access settings were split into separate groups before batching. Current UI promise: - The agent editor describes these as optional current-turn data for custom post-processing agents, with existing agents isolated unless enabled. ### Impact A post-processing agent that did not opt into current-turn data can receive data because another agent in the same connection/model batch opted in. This weakens the per-agent isolation contract and can expose prompt/runtime context beyond the selected agent settings. ### Expected Agents with different post-processing data access flags should not share a batch context. Grouping should include the relevant data-access flags or otherwise build context per agent. ### Candidate Fix Restore a grouping key equivalent to the legacy post-processing data key, covering at least `includePreGenInjections` and `includeParallelResults`.
Author
Owner

@SpicyMarinara commented on GitHub (Jun 2, 2026):

Fixed on refactor in a4ba3c90: agent grouping now includes post-processing data-access flags, so agents with different includePreGenInjections/includeParallelResults settings do not share a batch context. Verification passed: typecheck, architecture, docs, build, cargo check, diff check.

<!-- gh-comment-id:4601637244 --> @SpicyMarinara commented on GitHub (Jun 2, 2026): Fixed on refactor in a4ba3c90: agent grouping now includes post-processing data-access flags, so agents with different includePreGenInjections/includeParallelResults settings do not share a batch context. Verification passed: typecheck, architecture, docs, build, cargo check, diff check.
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#921
No description provided.