fix(core): allow generating responses in empty threads#13164
fix(core): allow generating responses in empty threads#13164
Conversation
Replace throw with warning in ensureGeminiCompatibleMessages when no user/assistant messages are present. Providers that support system-only prompts (Anthropic, OpenAI) now work natively. Gemini users get a warning and the provider's own error. Fixes #13045
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 81d3559 The changes in this PR will be included in the next version bump. This PR includes changesets to release 20 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 WalkthroughThe PR addresses issue Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Fixes #13045
ensureGeminiCompatibleMessageswas throwing aMastraErrorwhen there were no user/assistant messages (only system messages). This blocked generating responses in empty threads (e.g. generate welcome messages via CopilotKit'suseAgenthook).The fix replaces the throw with a warning via the Mastra logger. Providers that handle system-only prompts natively (Anthropic, OpenAI) now work without issues. Providers that require a user message (Gemini) will return their own error, and users will see a helpful warning in their logs pointing them in the right direction.
Summary by CodeRabbit