Skip to content

Conversation

@ssdeanx
Copy link
Owner

@ssdeanx ssdeanx commented Jan 15, 2026

  • Added cached content option to the weather agent for improved performance.
  • Updated Google model initialization to use languageModel method for various chat and image models.
  • Commented out unused imports and variables in Google configuration files.

refactor: modify embedding model initialization

  • Changed embedding model initialization in LanceDB, MongoDB, and Qdrant configurations to use ModelRouterEmbeddingModel for better flexibility.

fix: adjust sampling probability in Mastra configuration

  • Increased sampling probability from 0.5 to 0.75 to enhance decision-making in the agent's sampling strategy.

chore: update crawler statistics and session pool state

  • Modified SDK_CRAWLER_STATISTICS_0.json to reflect new request metrics and timestamps.
  • Updated SDK_SESSION_POOL_STATE.json with new session IDs and cookie values for improved session management.

feat: implement weather tool logging enhancements

  • Updated logging in the weather tool to include more detailed information about tool calls and input handling.

chore: add Convex configuration file

  • Created convex.json to define Node.js version for the Convex framework.

test: add agent registry tests

  • Implemented tests for agent registry to ensure all expected agents are present.

chore: add OpenTelemetry instrumentation setup

  • Created instrumentation file for OpenTelemetry to enable tracing and monitoring of the application.

Summary by Sourcery

Update agent configuration, observability, and vector storage integrations while refining Google provider usage and tooling around the weather and agent registry flows.

New Features:

  • Add multiple specialized financial, coding, marketing, utility, and network coordinator agents to the chat agent registry.
  • Configure Convex integration via a new convex.json file and align Convex schema with Mastra tables.

Enhancements:

  • Switch Google chat and embedding model initialization to use the provider-specific languageModel and embedding helpers and expose a cachedContent hint on the weather agent.
  • Refine weather tool logging metadata and strengthen UI tool components with typed inputs and outputs.
  • Update LanceDB, MongoDB, and Qdrant vector configurations to use a router-based embedding model and adjust Mastra sampling probability to favor more sampled requests.
  • Refresh crawler statistics and session pool state fixtures and bump several frontend dependencies (Next, @ai-sdk/react, Convex, and related packages).

Build:

  • Add or update Convex-related configuration and schema wiring to match current Mastra Convex integration.

Tests:

  • Add an agent registry test to validate that expected agents are registered in configuration.

Chores:

  • Apply minor formatting and comment tweaks in chat input, chat context types, and Google configuration files.

- Added cached content option to the weather agent for improved performance.
- Updated Google model initialization to use languageModel method for various chat and image models.
- Commented out unused imports and variables in Google configuration files.

refactor: modify embedding model initialization
- Changed embedding model initialization in LanceDB, MongoDB, and Qdrant configurations to use ModelRouterEmbeddingModel for better flexibility.

fix: adjust sampling probability in Mastra configuration
- Increased sampling probability from 0.5 to 0.75 to enhance decision-making in the agent's sampling strategy.

chore: update crawler statistics and session pool state
- Modified SDK_CRAWLER_STATISTICS_0.json to reflect new request metrics and timestamps.
- Updated SDK_SESSION_POOL_STATE.json with new session IDs and cookie values for improved session management.

feat: implement weather tool logging enhancements
- Updated logging in the weather tool to include more detailed information about tool calls and input handling.

chore: add Convex configuration file
- Created convex.json to define Node.js version for the Convex framework.

test: add agent registry tests
- Implemented tests for agent registry to ensure all expected agents are present.

chore: add OpenTelemetry instrumentation setup
- Created instrumentation file for OpenTelemetry to enable tracing and monitoring of the application.
Copilot AI review requested due to automatic review settings January 15, 2026 01:43
@continue
Copy link

continue bot commented Jan 15, 2026

All Green - Keep your PRs mergeable

Learn more

All Green is an AI agent that automatically:

✅ Addresses code review comments

✅ Fixes failing CI checks

✅ Resolves merge conflicts


Unsubscribe from All Green comments

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@coderabbitai
Copy link

coderabbitai bot commented Jan 15, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Significantly expanded agent library with new agents across graphing, mapping, data analysis, marketing, coding, and business intelligence categories.
    • Weather tool output now includes temperature unit (°C or °F) for clarity.
  • Improvements

    • Enhanced observability and monitoring with increased sampling coverage.
    • Optimized weather queries with location data caching.
  • Chores

    • Updated dependencies including AI SDK and Next.js packages.
    • Added configuration validation tests for agent configurations.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

This PR significantly expands the agent configuration surface by adding numerous new agents and networks (weatherAgent, graphSupervisorAgent, technicalAnalysisAgent, finnhubAgent, and many others), normalizes AGENT_CONFIGS keys to string literals, improves TypeScript type safety in tool component rendering with explicit UITool casts, refactors embedding model initialization across multiple config files to use ModelRouterEmbeddingModel, and extends the weather tool output schema to include a unit field.

Changes

Cohort / File(s) Summary
Agent Configuration Expansion
app/chat/config/agents.ts, tests/agents-config.test.ts
Added 50+ new agent entries (graphSupervisor, technicalAnalysis, finnhub, socialMedia, seo, customerSupport, codeReviewer, compliance, legal, etc.) and network orchestration entries with extended feature flags; normalized all AGENT_CONFIGS keys to string literals; added comprehensive test covering expected agent IDs.
Tool Type Safety & Rendering
app/chat/components/agent-tools.tsx
Replaced generic any type casts with concrete UITool types (PolygonStockQuotesUITool, ListCommitsUITool, WeatherUITool, ArxivUITool) for tool input/output props; commented out NewsCarousel and Serpapi-search rendering blocks.
Chat UI Formatting
app/chat/components/chat-input.tsx
Added blank lines after createCheckpoint in context destructuring and after agent name in status bar; formatting-only change.
Chat Context
app/chat/providers/chat-context-types.ts
Added comment documenting temporary agent switch in progress blocking sends.
Embedding Model Refactoring
src/mastra/config/lance.ts, src/mastra/config/mongodb.ts, src/mastra/config/qdrant.ts, src/mastra/config/google.ts
Replaced google.textEmbedding() and generic google() model calls with ModelRouterEmbeddingModel('google/gemini-embedding-001') and google.languageModel() respectively; added import for ModelRouterEmbeddingModel; commented out gemini3ProImage and googleNanoBanana exports.
Weather Tool Enhancement
src/mastra/agents/weather-agent.ts, src/mastra/tools/weather-tool.ts
Extended weather tool output schema with new unit: string field; added cachedContent property to weather agent provider options; changed logging from raw toolCallId to boolean check for 'get-weather' pattern.
Convex Configuration & Schema
convex.json, convex/schema.ts
Created new convex.json specifying Node.js version 24 and schema path; reorganized schema imports from @mastra/convex/schema to @mastra/convex and adjusted defineSchema import from convex/server.
Dependencies & Observability
package.json, src/mastra/index.ts
Updated minor versions for @ai-sdk/react, @next/bundle-analyzer, @next/mdx; downgraded convex from ^1.31.4 to ^1.26.2; increased observability sampling probability from 0.5 to 0.75.
Runtime Data
src/mastra/public/storage/key_value_stores/default/SDK_CRAWLER_STATISTICS_0.json, SDK_SESSION_POOL_STATE.json
Updated crawler metrics (timing, duration, throughput) and session pool state (session ID, cookies, timestamps) reflecting new runtime execution.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰 Hoppy times for types so bright,
Agents bloom—a config delight!
Embeddings dance in model routers' way,
Weather reports in units display! 🌤️
Type safety makes this bunny beam,

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title focuses on weather agent and Google configuration updates, but the PR contains substantial changes across multiple areas including embedding models, Convex integration, agent registry expansion, observability, and more. Revise the title to reflect the broader scope, such as 'feat: expand agent registry and update integrations' or provide a more comprehensive summary of the main changes.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The description comprehensively covers the major changes across all affected files including weather agent, Google configuration, embedding models, Mastra configuration, Convex setup, tests, and other updates.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch develop

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

🤖 Hi @ssdeanx, I've received your request, and I'm working on it now! You can track my progress in the logs for more details.

@sourcery-ai
Copy link

sourcery-ai bot commented Jan 15, 2026

Reviewer's Guide

Updates the weather agent to use cached content and enhanced logging, refactors Google and embedding model configuration to use the newer AI SDK APIs and ModelRouterEmbeddingModel, adjusts Mastra sampling behavior, expands and tightens agent registry configuration, and adds supporting Convex, OpenTelemetry, crawler state, and test fixtures.

Sequence diagram for enhanced weather agent call with logging and cached content

sequenceDiagram
  actor User
  participant UI as ChatUI
  participant MA as MastraAgentOrchestrator
  participant WA as weatherAgent
  participant WT as weatherTool
  participant L as Logger
  participant GA as GoogleAIProvider

  User->>UI: Enter weather question
  UI->>MA: sendMessage selectedAgent=weatherAgent
  MA->>WA: invokeAgent messages
  WA->>GA: initializeModel cachedContent
  GA-->>WA: modelWithCache
  WA->>WT: callTool get-weather input(location)

  WT->>L: log onInputStart toolCallId_includes_get_weather
  loop streaming_input
    WT->>L: log onInputDelta toolCallId_includes_get_weather
  end
  WT->>L: log onInputAvailable location

  alt cacheHit
    GA-->>WT: returnCachedResponse
  else cacheMiss
    WT->>GA: callModelOrApi location
    GA-->>WT: weatherData
  end

  WT->>L: log onOutput toolCallId_includes_get_weather
  WT-->>WA: toolResult weatherData
  WA-->>MA: agentResponse with weatherData
  MA-->>UI: streamResponse
  UI-->>User: renderWeatherCards
Loading

Class diagram for updated Google and embedding configurations

classDiagram
  class GoogleConfig {
    +string apiKey
    +google languageModel(string modelId)
    +google image(string modelId)
    +google embedding(string modelId)
  }

  class GoogleChatModels {
    +any gemini3Pro
    +any gemini3Flash
    +any gemini25Pro
    +any gemini25Flash
    +any gemini25FlashLite
    +any gemini25ComputerUse
    +any gemini25FlashAlt
  }

  class GoogleImageModels {
    +any gemini25FlashImage
    +any imagen4Generate
    +any imagen4Ultra
    +any imagen4Fast
  }

  class GoogleEmbeddingModels {
    +any geminiEmbedding001
  }

  class ModelRouterEmbeddingModel {
    -string modelId
    +ModelRouterEmbeddingModel(string modelId)
    +embed(string text) any
    +embedMany(string[] texts) any
  }

  class LanceConfig {
    +number embeddingDimension
    +ModelRouterEmbeddingModel embeddingModel
  }

  class MongoConfig {
    +number embeddingDimension
    +ModelRouterEmbeddingModel embeddingModel
  }

  class QdrantConfig {
    +number embeddingDimension
    +ModelRouterEmbeddingModel embeddingModel
  }

  class Memory {
    +any storage
    +any vector
    +ModelRouterEmbeddingModel embedder
    +Memory(any storage, any vector, ModelRouterEmbeddingModel embedder)
  }

  GoogleConfig <|.. GoogleChatModels
  GoogleConfig <|.. GoogleImageModels
  GoogleConfig <|.. GoogleEmbeddingModels

  GoogleEmbeddingModels o-- ModelRouterEmbeddingModel : defaultEmbedding

  LanceConfig o-- ModelRouterEmbeddingModel : embeddingModel
  MongoConfig o-- ModelRouterEmbeddingModel : embeddingModel
  QdrantConfig o-- ModelRouterEmbeddingModel : embeddingModel

  Memory o-- ModelRouterEmbeddingModel : embedder

  LanceConfig ..> Memory : usedBy
  MongoConfig ..> Memory : usedBy
Loading

Class diagram for agent registry and new agent/network entries

classDiagram
  class AgentFeatures {
    +boolean reasoning
    +boolean chainOfThought
    +boolean tools
    +boolean artifacts
    +boolean plan
    +boolean task
    +boolean sources
    +boolean webPreview
    +boolean canvas
    +boolean images
  }

  class AgentConfig {
    +string id
    +string name
    +string description
    +string category
    +AgentFeatures features
  }

  class AgentRegistry {
    +Record~string,AgentConfig~ AGENT_CONFIGS
    +string DEFAULT_AGENT_ID
  }

  class GraphSupervisorAgent {
  }

  class TechnicalAnalysisAgent {
  }

  class ChartJsAgent {
  }

  class MappingAgent {
  }

  class FetchAgent {
  }

  class FinnhubAgent {
  }

  class CodeGraphAgent {
  }

  class CodeMetricsAgent {
  }

  class SocialMediaAgent {
  }

  class SeoAgent {
  }

  class TranslationAgent {
  }

  class CustomerSupportAgent {
  }

  class ProjectManagementAgent {
  }

  class BgColorAgent {
  }

  class NoteTakerAgent {
  }

  class A2ACoordinatorAgent {
  }

  class CodingA2ACoordinator {
  }

  class DataPipelineNetwork {
  }

  class ReportGenerationNetwork {
  }

  class ResearchPipelineNetwork {
  }

  class ContentCreationNetwork {
  }

  class FinancialIntelligenceNetwork {
  }

  class LearningNetwork {
  }

  class MarketingAutomationNetwork {
  }

  class DevopsNetwork {
  }

  class BusinessIntelligenceNetwork {
  }

  class SecurityNetwork {
  }

  AgentRegistry o-- GraphSupervisorAgent
  AgentRegistry o-- TechnicalAnalysisAgent
  AgentRegistry o-- ChartJsAgent
  AgentRegistry o-- MappingAgent
  AgentRegistry o-- FetchAgent
  AgentRegistry o-- FinnhubAgent
  AgentRegistry o-- CodeGraphAgent
  AgentRegistry o-- CodeMetricsAgent
  AgentRegistry o-- SocialMediaAgent
  AgentRegistry o-- SeoAgent
  AgentRegistry o-- TranslationAgent
  AgentRegistry o-- CustomerSupportAgent
  AgentRegistry o-- ProjectManagementAgent
  AgentRegistry o-- BgColorAgent
  AgentRegistry o-- NoteTakerAgent
  AgentRegistry o-- A2ACoordinatorAgent
  AgentRegistry o-- CodingA2ACoordinator
  AgentRegistry o-- DataPipelineNetwork
  AgentRegistry o-- ReportGenerationNetwork
  AgentRegistry o-- ResearchPipelineNetwork
  AgentRegistry o-- ContentCreationNetwork
  AgentRegistry o-- FinancialIntelligenceNetwork
  AgentRegistry o-- LearningNetwork
  AgentRegistry o-- MarketingAutomationNetwork
  AgentRegistry o-- DevopsNetwork
  AgentRegistry o-- BusinessIntelligenceNetwork
  AgentRegistry o-- SecurityNetwork
Loading

File-Level Changes

Change Details Files
Update Google AI configuration to use new language and embedding APIs and clean up unused exports.
  • Switch chat model initialization to google.languageModel for all Gemini chat variants used by the app.
  • Switch embedding initialization from google.textEmbedding to google.embedding for gemini-embedding-001.
  • Remove/comment out unused image model (gemini3ProImage) and its public selector export.
  • Comment out unused logger import in Google config to avoid lint warnings.
src/mastra/config/google.ts
Refactor vector/embedding configurations to use ModelRouterEmbeddingModel across LanceDB, MongoDB, and Qdrant.
  • Replace direct google.textEmbedding usage with new ModelRouterEmbeddingModel('google/gemini-embedding-001') in LanceDB config (both config constant and Memory embedder).
  • Apply the same ModelRouterEmbeddingModel in MongoDB vector config and Memory embedder.
  • Update Qdrant document processing and similarity query functions to call embedMany with ModelRouterEmbeddingModel instead of the old embeddingModel reference.
src/mastra/config/lance.ts
src/mastra/config/mongodb.ts
src/mastra/config/qdrant.ts
Enhance weather agent and tool behavior, including cached content configuration and richer logging.
  • Add cachedContent field to the weather agent Google provider options so repeated queries can leverage cached location data.
  • Extend weather tool logging hooks (onInputStart, onInputDelta, onInputAvailable, onOutput) to include more detailed metadata such as message counts and structured input/output fields.
  • Modify logged toolCallId values to log only whether the ID contains 'get-weather' instead of the raw identifier, reducing log verbosity/sensitivity.
src/mastra/agents/weather-agent.ts
src/mastra/tools/weather-tool.ts
Adjust Mastra observability configuration and sampling behavior.
  • Increase sampling probability from 0.5 to 0.75 for ratio-based sampling, making tracing/observability events more likely to be recorded.
  • Add (commented) RequestContext instance wiring in observability options to document intended per-request context usage without changing runtime behavior yet.
src/mastra/index.ts
Expand and normalize agent registry definitions for chat agents and networks.
  • Quote all keys in AGENT_CONFIGS to ensure stable string keys and avoid minifier/serializer issues.
  • Add a large set of new agents (graphing/analysis, mapping, marketing/support, misc utility, A2A coordinators, and various network orchestrators) with appropriate categories and feature flags.
  • Keep DEFAULT_AGENT_ID behavior unchanged, still taking the first key (now 'weatherAgent') as default.
app/chat/config/agents.ts
Strengthen agent tool UI typing and temporarily disable some news/search tool UIs.
  • Tighten prop typing for CompanyProfileCard and CommitHistoryList by casting tool inputs/outputs to their specific UITool input/output types instead of any.
  • Do the same for WeatherCard, ForecastView, and ArxivPaperCard by casting to their corresponding UITool types.
  • Comment out the NewsCarousel rendering for serpapi-news-trends/finnhub-company-news and the SearchResultList rendering for serpapi-search, effectively disabling their specialized UI while leaving the code in place for later re‑enablement.
app/chat/components/agent-tools.tsx
Integrate Mastra Convex schema and add Convex runtime configuration.
  • Switch Convex schema imports to pull tables from '@mastra/convex' instead of '@mastra/convex/schema'.
  • Reorder imports and table declarations and reformat schema definition, leaving table mappings unchanged.
  • Introduce convex.json to pin the Node.js version and basic Convex configuration for the project.
convex/schema.ts
convex.json
Tweak chat UI and context typings for future features.
  • Minorly adjust ChatInput layout/whitespace around agent and model labels, with no behavior change.
  • Add a comment in ChatContextValue hinting at an upcoming "agent switch in progress" flag for blocking sends, without changing the interface shape yet.
app/chat/components/chat-input.tsx
app/chat/providers/chat-context-types.ts
Update crawler statistics/session state fixtures and add agent registry tests and OpenTelemetry setup.
  • Refresh SDK_CRAWLER_STATISTICS_0.json with new request metrics and timestamps to reflect recent crawling activity.
  • Update SDK_SESSION_POOL_STATE.json with new session IDs and cookie values for improved session lifecycle coverage in local runs.
  • Add tests ensuring all expected agents are present in the registry and wired correctly.
  • Add an OpenTelemetry instrumentation entrypoint to enable tracing/monitoring when the app runs with OTEL enabled.
src/mastra/public/storage/key_value_stores/default/SDK_CRAWLER_STATISTICS_0.json
src/mastra/public/storage/key_value_stores/default/SDK_SESSION_POOL_STATE.json
tests/agents-config.test.ts
src/mastra/otel/instrumentation.ts
Minor dependency and configuration maintenance in package.json.
  • Reformat package.json with 2‑space indentation while keeping metadata and scripts functionally identical.
  • Bump a few dependencies to newer patch/minor versions for @ai-sdk/react, @next/* packages, next, convex, and add an override for zod in overrides.
package.json
package-lock.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ssdeanx, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the system's agent capabilities by introducing several new specialized agents and networks, ranging from financial analysis to content creation and coding. It also refines core configurations, particularly for Google AI models and embedding providers, to improve model initialization, type safety, and overall flexibility. Performance is addressed through cached content options for the weather agent and an adjusted sampling strategy in Mastra. Furthermore, the PR improves maintainability and observability by adding a Convex configuration, setting up OpenTelemetry instrumentation, and introducing new tests for agent registration.

Highlights

  • Agent Enhancements: The weather agent now supports cached content for better performance, and numerous new agent and network configurations have been added, expanding the system's capabilities in areas like graphing, technical analysis, social media, and project management.
  • Google Model Configuration Update: Google AI model initialization has been refined to use languageModel and embedding methods, ensuring proper model type instantiation for chat, image, and embedding models. Unused imports and variables were also cleaned up.
  • Embedding Model Standardization: Embedding model initialization across LanceDB, MongoDB, and Qdrant configurations now consistently uses ModelRouterEmbeddingModel for improved flexibility and management.
  • Mastra Sampling Strategy Adjustment: The sampling probability in the Mastra configuration has been increased from 0.5 to 0.75 to enhance the agent's decision-making strategy.
  • Observability and Testing: A new Convex configuration file was added, OpenTelemetry instrumentation setup was introduced for tracing, and comprehensive tests for the agent registry were implemented to validate agent presence.
  • UI Tooling Refinements: Type assertions for tool inputs and outputs in AgentTools.tsx were updated for better type safety, and some unused UI components were commented out.
  • Crawler and Session Management Updates: Crawler statistics and session pool state JSON files were updated to reflect recent request metrics, timestamps, and session details.
  • Weather Tool Logging: Enhanced logging in the weather tool provides more detailed information about tool calls and input handling.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link

🤖 I'm sorry @ssdeanx, but I was unable to process your request. Please see the logs for more details.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a substantial set of features and refactorings, including adding many new agents, updating Google model configurations, and enhancing logging. The changes generally improve the system's capabilities and maintainability. However, there are a few critical points to address: a potential package downgrade for convex, the unexplained removal of sqlAgent, and an unusual file rename of instrumentation.ts which might break OpenTelemetry setup. Additionally, there are opportunities to improve type safety, code cleanliness by removing commented-out blocks, and consistency in configuration usage and logging.

I am having trouble creating individual review comments. Click here to see my feedback.

package.json (132)

high

The convex package appears to have been downgraded from version 1.31.4 to 1.26.2. This is unusual and could potentially introduce bugs or compatibility issues. Was this downgrade intentional? If so, could you please provide some context?

app/chat/components/agent-tools.tsx (313)

medium

For better type safety, you should cast the output prop to its specific type, WeatherUITool['output'], instead of any. This aligns with the other type-safe changes made in this component.

                                output={latest.output as WeatherUITool['output']}

app/chat/components/agent-tools.tsx (319)

medium

Similar to the WeatherCard, the output prop for ForecastView should be cast to WeatherUITool['output'] instead of any to improve type safety.

                                output={latest.output as WeatherUITool['output']}

app/chat/components/agent-tools.tsx (326-340)

medium

This block of code for NewsCarousel is commented out. If this functionality is no longer needed, it's better to remove the dead code rather than leaving it commented out. This improves code readability and maintainability.

app/chat/components/agent-tools.tsx (354-364)

medium

This block of code for SearchResultList is commented out. To keep the codebase clean, it's best to remove this dead code if it's no longer in use.

app/chat/config/agents.ts (605-612)

medium

I noticed that the sqlAgent has been removed in this pull request. This seems like a significant change that wasn't mentioned in the PR description. Could you please confirm if this removal was intentional? If it's no longer needed, it might be good to mention it in the description for clarity.

src/mastra/config/qdrant.ts (141)

medium

The embedding model is hardcoded here, but the QDRANT_CONFIG object at the top of the file also defines an embeddingModel. This creates an inconsistency. To improve maintainability, you should update the embeddingModel in QDRANT_CONFIG and reference it here.

Example update to the config:

const QDRANT_CONFIG = {
    // ... other properties
    embeddingModel: new ModelRouterEmbeddingModel('google/gemini-embedding-001'),
} as const
            model: QDRANT_CONFIG.embeddingModel,

src/mastra/config/qdrant.ts (263)

medium

Similar to the processDocument function, the embedding model is hardcoded here. It would be better to update the embeddingModel in the QDRANT_CONFIG object and reference it here for consistency.

            model: QDRANT_CONFIG.embeddingModel,

src/mastra/tools/weather-tool.ts (57)

medium

Logging toolCallId as a boolean (toolCallId.includes('get-weather')) reduces the usefulness of this log message for tracing and debugging. It would be more informative to log the full toolCallId string.

            toolCallId: toolCallId,

src/mastra/tools/weather-tool.ts (65)

medium

The toolCallId is being logged as a boolean here. For better traceability, please consider logging the full toolCallId string instead.

            toolCallId: toolCallId,

src/mastra/tools/weather-tool.ts (74)

medium

The toolCallId is being logged as a boolean here. For better traceability, please consider logging the full toolCallId string instead.

            toolCallId: toolCallId,

src/mastra/tools/weather-tool.ts (274)

medium

The toolCallId is being logged as a boolean here. For better traceability, please consider logging the full toolCallId string instead.

            toolCallId: toolCallId,

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 5 issues, and left some high level feedback:

  • In weather-tool.ts the logging now records toolCallId: toolCallId.includes('get-weather'), which replaces the actual ID with a boolean and makes tracing individual tool calls much harder; consider logging the real toolCallId and, if needed, an additional isWeatherCall flag.
  • In the LanceDB, MongoDB, and Qdrant config files you switched to new ModelRouterEmbeddingModel('google/gemini-embedding-001') but did not add an import for ModelRouterEmbeddingModel, which will cause build/runtime errors; bring in the appropriate import from its package.
  • In AgentTools the NewsCarousel and SearchResultList rendering blocks for serpapi-* and finnhub-company-news tools are fully commented out, effectively disabling those tool UIs while leaving the components and tool handlers in place—if this is intentional, consider adding a clear TODO or feature flag, otherwise re-enable or remove them to avoid confusing partial integration.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `weather-tool.ts` the logging now records `toolCallId: toolCallId.includes('get-weather')`, which replaces the actual ID with a boolean and makes tracing individual tool calls much harder; consider logging the real `toolCallId` and, if needed, an additional `isWeatherCall` flag.
- In the LanceDB, MongoDB, and Qdrant config files you switched to `new ModelRouterEmbeddingModel('google/gemini-embedding-001')` but did not add an import for `ModelRouterEmbeddingModel`, which will cause build/runtime errors; bring in the appropriate import from its package.
- In `AgentTools` the `NewsCarousel` and `SearchResultList` rendering blocks for `serpapi-*` and `finnhub-company-news` tools are fully commented out, effectively disabling those tool UIs while leaving the components and tool handlers in place—if this is intentional, consider adding a clear TODO or feature flag, otherwise re-enable or remove them to avoid confusing partial integration.

## Individual Comments

### Comment 1
<location> `src/mastra/tools/weather-tool.ts:56-57` </location>
<code_context>

     onInputStart: ({ toolCallId, messages, abortSignal }) => {
         log.info('Weather tool input streaming started', {
-            toolCallId,
+            toolCallId: toolCallId.includes('get-weather'),
             messageCount: messages.length,
             hook: 'onInputStart',
</code_context>

<issue_to_address>
**issue (bug_risk):** Logging `toolCallId.includes('get-weather')` instead of the actual `toolCallId` is likely a bug and loses useful context.

This change makes `toolCallId` a boolean in several hooks (`onInputStart`, `onInputDelta`, `onInputAvailable`, `onOutput`), changing the field’s meaning and making it harder to trace specific calls. To keep both behaviors, keep `toolCallId` as the original string and add a separate field, e.g. `isWeatherToolCall: toolCallId.includes('get-weather')`.
</issue_to_address>

### Comment 2
<location> `app/chat/components/agent-tools.tsx:326` </location>
<code_context>
                     )
                 }

-                if (
-                    (toolName === 'serpapi-news-trends' ||
-                        toolName === 'finnhub-company-news') &&
-                    hasOutput
-                ) {
-                    return (
-                        <NewsCarousel
-                            key={`${id}-${toolName}-${toolState}-${groupIdx}`}
-                            toolCallId={id}
-                            input={latest.input as any}
-                            output={latest.output as any}
-                            errorText={errorText}
-                        />
-                    )
-                }
+              //  if (
+               //     (toolName === 'serpapi-news-trends' ||
+              //          toolName === 'finnhub-company-news') &&
</code_context>

<issue_to_address>
**question (bug_risk):** Commenting out the SerpAPI/Finnhub news and search UI branches changes UX and may be an unintentional regression.

`NewsCarousel` and `SearchResultList` handling for `serpapi-news-trends`, `finnhub-company-news`, and `serpapi-search` is now entirely commented out, so those tool calls will use the generic renderer instead, changing the UI. If this is intentional, consider a feature flag or explicit runtime check rather than commenting out code; if not, it’s likely an accidental regression to revert or adjust.
</issue_to_address>

### Comment 3
<location> `src/mastra/config/qdrant.ts:140-141` </location>
<code_context>
         // Generate embeddings for all chunks
         const { embeddings } = await embedMany({
             values: chunks.map((chunk) => chunk.text),
-            model: QDRANT_CONFIG.embeddingModel,
+            model: new ModelRouterEmbeddingModel('google/gemini-embedding-001'),
         })

</code_context>

<issue_to_address>
**suggestion:** Embedding model configuration is now duplicated instead of reusing `QDRANT_CONFIG.embeddingModel`.

You’re now instantiating `new ModelRouterEmbeddingModel('google/gemini-embedding-001')` inline in multiple places while `QDRANT_CONFIG.embeddingModel` is still defined but unused. This risks config drift and adds unnecessary construction overhead. Consider either making `QDRANT_CONFIG.embeddingModel` the shared `ModelRouterEmbeddingModel` instance and reusing it, or removing the config field and centralizing the model selection in one shared constant.

Suggested implementation:

```typescript
        // Generate embeddings for all chunks
        const { embeddings } = await embedMany({
            values: chunks.map((chunk) => chunk.text),
            model: QDRANT_CONFIG.embeddingModel,
        })

```

1. Ensure that `QDRANT_CONFIG.embeddingModel` is defined as a shared instance of `ModelRouterEmbeddingModel('google/gemini-embedding-001')` (or the desired router model) somewhere in this file, e.g.:
   - `embeddingModel: new ModelRouterEmbeddingModel('google/gemini-embedding-001'),`
2. If there are other call sites in this file (or others) that also use `new ModelRouterEmbeddingModel('google/gemini-embedding-001')` inline, they should similarly be updated to use `QDRANT_CONFIG.embeddingModel` to keep configuration centralized.
</issue_to_address>

### Comment 4
<location> `src/mastra/config/lance.ts:22-23` </location>
<code_context>
     embeddingDimension: parseInt(
         process.env.LANCE_EMBEDDING_DIMENSION ?? '1536'
     ),
-    embeddingModel: google.textEmbedding('gemini-embedding-001'),
+    embeddingModel: new ModelRouterEmbeddingModel('google/gemini-embedding-001'),
 } as const

</code_context>

<issue_to_address>
**suggestion (performance):** Consider reusing a single `ModelRouterEmbeddingModel` instance rather than constructing it in multiple places.

In Lance, Mongo, and Qdrant you construct `new ModelRouterEmbeddingModel('google/gemini-embedding-001')` separately for `embeddingModel` and `embedder`. If this class is stateful or uses internal caches, consider creating a single shared instance (e.g. `const geminiEmbeddingModel = new ModelRouterEmbeddingModel('google/gemini-embedding-001')`) and reusing it to avoid redundant setup and keep configuration aligned across backends.
</issue_to_address>

### Comment 5
<location> `src/mastra/config/google.ts:41` </location>
<code_context>
 // Image Generation Models
 export const googleImageModels = {
     // Gemini Flash Image model
-    gemini25FlashImage: google('gemini-2.5-flash-image'),
-    gemini3ProImage: google('gemini-3-pro-image-preview'),
+    gemini25FlashImage: google.languageModel('gemini-2.5-flash-image'),
+   // gemini3ProImage: google('gemini-3-pro-image-preview'),
     // Imagen 4.0 models
</code_context>

<issue_to_address>
**issue (bug_risk):** Using `languageModel` for an image model name could be confusing and might not match the intended API.

`gemini25FlashImage` is now created via `google.languageModel('gemini-2.5-flash-image')` while other image models use `google.image(...)`. If this is intended for image generation, it should likely be constructed with `google.image` for consistency and to ensure it works correctly in image-generation flows.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

)
}

if (
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question (bug_risk): Commenting out the SerpAPI/Finnhub news and search UI branches changes UX and may be an unintentional regression.

NewsCarousel and SearchResultList handling for serpapi-news-trends, finnhub-company-news, and serpapi-search is now entirely commented out, so those tool calls will use the generic renderer instead, changing the UI. If this is intentional, consider a feature flag or explicit runtime check rather than commenting out code; if not, it’s likely an accidental regression to revert or adjust.

Comment on lines -22 to 23
embeddingModel: google.textEmbedding('gemini-embedding-001'),
embeddingModel: new ModelRouterEmbeddingModel('google/gemini-embedding-001'),
} as const
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (performance): Consider reusing a single ModelRouterEmbeddingModel instance rather than constructing it in multiple places.

In Lance, Mongo, and Qdrant you construct new ModelRouterEmbeddingModel('google/gemini-embedding-001') separately for embeddingModel and embedder. If this class is stateful or uses internal caches, consider creating a single shared instance (e.g. const geminiEmbeddingModel = new ModelRouterEmbeddingModel('google/gemini-embedding-001')) and reusing it to avoid redundant setup and keep configuration aligned across backends.

// Image Generation Models
export const googleImageModels = {
// Gemini Flash Image model
gemini25FlashImage: google('gemini-2.5-flash-image'),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Using languageModel for an image model name could be confusing and might not match the intended API.

gemini25FlashImage is now created via google.languageModel('gemini-2.5-flash-image') while other image models use google.image(...). If this is intended for image generation, it should likely be constructed with google.image for consistency and to ensure it works correctly in image-generation flows.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request includes multiple refactoring improvements, configuration updates, and infrastructure additions to enhance the Mastra-based AI application. The changes focus on standardizing model initialization patterns, improving observability, and expanding agent capabilities.

Changes:

  • Refactored Google AI SDK and embedding model initialization to use standardized methods (languageModel(), embedding()) and ModelRouterEmbeddingModel class
  • Enhanced observability by adding OpenTelemetry instrumentation setup and increasing sampling probability from 0.5 to 0.75
  • Expanded agent registry with 19 new agents and networks, adding comprehensive test coverage for agent configuration

Reviewed changes

Copilot reviewed 17 out of 19 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
types/instrumentation--nn.ts Added OpenTelemetry SDK configuration for distributed tracing
tests/agents-config.test.ts Created test suite to verify agent registry completeness
src/mastra/tools/weather-tool.ts Modified logging to use boolean check instead of raw toolCallId
src/mastra/public/storage/key_value_stores/default/SDK_SESSION_POOL_STATE.json Updated crawler session state with new session IDs and timestamps
src/mastra/public/storage/key_value_stores/default/SDK_CRAWLER_STATISTICS_0.json Refreshed crawler metrics with current run statistics
src/mastra/index.ts Increased telemetry sampling from 50% to 75% with outdated comment
src/mastra/config/qdrant.ts Switched to ModelRouterEmbeddingModel for embedding generation
src/mastra/config/mongodb.ts Standardized embedding model initialization pattern
src/mastra/config/lance.ts Applied consistent ModelRouterEmbeddingModel usage
src/mastra/config/google.ts Migrated to new Google SDK method names and commented unused code
src/mastra/agents/weather-agent.ts Added cachedContent configuration option
package.json Updated dependencies (@ai-sdk/react, @next/*, convex) and formatting
convex/schema.ts Updated import source and reformatted for consistency
convex.json Added Convex framework configuration file
app/chat/providers/chat-context-types.ts Added comment for isFocusMode documentation
app/chat/config/agents.ts Added 19 new agents/networks and applied consistent string literal syntax
app/chat/components/chat-input.tsx Minor whitespace formatting changes
app/chat/components/agent-tools.tsx Improved type safety and commented out unused tool renderers

onInputStart: ({ toolCallId, messages, abortSignal }) => {
log.info('Weather tool input streaming started', {
toolCallId,
toolCallId: toolCallId.includes('get-weather'),
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logging transformation changes toolCallId from a string identifier to a boolean value. This breaks the purpose of logging the tool call ID, which should be a unique identifier for tracing. Instead of logging whether the ID contains 'get-weather', the actual toolCallId string should be logged for proper request tracing and debugging.

Copilot uses AI. Check for mistakes.
onInputDelta: ({ inputTextDelta, toolCallId, messages, abortSignal }) => {
log.info('Weather tool received input chunk', {
toolCallId,
toolCallId: toolCallId.includes('get-weather'),
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as Comment 1: The boolean check replaces the actual toolCallId string, preventing proper correlation of log entries for this tool invocation.

Copilot uses AI. Check for mistakes.
onInputAvailable: ({ input, toolCallId, messages, abortSignal }) => {
log.info('Weather tool received input', {
toolCallId,
toolCallId: toolCallId.includes('get-weather'),
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as Comment 1: The boolean check replaces the actual toolCallId string, preventing proper correlation of log entries for this tool invocation.

Copilot uses AI. Check for mistakes.
onOutput: ({ output, toolCallId, toolName, abortSignal }) => {
log.info('Weather tool completed', {
toolCallId,
toolCallId: toolCallId.includes('get-weather'),
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as Comment 1: The boolean check replaces the actual toolCallId string, preventing proper correlation of log entries for this tool invocation.

Suggested change
toolCallId: toolCallId.includes('get-weather'),
toolCallId,
isGetWeatherCall: toolCallId.includes('get-weather'),

Copilot uses AI. Check for mistakes.
type: SamplingStrategyType.RATIO,
probability: 0.5,
probability: 0.75,
}, // 50% sampling
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inline comment states '50% sampling' but the probability is set to 0.75 (75%). The comment should be updated to match the actual value: '// 75% sampling'.

Suggested change
}, // 50% sampling
}, // 75% sampling

Copilot uses AI. Check for mistakes.
includeThoughts: true,
thinkingBudget: -1,
},
cachedContent: "Location data cached for weather queries",
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cachedContent property appears to be a string description, but the Google Generative AI API's cachedContent feature typically expects a cache configuration object or reference, not a descriptive string. This may not function as intended and could cause runtime errors or be silently ignored. Verify the correct usage in the @ai-sdk/google documentation.

Suggested change
cachedContent: "Location data cached for weather queries",

Copilot uses AI. Check for mistakes.
export const AGENT_CONFIGS: Record<string, AgentConfig> = {
// Core Agents
weatherAgent: {
"weatherAgent": {
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrapping object keys in quotes when they are valid JavaScript identifiers is unnecessary and inconsistent with typical TypeScript/JavaScript style. While not incorrect, this change adds visual noise and deviates from the codebase's previous style without apparent benefit.

Copilot uses AI. Check for mistakes.
import { embedMany } from 'ai'
import type { UIMessage } from 'ai'
import { log } from './logger'
import z from 'zod'
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'z' is defined but never used.

Suggested change
import z from 'zod'

Copilot uses AI. Check for mistakes.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 14

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (7)
src/mastra/agents/weather-agent.ts (2)

80-83: Remove commented-out code.

Per coding guidelines, commented-out code should be removed rather than left in place. Use version control history if this configuration is needed later.

🧹 Proposed fix
     maxRetries: 5,
-
-  //  defaultOptions: {
-//       autoResumeSuspendedTools: true,
- //   },
 })

42-50: cachedContent must be a cached content resource ID, not a descriptive string.

The cachedContent value should be a fully-qualified cached content resource name returned from Google's cachedContents API (format: projects/{PROJECT_NUMBER}/locations/{LOCATION}/cachedContents/{CACHE_ID}), not a descriptive string. The current placeholder string will cause the API to reject the request.

First create cached content via the Google AI API, then reference the returned resource ID.

src/mastra/tools/weather-tool.ts (2)

63-80: Same boolean logging issue in onInputDelta and onInputAvailable.

Apply the same fix to these lifecycle hooks to preserve the actual toolCallId value.

🐛 Proposed fix
 onInputDelta: ({ inputTextDelta, toolCallId, messages, abortSignal }) => {
     log.info('Weather tool received input chunk', {
-        toolCallId: toolCallId.includes('get-weather'),
+        toolCallId,
         inputTextDelta,
         abortSignal: abortSignal?.aborted,
         messageCount: messages.length,
         hook: 'onInputDelta',
     })
 },
 onInputAvailable: ({ input, toolCallId, messages, abortSignal }) => {
     log.info('Weather tool received input', {
-        toolCallId: toolCallId.includes('get-weather'), 
+        toolCallId,
         messageCount: messages.length,
         inputData: { location: input.location },
         abortSignal: abortSignal?.aborted,
         hook: 'onInputAvailable',
     })
 },

272-285: Same boolean logging issue in onOutput.

🐛 Proposed fix
 onOutput: ({ output, toolCallId, toolName, abortSignal }) => {
     log.info('Weather tool completed', {
-        toolCallId: toolCallId.includes('get-weather'),
+        toolCallId,
         toolName,
         outputData: {
             location: output.location,
             temperature: output.temperature,
             unit: output.unit,
             conditions: output.conditions,
         },
         hook: 'onOutput',
         abortSignal: abortSignal?.aborted,
     })
 },
app/chat/components/agent-tools.tsx (1)

304-324: Inconsistent type casting: output still uses any.

The input prop is properly typed as WeatherUITool['input'], but output still uses any. Apply consistent typing for both props.

♻️ Proposed fix
 <WeatherCard
     toolCallId={id}
     input={latest.input as WeatherUITool['input']}
-    output={latest.output as any}
+    output={latest.output as WeatherUITool['output']}
     errorText={errorText}
 />
 <ForecastView
     toolCallId={id}
     input={latest.input as WeatherUITool['input']}
-    output={latest.output as any}
+    output={latest.output as WeatherUITool['output']}
     errorText={errorText}
 />
src/mastra/config/lance.ts (2)

46-46: Replace hardcoded placeholder path with configuration.

The path '/path/to/db' is a placeholder that will cause runtime failures or unexpected behavior. Use LANCE_CONFIG.dbPath or another environment-based configuration.

🐛 Proposed fix
-const vectorStore = await LanceVectorStore.create('/path/to/db')
+const vectorStore = await LanceVectorStore.create(LANCE_CONFIG.dbPath)

231-243: Type mismatch: options.model is string but LANCE_CONFIG.embeddingModel is ModelRouterEmbeddingModel.

The function signature declares options.model as string | undefined, but line 239 falls back to LANCE_CONFIG.embeddingModel, which is now a ModelRouterEmbeddingModel instance. This will cause a type error or unexpected behavior when embedMany receives an incompatible type.

🐛 Proposed fix

Update the function signature and logic to handle the embedding model properly:

 export async function generateEmbeddings(
     texts: string[],
     options: {
-        model?: string
+        model?: typeof LANCE_CONFIG.embeddingModel
         dimensions?: number
     } = {}
 ): Promise<number[][]> {
     try {
         const model = options.model ?? LANCE_CONFIG.embeddingModel
🤖 Fix all issues with AI agents
In `@app/chat/components/agent-tools.tsx`:
- Around line 326-340: Remove the commented-out UI blocks for NewsCarousel and
SearchResultList in the agent-tools.tsx component: delete the commented code
that references NewsCarousel (the block containing key
`${id}-${toolName}-${toolState}-${groupIdx}`, toolCallId, input, output,
errorText) and the similar commented SearchResultList block (the other commented
range noted); keep the surrounding logic intact and rely on git history if
restoration is needed.

In `@app/chat/config/agents.ts`:
- Around line 732-738: The agent definition for "daneChangeLog" has a mismatched
id vs name/description; update the name and description to reflect changelog
functionality (e.g., change name to "Dane Changelog" or "Dane Changelog
Publisher" and description to "Generate and publish changelogs for packages" or
similar) so the id `daneChangeLog` matches the agent purpose, keeping the
existing category and features intact.

In `@app/chat/providers/chat-context-types.ts`:
- Around line 103-104: The dangling comment refers to a missing state flag for
agent switching; add a boolean property named isAgentSwitching to the chat
context/type (e.g., the ChatContext/ChatState or ChatContextType interface in
chat-context-types.ts) and ensure the ChatProvider/createChatContext initializer
sets a default (false) and any setters/useEffects update it where agent switches
occur; alternatively, if the flag is not needed, remove the orphaned comment.

In `@src/mastra/config/google.ts`:
- Line 78: Remove the dead commented-out export line for googleNanoBanana (the
line "//export const googleNanoBanana = googleImageModels.gemini3ProImage // Pro
image") from the file so no stray commented exports remain; search for any other
commented exports named googleNanoBanana and delete them, leaving only active
exports and documentation.
- Line 2: Remove the commented-out import for logError in the google.ts file;
locate the line containing "//import { logError } from './logger'" and delete it
so no unused or commented import remains, relying on VCS to recover if needed.
- Line 51: The config uses google.embedding() for geminiEmbedding001 which is
inconsistent with other configs that call google.textEmbedding(); update this
file to use google.textEmbedding('gemini-embedding-001') so the symbol
geminiEmbedding001 and the call site match the rest of the codebase (or
alternatively change all other references to google.embedding()—but apply the
simpler fix: revert google.embedding() to google.textEmbedding() in this file).
- Around line 41-42: Remove the commented-out gemini3ProImage line to eliminate
dead code; delete the line referencing gemini3ProImage and, if you need to note
its unavailability or deprecation, add a brief comment or note in the project
documentation (e.g., README or changelog) instead of leaving an inline commented
config; ensure the remaining config key gemini25FlashImage and its call to
google.languageModel('gemini-2.5-flash-image') remain unchanged.
- Around line 23-35: The model registrations (e.g., gemini3Pro, gemini3Flash,
gemini25Pro, gemini25Flash, gemini25FlashLite, gemini25ComputerUse,
gemini25FlashAlt) incorrectly call google.languageModel(...); replace each call
with the `@ai-sdk/google` factory function form google('model-id') (for example
google('gemini-3-pro-preview')) so each symbol is assigned the LanguageModel
returned by google(...) instead of the non-existent google.languageModel(...)
method.

In `@src/mastra/config/qdrant.ts`:
- Around line 261-264: The embedMany call currently constructs a new
ModelRouterEmbeddingModel('google/gemini-embedding-001') which duplicates
processDocument and breaks vector compatibility; replace that inline
ModelRouterEmbeddingModel usage with the shared embedding model constant used
elsewhere (the same constant referenced by processDocument, e.g.,
SHARED_EMBEDDING_MODEL or EMBEDDING_MODEL), update any imports or references so
embedMany({ model: ... }) uses that shared constant, and ensure embedMany,
ModelRouterEmbeddingModel, and processDocument now all rely on the same shared
embedding model symbol.
- Around line 139-142: processDocument is instantiating new
ModelRouterEmbeddingModel('google/gemini-embedding-001') while qdrantQueryTool
and qdrantGraphTool use QDRANT_CONFIG.embeddingModel, risking vector-space
mismatch and extra allocations; extract a single shared embedding model instance
(e.g., EMBEDDING_MODEL = new
ModelRouterEmbeddingModel('google/gemini-embedding-001') or set
QDRANT_CONFIG.embeddingModel to that instance) and replace the inline new
ModelRouterEmbeddingModel call in processDocument and any uses in
querySimilarDocuments/qdrantQueryTool/qdrantGraphTool so all functions use the
same QDRANT_CONFIG.embeddingModel constant.

In `@src/mastra/index.ts`:
- Around line 435-437: Remove the commented-out instantiation of RequestContext
or implement it: if you need a per-request context, replace the commented line
with runtime creation of a RequestContext instance passed into the route
configuration (e.g., ensure the route option key requestContext receives a new
RequestContext() for each request using the appropriate middleware or factory),
otherwise delete the commented block entirely and open an issue referencing
RequestContext to track the requirement; locate the commented lines around the
requestContext key and update either the route setup to instantiate
RequestContext per request or remove the comment.
- Around line 293-296: The inline comment "// 50% sampling" is stale and does
not match the configured sampling.probability of 0.75 in the sampling block
using SamplingStrategyType.RATIO; update the comment to reflect 75% sampling or
remove the comment entirely so it no longer contradicts the actual configuration
in the sampling object (sampling.probability and SamplingStrategyType.RATIO).

In `@src/mastra/tools/weather-tool.ts`:
- Around line 55-61: The log in onInputStart incorrectly records toolCallId as a
boolean by calling toolCallId.includes('get-weather'); change the logged field
to the actual identifier by passing toolCallId itself (e.g., log.info(..., {
toolCallId, messageCount: messages.length, hook: 'onInputStart', abortSignal:
abortSignal?.aborted })) so the real ID is preserved for tracing and debugging.

In `@tests/agents-config.test.ts`:
- Around line 35-40: Replace the manual loop that checks each id with a single
assertion using Jest's expect.arrayContaining so failures list all missing IDs
at once; specifically, in the test that calls getAllAgentIds() and iterates
expectedIds, remove the for-loop and assert that the returned ids array contains
arrayContaining(expectedIds) (use
expect(ids).toEqual(expect.arrayContaining(expectedIds)) or equivalent)
referencing the getAllAgentIds call and the expectedIds variable.
📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a940839 and b8cd678.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (18)
  • app/chat/components/agent-tools.tsx
  • app/chat/components/chat-input.tsx
  • app/chat/config/agents.ts
  • app/chat/providers/chat-context-types.ts
  • convex.json
  • convex/schema.ts
  • package.json
  • src/mastra/agents/weather-agent.ts
  • src/mastra/config/google.ts
  • src/mastra/config/lance.ts
  • src/mastra/config/mongodb.ts
  • src/mastra/config/qdrant.ts
  • src/mastra/index.ts
  • src/mastra/public/storage/key_value_stores/default/SDK_CRAWLER_STATISTICS_0.json
  • src/mastra/public/storage/key_value_stores/default/SDK_SESSION_POOL_STATE.json
  • src/mastra/tools/weather-tool.ts
  • tests/agents-config.test.ts
  • types/instrumentation--nn.ts
🧰 Additional context used
📓 Path-based instructions (42)
**/*.{js,ts,tsx,jsx,py,java,cs,go,rb,php,swift,kt}

📄 CodeRabbit inference engine (.github/instructions/code-review-generic.instructions.md)

**/*.{js,ts,tsx,jsx,py,java,cs,go,rb,php,swift,kt}: Use descriptive and meaningful names for variables, functions, and classes
Apply Single Responsibility Principle: each function/class should do one thing well
Avoid code duplication (DRY principle)
Keep functions small and focused, ideally under 20-30 lines
Avoid deeply nested code with maximum 3-4 levels of nesting
Avoid magic numbers and strings; use named constants instead
Code should be self-documenting; use comments only when necessary for non-obvious logic
Implement proper error handling at appropriate levels with meaningful error messages
Avoid silent failures and ignored exceptions; fail fast and validate inputs early
Use appropriate error types/exceptions rather than generic error handling
Validate and sanitize all user inputs
Use parameterized queries to prevent SQL injection; never use string concatenation for SQL
Implement proper authentication checks before accessing resources
Verify users have proper authorization permissions before allowing actions
Use established cryptography libraries; never implement custom cryptographic algorithms
Avoid N+1 query problems; use proper indexing and eager loading strategies
Use appropriate algorithms with suitable time/space complexity for the use case
Utilize caching for expensive or repeated operations
Ensure proper cleanup of connections, files, and streams
Implement pagination for large result sets
Load data only when needed (lazy loading)
Document all public APIs with clear purpose, parameters, and return values
Include explanatory comments for complex logic that is not immediately obvious

Files:

  • app/chat/providers/chat-context-types.ts
  • tests/agents-config.test.ts
  • src/mastra/config/mongodb.ts
  • src/mastra/tools/weather-tool.ts
  • src/mastra/config/qdrant.ts
  • app/chat/components/chat-input.tsx
  • src/mastra/agents/weather-agent.ts
  • src/mastra/index.ts
  • app/chat/components/agent-tools.tsx
  • src/mastra/config/lance.ts
  • src/mastra/config/google.ts
  • app/chat/config/agents.ts
  • convex/schema.ts
**/*.{js,ts,tsx,jsx,py,java,cs,go,rb,php,swift,kt,json,yaml,yml,env,properties,xml}

📄 CodeRabbit inference engine (.github/instructions/code-review-generic.instructions.md)

Never include passwords, API keys, tokens, or personally identifiable information (PII) in code or logs

Files:

  • app/chat/providers/chat-context-types.ts
  • tests/agents-config.test.ts
  • convex.json
  • src/mastra/config/mongodb.ts
  • src/mastra/public/storage/key_value_stores/default/SDK_CRAWLER_STATISTICS_0.json
  • src/mastra/tools/weather-tool.ts
  • src/mastra/config/qdrant.ts
  • app/chat/components/chat-input.tsx
  • src/mastra/agents/weather-agent.ts
  • src/mastra/index.ts
  • app/chat/components/agent-tools.tsx
  • src/mastra/config/lance.ts
  • src/mastra/config/google.ts
  • src/mastra/public/storage/key_value_stores/default/SDK_SESSION_POOL_STATE.json
  • app/chat/config/agents.ts
  • convex/schema.ts
  • package.json
app/**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)

Use the app/ directory structure (Next.js 13+) as the recommended approach for new projects, organizing routes with page.tsx, layout.tsx, loading.tsx, error.tsx, route.ts files, and dynamic segments using brackets

Files:

  • app/chat/providers/chat-context-types.ts
  • app/chat/components/chat-input.tsx
  • app/chat/components/agent-tools.tsx
  • app/chat/config/agents.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)

**/*.{ts,tsx,js,jsx}: Use next/dynamic for lazy loading components to improve initial load time (e.g., dynamic(() => import('../components/MyComponent')))
Use React Context, Zustand, Jotai, or Recoil for managing global state instead of Redux for smaller Next.js projects
Avoid over-fetching data—only fetch the data that is needed by the component
Avoid blocking the main thread with long-running synchronous operations
Use try...catch blocks for handling errors in asynchronous operations
Use immutable data structures and avoid mutating data directly to prevent unexpected side effects
Implement secure authentication and authorization mechanisms; avoid storing secrets in client-side code
Always validate user input on the server-side for security; use client-side validation only for immediate feedback
Configure ESLint with recommended rules for JavaScript and React, and integrate it into the build process
Centralize error logging to a service like Sentry or Bugsnag for tracking and analyzing issues
Remove unused code using tree shaking to reduce bundle size

Files:

  • app/chat/providers/chat-context-types.ts
  • tests/agents-config.test.ts
  • src/mastra/config/mongodb.ts
  • src/mastra/tools/weather-tool.ts
  • src/mastra/config/qdrant.ts
  • app/chat/components/chat-input.tsx
  • src/mastra/agents/weather-agent.ts
  • src/mastra/index.ts
  • app/chat/components/agent-tools.tsx
  • src/mastra/config/lance.ts
  • src/mastra/config/google.ts
  • app/chat/config/agents.ts
  • convex/schema.ts
**/{components,lib,app}/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)

Store authentication tokens securely in HTTP-only cookies or local storage

Files:

  • app/chat/providers/chat-context-types.ts
  • app/chat/components/chat-input.tsx
  • app/chat/components/agent-tools.tsx
  • app/chat/config/agents.ts
**/{components,app,pages}/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)

Use a validation library like zod or yup for validating user input

Files:

  • app/chat/providers/chat-context-types.ts
  • app/chat/components/chat-input.tsx
  • app/chat/components/agent-tools.tsx
  • app/chat/config/agents.ts
**/*.{ts,js}

📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)

Encrypt sensitive data at rest and in transit

Files:

  • app/chat/providers/chat-context-types.ts
  • tests/agents-config.test.ts
  • src/mastra/config/mongodb.ts
  • src/mastra/tools/weather-tool.ts
  • src/mastra/config/qdrant.ts
  • src/mastra/agents/weather-agent.ts
  • src/mastra/index.ts
  • src/mastra/config/lance.ts
  • src/mastra/config/google.ts
  • app/chat/config/agents.ts
  • convex/schema.ts
**/*.{ts,tsx,js,jsx,json,css,scss}

📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)

Use a code formatter like Prettier to automatically format code on save

Files:

  • app/chat/providers/chat-context-types.ts
  • tests/agents-config.test.ts
  • convex.json
  • src/mastra/config/mongodb.ts
  • src/mastra/public/storage/key_value_stores/default/SDK_CRAWLER_STATISTICS_0.json
  • src/mastra/tools/weather-tool.ts
  • src/mastra/config/qdrant.ts
  • app/chat/components/chat-input.tsx
  • src/mastra/agents/weather-agent.ts
  • src/mastra/index.ts
  • app/chat/components/agent-tools.tsx
  • src/mastra/config/lance.ts
  • src/mastra/config/google.ts
  • src/mastra/public/storage/key_value_stores/default/SDK_SESSION_POOL_STATE.json
  • app/chat/config/agents.ts
  • convex/schema.ts
  • package.json
**/{components,pages,app}/**/*

📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)

Keep related components, styles, and tests in the same directory through co-location

Files:

  • app/chat/providers/chat-context-types.ts
  • app/chat/components/chat-input.tsx
  • app/chat/components/agent-tools.tsx
  • app/chat/config/agents.ts
**/*.{js,jsx,ts,tsx,py,java,c,cpp,cs,go,rb,php,swift,kt,scala,rs}

📄 CodeRabbit inference engine (.github/instructions/self-explanatory-code-commenting.instructions.md)

**/*.{js,jsx,ts,tsx,py,java,c,cpp,cs,go,rb,php,swift,kt,scala,rs}: Avoid obvious comments that state what the code already clearly expresses (e.g., 'Increment counter by one' for counter++).
Avoid redundant comments that simply repeat what the code already expresses.
Keep comments accurate and update them when code changes to avoid outdated comments that no longer match the implementation.
Write comments that explain WHY specific calculations or business logic is implemented the way it is, especially for complex or non-obvious approaches.
Comment non-obvious algorithms to explain the algorithm choice and why it was selected for the problem.
Comment regex patterns to explain what patterns they match and their intended purpose.
Comment API constraints, rate limits, gotchas, and external dependencies to explain non-obvious external requirements.
Comment configuration constants and magic numbers to explain their source, reasoning, or constraints.
Use annotation comments (TODO, FIXME, HACK, NOTE, WARNING, PERF, SECURITY, BUG, REFACTOR, DEPRECATED) to mark code requiring attention or special consideration.
Never comment out code; remove it instead and use version control history if needed.
Avoid using changelog comments in code; maintain version history in commit messages and documentation instead.
Avoid decorative divider comments (like //====); use code organization and clear function/class names instead.
Ensure comments are grammatically correct, clear, and use professional language.
Place comments appropriately above the code they describe, not inline or after code when possible.

Files:

  • app/chat/providers/chat-context-types.ts
  • tests/agents-config.test.ts
  • src/mastra/config/mongodb.ts
  • src/mastra/tools/weather-tool.ts
  • src/mastra/config/qdrant.ts
  • app/chat/components/chat-input.tsx
  • src/mastra/agents/weather-agent.ts
  • src/mastra/index.ts
  • app/chat/components/agent-tools.tsx
  • src/mastra/config/lance.ts
  • src/mastra/config/google.ts
  • app/chat/config/agents.ts
  • convex/schema.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/instructions/self-explanatory-code-commenting.instructions.md)

**/*.{ts,tsx}: Use TSDoc standards for documenting public APIs in TypeScript, including @param, @returns, @throws, @example, and @see tags.
Include file headers with @fileoverview, @author, @copyright, and @license TSDoc tags for TypeScript files.
Document interface and type definitions with TSDoc comments explaining their purpose and usage.
Use @template tags to document generic type parameters in TypeScript functions and types.
Document type guards with clear explanations of validation logic and return type predicates.
Comment advanced type definitions to explain their purpose and when they should be used.

**/*.{ts,tsx}: Use strict equality (eqeqeq: ['error', 'always']) — always use === and !== instead of == and !=
Require curly braces for all blocks (curly: ['error', 'all']) — even single-statement blocks must have braces
Avoid unused variables (@typescript-eslint/no-unused-vars: ['warn', {}]) — remove all unused variable declarations
Avoid explicit any types (@typescript-eslint/no-explicit-any: 'warn') — use proper types or unknown instead
Use object shorthand syntax (object-shorthand: 'error') — use { name } instead of { name: name }
Prefer arrow functions in callbacks (prefer-arrow-callback: 'error') — use => syntax instead of function expressions
Use const when possible (prefer-const: 'warn') — prefer const over let for variables that are not reassigned
Prefer interface for type definitions (@typescript-eslint/consistent-type-definitions: ['error', 'interface']) — use interfaces for object shapes in public APIs
Use import type for type-only imports — always use import type { T } from 'module' for type declarations
Use optional chaining (?.) for nullable access — use obj?.prop instead of obj && obj.prop
Use nullish coalescing (??) for defaults — prefer value ?? defaultValue over value || defaultValue for null checks
Require explicit return types for public functions — all public function declaratio...

Files:

  • app/chat/providers/chat-context-types.ts
  • tests/agents-config.test.ts
  • src/mastra/config/mongodb.ts
  • src/mastra/tools/weather-tool.ts
  • src/mastra/config/qdrant.ts
  • app/chat/components/chat-input.tsx
  • src/mastra/agents/weather-agent.ts
  • src/mastra/index.ts
  • app/chat/components/agent-tools.tsx
  • src/mastra/config/lance.ts
  • src/mastra/config/google.ts
  • app/chat/config/agents.ts
  • convex/schema.ts
**/*.{ts,tsx,js,jsx,mjs,cjs,py,java,cs,go,rb,php,rs,cpp,c,h,hpp}

📄 CodeRabbit inference engine (.github/instructions/update-docs-on-code-change.instructions.md)

Use automated documentation generation tools appropriate for the language: JSDoc/TSDoc for JavaScript/TypeScript, Sphinx/pdoc for Python, Javadoc for Java, xmldoc for C#, godoc for Go, rustdoc for Rust

Files:

  • app/chat/providers/chat-context-types.ts
  • tests/agents-config.test.ts
  • src/mastra/config/mongodb.ts
  • src/mastra/tools/weather-tool.ts
  • src/mastra/config/qdrant.ts
  • app/chat/components/chat-input.tsx
  • src/mastra/agents/weather-agent.ts
  • src/mastra/index.ts
  • app/chat/components/agent-tools.tsx
  • src/mastra/config/lance.ts
  • src/mastra/config/google.ts
  • app/chat/config/agents.ts
  • convex/schema.ts
app/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use Next.js 16 App Router with React 19 — organize routes under app/ with proper layout and page components

Files:

  • app/chat/providers/chat-context-types.ts
  • app/chat/components/chat-input.tsx
  • app/chat/components/agent-tools.tsx
  • app/chat/config/agents.ts
app/**/*.{css,tsx,ts}

📄 CodeRabbit inference engine (app/AGENTS.md)

Use Tailwind CSS 4 with oklch color variables for styling Next.js App Directory pages and layouts

Files:

  • app/chat/providers/chat-context-types.ts
  • app/chat/components/chat-input.tsx
  • app/chat/components/agent-tools.tsx
  • app/chat/config/agents.ts
app/chat/**/*.{ts,tsx}

📄 CodeRabbit inference engine (app/chat/AGENTS.md)

Use AI SDK v5 type imports: UIMessage, DynamicToolUIPart, TextUIPart, ReasoningUIPart with helper functions (isTextUIPart, isReasoningUIPart, isToolOrDynamicToolUIPart) instead of direct content access

Files:

  • app/chat/providers/chat-context-types.ts
  • app/chat/components/chat-input.tsx
  • app/chat/components/agent-tools.tsx
  • app/chat/config/agents.ts
app/chat/providers/**/*.{ts,tsx}

📄 CodeRabbit inference engine (app/chat/AGENTS.md)

Handle Mastra stream chunk types: text-delta, reasoning-delta (not 'reasoning'), tool-call, tool-result, source, finish in the chat streaming implementation

Files:

  • app/chat/providers/chat-context-types.ts
**/*.{test,spec}.{js,ts,tsx,jsx,py,java,cs,go,rb,php,swift,kt}

📄 CodeRabbit inference engine (.github/instructions/code-review-generic.instructions.md)

**/*.{test,spec}.{js,ts,tsx,jsx,py,java,cs,go,rb,php,swift,kt}: Critical paths and new functionality must have appropriate test coverage
Use descriptive test names that clearly explain what is being tested
Structure tests with clear Arrange-Act-Assert or Given-When-Then pattern
Tests should be independent and not depend on each other or external state
Use specific assertions instead of generic assertTrue/assertFalse in tests
Test boundary conditions, null values, and empty collections (edge cases)
Mock external dependencies in tests, not domain logic

Files:

  • tests/agents-config.test.ts
**/*.{test,spec}.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)

**/*.{test,spec}.{ts,tsx,js,jsx}: Use Jest as the testing framework for unit and integration tests
Mock external dependencies during testing to isolate components
Test edge cases and error conditions to ensure components are robust
Use Mock Service Worker (msw) to intercept and mock API calls during testing
Co-locate test files with the components they are testing
Use a consistent naming convention for test files (e.g., ComponentName.test.js or ComponentName.spec.ts)
Organize tests by feature to improve maintainability and clarity

Files:

  • tests/agents-config.test.ts
src/mastra/**/*

📄 CodeRabbit inference engine (src/AGENTS.md)

mastra modules can import from utils, but must not import from app or cli (except types)

Files:

  • src/mastra/config/mongodb.ts
  • src/mastra/public/storage/key_value_stores/default/SDK_CRAWLER_STATISTICS_0.json
  • src/mastra/tools/weather-tool.ts
  • src/mastra/config/qdrant.ts
  • src/mastra/agents/weather-agent.ts
  • src/mastra/index.ts
  • src/mastra/config/lance.ts
  • src/mastra/config/google.ts
  • src/mastra/public/storage/key_value_stores/default/SDK_SESSION_POOL_STATE.json
src/mastra/config/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

src/mastra/config/**/*.ts: Centralize all provider clients (Google, OpenAI, Anthropic, OpenRouter, Vertex), storage configuration, and role hierarchy in src/mastra/config
Use environment-based configuration for all secrets and provider clients — store all sensitive values in environment variables

Files:

  • src/mastra/config/mongodb.ts
  • src/mastra/config/qdrant.ts
  • src/mastra/config/lance.ts
  • src/mastra/config/google.ts
src/mastra/{tools,config}/**

📄 CodeRabbit inference engine (src/mastra/AGENTS.md)

When adding new tools or providers, add environment variable placeholders to .env and document them in src/mastra/config/AGENTS.md

Files:

  • src/mastra/config/mongodb.ts
  • src/mastra/tools/weather-tool.ts
  • src/mastra/config/qdrant.ts
  • src/mastra/config/lance.ts
  • src/mastra/config/google.ts
src/mastra/tools/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

src/mastra/tools/**/*.ts: Implement tools using createTool({ id, description, inputSchema, outputSchema, execute }) with strict Zod schemas — all tools must follow this pattern
Use strict Zod schemas for all tool input and output validation — define inputSchema and outputSchema with proper type inference

src/mastra/tools/**/*.ts: Create tools using the createTool pattern with explicit Zod schemas for input/output validation
Keep tools small and side-effect-free when possible; delegate complex orchestration to agents

Files:

  • src/mastra/tools/weather-tool.ts
**/*-tool.ts

📄 CodeRabbit inference engine (AGENTS.md)

Name tool implementation files with -tool.ts suffix (e.g., weather-tool.ts)

Files:

  • src/mastra/tools/weather-tool.ts
src/mastra/tools/**/*.{ts,tsx}

📄 CodeRabbit inference engine (src/mastra/tools/AGENTS.md)

src/mastra/tools/**/*.{ts,tsx}: Import SpanType from @mastra/core/observability and TracingContext from @mastra/core/observability to maintain consistency and compatibility across the codebase
All tools must use Mastra's tracing helpers and execution-provided tracingContext instead of importing or using OpenTelemetry APIs directly (do NOT import @opentelemetry/api)
Define a typed RequestContext interface extending RequestContext for each tool to ensure type safety and clear documentation of expected context values
Create a child span using tracingContext?.currentSpan?.createChildSpan() with type: SpanType.TOOL_CALL for the primary operation and pass requestContext: context?.requestContext for automatic metadata extraction
Include tool.id, user.id, and workspace.id in span metadata where applicable
Emit data-tool-progress events at the start and completion of tool execution with status ('in-progress' or 'done') and stage matching the tool id
Respect abortSignal early (fail fast) in tool execution and record cancellations in spans before long-running operations
Progress event format must have id at the top level of the object (outside data), not inside the data object
Lifecycle hooks must be declared in order: onInputStart, onInputDelta, onInputAvailable before the execute property, and onOutput after execute
All lifecycle hooks (onInputStart, onInputDelta, onInputAvailable, onOutput) must be implemented with structured logging using the Mastra logger
Use log.info() from the Mastra logger with structured logging objects containing toolCallId, messageCount, inputData, abortSignal, and hook properties in lifecycle hooks
Extract typed context in execute function with pattern: const requestContext = context?.requestContext as ToolNameContext
Provide sensible defaults for optional RequestContext properties (e.g., const temperatureUnit = requestContext?.temperatureUnit ?? 'celsius')
Update spans...

Files:

  • src/mastra/tools/weather-tool.ts
**/{components,src/components,ui}/**/*.{jsx,tsx}

📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)

Name components using PascalCase (e.g., ComponentName.jsx or ComponentName.tsx)

Files:

  • app/chat/components/chat-input.tsx
  • app/chat/components/agent-tools.tsx
app/**/*.{tsx,jsx}

📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)

app/**/*.{tsx,jsx}: Use server components by default in the app directory and only use client components when interactivity (event handlers, useState, useEffect) is required
Render as much as possible on the server using server components in the app directory to reduce client-side JavaScript

Files:

  • app/chat/components/chat-input.tsx
  • app/chat/components/agent-tools.tsx
**/{components,pages,app}/**/*.{tsx,jsx}

📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)

**/{components,pages,app}/**/*.{tsx,jsx}: Use next/image component for automatic image optimization, including lazy loading and responsive images
Use SWR or React Query for client-side data fetching and caching
Use react-hook-form for managing forms and validation
Always use setState or hooks to update state; never mutate state directly
Use React.memo to memoize components and prevent unnecessary re-renders
Never write server-side code in client components to avoid exposing secrets or causing unexpected behavior
Create reusable error boundary components and implement getDerivedStateFromError or componentDidCatch lifecycle methods
Use the <Link prefetch> tag to prefetch pages that are likely to be visited for improved performance
Minimize re-renders by only updating state when necessary to reduce the number of re-renders
Use Intersection Observer API for manual lazy loading of content beyond image and component lazy loading
Sanitize user input to prevent Cross-Site Scripting (XSS) attacks, especially when rendering HTML directly from user input
Write unit tests for individual components using React Testing Library to test from a user perspective
Separate components that handle data fetching and state management (container components) from those that only render UI (presentational components)
Favor composition over inheritance to create flexible and reusable components
Group files by feature rather than by type (e.g., components/user-profile/ instead of components/button, components/form)

Files:

  • app/chat/components/chat-input.tsx
  • app/chat/components/agent-tools.tsx
**/*.{tsx,jsx,module.css,module.scss}

📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)

Use CSS Modules, Styled Components, or Tailwind CSS for component-level styling, with Tailwind CSS preferred for rapid development

Files:

  • app/chat/components/chat-input.tsx
  • app/chat/components/agent-tools.tsx
**/*.{tsx,jsx}

📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)

**/*.{tsx,jsx}: Use complete dependency arrays in useEffect hooks to prevent unexpected behavior and infinite loops
Clean up event listeners and timers in useEffect hooks to avoid memory leaks

Files:

  • app/chat/components/chat-input.tsx
  • app/chat/components/agent-tools.tsx
**/{components,src/components,ui}/**/*.{tsx,jsx}

📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)

Organize components into atoms, molecules, organisms, templates, and pages using atomic design principles

Files:

  • app/chat/components/chat-input.tsx
  • app/chat/components/agent-tools.tsx
**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

Use kebab-case for directory names containing components (e.g., ai-elements/, public-components/)

Files:

  • app/chat/components/chat-input.tsx
  • app/chat/components/agent-tools.tsx
app/**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

Use Tailwind CSS 4 with oklch color variables for styling — leverage shadcn/ui base components (34 components) and AI Elements (30 components)

Define React 19 component exports in files named with .tsx extension within the app directory

Files:

  • app/chat/components/chat-input.tsx
  • app/chat/components/agent-tools.tsx
app/chat/components/**/*.{ts,tsx}

📄 CodeRabbit inference engine (app/chat/AGENTS.md)

app/chat/components/**/*.{ts,tsx}: Access message text via message.parts?.find(isTextUIPart)?.text instead of message.content
Use message.parts?.filter(isToolOrDynamicToolUIPart) to retrieve tool parts with states: input-available, output-available, output-error
Import and use specific AI Elements components: Conversation, Message, PromptInput, ModelSelector, Reasoning, Tool, Sources, Artifact, Loader, CodeBlock in their designated files
Use feature flags from agent configuration to conditionally render Reasoning, Tool, Sources, and Artifact components

Files:

  • app/chat/components/chat-input.tsx
  • app/chat/components/agent-tools.tsx
app/chat/components/chat-input.tsx

📄 CodeRabbit inference engine (app/chat/AGENTS.md)

ChatInput component must implement PromptInput with Textarea, Footer, and Submit subcomponents

Files:

  • app/chat/components/chat-input.tsx
src/mastra/agents/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Implement agents using new Agent({ id, name, description, instructions, model, tools, memory }) — all agents must follow this pattern

Wire tools together into agents to create higher-level behaviors; use RequestContext or agent-specific runtime context types (e.g., EditorRuntimeContext) to enforce access control

Files:

  • src/mastra/agents/weather-agent.ts
**/*-agent.ts

📄 CodeRabbit inference engine (AGENTS.md)

Name agent implementation files with -agent.ts suffix (e.g., research-agent.ts)

Files:

  • src/mastra/agents/weather-agent.ts
src/mastra/index.ts

📄 CodeRabbit inference engine (src/AGENTS.md)

Enforce registration pattern in mastra/index.ts for AI orchestration modules composition

Files:

  • src/mastra/index.ts
app/chat/components/agent-tools.tsx

📄 CodeRabbit inference engine (app/chat/AGENTS.md)

Display tool invocations using Tool component with Header, Content, Input, and Output subcomponents when agent tools feature is enabled

Files:

  • app/chat/components/agent-tools.tsx
app/chat/config/agents.ts

📄 CodeRabbit inference engine (app/chat/AGENTS.md)

app/chat/config/agents.ts: Agent configuration must define features object with properties: reasoning, chainOfThought, tools, sources, canvas, artifacts, fileUpload as boolean flags
Categorize agents into: core, research, content, data, financial, diagram, or utility categories in the agent configuration

Files:

  • app/chat/config/agents.ts
{package.json,package-lock.json,yarn.lock,requirements.txt,requirements-*.txt,Pipfile,Pipfile.lock,build.gradle,pom.xml,*.gemfile,composer.json,Cargo.toml,go.mod,go.sum}

📄 CodeRabbit inference engine (.github/instructions/code-review-generic.instructions.md)

Keep dependencies up-to-date and monitor for known security vulnerabilities

Files:

  • package.json
{package.json,package-lock.json,yarn.lock}

📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)

Regularly update dependencies to patch security vulnerabilities

Files:

  • package.json
package.json

📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)

Use a build script to automate the build process

Files:

  • package.json
🧬 Code graph analysis (3)
tests/agents-config.test.ts (1)
app/chat/config/agents.ts (1)
  • getAllAgentIds (942-944)
src/mastra/tools/weather-tool.ts (1)
src/mastra/config/logger.ts (1)
  • log (16-36)
app/chat/components/agent-tools.tsx (2)
src/components/ai-elements/tools/types.ts (4)
  • PolygonStockQuotesUITool (277-279)
  • ListCommitsUITool (238-238)
  • WeatherUITool (302-302)
  • ArxivUITool (157-157)
src/mastra/tools/weather-tool.ts (1)
  • WeatherUITool (353-353)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Sourcery review
  • GitHub Check: CodeQL analysis (javascript-typescript)
  • GitHub Check: Agent
  • GitHub Check: Codacy Security Scan
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (23)
src/mastra/public/storage/key_value_stores/default/SDK_SESSION_POOL_STATE.json (1)

1-53: Do not commit session state files containing authentication tokens to version control.

This file contains actual session cookies (NID, GSP) with authentication token values that should not be stored in the repository. Per coding guidelines, tokens and credentials must never be included in code or logs.

Session state files are ephemeral runtime artifacts and should be excluded from version control to prevent exposure of session tokens, usage patterns, and accidental credential leaks.

src/mastra/public/storage/key_value_stores/default/SDK_CRAWLER_STATISTICS_0.json (1)

1-27: These auto-generated runtime data files are already properly excluded in .gitignore.

The src/mastra/public/storage/ directory and its contents are already configured to be ignored by Git:

  • src/mastra/public/storage/key_value_stores/default/*.json
  • src/mastra/public/storage/key_value_stores/default/SDK_CRAWLER_STATISTICS_0.json (explicitly listed)
  • src/mastra/public/storage/request_queues/default/*.json

No further .gitignore changes are needed. If these files are currently committed to the repository, they should be removed from tracking using git rm --cached while keeping the local files.

Likely an incorrect or invalid review comment.

src/mastra/agents/weather-agent.ts (1)

18-78: Agent implementation follows the expected pattern.

The agent correctly implements the required structure with id, name, description, instructions, model, tools, and memory. The use of RequestContext for tier-based model selection and typed runtime context (WeatherRuntimeContext) is well implemented.

app/chat/components/chat-input.tsx (2)

74-76: LGTM - formatting-only change.

This is a whitespace adjustment with no functional impact.


127-129: LGTM - formatting-only change.

This is a whitespace adjustment with no functional impact.

src/mastra/config/qdrant.ts (1)

6-6: LGTM - Import for embedding model router.

The import supports the refactored embedding model initialization pattern.

convex.json (1)

1-6: No issues found. Node.js version 24 is released and available as of January 2026.

package.json (2)

214-214: Zod 4 dependency with override looks correct.

The Zod 4 (^4.2.1) dependency with a matching override ensures version consistency across all dependencies. Note that Zod 4 has significant breaking changes from Zod 3 (unified error customization, stricter number validation, default value behavior changes). Ensure all schemas in the codebase are compatible with Zod 4 semantics.

Also applies to: 263-263


132-132: No action needed. The convex version (^1.26.2) is compatible with the codebase. The convex/schema.ts file uses standard @mastra/convex table imports and the defineSchema API from convex/server, both of which are supported by version 1.26.2. There is no evidence in the repository history that a downgrade occurred.

Likely an incorrect or invalid review comment.

src/mastra/tools/weather-tool.ts (1)

44-53: Good addition of unit field to output.

The unit field in the output schema and the corresponding implementation correctly formats the temperature unit for display (°C or °F). This enhances the tool's output clarity.

Also applies to: 199-202

src/mastra/config/mongodb.ts (3)

10-10: Good refactor to ModelRouterEmbeddingModel.

Using ModelRouterEmbeddingModel provides a flexible abstraction layer for embedding model selection. The model identifier 'google/gemini-embedding-001' follows the expected router format.

Also applies to: 27-27


68-72: Memory embedder refactored consistently.

The mongoMemory configuration now uses ModelRouterEmbeddingModel for the embedder, maintaining consistency with the MONGODB_CONFIG.embeddingModel pattern used elsewhere in this file.


1-11: Imports are well-organized.

The import structure follows the coding guidelines: external framework imports first, then type imports, then internal imports. The addition of ModelRouterEmbeddingModel from @mastra/core/llm is properly placed.

app/chat/components/agent-tools.tsx (2)

281-290: Good type safety improvements.

Replacing any casts with specific UITool types (PolygonStockQuotesUITool, ListCommitsUITool, ArxivUITool) improves type safety and catches potential prop mismatches at compile time.

Also applies to: 292-302, 342-352


43-43: Remove redundant WeatherUITool type export from src/mastra/tools/weather-tool.ts.

WeatherUITool is exported from both src/mastra/tools/weather-tool.ts (line 353) and src/components/ai-elements/tools/types.ts (line 302). Both reference the same weatherTool constant and produce identical types. The definition in types.ts serves as the unified UI tool type interface; remove the duplicate export from weather-tool.ts to follow the DRY principle.

convex/schema.ts (1)

1-22: Import consolidation is correct; verify exports at build time.

The schema imports are consolidated from @mastra/convex, with all 8 table definitions properly imported and mapped to their corresponding table names. No stale imports from the previous @mastra/convex/schema path remain in the codebase. These imports will be validated by the TypeScript compiler at build time; if the exports don't exist in @mastra/convex@0.1.0-beta.8, the build will fail with clear import errors.

src/mastra/config/lance.ts (2)

7-7: LGTM on the ModelRouterEmbeddingModel integration.

The consistent use of ModelRouterEmbeddingModel('google/gemini-embedding-001') across LANCE_CONFIG.embeddingModel and lanceMemory.embedder aligns with the PR's goal of standardizing embedding model resolution via a router pattern.

Also applies to: 23-23, 54-54


3-3: Remove unused google import.

After switching to ModelRouterEmbeddingModel, the google import from @ai-sdk/google is unused in this file. Remove it to keep imports clean.

♻️ Suggested fix
-import { google } from '@ai-sdk/google'
app/chat/config/agents.ts (4)

344-441: LGTM on new graphing/analysis and coding agents.

The new agents (graphSupervisorAgent, technicalAnalysisAgent, chartJsAgent, mappingAgent, fetchAgent, finnhubAgent, codeGraphAgent, codeMetricsAgent) are well-structured with appropriate categories and feature flags. The placement under financial, diagram, utility, and coding categories is logical.


443-491: LGTM on marketing and support agents.

The socialMediaAgent, seoAgent, translationAgent, customerSupportAgent, and projectManagementAgent configurations follow the established pattern with appropriate feature flags for their use cases.


768-817: LGTM on misc utility and A2A coordinator agents.

The bgColorAgent, noteTakerAgent, a2aCoordinatorAgent, and codingA2ACoordinator agents are well-defined with sensible feature configurations for their respective purposes.


819-889: LGTM on network orchestration entries.

The network configurations (dataPipelineNetwork, reportGenerationNetwork, etc.) consistently enable chainOfThought and tools features, which is appropriate for orchestration agents. Categories are correctly assigned based on the network's domain.

tests/agents-config.test.ts (1)

1-41: LGTM on the new test coverage.

This test effectively validates that the newly added agents and networks are properly registered in AGENT_CONFIGS. The test is well-structured, independent, and follows the testing guidelines.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment on lines +326 to +340
// if (
// (toolName === 'serpapi-news-trends' ||
// toolName === 'finnhub-company-news') &&
// hasOutput
// ) {
// return (
// <NewsCarousel
// key={`${id}-${toolName}-${toolState}-${groupIdx}`}
// toolCallId={id}
// input={latest.input as any}
// output={latest.output as any}
// errorText={errorText}
// />
// )
// }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Remove commented-out code.

Per coding guidelines: "Never comment out code; remove it instead and use version control history if needed." These commented blocks for NewsCarousel and SearchResultList should be deleted.

♻️ Proposed fix - remove commented code
-              //  if (
-               //     (toolName === 'serpapi-news-trends' ||
-              //          toolName === 'finnhub-company-news') &&
-              //      hasOutput
-             //   ) {
-              //      return (
-              //          <NewsCarousel
-              //              key={`${id}-${toolName}-${toolState}-${groupIdx}`}
-              //              toolCallId={id}
-              //              input={latest.input as any}
-              //              output={latest.output as any}
-              //              errorText={errorText}
-              //          />
-              //      )
-              //  }
...
-               // if (toolName === 'serpapi-search' && hasOutput) {
-                //    return (
-                //        <SearchResultList
-                //            key={`${id}-${toolName}-${toolState}-${groupIdx}`}
-                 //           toolCallId={id}
-                 //           input={latest.input as any}
-                 //           output={latest.output as any}
-                //            errorText={errorText}
-                //        />
-                //    )
-             //   }

Also applies to: 354-364

🤖 Prompt for AI Agents
In `@app/chat/components/agent-tools.tsx` around lines 326 - 340, Remove the
commented-out UI blocks for NewsCarousel and SearchResultList in the
agent-tools.tsx component: delete the commented code that references
NewsCarousel (the block containing key
`${id}-${toolName}-${toolState}-${groupIdx}`, toolCallId, input, output,
errorText) and the similar commented SearchResultList block (the other commented
range noted); keep the surrounding logic intact and rely on git history if
restoration is needed.

Comment on lines +732 to 738
"daneChangeLog": {
id: 'daneChangeLog',
name: 'Dane Package Publisher',
description: 'Publish packages to npm',
category: 'utility',
features: { ...defaultFeatures, tools: false },
},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix mismatched id, name, and description for daneChangeLog.

The configuration has id: 'daneChangeLog' but the name is "Dane Package Publisher" and description is "Publish packages to npm". This appears to be a copy-paste error. Either the id should be updated or the name/description should reflect changelog functionality.

🐛 Proposed fix (assuming this should be a changelog agent)
     "daneChangeLog": {
         id: 'daneChangeLog',
-        name: 'Dane Package Publisher',
-        description: 'Publish packages to npm',
+        name: 'Dane Change Log',
+        description: 'Generate changelog entries from commits',
         category: 'utility',
         features: { ...defaultFeatures, tools: false },
     },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"daneChangeLog": {
id: 'daneChangeLog',
name: 'Dane Package Publisher',
description: 'Publish packages to npm',
category: 'utility',
features: { ...defaultFeatures, tools: false },
},
"daneChangeLog": {
id: 'daneChangeLog',
name: 'Dane Change Log',
description: 'Generate changelog entries from commits',
category: 'utility',
features: { ...defaultFeatures, tools: false },
},
🤖 Prompt for AI Agents
In `@app/chat/config/agents.ts` around lines 732 - 738, The agent definition for
"daneChangeLog" has a mismatched id vs name/description; update the name and
description to reflect changelog functionality (e.g., change name to "Dane
Changelog" or "Dane Changelog Publisher" and description to "Generate and
publish changelogs for packages" or similar) so the id `daneChangeLog` matches
the agent purpose, keeping the existing category and features intact.

Comment on lines +103 to 104
// Temporarily indicates an agent switch is in progress and sends are blocked

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Orphaned comment without corresponding property.

This comment describes a temporary agent-switch-in-progress state but no corresponding property (e.g., isAgentSwitching: boolean) is defined. Either add the missing property or remove the dangling comment.

Suggested fix if property is intended
     // Focus Mode
     isFocusMode: boolean
-    // Temporarily indicates an agent switch is in progress and sends are blocked
+    // Temporarily indicates an agent switch is in progress and sends are blocked
+    isAgentSwitching: boolean

     // Actions
🤖 Prompt for AI Agents
In `@app/chat/providers/chat-context-types.ts` around lines 103 - 104, The
dangling comment refers to a missing state flag for agent switching; add a
boolean property named isAgentSwitching to the chat context/type (e.g., the
ChatContext/ChatState or ChatContextType interface in chat-context-types.ts) and
ensure the ChatProvider/createChatContext initializer sets a default (false) and
any setters/useEffects update it where agent switches occur; alternatively, if
the flag is not needed, remove the orphaned comment.

@@ -1,5 +1,5 @@
import { createGoogleGenerativeAI } from '@ai-sdk/google'
import { logError } from './logger'
//import { logError } from './logger'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Remove commented-out import instead of leaving it.

As per coding guidelines, commented-out code should be removed rather than left in place. If logError is no longer needed, delete the import entirely and rely on version control history.

🧹 Suggested fix
-//import { logError } from './logger'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
//import { logError } from './logger'
🤖 Prompt for AI Agents
In `@src/mastra/config/google.ts` at line 2, Remove the commented-out import for
logError in the google.ts file; locate the line containing "//import { logError
} from './logger'" and delete it so no unused or commented import remains,
relying on VCS to recover if needed.

Comment on lines +23 to +35
gemini3Pro: google.languageModel('gemini-3-pro-preview'),
// Gemini 3 Flash model
gemini3Flash: google('gemini-3-flash-preview'),
gemini3Flash: google.languageModel('gemini-3-flash-preview'),
// Gemini 2.5 Pro model for higher-performance applications
gemini25Pro: google('gemini-2.5-pro'),
gemini25Pro: google.languageModel('gemini-2.5-pro'),
// Gemini 2.5 Flash model for general-purpose applications
gemini25Flash: google('gemini-2.5-flash-preview-09-2025'),
gemini25Flash: google.languageModel('gemini-2.5-flash-preview-09-2025'),
// Gemini 2.5 Flash Lite model for free-tier applications
gemini25FlashLite: google('gemini-2.5-flash-lite-preview-09-2025'),
gemini25FlashLite: google.languageModel('gemini-2.5-flash-lite-preview-09-2025'),
// Gemini Computer Use model for tasks requiring higher accuracy and reliability
gemini25ComputerUse: google('gemini-2.5-computer-use-preview-10-2025'),
gemini25ComputerUse: google.languageModel('gemini-2.5-computer-use-preview-10-2025'),
// Additional variants
gemini25FlashAlt: google('gemini-2.5-flash-preview-09-2025'),
gemini25FlashAlt: google.languageModel('gemini-2.5-flash-preview-09-2025'),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

@ai-sdk/google v3.0.8 languageModel API documentation

💡 Result:

I couldn't find any release or docs specifically for "@ai-sdk/google v3.0.8". The official AI SDK / Google provider documentation and package pages you can use instead:

  • AI SDK — Google provider docs (LanguageModel usage and examples). [1]
  • AI SDK reference for LanguageModel V3 middleware and language-model APIs. [2]
  • npm package page for @ai-sdk/google (current published versions and changelog). [3]

If you need docs for a specific version (v3.0.8), tell me where that version is hosted (GitHub repo, private registry, or a tarball) or I can continue searching—would you like me to search GitHub releases or a specific registry for v3.0.8?

Sources:
[1] https://ai-sdk.dev/providers/ai-sdk-providers/google-generative-ai
[2] https://ai-sdk.dev/docs/reference/ai-sdk-core/language-model-v2-middleware
[3] https://www.npmjs.com/package/%40ai-sdk/google


🌐 Web query:

@ai-sdk/google languageModel method ai-sdk.dev documentation

💡 Result:

The ai-sdk.dev docs for the Google provider (@ai-sdk/google) show how to create/use language model instances (the languageModel method is exposed via the google(...) factory) and examples for generateText/streamText. Example usage:

  • Import provider and call model factory: import { google } from '@ai-sdk/google'; const model = google('gemini-1.5-pro-latest');
  • Use with AI SDK core functions: await generateText({ model: google('gemini-2.5-flash'), messages: [{ role: 'user', content: [{ type: 'text', text: 'Your prompt' }] }] });

Docs:

  • Google provider (Ai SDK) — usage, file inputs, examples. [1]
  • AI SDK Core reference (generateText / streamText and language-model integration). [2]
  • npm package page for @ai-sdk/google. [3]

Sources:
[1] ai-sdk.dev — Google Generative AI provider documentation. (ai-sdk.dev)
[2] ai-sdk.dev — AI SDK Core reference (generateText, streamText, etc.). (v5.ai-sdk.dev)
[3] npm: @ai-sdk/google package (readme/examples). (npmjs.com)

Would you like the exact code snippet for a specific model or use-case (streaming, files, embeddings)?

Citations:


🌐 Web query:

@ai-sdk/google google() factory function returns languageModel property

💡 Result:

Short answer: Calling google('model-id') (the @ai-sdk/google factory) returns a LanguageModel instance (a provider model function/object) — it does not return an object with a separate languageModel property. See the Google provider docs and the AI SDK core provider API. [1][2]

Sources:

  • @ai-sdk/google docs (provider usage / examples). [1]
  • AI SDK core / provider registry docs (languageModel() returns a LanguageModel). [2]

Use google('model-id') directly instead of google.languageModel('model-id').

The @ai-sdk/google factory function google() returns a LanguageModel instance directly. The pattern google.languageModel() does not exist in the API. Update all model definitions to use google('gemini-3-pro-preview') instead of google.languageModel('gemini-3-pro-preview').

🤖 Prompt for AI Agents
In `@src/mastra/config/google.ts` around lines 23 - 35, The model registrations
(e.g., gemini3Pro, gemini3Flash, gemini25Pro, gemini25Flash, gemini25FlashLite,
gemini25ComputerUse, gemini25FlashAlt) incorrectly call
google.languageModel(...); replace each call with the `@ai-sdk/google` factory
function form google('model-id') (for example google('gemini-3-pro-preview')) so
each symbol is assigned the LanguageModel returned by google(...) instead of the
non-existent google.languageModel(...) method.

Comment on lines 261 to 264
} = await embedMany({
values: [queryText],
model: QDRANT_CONFIG.embeddingModel,
model: new ModelRouterEmbeddingModel('google/gemini-embedding-001'),
})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Same inconsistency as processDocument - use shared embedding model.

This duplicates the issue in processDocument. Use the same shared embedding model constant to ensure vector compatibility across all operations.

🤖 Prompt for AI Agents
In `@src/mastra/config/qdrant.ts` around lines 261 - 264, The embedMany call
currently constructs a new
ModelRouterEmbeddingModel('google/gemini-embedding-001') which duplicates
processDocument and breaks vector compatibility; replace that inline
ModelRouterEmbeddingModel usage with the shared embedding model constant used
elsewhere (the same constant referenced by processDocument, e.g.,
SHARED_EMBEDDING_MODEL or EMBEDDING_MODEL), update any imports or references so
embedMany({ model: ... }) uses that shared constant, and ensure embedMany,
ModelRouterEmbeddingModel, and processDocument now all rely on the same shared
embedding model symbol.

Comment on lines 293 to 296
sampling: {
type: SamplingStrategyType.RATIO,
probability: 0.5,
probability: 0.75,
}, // 50% sampling
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Stale comment contradicts actual sampling probability.

The comment on line 296 says "// 50% sampling" but the probability is now 0.75 (75%). Update or remove the comment to match the actual configuration.

Suggested fix
                 sampling: {
                     type: SamplingStrategyType.RATIO,
                     probability: 0.75,
-                }, // 50% sampling
+                }, // 75% sampling
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
sampling: {
type: SamplingStrategyType.RATIO,
probability: 0.5,
probability: 0.75,
}, // 50% sampling
sampling: {
type: SamplingStrategyType.RATIO,
probability: 0.75,
}, // 75% sampling
🤖 Prompt for AI Agents
In `@src/mastra/index.ts` around lines 293 - 296, The inline comment "// 50%
sampling" is stale and does not match the configured sampling.probability of
0.75 in the sampling block using SamplingStrategyType.RATIO; update the comment
to reflect 75% sampling or remove the comment entirely so it no longer
contradicts the actual configuration in the sampling object
(sampling.probability and SamplingStrategyType.RATIO).

Comment on lines +435 to 437
// Use an instance of RequestContext (not the class) so the route has a proper context per request
// requestContext: new RequestContext()
},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Remove commented-out code or implement the feature.

Per coding guidelines, avoid commenting out code. If RequestContext per-request instantiation is needed, implement it; otherwise, remove this commented block and track the requirement in an issue.

🤖 Prompt for AI Agents
In `@src/mastra/index.ts` around lines 435 - 437, Remove the commented-out
instantiation of RequestContext or implement it: if you need a per-request
context, replace the commented line with runtime creation of a RequestContext
instance passed into the route configuration (e.g., ensure the route option key
requestContext receives a new RequestContext() for each request using the
appropriate middleware or factory), otherwise delete the commented block
entirely and open an issue referencing RequestContext to track the requirement;
locate the commented lines around the requestContext key and update either the
route setup to instantiate RequestContext per request or remove the comment.

Comment on lines 55 to 61
onInputStart: ({ toolCallId, messages, abortSignal }) => {
log.info('Weather tool input streaming started', {
toolCallId,
toolCallId: toolCallId.includes('get-weather'),
messageCount: messages.length,
hook: 'onInputStart',
abortSignal: abortSignal?.aborted,
})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Bug: toolCallId logged as boolean instead of actual ID.

Logging toolCallId.includes('get-weather') returns a boolean (true/false), losing the actual tool call identifier needed for debugging and tracing. This appears unintentional.

🐛 Proposed fix to log the actual toolCallId
 onInputStart: ({ toolCallId, messages, abortSignal }) => {
     log.info('Weather tool input streaming started', {
-        toolCallId: toolCallId.includes('get-weather'),
+        toolCallId,
         messageCount: messages.length,
         hook: 'onInputStart',
         abortSignal: abortSignal?.aborted,
     })
 },
🤖 Prompt for AI Agents
In `@src/mastra/tools/weather-tool.ts` around lines 55 - 61, The log in
onInputStart incorrectly records toolCallId as a boolean by calling
toolCallId.includes('get-weather'); change the logged field to the actual
identifier by passing toolCallId itself (e.g., log.info(..., { toolCallId,
messageCount: messages.length, hook: 'onInputStart', abortSignal:
abortSignal?.aborted })) so the real ID is preserved for tracing and debugging.

Comment on lines +35 to +40
it('contains newly added agents and networks', () => {
const ids = getAllAgentIds()
for (const id of expectedIds) {
expect(ids).toContain(id)
}
})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Consider using expect.arrayContaining for more concise assertions.

The current loop is clear, but using expect.arrayContaining provides better error messages showing all missing IDs at once rather than failing on the first missing one.

♻️ Alternative approach
     it('contains newly added agents and networks', () => {
         const ids = getAllAgentIds()
-        for (const id of expectedIds) {
-            expect(ids).toContain(id)
-        }
+        expect(ids).toEqual(expect.arrayContaining(expectedIds))
     })
🤖 Prompt for AI Agents
In `@tests/agents-config.test.ts` around lines 35 - 40, Replace the manual loop
that checks each id with a single assertion using Jest's expect.arrayContaining
so failures list all missing IDs at once; specifically, in the test that calls
getAllAgentIds() and iterates expectedIds, remove the for-loop and assert that
the returned ids array contains arrayContaining(expectedIds) (use
expect(ids).toEqual(expect.arrayContaining(expectedIds)) or equivalent)
referencing the getAllAgentIds call and the expectedIds variable.

@ssdeanx ssdeanx merged commit bdf6218 into main Jan 15, 2026
160 of 164 checks passed
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