Skip to content

willContinue doesn't count tool-error as completed output (AI SDK v6) #240

@impish0

Description

@impish0

Hi! 👋

Version: @convex-dev/agent@0.6.1, ai@6.0.142

Thanks for all you do! It's been quite an experience moving to convex.

My issue:

When a tool call fails, AI SDK v6 returns it as a tool-error content part (not tool-result).

willContinue only counts step.toolResults, so it sees fewer results than calls and stops even though the step actually completed. This causes agents to stop mid-work when any tool errors occur during parallel execution.

in File: src/client/utils.ts:13

// line 13 — currently:
if (step.toolCalls.length > step.toolResults.length) return false;

// Ideally would be something like:
const completedOutputs = step.content?.filter(
  (p) => p.type === "tool-result" || p.type === "tool-error",
).length ?? step.toolResults.length;
if (step.toolCalls.length > completedOutputs) return false;

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions