[GH-ISSUE #2680] [Issue]: Tool agent's tool-call exception corrupts co-grouped agents (missing await in executeAgent) → siblings overwritten as failed #1327

Closed
opened 2026-10-21 05:31:37 +07:00 by bsakaguchi · 2 comments
Owner

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

Originally assigned to: @kolacheee on GitHub.

Summary

A tool-using agent whose tool call throws does not just fail itself — it corrupts the results of every other agent sharing its provider+model job group, overwriting their already-successful output with success: false error results.

Expected behavior

When a single tool agent's tool call throws, only that agent should be marked failed (a failed AgentResult via makeError). Co-grouped agents (e.g. the built-in tracker/expression batch agents, or sibling tool agents) that ran successfully should keep their real output, and the main user turn should be unaffected.

Actual behavior

A single tool agent's rethrow rejects the whole group, and every agent in that group — including co-grouped batch agents and sibling tool agents that already succeeded — is overwritten with a success: false error result, discarding their real output.

Root cause chain:

  • packages/server/src/services/agents/agent-executor.ts — executeAgent returns the tool path with return executeAgentWithTools(...) and no await (line ~305). Because there is no await, the function's own try/catch (catch at line ~420, which would have produced a failed AgentResult via makeError) never runs for the tool path.
  • When a tool call throws, executeAgentWithTools rethrows (throw err, line ~525). With no await at the call site, executeAgent returns a rejected promise instead of a failed AgentResult.
  • packages/server/src/services/agents/agent-pipeline.ts — executeGroup joins batch and tool agents for the same provider+model group with Promise.all([...]) (line ~188), with the tool agents inside a Promise.all (lines ~179–186). One tool agent's rejection rejects that Promise.all, rejecting the whole executeGroup.
  • executePhase catches the rejected group via Promise.allSettled and, at lines ~245–262, overwrites every agent in the group with success: false error results — including co-grouped batch agents and sibling tool agents that already succeeded.

Steps to reproduce

  1. Configure a custom tool-using agent that shares the default-for-agents connection (same provider + model) with the built-in batch agents (e.g. tracker, expression).
  2. Trigger a turn where the custom agent makes a tool call that throws (e.g. the tool's executeToolCall raises).
  3. Observe that the co-grouped batch agents' feedback is reported as failed even though they completed successfully.

Environment

  • Marinara Engine version: 2.0.0 (reproduced against staging)
  • Install type: source
  • OS + version: any
  • Browser or app shell: n/a (server-side agent pipeline)

Logs, screenshots, or video

In the server log you would see [agent-pipeline] Group REJECTED in phase "..." followed by the group's whole agent list, even though only one tool agent actually failed.

Additional context

Two fix options:

  • (a) Add await at agent-executor.ts:305 (return await executeAgentWithTools(...)) so the existing catch at ~420 converts the rethrow into a failed AgentResult for only that agent. Minimal; preserves per-agent isolation.
  • (b) Stop rethrowing at agent-executor.ts:525 and instead return a failed AgentResult for that agent.

Option (a) is the minimal fix. A PR implementing it is being opened against staging.

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @kolacheee on GitHub (Jun 20, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2680 Originally assigned to: @kolacheee on GitHub. ## Summary A tool-using agent whose tool call throws does not just fail itself — it corrupts the results of **every other agent** sharing its provider+model job group, overwriting their already-successful output with `success: false` error results. ## Expected behavior When a single tool agent's tool call throws, only that agent should be marked failed (a failed `AgentResult` via `makeError`). Co-grouped agents (e.g. the built-in `tracker`/`expression` batch agents, or sibling tool agents) that ran successfully should keep their real output, and the main user turn should be unaffected. ## Actual behavior A single tool agent's rethrow rejects the whole group, and every agent in that group — including co-grouped batch agents and sibling tool agents that already **succeeded** — is overwritten with a `success: false` error result, discarding their real output. Root cause chain: - `packages/server/src/services/agents/agent-executor.ts` — `executeAgent` returns the tool path with `return executeAgentWithTools(...)` and **no `await`** (line ~305). Because there is no `await`, the function's own `try/catch` (catch at line ~420, which would have produced a failed `AgentResult` via `makeError`) never runs for the tool path. - When a tool call throws, `executeAgentWithTools` rethrows (`throw err`, line ~525). With no `await` at the call site, `executeAgent` returns a **rejected** promise instead of a failed `AgentResult`. - `packages/server/src/services/agents/agent-pipeline.ts` — `executeGroup` joins batch and tool agents for the same provider+model group with `Promise.all([...])` (line ~188), with the tool agents inside a `Promise.all` (lines ~179–186). One tool agent's rejection rejects that `Promise.all`, rejecting the whole `executeGroup`. - `executePhase` catches the rejected group via `Promise.allSettled` and, at lines ~245–262, overwrites **every** agent in the group with `success: false` error results — including co-grouped batch agents and sibling tool agents that already succeeded. ## Steps to reproduce 1. Configure a custom tool-using agent that shares the **default-for-agents** connection (same provider + model) with the built-in batch agents (e.g. `tracker`, `expression`). 2. Trigger a turn where the custom agent makes a tool call that throws (e.g. the tool's `executeToolCall` raises). 3. Observe that the co-grouped batch agents' feedback is reported as failed even though they completed successfully. ## Environment - Marinara Engine version: 2.0.0 (reproduced against `staging`) - Install type: source - OS + version: any - Browser or app shell: n/a (server-side agent pipeline) ## Logs, screenshots, or video In the server log you would see `[agent-pipeline] Group REJECTED in phase "..."` followed by the group's whole agent list, even though only one tool agent actually failed. ## Additional context Two fix options: - **(a)** Add `await` at `agent-executor.ts:305` (`return await executeAgentWithTools(...)`) so the existing catch at ~420 converts the rethrow into a failed `AgentResult` for **only** that agent. Minimal; preserves per-agent isolation. - **(b)** Stop rethrowing at `agent-executor.ts:525` and instead return a failed `AgentResult` for that agent. Option (a) is the minimal fix. A PR implementing it is being opened against `staging`. ## Template check - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:31:37 +07:00
Author
Owner

@kolacheee commented on GitHub (Jun 20, 2026):

assign me pls

<!-- gh-comment-id:4760304549 --> @kolacheee commented on GitHub (Jun 20, 2026): assign me pls
Author
Owner

@kolacheee commented on GitHub (Jun 20, 2026):

Picking this up — draft PR opened against staging: #2681 (owner: @kolacheee). Implements fix option (a): add await to the tool-loop call in executeAgent so a tool-call rethrow is caught locally and fails only that agent, instead of rejecting the group and overwriting co-grouped agents.

Note: I don't have triage permission here to add the in-pr label — a maintainer may want to apply it.

<!-- gh-comment-id:4760307278 --> @kolacheee commented on GitHub (Jun 20, 2026): Picking this up — draft PR opened against `staging`: #2681 (owner: @kolacheee). Implements fix option (a): add `await` to the tool-loop call in `executeAgent` so a tool-call rethrow is caught locally and fails only that agent, instead of rejecting the group and overwriting co-grouped agents. Note: I don't have triage permission here to add the `in-pr` label — a maintainer may want to apply it.
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#1327
No description provided.