Skip to content

chore(web): upgrade Vercel AI SDK to v7#4652

Open
chrarnoldus wants to merge 2 commits into
mainfrom
chore/upgrade-ai-sdk-v7
Open

chore(web): upgrade Vercel AI SDK to v7#4652
chrarnoldus wants to merge 2 commits into
mainfrom
chore/upgrade-ai-sdk-v7

Conversation

@chrarnoldus

Copy link
Copy Markdown
Contributor

Summary

Upgrades the Vercel AI SDK (ai) and affiliated @ai-sdk/* provider packages to the latest major v7 line.

Package From To
ai 6.0.224 7.0.29
@ai-sdk/anthropic 3.0.96 4.0.15
@ai-sdk/gateway 3.0.148 4.0.21
@ai-sdk/mistral 3.0.48 4.0.12
@ai-sdk/openai 3.0.84 4.0.15
@ai-sdk/openai-compatible 2.0.59 3.0.11

Versions are pinned to the newest releases that satisfy the workspace minimumReleaseAge policy (6842 min), keeping the provider set internally consistent on @ai-sdk/provider@4.0.3 / @ai-sdk/provider-utils@5.0.10.

Breaking changes applied

Per the v6 → v7 migration guide, in apps/web/src/lib/bot/agent-runner.ts:

  • stepCountIsisStepCount
  • onStepFinishonStepEnd

Notes

  • No AI SDK telemetry usage in the codebase, so the new @ai-sdk/otel package is not required.
  • Repo engines (Node >=24) already satisfies v7's Node 22+ requirement.
  • All other call sites use stable APIs (generateText, embed/embedMany, Output.object, createGateway, createOpenAICompatible, createOpenAI, provider option types) verified present in the target versions.
  • Relying on CI for typecheck/lint/test validation.

Upgrade ai and affiliated @ai-sdk/* packages to the latest major v7
line. Versions are pinned to the newest releases that satisfy the
workspace minimumReleaseAge policy.

- ai 6.0.224 -> 7.0.29
- @ai-sdk/anthropic 3.0.96 -> 4.0.15
- @ai-sdk/gateway 3.0.148 -> 4.0.21
- @ai-sdk/mistral 3.0.48 -> 4.0.12
- @ai-sdk/openai 3.0.84 -> 4.0.15
- @ai-sdk/openai-compatible 2.0.59 -> 3.0.11

Apply v7 breaking renames in the bot agent runner:
- stepCountIs -> isStepCount
- onStepFinish -> onStepEnd
@chrarnoldus chrarnoldus self-assigned this Jul 21, 2026
Comment thread apps/web/src/lib/bot/agent-runner.ts
Comment thread apps/web/src/lib/bot/agent-runner.ts
Comment thread apps/web/src/lib/bot/agent-runner.ts
@kilo-code-bot

kilo-code-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 3 Issues Found | Recommendation: Address before merge

Executive Summary

The disputed AI SDK identifiers isStepCount and onStepEnd in apps/web/src/lib/bot/agent-runner.ts remain unresolved and could not be independently verified in this environment; the new jest.config.ts transform pattern change introduces no issues.

Overview

Severity Count
CRITICAL 3
WARNING 0
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
apps/web/src/lib/bot/agent-runner.ts 33 isStepCount import name is disputed; the author asserts it is the canonical v7 export, but this could not be independently verified against the published ai package in this environment
apps/web/src/lib/bot/agent-runner.ts 261 stopWhen call depends on the disputed isStepCount import
apps/web/src/lib/bot/agent-runner.ts 331 onStepEnd option name is disputed; the author asserts it is the canonical v7 option, but this could not be independently verified against the published ai package in this environment
Files Reviewed (4 files)
  • apps/web/jest.config.ts - 0 issues (adds ai@, @ai-sdk, @standard-schema, @workflow, eventsource-parser to the ESM transform allowlist so the upgraded packages are transformed in Jest)
  • apps/web/package.json - 0 issues
  • apps/web/src/lib/bot/agent-runner.ts - 3 issues (unchanged this round; findings carried forward pending independent verification of the disputed identifier names)
  • pnpm-lock.yaml - skipped (generated lockfile)

Fix these issues in Kilo Cloud

Previous Review Summary (commit 2145eed)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 2145eed)

Status: 3 Issues Found | Recommendation: Address before merge

Executive Summary

The renamed AI SDK identifiers isStepCount and onStepEnd in apps/web/src/lib/bot/agent-runner.ts do not match the AI SDK's documented v7 API (stepCountIs / onStepFinish) and are likely to break compilation or the bot's tool-loop agent step tracking.

Overview

Severity Count
CRITICAL 3
WARNING 0
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
apps/web/src/lib/bot/agent-runner.ts 33 isStepCount is not a documented AI SDK v7 export; real name is stepCountIs
apps/web/src/lib/bot/agent-runner.ts 261 stopWhen call depends on the unverified isStepCount import
apps/web/src/lib/bot/agent-runner.ts 331 onStepEnd is not a documented AI SDK v7 option; real name is onStepFinish
Files Reviewed (3 files)
  • apps/web/package.json - 0 issues
  • apps/web/src/lib/bot/agent-runner.ts - 3 issues
  • pnpm-lock.yaml - skipped (generated lockfile)

Fix these issues in Kilo Cloud


Reviewed by claude-sonnet-5 · Input: 32 · Output: 12.1K · Cached: 720.3K

Review guidance: REVIEW.md from base branch main

AI SDK v7 is ESM-only (no CJS build), so Jest must transform the
`ai` package and its ESM dependency closure instead of loading them
as CommonJS. Add them to the transformIgnorePatterns exception list:

- ai
- @ai-sdk/* (gateway, provider, provider-utils, openai, anthropic, ...)
- @standard-schema/spec
- @workflow/serde
- eventsource-parser

Fixes 'Cannot use import statement outside a module' failures in web
test suites that transitively import the AI SDK.

Copy link
Copy Markdown
Contributor Author

Review note: automated "CRITICAL" flags are false positives

The Kilo Code Review bot re-flags isStepCount / onStepEnd in agent-runner.ts as "disputed", but it explicitly states it could not independently verify against the published ai package. These are the canonical AI SDK v7 names, and this is now empirically confirmed by CI:

  • typecheck passes — TypeScript would fail to compile if isStepCount / onStepEnd were not real exports of ai@7.0.29.
  • web test passes — the bot agent runner compiles and runs.

Verified directly against the installed ai@7.0.29 type declarations:

  • dist/index.d.ts:1757: declare function isStepCount(stepCount: number): StopCondition<any, any>, with the old name re-exported as a deprecated alias (isStepCount as stepCountIs).
  • dist/index.d.ts:3495-3496: @param onStepEnd - Callback that is called when each step (LLM call) ends... / @param onStepFinish - Deprecated alias for onStepEnd.

Both renames are documented in the official v6→v7 migration guide (codemods rename-step-count-is and rename-on-step-finish-to-on-step-end). Keeping the canonical v7 names rather than the deprecated aliases.

All 64 CI checks are green (2 intentionally skipped: CodeQL, notify-main).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants