Skip to content

fix: allow ToolLoopAgent prepareCall to type top-level reasoning overrides - #18482

Merged
aayush-kapoor merged 2 commits into
mainfrom
bugfix-18478-20260805180820617438
Aug 5, 2026
Merged

fix: allow ToolLoopAgent prepareCall to type top-level reasoning overrides#18482
aayush-kapoor merged 2 commits into
mainfrom
bugfix-18478-20260805180820617438

Conversation

@ai-sdk-factory

@ai-sdk-factory ai-sdk-factory Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Background

ToolLoopAgent runtime exposed and forwarded the top-level reasoning option, but prepareCall consumers received TS2339 and TS2353 when reading or overriding it.

Root Cause

Both prepareCall Pick lists omitted reasoning even though ToolLoopAgentSettings defines it and runtime spreads the complete settings into and out of prepareCall; the reproduction confirmed the type errors alongside correct runtime forwarding.

Summary

Added reasoning to the prepareCall input and return types, added regression type coverage, removed reproduction artifacts, and added an ai patch changeset.

Testing

Added a type test covering access to settings.reasoning and typed reasoning return overrides.

End-to-end Validation

  • pnpm -C examples/ai-functions exec tsc --noEmit --pretty false --strict --skipLibCheck --target es2022 --module esnext --moduleResolution bundler --types node src/reproduction/tool-loop-agent-reasoning-validation.ts — consumer-style code compiled successfully when reading and overriding reasoning.

Related Issues

Fixes #18478

Closes #18479

ai-sdk-factory and others added 2 commits August 5, 2026 18:09
Co-authored-by: hyamero <78056869+hyamero@users.noreply.github.com>
@ai-sdk-factory

ai-sdk-factory Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Bugfix review

Outcome: approved

Reproduction replay

Status: no-longer-reproduces

The exact original reproduction completed successfully and the original bug signal did not appear.

Fixes issue

Status: fully-addresses

The change adds reasoning to both the prepareCall input and return Pick lists, aligning the public types with the existing runtime forwarding behavior.

Side effects

Risk: none

The production change is type-only and permits an optional property already present at runtime; it does not alter legitimate runtime behavior.

Performance

Risk: none

No runtime code, allocation behavior, or execution path changes.

Backwards compatibility

Risk: none

The change does not read, write, migrate, or alter persisted data.

Breaking changes

Risk: none

This is an additive widening of the exported prepareCall callback types. It removes erroneous type restrictions without changing exports, accepted runtime inputs, outputs, errors, defaults, configuration, or data formats.

Architecture

Risk: none

The fix remains within the owning AI package and existing ToolLoopAgentSettings abstraction, introduces no dependencies or cross-package source imports, and accurately models the existing implementation.

Change scope

Status: minimal

The diff contains only the two required type additions, focused regression type coverage, and the required patch changeset.

Security

Risk: none

No runtime handling, network access, credentials, parsing, validation, or trust boundaries are changed.

Testing

Status: appropriate

The regression test covers reading options.reasoning and validating a typed reasoning return override; package type checking, the Node test suite, formatting checks, and the exact reproduction replay all passed.

Verification

Inspected the complete merge-base diff, relevant public types, exports, runtime prepareCall flow, and all changed files. The AI package type check passed, the Node suite passed including ToolLoopAgent tests, formatting and diff checks passed, and the authoritative replay confirmed the original bug no longer reproduces.

@aayush-kapoor
aayush-kapoor merged commit a6b17a2 into main Aug 5, 2026
64 checks passed
@aayush-kapoor
aayush-kapoor deleted the bugfix-18478-20260805180820617438 branch August 5, 2026 19:30
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

🚀 Published in:

Package Version
ai 7.0.54 github npm
@ai-sdk/alibaba 2.0.26 github npm
@ai-sdk/amazon-bedrock 5.0.45 github npm
@ai-sdk/angular 3.0.54 github npm
@ai-sdk/anthropic 4.0.32 github npm
@ai-sdk/anthropic-aws 2.0.24 github npm
@ai-sdk/assemblyai 3.0.22 github npm
@ai-sdk/azure 4.0.32 github npm
@ai-sdk/baseten 2.1.2 github npm
@ai-sdk/black-forest-labs 2.0.23 github npm
@ai-sdk/bytedance 2.0.24 github npm
@ai-sdk/cartesia 3.0.17 github npm
@ai-sdk/cerebras 3.0.24 github npm
@ai-sdk/code-mode 1.0.11 github npm
@ai-sdk/cohere 4.0.22 github npm
@ai-sdk/deepgram 3.0.22 github npm
@ai-sdk/deepinfra 3.0.24 github npm
@ai-sdk/deepseek 3.0.23 github npm
@ai-sdk/elevenlabs 3.0.23 github npm
@ai-sdk/fal 3.0.23 github npm
@ai-sdk/fireworks 3.0.26 github npm
@ai-sdk/fish-audio 3.0.0 github npm
@ai-sdk/gateway 4.0.42 github npm
@ai-sdk/gladia 3.0.22 github npm
@ai-sdk/google 4.0.35 github npm
@ai-sdk/google-vertex 5.0.43 github npm
@ai-sdk/groq 4.0.23 github npm
@ai-sdk/harness 1.0.60 github npm
@ai-sdk/harness-claude-code 1.0.61 github npm
@ai-sdk/harness-codex 1.0.62 github npm
@ai-sdk/harness-deepagents 1.0.59 github npm
@ai-sdk/harness-opencode 1.0.61 github npm
@ai-sdk/harness-pi 1.0.60 github npm
@ai-sdk/huggingface 2.0.24 github npm
@ai-sdk/hume 3.0.22 github npm
@ai-sdk/klingai 4.0.24 github npm
@ai-sdk/langchain 3.0.54 github npm
@ai-sdk/llamaindex 3.0.54 github npm
@ai-sdk/lmnt 3.0.22 github npm
@ai-sdk/luma 3.0.23 github npm
@ai-sdk/mcp 2.0.26 github npm
@ai-sdk/minimax 3.0.8 github npm
@ai-sdk/mistral 4.0.24 github npm
@ai-sdk/moonshotai 3.0.27 github npm
@ai-sdk/open-responses 2.0.22 github npm
@ai-sdk/openai 4.0.31 github npm
@ai-sdk/openai-compatible 3.0.24 github npm
@ai-sdk/otel 1.0.54 github npm
@ai-sdk/perplexity 4.0.24 github npm
@ai-sdk/policy-opa 1.0.54 github npm
@ai-sdk/prodia 2.0.23 github npm
@ai-sdk/provider-utils 5.0.22 github npm
@ai-sdk/quiverai 2.0.22 github npm
@ai-sdk/react 4.0.57 github npm
@ai-sdk/replicate 3.0.23 github npm
@ai-sdk/revai 3.0.22 github npm
@ai-sdk/rsc 3.0.54 github npm
@ai-sdk/sandbox-just-bash 1.0.60 github npm
@ai-sdk/sandbox-vercel 1.0.60 github npm
@ai-sdk/svelte 5.0.54 github npm
@ai-sdk/togetherai 3.0.25 github npm
@ai-sdk/tui 1.0.55 github npm
@ai-sdk/valibot 3.0.22 github npm
@ai-sdk/vercel 3.0.24 github npm
@ai-sdk/voyage 2.0.22 github npm
@ai-sdk/vue 4.0.54 github npm
@ai-sdk/workflow 1.0.54 github npm
@ai-sdk/workflow-harness 1.0.60 github npm
@ai-sdk/xai 4.0.29 github npm

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ToolLoopAgent: prepareCall types omit the top-level reasoning option present at runtime

2 participants