chore: upgrade AI SDK v6 → v7 (chat)#1817
Conversation
Bump to the v7 line:
- ai 6.0.165 → 7.0.2
- @ai-sdk/react 3 → 4, @ai-sdk/{anthropic,google,openai} 3 → 4,
@ai-sdk/gateway 3 → 4, @ai-sdk/mcp 0.0.11 → 2
- zod floor → ^3.25.76 (ai@7 peer range)
Codemod (`npx @ai-sdk/codemod v7`) handled the mechanical renames:
`isToolOrDynamicToolUIPart` → `isToolUIPart`, `experimental_generateImage`
→ `generateImage`, `Experimental_GenerateImageResult` → `GenerateImageResult`,
and `system` → `instructions` on core generate calls.
Manual fixes where the codemod over-applied or v7 types tightened:
- hooks/useVercelChat.ts: keep `onFinish` (the codemod's onFinish→onEnd is for
core streamText/generateText; @ai-sdk/react useChat still uses onFinish).
- lib/ai/generateText.ts, generateArray.ts: these wrap the SDK behind a local
`{ system }` API — kept that param, pass `instructions: system` to the SDK.
- lib/email/generateTxtFileEmail.ts: calls the local wrapper, so back to `system:`.
- extractSendEmailResults.test.ts: drop `content`/`createdAt` from UIMessage
fixtures (v7 UIMessage is parts-only).
Verified: `tsc --noEmit` clean, 72/72 vitest pass, `next build` compiles (full
page-data step needs Supabase/Twilio env, present on Vercel — preview validates).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
More reviews will be available in 44 minutes and 50 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (6)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
No issues found across 9 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: Major version bump of core AI SDK v6→v7 with multi-file API changes; requires human review for runtime compatibility despite clean static checks.
Re-trigger cubic
✅ Verification — all checks green under AI SDK v7Commit
The full production build that can't complete locally (needs Supabase/Twilio env) passes on Vercel. This validates the first real v6→v7 upgrade in the monorepo (marketing was a removal). Note on browser smoke: the chat streaming UI sits behind Privy auth; a full logged-in send/stream test needs an email OTP I can't receive, so I'm relying on the green CI + full-env Vercel build + bot reviews. Happy to walk through a manual streaming check together if you want eyes on the UI before merge. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2988842bae
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| "@ai-sdk/mcp": "^0.0.11", | ||
| "@ai-sdk/openai": "3.0.66", | ||
| "@ai-sdk/react": "3.0.167", | ||
| "@ai-sdk/anthropic": "^4.0.0", |
There was a problem hiding this comment.
Update CI to Node 22 with the SDK bump
The AI SDK v7 bump pulls packages that now declare engines: { node: '>=22' } in pnpm-lock.yaml (ai@7.0.2 and the upgraded @ai-sdk/* packages), but the test workflow still runs actions/setup-node with node-version: 20 at .github/workflows/test.yaml:25. Any PR/test run on that workflow now installs and executes these packages outside their supported runtime, so CI can fail or stop matching the runtime this dependency set requires; please update the workflow/package engines to Node 22 alongside the upgrade.
Useful? React with 👍 / 👎.
Second real upgrade in the monorepo-wide AI SDK v6→v7 migration (chat#1816). Targets
testper repo convention. This is the first PR that actually validates a v6→v7 bump in our stack (marketing was a dead-code removal).What changed
ai6.0.165→7.0.2@ai-sdk/react3→4,@ai-sdk/{anthropic,google,openai}3→4,@ai-sdk/gateway3→4,@ai-sdk/mcp0.0.11→2zodfloor^3.25.0→^3.25.76(ai@7 peer range)Codemod (mechanical)
npx @ai-sdk/codemod v7handled:isToolOrDynamicToolUIPart→isToolUIPart,experimental_generateImage→generateImage,Experimental_GenerateImageResult→GenerateImageResult,system→instructionson core generate calls.Manual fixes (codemod over-applied / v7 types tightened)
hooks/useVercelChat.ts— reverted toonFinish. The codemod'sonFinish→onEndis for corestreamText/generateText;@ai-sdk/reactuseChatstill usesonFinish(verified against the installedUseChatOptionstype).lib/ai/generateText.ts+generateArray.ts— these wrap the SDK behind a local{ system }API. Kept that external param, passinstructions: systemto the SDK internally (minimal blast radius vs. renaming the wrapper's API + all callers).lib/email/generateTxtFileEmail.ts— calls the local wrapper, so its arg goes back tosystem:.extractSendEmailResults.test.ts— droppedcontent/createdAtfromUIMessagefixtures (v7UIMessageis parts-only).Note:
generateObjectis retained — it's alive inai@7.0.2(verified; a validation hook flagged it as removed, which is a false positive).Verification (local)
@ai-sdk/codemod v7tsc --noEmitvitest runnext buildWill preview-verify the streaming chat UI end-to-end once the Vercel deploy is up.
Tracking: chat#1816. Merge target
test; synctest→mainper repo flow on release.🤖 Generated with Claude Code
Summary by cubic
Upgrade
aiSDK to v7 and bump related@ai-sdk/*packages, updating call sites to the v7 API (instructions,isToolUIPart,generateImage,GenerateImageResult). Existing app wrappers stay the same, so callers still usesystemanduseChatstill usesonFinish.Dependencies
ai6.0.165 →^7.0.2@ai-sdk/react3 →^4.0.2@ai-sdk/{anthropic,google,openai}3 →^4.0.0@ai-sdk/gateway3 →^4.0.2@ai-sdk/mcp0.0.11→^2.0.0zodfloor →^3.25.76Migration
systemcontinue to work.UIMessageshould use parts-only messages (removecontentandcreatedAt).Written for commit 2988842. Summary will update on new commits.