Skip to content

fix(eve): surface terminal model-call failures from subagents to the parent#454

Open
enjoykumawat wants to merge 1 commit into
vercel:mainfrom
enjoykumawat:fix/subagent-terminal-model-call-failure
Open

fix(eve): surface terminal model-call failures from subagents to the parent#454
enjoykumawat wants to merge 1 commit into
vercel:mainfrom
enjoykumawat:fix/subagent-terminal-model-call-failure

Conversation

@enjoykumawat

Copy link
Copy Markdown

Fixes #412

Problem

A terminal MODEL_CALL_FAILED classification (structural 4xx, invalid API key, unresolvable model id, etc.) made createToolLoopHarness's step function return { next: { done: true, output: "" }, session } regardless of run mode.

For a subagent (config.mode === "task"), that result is what finalizeDone in workflow-entry.ts rolls up into the parent's subagent-result tool call via createDelegatedSubagentSuccessResult/createDelegatedSubagentErrorResult, gated on action.isError === true. Since the terminal branch never set isError, a subagent whose model call failed terminally (e.g. a 404 for an unresolvable model id, matching the repro in #412) was reported to the parent as a successful call with empty output. The orchestrator then continued and the top-level session reported success even though the subagent's model call failed.

The non-terminal (recoverable / retry-exhausted) failure path a few lines below already special-cases config.mode === "task" and returns { done: true, isError: true, output: errorMessage } for exactly this reason — the terminal branch above it was just missing the same check.

Fix

Apply the same config.mode === "task" check to the terminal branch, so a terminal model-call failure in a subagent surfaces as { done: true, isError: true, output: errorMessage } instead of silently swallowing the failure. Non-task-mode behavior ({ done: true, output: "" }, tearing down the conversation session) is unchanged.

Testing

Added a regression test in tool-loop.test.ts mirroring the existing "structural 4xx" terminal-cascade test, but in task mode, asserting result.next carries isError: true and the error message instead of an empty success output. Confirmed it fails on main and passes with the fix.

Ran the full packages/eve unit suite before/after — no new failures (a handful of pre-existing Windows-path-separator failures in unrelated CLI/nitro-host tests are present on main as well, unrelated to this change).

Added a changeset (patch) for the published eve package.

…parent

A terminal MODEL_CALL_FAILED classification (structural 4xx, invalid API
key, unresolvable model id, etc.) returned {done: true, output: ""} from
the tool loop regardless of run mode. For a subagent ("task" mode), this
was indistinguishable from success once rolled up into the parent's
subagent-result tool call, so the orchestrator reported the run as
completed even though the subagent's model call failed terminally.

The non-terminal (recoverable/retry-exhausted) failure path already
special-cased task mode to return {done: true, isError: true, output}
so the parent sees the failure. Apply the same mode check to the
terminal path.

Fixes vercel#412

Signed-off-by: Enjoy Kumawat <ekumawat54@gmail.com>
@vercel

vercel Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

@enjoykumawat is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant