-
Notifications
You must be signed in to change notification settings - Fork 1
Develop #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Added "convex" package to package.json and package-lock.json. - Updated tsconfig.json to include convex types for TypeScript. - Created generated files for Convex API utilities: - api.d.ts - api.js - dataModel.d.ts - server.d.ts - server.js
Reorganize and standardize imports/indentation in many mastra agent, network, and tool files. Add InternalSpans where needed and expand e2b tool imports. Comment out unused/unstable defaults (e.g. autoResumeSuspendedTools) and some unused imports. Adjust lucide-react icon names and fix a minor OpenAPI MD markup detail.
Learn moreAll Green is an AI agent that automatically: ✅ Addresses code review comments ✅ Fixes failing CI checks ✅ Resolves merge conflicts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry @ssdeanx, your pull request is larger than the review limit of 150000 diff characters
There was a problem hiding this 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.
|
🤖 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. |
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughThis PR refactors the Mastra agent and network infrastructure by systematically removing BatchPartsProcessor from output pipelines, disabling confirmationTool usage, removing defaultOptions blocks, and standardizing configurations with explicit providerOptions, InternalSpans tracing, and enhanced system instructions across 50+ agents and networks. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
🤖 I'm sorry @ssdeanx, but I was unable to process your request. Please see the logs for more details. |
Summary of ChangesHello @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 introduces the integration of Convex.dev, a real-time backend platform, into the project. It also includes extensive internal refactoring of AI agent and network configurations, focusing on streamlining output processing and tool management. Minor UI updates and adjustments to the observability setup are also part of this broad development effort. Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this 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 support for Convex by adding the necessary configuration and generated files. It also performs a large-scale refactoring across numerous agent and network definitions.
My review focuses on several key patterns observed in the changes:
- Feature Disabling: Many agents have had
autoResumeSuspendedTools,BatchPartsProcessor, andconfirmationToolcommented out. These are significant behavioral changes that impact tool execution and output streaming. If these are temporary for debugging, they should be marked withTODOs; if permanent, the commented code should be removed for clarity. - Observability: The
OtelBridgefor OpenTelemetry has been disabled in the main Mastra configuration. This is a major change that affects observability and should be clarified. - Code Style: There are minor formatting issues, such as trailing whitespace in
.mdxand.tsxfiles, and some opportunities to improve import organization for better readability.
| maxRetries: 3, | ||
| defaultOptions: { | ||
| autoResumeSuspendedTools: true, | ||
| // autoResumeSuspendedTools: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The autoResumeSuspendedTools option has been commented out. This is a significant change in the agent's behavior regarding tool calls. If this is a temporary change for debugging, please add a TODO comment explaining why. If this feature is being permanently disabled for this agent, it would be clearer to remove the defaultOptions block entirely. This change is present in many agents across this pull request.
| // new BatchPartsProcessor({ | ||
| // batchSize: 20, | ||
| // maxWaitTime: 100, | ||
| // emitOnNonText: true, | ||
| // }), | ||
| ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The BatchPartsProcessor has been commented out from the outputProcessors array. This will affect how output is streamed from the agent. If this is an intentional and permanent change, please remove the commented-out code. If it's for temporary debugging, a TODO comment explaining the context would be helpful. This change is present in multiple agent definitions in this file and others.
| // bridge: new OtelBridge({ | ||
| // name: 'mastra-otel-bridge', | ||
| // otelTracer: { | ||
| // startSpan: (name: string, options: SpanOptions | undefined) => { | ||
| // const tracer = trace.getTracer("mastra-otel-bridge-tracer"); | ||
| // return tracer.startSpan(name, options); | ||
| // }, | ||
| // }, | ||
| logger: log, | ||
| logLevel: 'info', | ||
| // logger: log, | ||
| // logLevel: 'info', | ||
| // batchsize: 500, | ||
| timeout: 50000, | ||
| serializationOptions: { | ||
| maxStringLength: 1024, // Maximum length for string values (default: 1024) | ||
| maxDepth: 6, // Maximum depth for nested objects (default: 6) | ||
| maxArrayLength: 50, // Maximum number of items in arrays (default: 50) | ||
| maxObjectKeys: 50, // Maximum number of keys in objects (default: 50) | ||
| }, | ||
| resourceAttributes: { | ||
| 'deployment.environment': 'dev', | ||
| }, | ||
| }), | ||
| // timeout: 50000, | ||
| // serializationOptions: { | ||
| // maxStringLength: 1024, // Maximum length for string values (default: 1024) | ||
| // maxDepth: 6, // Maximum depth for nested objects (default: 6) | ||
| // maxArrayLength: 50, // Maximum number of items in arrays (default: 50) | ||
| // maxObjectKeys: 50, // Maximum number of keys in objects (default: 50) | ||
| // }, | ||
| // resourceAttributes: { | ||
| // 'deployment.environment': 'dev', | ||
| // }, | ||
| // }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| testEngineerAgent, | ||
| refactoringAgent, | ||
| }, | ||
| tools: {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - **GET** `/api` - Get API status (no params | 200: success) | ||
|
|
||
| </details> | ||
| </details> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| <LayoutHorizontalIcon className="size-3.5" /> | ||
| </Button> | ||
| <LayoutPanelLeftIcon className="size-3.5" /> | ||
| </Button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| import { Agent } from '@mastra/core/agent' | ||
| import type { RequestContext } from '@mastra/core/request-context' | ||
| import { | ||
| createAnswerRelevancyScorer, | ||
| createToxicityScorer, | ||
| createAnswerRelevancyScorer, | ||
| createToxicityScorer, | ||
| } from '@mastra/evals/scorers/prebuilt' | ||
|
|
||
| import { googleAIFlashLite } from '../config/google' | ||
| import { pgMemory } from '../config/pg-storage' | ||
| import { log } from '../config/logger' | ||
| import { pgMemory } from '../config/pg-storage' | ||
|
|
||
| import { InternalSpans } from '@mastra/core/observability' | ||
| import { | ||
| codeArchitectAgent, | ||
| codeReviewerAgent, | ||
| testEngineerAgent, | ||
| refactoringAgent, | ||
| codeArchitectAgent, | ||
| codeReviewerAgent, | ||
| refactoringAgent, | ||
| testEngineerAgent, | ||
| } from '../agents/codingAgents' | ||
| import { knowledgeIndexingAgent } from '../agents/knowledgeIndexingAgent' | ||
| import * as e2bTools from '../tools/e2b' | ||
| import { researchSynthesisWorkflow } from '../workflows/research-synthesis-workflow' | ||
| import { | ||
| checkFileExists, | ||
| createDirectory, | ||
| createSandbox, | ||
| deleteFile, | ||
| getFileInfo, | ||
| getFileSize, | ||
| listFiles, | ||
| runCode, | ||
| runCommand, | ||
| watchDirectory, | ||
| writeFile, | ||
| writeFiles, | ||
| } from '../tools/e2b' | ||
| import { automatedReportingWorkflow } from '../workflows/automated-reporting-workflow' | ||
| import { dataAnalysisWorkflow } from '../workflows/data-analysis-workflow' | ||
| import { financialReportWorkflow } from '../workflows/financial-report-workflow' | ||
| import { specGenerationWorkflow } from '../workflows/spec-generation-workflow' | ||
| import { repoIngestionWorkflow } from '../workflows/repo-ingestion-workflow' | ||
| import { learningExtractionWorkflow } from '../workflows/learning-extraction-workflow' | ||
| import { repoIngestionWorkflow } from '../workflows/repo-ingestion-workflow' | ||
| import { researchSynthesisWorkflow } from '../workflows/research-synthesis-workflow' | ||
| import { safeRefactoringWorkflow } from '../workflows/safe-refactoring-workflow' | ||
| import { specGenerationWorkflow } from '../workflows/spec-generation-workflow' | ||
| import { testGenerationWorkflow } from '../workflows/test-generation-workflow' | ||
| import { dataAnalysisWorkflow } from '../workflows/data-analysis-workflow' | ||
| import { automatedReportingWorkflow } from '../workflows/automated-reporting-workflow' | ||
| import { | ||
| checkFileExists, | ||
| createDirectory, | ||
| createSandbox, | ||
| deleteFile, | ||
| getFileInfo, | ||
| getFileSize, | ||
| listFiles, | ||
| runCode, | ||
| runCommand, | ||
| watchDirectory, | ||
| writeFile, | ||
| writeFiles, | ||
| } from '../tools/e2b' | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // Type-specific properties: | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this 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 PR makes widespread formatting and configuration changes across the Mastra codebase. The changes primarily involve:
Changes:
- Commented out
BatchPartsProcessorusage anddefaultOptions.autoResumeSuspendedToolsacross all agents and networks - Commented out
OtelBridgeconfiguration and several scorer imports in the main Mastra configuration - Added Convex integration with new generated files and TypeScript configuration updates
- Replaced deprecated Lucide icon imports with new alternatives
- Fixed formatting issues in MDX documentation files
Reviewed changes
Copilot reviewed 47 out of 52 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json / package-lock.json | Added convex v1.31.4 dependency |
| tsconfig.json | Added convex directory patterns to TypeScript includes |
| convex/_generated/* | Auto-generated Convex integration files |
| src/mastra/index.ts | Commented out OtelBridge, scorer imports, and observation configuration |
| src/mastra/config/pg-storage.ts | Enabled reranker configuration with ModelRouterLanguageModel |
| src/mastra/agents/* | Removed BatchPartsProcessor and autoResumeSuspendedTools across 40+ agent files |
| src/mastra/networks/* | Same processor/option removals across all network files |
| app/workflows/components/workflow-actions.tsx | Updated deprecated icon imports |
| app/api-reference/openapi-schema/page.mdx | Fixed formatting (added newlines in details tags) |
| options: { | ||
| weights: { | ||
| semantic: 0.5, // Semantic relevance weight | ||
| vector: 0.3, // Vector similarity weight |
Copilot
AI
Jan 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected. The vector property is not properly aligned with semantic above and position below. This breaks the consistent indentation pattern used throughout the options object.
| enabled: true, | ||
| scope: 'resource', // 'resource' | 'thread' | ||
| version: 'vnext', | ||
| // version: 'vnext', |
Copilot
AI
Jan 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commented-out version: 'vnext' configuration lacks an explanation for why it was disabled. This makes it unclear whether this is temporary debugging, deprecated functionality, or intentional removal. Add a comment explaining the reason for commenting this out.
| LayoutPanelTopIcon, | ||
| LayoutGridIcon, | ||
| } from 'lucide-react' | ||
| } from 'lucide-react' |
Copilot
AI
Jan 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected at the end of the line. This violates code cleanliness standards.
| } from 'lucide-react' | |
| } from 'lucide-react' |
| - **GET** `/api` - Get API status (no params | 200: success) | ||
|
|
||
| </details> | ||
| </details> |
Copilot
AI
Jan 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected at the end of the line. This violates code cleanliness standards and should be removed for consistency.
| // maxBatchSize: 1000, | ||
| // maxBufferSize: 10000, | ||
| // maxBatchWaitMs: 5000, |
Copilot
AI
Jan 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical observability configuration options are commented out without explanation. This significantly impacts the observability system's performance and behavior. Either remove these commented lines or add a clear comment explaining why these specific values were disabled and what the implications are.
| }, | ||
| }, | ||
| defaultOptions: { | ||
| // autoResumeSuspendedTools: true, |
Copilot
AI
Jan 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The daneChangeLog agent keeps defaultOptions.autoResumeSuspendedTools enabled while all other agents in this file have it commented out. This inconsistency suggests this may be unintentional and should be reviewed for consistency with the other agents.
| // autoResumeSuspendedTools: true, | |
| autoResumeSuspendedTools: true, |
| description: | ||
| 'A2A Coordinator that orchestrates multiple coding agents in parallel for complex development tasks like full feature development, comprehensive reviews, and refactoring with tests.', | ||
| instructions: ({ requestContext }) => { | ||
| const userId = requestContext.get('userId') |
Copilot
AI
Jan 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'userId' is assigned a value but never used.
| const userId = requestContext.get('userId') |
| // runtimeContext is read at invocation time | ||
| const userTier = requestContext.get('user-tier') ?? 'free' | ||
| const language = requestContext.get('language') ?? 'en' | ||
| const responseFormat = requestContext.get('responseFormat') ?? 'json' |
Copilot
AI
Jan 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'responseFormat' is assigned a value but never used.
| const responseFormat = requestContext.get('responseFormat') ?? 'json' |
| import { ModelRouterEmbeddingModel } from '@mastra/core/llm' | ||
| import { ModelRouterEmbeddingModel, ModelRouterLanguageModel } from '@mastra/core/llm' | ||
| import { SpanType } from '@mastra/core/observability' | ||
| import { google } from '@ai-sdk/google' |
Copilot
AI
Jan 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'google' is defined but never used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 92
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (13)
src/mastra/agents/dataExportAgent.ts (1)
49-49: Tool name mismatch in instructions.The instructions reference
'dataValidatorTool'but the actual tool wired to the agent isdataValidatorToolJSON(line 63). This mismatch could cause the AI model to attempt calling a non-existent tool.🐛 Proposed fix
-1. **Validate**: Use 'dataValidatorTool' to verify structure. +1. **Validate**: Use 'dataValidatorToolJSON' to verify structure.src/mastra/agents/webResearchAgent.ts (1)
117-126: WireevaluateResultToolinto the agent or remove from instructions.Line 84 instructs the agent to use
evaluateResultToolfor output quality assessment, but this tool is not included in thetoolsconfiguration (lines 117-126). Either add the missing tool import and wire it to the agent's tools, or remove the reference from the instructions.src/mastra/agents/dane.ts (1)
240-241: Fix typo in instructions.Line 241 contains a typo: "capabale" should be "capable".
✏️ Proposed fix
## execaTool - Makes you a powerful agent capabale of executing files on the local system. + Makes you a powerful agent capable of executing files on the local system.src/mastra/agents/reportAgent.ts (2)
1-11: Import organization could be improved.Per coding guidelines, imports should be organized as: (1) External framework imports, (2) Type imports with
import type, (3) Internal imports. Currently, internal imports (lines 2-4) are placed before type imports (lines 6, 11) and some external imports (lines 7-10).Suggested import order
import { Agent } from '@mastra/core/agent' -import { google3, googleAIFlashLite, googleAIPro } from '../config/google' -import { log } from '../config/logger' -import { pgMemory } from '../config/pg-storage' - -import type { GoogleGenerativeAIProviderOptions } from '@ai-sdk/google' import { InternalSpans } from '@mastra/core/observability' import { TokenLimiterProcessor } from '@mastra/core/processors' + +import type { GoogleGenerativeAIProviderOptions } from '@ai-sdk/google' import type { RequestContext } from '@mastra/core/request-context' + +import { google3, googleAIFlashLite, googleAIPro } from '../config/google' +import { log } from '../config/logger' +import { pgMemory } from '../config/pg-storage'
103-107: Remove commented-out configuration block.This commented block with
--- IGNORE ---markers should be removed entirely. Version control preserves history if this configuration is needed later.Suggested fix
}) - -// --- IGNORE --- -// defaultGenerateOptions: { -// output: reportOutputSchema, -// }, -// --- IGNORE ---src/mastra/agents/recharts.ts (1)
186-243: Update instructions to reference the correct Recharts version.The instructions reference "Recharts v3.5.0+" but the project dependency is "recharts": "^2.15.4" (from package.json). This mismatch will cause the agent to generate code incompatible with the actual installed version. Update line 213 to reflect Recharts v2.15.4:
- Generate TypeScript React components using Recharts v2.15.0+.The agent structure and model selection are appropriate for code generation; however, this version inconsistency must be corrected to ensure generated components are compatible with the project's dependencies.
src/mastra/agents/csv_to_excalidraw.ts (1)
96-96: Fix typo: "posible" → "possible".Suggested fix
-3. Try to match styling of the original image when posible (colors, fonts, sizes). Be consistent. +3. Try to match styling of the original image when possible (colors, fonts, sizes). Be consistent.app/workflows/components/workflow-actions.tsx (1)
20-25: Unconventional hook usage pattern.Wrapping
useReactFlow()in a try-catch violates React's rules of hooks (hooks should not be called conditionally). While this works because the hook is always called (not skipped), a cleaner approach is to use a custom hook or context that safely provides the ReactFlow instance, or ensure this component is only rendered within a<ReactFlowProvider>.src/mastra/agents/researchAgent.ts (1)
57-80: Instruction references tools not included in the agent's tools object.The Tool Selection Guide mentions several tools that are not available in this agent's
toolsconfiguration:
batchWebScraperTool- not in tools (Line 69)pgQueryTool- not in tools (Line 73)alphaVantage*tools - not in tools (Line 72)This could lead to the model attempting to use unavailable tools, resulting in errors or degraded behavior.
📝 Suggested instruction update
Either add the missing tools to the agent's
toolsobject, or update the instructions to only reference available tools:## Tool Selection Guide -- **Web**: 'webScraperTool' (single URL), 'batchWebScraperTool' (multiple). +- **Web**: 'webScraperTool' (single URL). - **News/Trends**: 'googleNewsTool', 'googleTrendsTool', 'googleFinanceTool'. - **Academic**: 'googleScholarTool'. -- **Financial**: Use 'polygon*', 'finnhub*', or 'alphaVantage*' for stocks/crypto. -- **Internal**: 'pgQueryTool' for previously indexed knowledge. +- **Financial**: Use 'polygonStockQuotesTool', 'finnhubQuotesTool' for stocks. - **Processing**: 'pdfToMarkdownTool' for PDFs; 'evaluateResultTool' for quality checks.src/mastra/agents/financialAnalysisAgent.ts (1)
56-59: System prompt references disabled tools.The system prompt instructs the agent to use
polygonTool,finnhubTool, andfinancialChartTool, but these tools are commented out in thetoolsconfiguration (lines 132-136). This creates a mismatch where the agent may attempt to use tools that don't exist, causing runtime failures or confusing behavior.Either update the prompt to only reference available tools (
alphaVantageTool,technicalAnalysisTool) or re-enable the commented-out tools.🐛 Proposed fix for the system prompt
## Tool Selection Guide -- **Real-time Data**: Use 'polygonTool' for current prices, aggregates, quotes. -- **Historical Data**: Use 'finnhubTool' for historical prices, financials, news. - **Fundamental Analysis**: Use 'alphaVantageTool' for company overviews, earnings, sector performance. -- **Charts**: Use 'financialChartTool' for creating visual representations. - **Technical Analysis**: Use 'technicalAnalysisTool' for indicators and signals.src/mastra/agents/dataIngestionAgent.ts (1)
44-64: Tool naming mismatch in instructions.The instructions reference
dataValidatorTool(lines 51, 58), but the actual tool is nameddataValidatorToolJSON(line 72). This mismatch could confuse the agent when selecting tools.Additionally,
chartSupervisorToolis configured (line 75) but not documented in the instructions.🐛 Proposed fix for consistent tool naming
## Tools - **csvToJsonTool**: Parse CSV to JSON array. - **readCSVDataTool**: Read CSV with header detection. -- **dataValidatorTool**: Validate against schema. +- **dataValidatorToolJSON**: Validate against JSON schema. - **File Tools**: list, info, and read data files. +- **chartSupervisorTool**: Generate charts from data. ## Workflow 1. **Locate**: Find file via 'listDataDirTool' and verify with 'getDataFileInfoTool'. 2. **Read**: Use 'readDataFileTool' or 'readCSVDataTool'. 3. **Parse**: Convert to JSON via 'csvToJsonTool'. -4. **Validate**: Check against schema via 'dataValidatorTool'. +4. **Validate**: Check against schema via 'dataValidatorToolJSON'. 5. **Return**: Validated JSON with metadata (rows, cols).src/mastra/networks/marketingAutomationNetwork.ts (1)
22-156: Consider extracting long instructions to a separate constant or file.The instructions string spans approximately 135 lines, making this file harder to navigate and maintain. Consider extracting the instructions to a separate constant or importing from a dedicated file for better organization.
src/mastra/networks/businessIntelligenceNetwork.ts (1)
23-171: Instructions string is extremely long (~149 lines).This extensive instructions block significantly impacts file readability. Consider extracting to a separate constant or file, and evaluate whether all sections are necessary for the agent's function.
🤖 Fix all issues with AI agents
In `@package.json`:
- Line 132: The convex dependency in package.json is pinned to a non-existent
version "^1.31.4"; update the "convex" entry in package.json (the dependency
line with "convex": "^1.31.4") to a published version such as "^1.26.2" or
another compatible stable release, then run npm install / yarn install to verify
resolution and update lockfile accordingly.
In `@src/mastra/a2a/codingA2ACoordinator.ts`:
- Around line 60-62: The instructions function extracts a userId that is never
used: inside the instructions: ({ requestContext }) => { ... } block remove the
dead line that declares const userId = requestContext.get('userId') so there are
no unused variables; if the ID may be needed later, replace the declaration with
a commented note or retrieve it only where used (refer to the instructions
function in codingA2ACoordinator.ts).
In `@src/mastra/agents/academicResearchAgent.ts`:
- Around line 146-148: Remove the commented-out line and the empty
defaultOptions block in the AcademicResearchAgent configuration: delete the
commented "// autoResumeSuspendedTools: true," and remove the entire
defaultOptions: { } entry so no empty configuration remains in the
academicResearchAgent (search for defaultOptions in
src/mastra/agents/academicResearchAgent.ts or the AcademicResearchAgent
definition) — keep surrounding formatting intact.
In `@src/mastra/agents/acpAgent.ts`:
- Around line 133-135: Remove the commented-out defaultOptions block (the lines
containing "// defaultOptions: {", "// autoResumeSuspendedTools:
true,", and "// },") from acpAgent.ts; simply delete these commented lines so
no dead/commented code remains—rely on git history to restore this configuration
if needed later.
In `@src/mastra/agents/bgColorAgent.ts`:
- Around line 23-25: Remove the commented-out defaultOptions block in
bgColorAgent.ts: delete the lines containing the commented `defaultOptions`
definition (the `autoResumeSuspendedTools: true` entry and its surrounding
comment markers) so no unused commented code remains in the file; ensure no
references to `defaultOptions` elsewhere in the file need updating after
removal.
- Around line 15-17: Replace the ad-hoc Memory usage in bgColorAgent by
importing and using the shared pgMemory: remove the direct instantiation new
Memory() in the agent config and instead import pgMemory from the shared
pg-storage module (the same pgMemory used elsewhere) and assign memory: pgMemory
in the agent initialization (update the imports at the top of bgColorAgent.ts to
pull in pgMemory from src/mastra/config/pg-storage.ts and replace the Memory
reference in the object where model/tools/memory are defined).
In `@src/mastra/agents/businessLegalAgents.ts`:
- Line 254: The three agents contractAnalysisAgent, complianceMonitoringAgent,
and businessStrategyAgent currently hardcode model: googleAI3; change them to
use the same tier-based model selection used by legalResearchAgent (call the
existing tier-to-model resolver function used in legalResearchAgent to set the
model property), ensure the call accepts the agent's tier/user plan and
preserves googleAI3 as a sensible fallback, and update any related
config/constructor parameters so all four agents use the same tier-based
selection logic for consistency and cost control.
- Around line 461-466: The businessStrategyAgent scorer config only includes
relevancy; add a safety scorer for consistency by including a `safety` entry
alongside `relevancy` that uses `createToxicityScorer()` (same pattern used by
`legalResearchAgent`, `contractAnalysisAgent`, and `complianceMonitoringAgent`)
and mirror their sampling settings (e.g., `{ type: 'ratio', rate: 0.5 }`) so the
`scorers` block contains both `relevancy: { scorer:
createAnswerRelevancyScorer({ model: googleAIFlashLite }), sampling: { type:
'ratio', rate: 0.5 } }` and `safety: { scorer: createToxicityScorer(), sampling:
{ type: 'ratio', rate: 0.5 } }`.
- Around line 90-91: Fix the typo in the system prompt string in
businessLegalAgents.ts: replace the phrase "Your working with" with the correct
contraction "You're working with" inside the prompt content (the template
literal assigned to content in the agent prompt) so the prompt reads "You're
working with:".
- Around line 266-267: Add the missing tracingPolicy configuration to each agent
creation so they match the PR standard: in the contractAnalysisAgent,
complianceMonitoringAgent, and businessStrategyAgent initialization objects add
options.tracingPolicy: InternalSpans.ALL (i.e., set the agents'
options.tracingPolicy to InternalSpans.ALL where other agents do this) to ensure
consistent tracing behavior across these agents.
In `@src/mastra/agents/calendarAgent.ts`:
- Around line 69-77: Remove the commented-out defaultOptions block inside the
agent configuration in calendarAgent.ts: delete the commented lines for
defaultOptions (the // defaultOptions: { // autoResumeSuspendedTools:
true, // },) located near the options/tracingPolicy and
outputProcessors/TokenLimiterProcessor entries so only live configuration
remains; rely on VCS for history instead of leaving commented code.
In `@src/mastra/agents/codingAgents.ts`:
- Around line 5-6: There are leftover commented-out references to
BatchPartsProcessor scattered in this file; delete those commented blocks (the
commented references around the BatchPartsProcessor mentions) instead of leaving
them as dead code and ensure the import list no longer references
BatchPartsProcessor; remove any residual commented import lines and run the
linter/TS compile to confirm no unused-import warnings remain.
- Around line 20-21: The import order in codingAgents.ts is incorrect: move the
External framework import "InternalSpans" so it is grouped with other
"@mastra/core" imports at the top of the file (above internal imports like
"pgMemory"); if "InternalSpans" is a type, change it to an "import type" to
follow the guideline for type imports, and ensure the final ordering is:
external framework imports, import type declarations, then internal project
imports (e.g., keep "pgMemory" after those).
- Around line 445-448: Remove the commented-out defaultOptions block shown
inside the coding agent configuration (the commented lines containing
"defaultOptions: { autoResumeSuspendedTools: true, }") rather than leaving it
commented; also remove the analogous commented block in the refactoringAgent
configuration (the commented lines around the refactoringAgent's
defaultOptions). Leave no commented-out code fragments—use version control to
retrieve history if needed.
- Around line 122-124: The cachedContent value in the
GoogleGenerativeAIProviderOptions object is a descriptive string instead of a
cache resource identifier; update the object where cachedContent is set (symbol:
cachedContent within the GoogleGenerativeAIProviderOptions instance) to either
remove the cachedContent key if you haven't implemented caching yet, or replace
the string with a valid cache resource ID (e.g., the CachedContents API returned
id or a full resource name like cachedContents/{id}) so the provider receives a
real cache reference.
In `@src/mastra/agents/contentStrategistAgent.ts`:
- Around line 99-101: Remove the commented-out defaultOptions block (the lines
containing "defaultOptions: { autoResumeSuspendedTools: true, }") from the
ContentStrategistAgent source so no commented code remains; simply delete those
commented lines around the defaultOptions symbol and commit the change (use VCS
history to restore later if needed).
In `@src/mastra/agents/copywriterAgent.ts`:
- Line 97: Remove the unnecessary empty workflows property from the
copywriterAgent object: delete the line "workflows: {}," inside the
copywriterAgent definition (or, if the Agent interface actually requires a
workflows field, replace it with an explicit undefined or a properly implemented
workflows object). Locate the copywriterAgent export/const to apply this change.
- Around line 100-102: Remove the commented-out defaultOptions block in
src/mastra/agents/copywriterAgent.ts: delete the two commented lines "//
defaultOptions: {" and "// autoResumeSuspendedTools: true," and the closing
"// }" so the file matches other agents' formatting and contains no stray
commented configuration; ensure no trailing whitespace remains where the block
was removed and run quick lint/format to confirm consistency.
- Around line 5-13: Remove the commented-out imports in the import block of
copywriterAgent.ts: delete the commented lines referencing batchWebScraperTool,
siteMapExtractorTool, and linkExtractorTool so only active tools
(contentCleanerTool, htmlToMarkdownTool, scrapingSchedulerTool, webScraperTool)
are imported; ensure the import statement remains syntactically valid and
formatted (commas/newlines) after removal and run linting to catch any style
issues.
- Around line 77-86: Delete the commented-out tool entries inside the tools
object (remove the lines referencing batchWebScraperTool, siteMapExtractorTool,
linkExtractorTool) so only active tools (e.g., webScraperTool,
scrapingSchedulerTool, htmlToMarkdownTool, contentCleanerTool,
chartSupervisorTool) remain; also remove any corresponding commented-out import
statements for those tools elsewhere in copywriterAgent.ts to avoid
dead/commented code and ensure punctuation/commas in the tools object are
correct after deletion.
In `@src/mastra/agents/csv_to_excalidraw.ts`:
- Around line 21-25: The prompt currently interpolates userId from
requestContext.get('userId') and will include the literal "user: undefined" if
missing; update the logic in src/mastra/agents/csv_to_excalidraw.ts that builds
the returned system message (the block that uses userId) to guard against
undefined by either conditionally omitting the "user: ..." line or substituting
a safe fallback (e.g., "anonymous" or "unknown"), ensuring you reference the
userId variable and requestContext.get call when making the change.
- Around line 192-194: Remove the commented-out configuration block for
"defaultOptions" (the lines "// defaultOptions: { //
autoResumeSuspendedTools: true, // },") from
src/mastra/agents/csv_to_excalidraw.ts so the codebase does not contain
dead/commented code; if the option is required, restore it properly by adding a
real configuration entry where defaultOptions is defined instead of leaving it
commented.
In `@src/mastra/agents/customerSupportAgent.ts`:
- Around line 139-141: Remove the commented-out defaultOptions block (the lines
"// defaultOptions: {", "// autoResumeSuspendedTools: true,", "// },")
from the customerSupportAgent agent configuration so no dead/commented code
remains; locate the block near the customerSupportAgent setup (where
defaultOptions would be defined) and delete those commented lines, leaving the
surrounding code intact.
In `@src/mastra/agents/dane.ts`:
- Around line 14-16: Add a TSDoc comment for the exported interface DaneContext
describing its purpose and usage: explain that it represents contextual data
passed to DANE agents, note that userId is an optional string identifying the
current user, and include any constraints or typical usage examples (e.g., when
userId may be undefined). Place the TSDoc immediately above the "export
interface DaneContext" declaration so tooling and docs pick it up.
- Around line 154-161: Remove the dead/commented BatchPartsProcessor code from
the outputProcessors array in the Dane agent; locate the outputProcessors
property (where TokenLimiterProcessor(128576) is instantiated) and delete the
commented-out BatchPartsProcessor block so only active processors remain,
keeping formatting and trailing commas consistent.
- Around line 209-216: The outputProcessors array contains a commented-out
BatchPartsProcessor configuration that should be removed; edit the
outputProcessors in the dane agent (where TokenLimiterProcessor(128576) is
defined) and delete the commented BatchPartsProcessor block so only active
processors remain (e.g., TokenLimiterProcessor) and run formatting/linting to
ensure the array remains valid.
- Around line 282-298: Remove the dead/commented code and the unnecessary empty
configuration: delete the commented-out BatchPartsProcessor block inside the
outputProcessors array so only new TokenLimiterProcessor(128576) remains, and
remove the empty defaultOptions object (or populate it if needed) from the agent
configuration; ensure the surrounding commas/braces remain syntactically valid
after removal.
- Around line 56-63: Remove the commented-out BatchPartsProcessor lines from the
outputProcessors array: delete the commented block that references
BatchPartsProcessor (the commented new BatchPartsProcessor({...}) lines) and
ensure the array contains only the active processor(s) such as new
TokenLimiterProcessor(128576) with proper commas/formatting so the file compiles
cleanly.
- Around line 96-112: Remove the two commented-out code blocks inside the agent
configuration: delete the commented BatchPartsProcessor block (the lines that
reference new BatchPartsProcessor({ batchSize: 10, maxWaitTime: 75,
emitOnNonText: true })) and remove the commented defaultOptions block (the lines
declaring defaultOptions: { autoResumeSuspendedTools: true }), leaving only the
active entries such as outputProcessors: [ new TokenLimiterProcessor(128576) ]
and the options/tracingPolicy configuration intact.
- Around line 56-57: Introduce a named constant for the repeated token limit and
replace the magic number in each TokenLimiterProcessor instantiation: add a
top-level constant (e.g., const OUTPUT_TOKEN_LIMIT = 128576) immediately after
the imports, then update all uses of new TokenLimiterProcessor(128576) to new
TokenLimiterProcessor(OUTPUT_TOKEN_LIMIT) in this module (and other Dane agent
modules if they also repeat the value).
In `@src/mastra/agents/dataExportAgent.ts`:
- Around line 1-16: Imports are out of the prescribed order; reorder them so
external framework imports come first, then type-only imports, then internal
project imports. Specifically, move lines importing from '@mastra/core/agent',
'@mastra/core/observability', '@mastra/core/processors' and any other external
packages to the top, keep the "import type { RequestContext } from
'@mastra/core/request-context'" in the type-only section immediately after
external imports, and place internal config and tool imports (googleAI, log,
pgMemory, backupDataTool, listDataDirTool, writeDataFileTool,
dataValidatorToolJSON, jsonToCsvTool) last; ensure relative import grouping is
preserved and remove blank-line misplacement so symbols like Agent,
InternalSpans, TokenLimiterProcessor, RequestContext, googleAI, log, pgMemory,
backupDataTool, listDataDirTool, writeDataFileTool, dataValidatorToolJSON, and
jsonToCsvTool are easy to locate.
- Around line 73-76: Replace the magic number 1048576 with a named constant
(e.g., TOKEN_LIMIT_BYTES or DATA_EXPORT_TOKEN_LIMIT) declared near the top of
the module and use that constant when instantiating TokenLimiterProcessor in
outputProcessors (TokenLimiterProcessor(...)); also delete the commented-out
defaultOptions block (the three commented lines) entirely so only active code
remains and rely on VCS history if needed later.
In `@src/mastra/agents/dataIngestionAgent.ts`:
- Around line 83-85: Remove the commented-out defaultOptions block in
src/mastra/agents/dataIngestionAgent.ts; specifically delete the lines
containing the commented-out "defaultOptions: { autoResumeSuspendedTools: true,
}" so the file matches other agents and has no leftover commented configuration
for defaultOptions.
In `@src/mastra/agents/dataProcessingAgent.ts`:
- Around line 116-125: The thinkingConfig currently hardcodes thinkingLevel:
'medium' under providerOptions.google; update the logic in dataProcessingAgent
(where processingMode is set/used) to choose thinkingConfig based on
processingMode (e.g., when processingMode === 'accurate' set a higher
thinkingLevel or larger thinking/budget settings such as 'high' or increased
time/budget, and keep 'medium' or lower for 'fast' modes), and apply that
dynamic thinkingConfig into providerOptions.google so the provider's behavior
matches the processingMode intent.
- Around line 140-152: The system prompt lists tools that are commented out in
the tools object, which creates a mismatch; either restore the tools or update
the prompt. Fix by either uncommenting and exporting the actual tool variables
(documentChunkingTool, codeChunkingTool, dataProcessingTools, dataValidatorTool)
so they are present in the tools object and ensure their imports/definitions
exist, or edit the system prompt text to remove those tool names and instead
list only the available tools (csvToJsonTool, jsonToCsvTool, dateTimeTool,
colorChangeTool, randomGeneratorTool, calculatorTool, evaluateResultTool);
ensure the tools object and prompt remain consistent so the agent won't
reference unavailable symbols.
- Around line 127-139: The model function in dataProcessingAgent.ts returns
mixed types depending on user-tier (a LanguageModel for 'enterprise' and 'free'
but a string for 'pro'), causing runtime type errors; update the 'pro' branch so
it returns a LanguageModel instance like the others (e.g., call
google.chat('gemini-3-flash-preview') instead of returning the raw string),
keeping the logic around requestContext.get('user-tier') and the model: (...)
function intact so all branches return the same type.
In `@src/mastra/agents/editorAgent.ts`:
- Around line 97-99: Remove the commented-out defaultOptions block in
editorAgent.ts (the lines containing "// defaultOptions: {", "//
autoResumeSuspendedTools: true,", and "// },")—delete this commented code
entirely from the file (no replacement needed) so history is preserved via
version control; ensure no leftover commented lines remain near the editor agent
configuration or adjacent code in the file.
In `@src/mastra/agents/financialAnalysisAgent.ts`:
- Around line 131-137: The tools object in financialAnalysisAgent.ts still
contains commented-out tool entries (polygonTool, finnhubTool,
financialChartTool); remove those commented lines so the tools configuration
matches current imports—leave only the active tool identifiers
(alphaVantageTool, technicalAnalysisTool) in the tools object and ensure there
are no leftover commented tool references.
- Around line 11-15: Remove the commented-out tool names (polygonTool,
finnhubTool, financialChartTool) from the tools/imports list in
financialAnalysisAgent.ts so only active tools (e.g., alphaVantageTool,
technicalAnalysisTool) remain; locate the commented lines containing
"polygonTool", "finnhubTool", and "financialChartTool" and delete them entirely
to comply with the coding guidelines.
- Around line 145-147: Remove the commented-out defaultOptions block in the
FinancialAnalysisAgent file; locate the commented lines referencing
"defaultOptions" (the two-line commented block shown) inside
src/mastra/agents/financialAnalysisAgent.ts and delete them so the agent matches
the pattern used by other agents.
- Around line 118-130: The model selection in the model(...) function returns
inconsistent types based on userTier
(RequestContext<FinancialAnalysisRuntimeContext> 'user-tier' values
'enterprise', 'pro', 'free'): enterprise and free return a model object via
google.chat(...), while pro returns a raw string; make all branches return the
same type (preferably model objects) by changing the pro branch to return
google.chat('gemini-3-flash-preview') (or alternatively wrap the enterprise/free
returns as strings if you decide to standardize on string), ensuring model(...)
consistently returns the same type across 'enterprise', 'pro', and default
branches.
In `@src/mastra/agents/graphingAgents.ts`:
- Around line 351-354: The comment references the wrong tool name ("fetchAgent")
in the input-handling instructions; update the wording to reference the actual
wired tool name `resilientFetchTool` wherever that instruction appears (e.g., in
the input handling block that lists "{ repoPath?, fileList?, files?: [{path,
content}], githubRepo? }"), ensuring any examples or comments calling
`fetchAgent` are replaced with `resilientFetchTool` so the instructions match
the implemented tools.
- Around line 457-459: Remove the commented-out configuration block (the lines
referencing "defaultOptions" and "autoResumeSuspendedTools") from the
file—delete the commented lines rather than leaving them in place; rely on VCS
history if this configuration needs to be restored later.
- Around line 224-241: chartJsAgent is missing the options.tracingPolicy used by
other agents; add an options object to the chartJsAgent declaration that
includes tracingPolicy set to the same policy used by the other agents (match
the tracingPolicy value used by
graphSupervisorAgent/technicalAnalysisAgent/mappingAgent) so observability is
consistent across agents; update the chartJsAgent export to include options: {
tracingPolicy: <samePolicyIdentifier> } referencing the existing tracing policy
identifier used elsewhere.
In `@src/mastra/agents/recharts.ts`:
- Line 328: The exported agent config includes an empty "scorers" property which
looks like a placeholder; either remove the "scorers" field from the
configuration object in src/mastra/agents/recharts.ts (the object that currently
contains scorers: {}) if not used, or replace it with a short TODO comment
explaining what scorers will be and why it’s empty (e.g., above the config or
next to the "scorers" key) so intent is clear for future changes.
- Line 33: Extract the duplicated type alias UserTier into a single shared types
module (create and export UserTier from a new common types file) and replace the
local inline definitions in UserTier declarations with an import of that shared
type; specifically, create the exported type UserTier = 'free' | 'pro' |
'enterprise' in the new module, then update the files that currently declare
UserTier (recharts.ts, repo-ingestion-workflow.ts, spec-generation-workflow.ts,
alpha-vantage.tool.ts) to remove their local type definitions and import the
shared UserTier instead.
- Around line 340-344: Remove the commented-out BatchPartsProcessor
configuration block: delete the lines containing the commented invocation of
BatchPartsProcessor (the three-line block referencing batchSize, maxWaitTime,
and emitOnNonText) so no dead/commented code remains; if the processor is
needed, re-enable it by uncommenting and wiring the BatchPartsProcessor
instantiation (with the same options) into the surrounding pipeline code where
other processors are constructed, otherwise remove the commented lines entirely
and rely on version control to restore if required.
In `@src/mastra/agents/reportAgent.ts`:
- Around line 67-82: Extract the repeated user-tier extraction into a small
helper and use it from both the instructions and model closures: locate the
user-tier retrieval expression (requestContext.get('user-tier') ?? 'free') used
inside the instructions function and the model function in reportAgent.ts,
create a helper function (e.g., getUserTier(requestContext:
RequestContext<ReportRuntimeContext>) ) that returns the resolved tier string,
then replace both inline expressions in instructions and model with calls to
that helper so the tier resolution logic is centralized and maintainable.
- Around line 93-100: Remove the commented-out BatchPartsProcessor block inside
the outputProcessors array in reportAgent.ts; keep the existing
TokenLimiterProcessor(1048576) entry, delete the commented lines that reference
BatchPartsProcessor (and any surrounding comment markers) so the array contains
only active processors and is properly formatted/commas adjusted.
In `@src/mastra/agents/researchAgent.ts`:
- Around line 142-152: Remove the commented-out legacy code: delete the
commented BatchPartsProcessor block and the commented defaultOptions block so
only the active outputProcessors array remains (which contains
TokenLimiterProcessor(128000)); reference TokenLimiterProcessor,
BatchPartsProcessor, and defaultOptions to locate and remove the commented
lines, relying on version control if you need the old implementations.
In `@src/mastra/agents/researchPaperAgent.ts`:
- Around line 83-93: Remove the dead/commented code in the agent config: delete
the commented-out BatchPartsProcessor block inside outputProcessors and the
commented-out defaultOptions block so only active configuration remains (keep
the existing TokenLimiterProcessor(128000) entry intact); update the
researchPaperAgent.ts outputProcessors array and remove the unused
defaultOptions comment to comply with coding guidelines and avoid clutter.
In `@src/mastra/agents/scriptWriterAgent.ts`:
- Around line 85-89: Remove the commented-out defaultOptions block from
scriptWriterAgent.ts, and replace the magic number 1048576 used in new
TokenLimiterProcessor(1048576) with a named constant (e.g., TOKEN_LIMIT_BYTES or
MAX_TOKEN_BYTES) declared near the top of the module; update the
TokenLimiterProcessor instantiation to use that constant so the intent (1 MB) is
clear and avoid leaving commented code—rely on VCS for history instead.
- Around line 50-53: Replace the magic number -1 used for thinkingBudget in the
thinkingConfig object with a named constant (e.g., UNLIMITED_THINKING_BUDGET) or
add an inline comment explaining that -1 means "unlimited"; update the
definition near the top of scriptWriterAgent.ts (or an appropriate constants
module) and reference that constant in the thinkingConfig (symbol names:
thinkingConfig, thinkingBudget, UNLIMITED_THINKING_BUDGET).
- Line 11: The type UserTier is duplicated here; instead of redefining type
UserTier = 'free' | 'pro' | 'enterprise' in scriptWriterAgent.ts, import the
existing UserTier export from the module that defines it (the alpha-vantage
tool) and remove the local type alias; update any references in
ScriptWriterAgent to use the imported UserTier to preserve a single source of
truth and avoid type drift.
- Around line 65-73: The agent is returning hardcoded model strings instead of
using the exported config constants; update the import in scriptWriterAgent.ts
to include googleAIPro and googleAIFlashLite, replace the enterprise branch to
return googleAIPro, keep the pro branch returning googleAI, and change the
free-tier return to googleAIFlashLite so all model selections use the shared
config constants (googleAI, googleAIPro, googleAIFlashLite).
In `@src/mastra/agents/seoAgent.ts`:
- Around line 115-117: Remove the commented-out defaultOptions block (the lines
containing "defaultOptions" and its inner "autoResumeSuspendedTools: true") from
the seoAgent file; delete these commented lines entirely so only active code
remains, relying on version control for history rather than keeping
commented-out configuration in the source.
- Around line 1-9: The imports in seoAgent.ts are out of the project's canonical
order; group and reorder them so external framework imports from '@mastra/core'
(e.g., Agent and InternalSpans) come first and are colocated, followed by any
type imports (if present), then internal config imports (e.g., googleAI3, log,
pgMemory) and finally local module imports (contentStrategistAgent,
evaluationAgent, researchAgent); adjust the import statements for Agent and
InternalSpans to be adjacent and move googleAI3, log, pgMemory and the three
agent imports below them to match the guideline without changing identifiers or
functionality.
In `@src/mastra/agents/socialMediaAgent.ts`:
- Around line 108-110: The diff shows commented-out configuration lines for
defaultOptions and autoResumeSuspendedTools in socialMediaAgent; remove those
commented lines entirely (delete the two lines containing "defaultOptions: {"
and "autoResumeSuspendedTools: true,") rather than leaving them commented,
leaving the surrounding code unchanged and relying on VCS history if needed;
ensure no residual comment markers remain and run linters/tests to confirm no
formatting issues.
- Around line 1-10: Imports in socialMediaAgent.ts are currently mixed; reorder
them so external framework imports (e.g., Agent, InternalSpans from
'@mastra/core/*') come first, followed by type imports if any, then internal
project imports (e.g., googleAI3, log, pgMemory from '../config/*' and
calendarAgent, contentStrategistAgent, copywriterAgent, researchAgent). Update
the top of the file to group and order these symbols accordingly so that all
`@mastra/core` imports are adjacent and all ../config and ./agent imports follow
after.
In `@src/mastra/agents/translationAgent.ts`:
- Around line 1-8: The import order in translationAgent.ts is incorrect: move
the External import "InternalSpans" (from '@mastra/core/observability') into the
external/framework imports group at the top (with imports like Agent from
'@mastra/core/agent') so imports follow the guideline (external framework
imports first, then type imports, then internal imports); update the file so
InternalSpans is grouped with other external imports and leave internal imports
(googleAI3, log, pgMemory, evaluationAgent, researchAgent) below.
- Around line 130-132: Remove the commented-out defaultOptions block (the lines
containing "defaultOptions: { autoResumeSuspendedTools: true, }") from the
TranslationAgent code to avoid leaving dead code in place; simply delete those
commented lines from the translationAgent.ts file (e.g., inside the
TranslationAgent class or its configuration section) and rely on VCS history if
the code needs to be restored.
In `@src/mastra/agents/weather-agent.ts`:
- Around line 79-81: Remove the commented-out defaultOptions block (specifically
the commented `defaultOptions` object and `autoResumeSuspendedTools` line) from
weather-agent.ts; if toggling `autoResumeSuspendedTools` is required, implement
it as a real configuration option (e.g., read from an existing options/config
structure or environment variable) and wire that into the agent's initialization
instead of leaving commented code in place.
In `@src/mastra/agents/webResearchAgent.ts`:
- Around line 142-144: Remove the commented-out defaultOptions block in
src/mastra/agents/webResearchAgent.ts (the lines containing "//
defaultOptions: { // autoResumeSuspendedTools: true, // },")—delete
those commented lines entirely from the WebResearchAgent configuration so no
dead/commented code remains; if you intended to disable
autoResumeSuspendedTools, simply omit the defaultOptions property from the agent
setup (no alternative flag or commented placeholder).
- Around line 136-141: Remove the commented-out BatchPartsProcessor block and
the now-unused BatchPartsProcessor import from the top of the file; ensure no
other references to BatchPartsProcessor remain in the module (e.g., any
variables, array entries, or configs that referenced BatchPartsProcessor) and
run a quick build/lint to confirm the unused import is gone.
In `@src/mastra/config/pg-storage.ts`:
- Line 110: Remove the commented-out configuration line "version: 'vnext'" from
src/mastra/config/pg-storage.ts and update the log message that still references
"version: 'vnext'" to reflect the actual active configuration (or restore the
configuration entry if you intended to keep that version); locate the log call
that includes the string "version: 'vnext'" and either change the message to the
correct version/value or interpolate the active config variable so the log stays
consistent with the code.
- Around line 200-210: The weights object in the reranker config has a
mis-indented "vector" property; locate the "reranker" config (the
ModelRouterLanguageModel instantiation and its "options.weights" object) and
align the "vector: 0.3," entry to match the indentation of "semantic" and
"position" so all three weight lines are vertically aligned and use the same
indentation level.
In `@src/mastra/index.ts`:
- Around line 331-341: The DefaultExporter instantiation sets logLevel to
'debug' which is too verbose for production; change it to use an
environment-driven value (e.g., process.env.EXPORTER_LOG_LEVEL or a config
getter) so it defaults to 'info' in prod and can be overridden in dev, and
remove the commented-out batch config lines (maxBatchSize, maxBufferSize,
maxBatchWaitMs) from the DefaultExporter options to follow coding guidelines;
locate the change around the DefaultExporter constructor call in
src/mastra/index.ts.
- Around line 345-366: Remove the large commented-out OtelBridge configuration
block that begins with the OtelBridge instantiation and includes the commented
properties (e.g., OtelBridge, 'mastra-otel-bridge', otelTracer.startSpan,
logger/logLevel, batchsize/timeout, serializationOptions, resourceAttributes);
delete the entire commented section so no dead/commented code remains in
src/mastra/index.ts and rely on VCS history or external docs if you need to
restore it later.
- Around line 142-150: Remove the commented-out import lines for unused symbols
to comply with coding guidelines: delete the commented imports for OtelBridge,
createTextualDifferenceScorer, createToneScorer, and
createToolCallAccuracyScorerCode so only active imports (e.g., DefaultExporter,
createCompletenessScorer, keywordCoverageScorer) remain; ensure no leftover
comment markers remain and run a quick lint/format check to confirm no unused or
stray comments remain.
In `@src/mastra/networks/businessIntelligenceNetwork.ts`:
- Around line 183-191: Remove the dead/commented code and the unused empty
options object: delete the commented-out references to confirmationTool and the
BatchPartsProcessor block inside the outputProcessors array, and remove the
empty options: {} property (or replace it with undefined/null only if the
surrounding code expects the key to exist). Ensure outputProcessors retains the
TokenLimiterProcessor(128000) entry and that no other references to
confirmationTool or BatchPartsProcessor remain in the enclosing scope (e.g., the
businessIntelligenceNetwork configuration).
In `@src/mastra/networks/codingTeamNetwork.ts`:
- Around line 193-200: Remove the commented-out BatchPartsProcessor block inside
the outputProcessors array; keep only the active processor(s) (e.g.,
TokenLimiterProcessor(256000)) and delete the commented lines referencing
BatchPartsProcessor so no dead/commented code remains; if you need to preserve
the configuration for history or deprecation reasons, record it in the commit
message or migration notes rather than leaving it commented in the source.
- Line 41: The magic number 3 used in the retry condition should be extracted to
a named constant (e.g., MAX_RETRY_ATTEMPTS) for clarity and reuse: define
MAX_RETRY_ATTEMPTS near the top of the module (or close to the function using
it) and replace the hardcoded `3` in the condition `if (score < 0.7 &&
(retryCount ?? 0) < 3)` with `(retryCount ?? 0) < MAX_RETRY_ATTEMPTS`; update
any other occurrences of the same literal in this module to use the constant so
the retry limit is centralized and maintainable.
- Around line 26-27: Add a TSDoc block above the exported class QualityChecker
(which implements Processor) describing its purpose, responsibilities, and basic
usage (what it processes, expected inputs/outputs, and any important side
effects or configuration), include tags like `@remarks` if needed and `@example`
showing how to instantiate/use it, and document any public methods or properties
(e.g., id) so the class is fully documented according to project TSDoc
guidelines.
- Around line 54-100: The evaluateQuality function is marked async unnecessarily
and uses hardcoded "magic" numbers and lacks TSDoc; remove the async and Promise
return (make it a synchronous function evaluateQuality(text: string): number),
introduce named constants (e.g., LENGTH_CAP = 500, NEGATIVE_PENALTY = 0.25,
POSITIVE_INCREMENT = 0.05, POSITIVE_CAP = 0.2, and QUALITY_THRESHOLD = 0.7) and
replace all literals in evaluateQuality with those constants, add a brief TSDoc
above evaluateQuality describing inputs/return, and update callers (the code
that checked against 0.7) to use QUALITY_THRESHOLD and to handle the synchronous
numeric return instead of awaiting a Promise.
- Around line 29-51: The abort call currently occurs inside the evaluateQuality
Promise callback and may run too late; change processOutputStep to perform the
quality check synchronously by making processOutputStep async and awaiting
evaluateQuality(text) so you can call abort(...) before returning/streaming; use
the existing symbols processOutputStep, evaluateQuality, and retryCount to
implement the synchronous check and retry logic. Replace magic numbers with
named constants (e.g., MIN_QUALITY_THRESHOLD = 0.7 and MIN_LENGTH_SCORE = 500)
declared at the top of the file and use those constants in the
score/length/retry decisions. Finally add a TSDoc block to the QualityChecker
class describing its responsibility in the processor pipeline and how it uses
the constants and processOutputStep to enforce quality and retry behavior.
In `@src/mastra/networks/contentCreationNetwork.ts`:
- Around line 123-124: The network config in contentCreationNetwork explicitly
sets empty properties ("options: {}" and "tools: {}") while other network
configs omit/comment out empty keys; update the ContentCreation network config
to match the project convention by removing or commenting out the empty "tools"
property (and align "options" handling if other files omit empty options) so the
config uses the same pattern as the other network files (locate the object
literal where options and tools are defined in contentCreationNetwork and remove
or comment the tools: {} entry).
- Around line 127-131: Remove the commented-out BatchPartsProcessor block found
near the ContentCreationNetwork implementation: delete the commented lines
containing "new BatchPartsProcessor({ batchSize: 20, maxWaitTime: 100,
emitOnNonText: true, })" so the file no longer contains that inactive
configuration; ensure no other references or TODO comments remain related to
this snippet and run tests/lint to confirm formatting.
In `@src/mastra/networks/dataPipelineNetwork.ts`:
- Around line 97-104: Remove the commented-out BatchPartsProcessor block from
the outputProcessors array so only active processors remain; specifically edit
the outputProcessors declaration (which currently contains new
TokenLimiterProcessor(128000) and the commented BatchPartsProcessor) and delete
the commented lines for BatchPartsProcessor, ensuring any trailing commas or
formatting around the array stay valid.
In `@src/mastra/networks/devopsNetwork.ts`:
- Around line 173-180: Remove the commented-out BatchPartsProcessor block inside
the outputProcessors array in devopsNetwork.ts; specifically, delete the
commented lines referencing BatchPartsProcessor (the commented new
BatchPartsProcessor({...}) block) so only active processors like
TokenLimiterProcessor(128000) remain.
In `@src/mastra/networks/financialIntelligenceNetwork.ts`:
- Around line 150-159: Remove the unnecessary empty tools: {} property and
delete the commented-out BatchPartsProcessor block in the outputProcessors
array; leave only the active processors (e.g., TokenLimiterProcessor(128000)) so
the outputProcessors array contains only real processor instances and no
commented code or empty objects (locate where tools: {} and the commented
BatchPartsProcessor appear near the outputProcessors definition).
In `@src/mastra/networks/index.ts`:
- Line 91: Remove the no-op empty options object (the "options: {}" property)
from the network config to avoid clutter; locate the object literal containing
"options: {}" in src/mastra/networks/index.ts and delete that property, or if
the Agent interface requires the property, change it to be omitted or set to
undefined/optional so the shape matches the Agent type without an empty object.
- Line 106: The exported networks config contains an unused empty property
'scorers: {}'; remove that key from the object literal (or make it optional in
the Agent type) so the config no longer includes an empty scorers object—locate
the object containing 'scorers' in src/mastra/networks/index.ts and delete the
'scorers: {}' entry (or adjust the Agent/interface to accept an absent scorers
property if required).
- Around line 105-115: Remove the commented-out code in the network config:
delete the commented reference to confirmationTool and the commented
BatchPartsProcessor block inside the outputProcessors array; leave scorers,
workflows (e.g., weatherWorkflow) and the active TokenLimiterProcessor(128000)
intact to preserve behavior and rely on VCS for history.
In `@src/mastra/networks/learningNetwork.ts`:
- Around line 132-141: Remove the commented-out code: delete the commented
`confirmationTool` entry in the tools block and the commented
`BatchPartsProcessor` block inside outputProcessors; keep the active
TokenLimiterProcessor(128000) and an empty options object as-is, and reformat
the surrounding array/object so there are no leftover blank comment lines or
trailing commas—verify compilation/linting after the cleanup.
In `@src/mastra/networks/marketingAutomationNetwork.ts`:
- Around line 167-175: Remove the commented-out dead code inside the
outputProcessors block of marketingAutomationNetwork.ts: delete the commented
reference to "tools: { confirmationTool }" and the commented BatchPartsProcessor
block (the commented new BatchPartsProcessor({...}) lines), leaving only the
active processors such as TokenLimiterProcessor(128000); ensure no other
commented-out remnants remain in the outputProcessors array and run a quick
lint/format to keep the file tidy.
In `@src/mastra/networks/reportGenerationNetwork.ts`:
- Around line 121-123: Remove the commented-out tracingPolicy configuration
block (the commented lines referencing options: { tracingPolicy: { internal:
InternalSpans.ALL } }) from reportGenerationNetwork so the codebase has no
dead/commented code; if tracing should be tracked for future work, create a TODO
or issue instead of leaving the commented lines in place and reference
tracingPolicy/InternalSpans.ALL in that task.
- Around line 130-143: Remove the commented-out configuration entries: delete
the commented reference to confirmationTool in the tools block and remove the
commented BatchPartsProcessor configuration inside outputProcessors; keep the
active workflows (weatherWorkflow, financialReportWorkflow,
researchSynthesisWorkflow, learningExtractionWorkflow) and the
TokenLimiterProcessor(128000) intact so only live code remains in the
export/object that defines workflows and outputProcessors.
In `@src/mastra/networks/researchPipelineNetwork.ts`:
- Around line 147-156: Remove the commented-out code from the
outputProcessors/options block: delete the line "// tools: { confirmationTool }"
and the commented BatchPartsProcessor block (the commented lines around
BatchPartsProcessor) so only active configuration remains (e.g., options: {} and
outputProcessors with new TokenLimiterProcessor(128000)); leave
TokenLimiterProcessor and other active settings untouched and rely on VCS to
recover any removed code if needed.
- Around line 136-146: The researchPipelineNetwork configuration is missing a
`scorers` section to monitor output quality; add a `scorers` property to the
researchPipelineNetwork object (near `memory`, `agents`, `workflows`) and
include at least the `relevancy` scorer (and optionally `safety`) consistent
with other agents/coordinators in the PR so outputs from `researchPaperAgent`,
`documentProcessingAgent`, `knowledgeIndexingAgent`, and `researchAgent` are
scored for relevancy and safety.
- Around line 147-148: The options object passed to the network is currently
empty; add tracingPolicy: InternalSpans.ALL to that options object and import
InternalSpans from '@mastra/core/observability' so the network uses the same
InternalSpans.ALL tracing policy as other agents/networks (refer to the options
object and the ResearchPipelineNetwork/constructor where options is defined).
In `@src/mastra/networks/securityNetwork.ts`:
- Around line 174-185: Remove all commented-out code in the object literal:
delete the commented reference to confirmationTool, remove the commented
defaultNetworkOptions entry (and the problematic "as unknown as any" pattern),
and remove the commented BatchPartsProcessor block so outputProcessors only
contains the active TokenLimiterProcessor(128000). After removal, ensure the
surrounding options/outputProcessors structure remains valid
JavaScript/TypeScript (commas and indentation) and, if you actually need
defaultNetworkOptions, replace the commented line with a properly typed value
instead of using "as unknown as any".
In `@tsconfig.json`:
- Around line 62-69: The tsconfig include array contains redundant patterns:
remove the "convex/mastra/**/*.ts" entry (it's subsumed by "convex/**/*.ts") and
remove the duplicate "types/**/*.d.ts" entry so each include pattern appears
only once; update the include list accordingly in tsconfig.json.
| "cmdk": "^1.1.1", | ||
| "concurrently": "^9.2.1", | ||
| "convert-csv-to-json": "^3.20.0", | ||
| "convex": "^1.31.4", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check latest version of convex on npm
echo "=== Latest convex version ==="
npm view convex version 2>/dev/null || echo "npm command not available"
# Check version history to see when 1.31.4 was released
echo "=== Convex version 1.31.4 details ==="
npm view convex@1.31.4 2>/dev/null || echo "Cannot fetch via npm"
# Try using curl to check npm registry directly
echo "=== Checking npm registry directly ==="
curl -s https://registry.npmjs.org/convex/latest | python3 -c "import sys, json; data=json.load(sys.stdin); print(f\"Latest version: {data.get('version', 'N/A')}\")" 2>/dev/null || echo "Cannot access registry"
# Check if there are any security advisories in npm audit
echo "=== Creating test package.json ==="
cat > /tmp/test-package.json << 'EOF'
{
"dependencies": {
"convex": "^1.31.4"
}
}
EOF
cd /tmp && npm audit --json /tmp/test-package.json 2>/dev/null | python3 -c "import sys, json; data=json.load(sys.stdin); vulnerabilities = data.get('vulnerabilities', {}); print(f'Vulnerabilities found: {len(vulnerabilities)}'); [print(f'{k}: {v}') for k,v in vulnerabilities.items()]" 2>/dev/null || echo "npm audit check skipped"Repository: ssdeanx/AgentStack
Length of output: 148
🌐 Web query:
convex npm package latest version release date security vulnerabilities
💡 Result:
- Latest npm version: 1.26.2 (published Jan 5, 2026). [1]
- Security/vulnerabilities: no direct known vulnerabilities reported for the convex package in Snyk’s vulnerability database; third‑party scans (ReversingLabs / Spectra) report no detected risks for recent versions. (Always scan your dependency tree for transitive issues before upgrading in CI). [2][3]
Sources:
[1] npm package page for convex (version and publish info).
[2] Snyk package security page for convex (no direct vulnerabilities found).
[3] ReversingLabs / Spectra Assure community scan for convex (no risks detected).
The convex dependency version ^1.31.4 does not exist in npm registry.
The latest available version is 1.26.2 (released Jan 5, 2026). The specified version exceeds what is published, which will cause installation to fail. Update to an existing version, such as ^1.26.2 or the appropriate stable release compatible with your requirements.
🤖 Prompt for AI Agents
In `@package.json` at line 132, The convex dependency in package.json is pinned to
a non-existent version "^1.31.4"; update the "convex" entry in package.json (the
dependency line with "convex": "^1.31.4") to a published version such as
"^1.26.2" or another compatible stable release, then run npm install / yarn
install to verify resolution and update lockfile accordingly.
| defaultOptions: { | ||
| autoResumeSuspendedTools: true, | ||
| // autoResumeSuspendedTools: true, | ||
| }, |
There was a problem hiding this comment.
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 and empty defaultOptions block.
Per coding guidelines, commented-out code should be removed rather than left in place. The defaultOptions block is now effectively empty and serves no purpose.
♻️ Proposed fix
maxRetries: 3,
- defaultOptions: {
-// autoResumeSuspendedTools: true,
- },
})🤖 Prompt for AI Agents
In `@src/mastra/agents/academicResearchAgent.ts` around lines 146 - 148, Remove
the commented-out line and the empty defaultOptions block in the
AcademicResearchAgent configuration: delete the commented "//
autoResumeSuspendedTools: true," and remove the entire defaultOptions: { } entry
so no empty configuration remains in the academicResearchAgent (search for
defaultOptions in src/mastra/agents/academicResearchAgent.ts or the
AcademicResearchAgent definition) — keep surrounding formatting intact.
| // defaultOptions: { | ||
| // autoResumeSuspendedTools: true, | ||
| // }, |
There was a problem hiding this comment.
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.
Per coding guidelines, commented-out code should be removed. Use version control history if the autoResumeSuspendedTools configuration needs to be restored.
♻️ Suggested cleanup
options: {
tracingPolicy: {
internal: InternalSpans.ALL,
},
},
-// defaultOptions: {
-// autoResumeSuspendedTools: true,
-// },
})📝 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.
| // defaultOptions: { | |
| // autoResumeSuspendedTools: true, | |
| // }, | |
| options: { | |
| tracingPolicy: { | |
| internal: InternalSpans.ALL, | |
| }, | |
| }, | |
| }) |
🤖 Prompt for AI Agents
In `@src/mastra/agents/acpAgent.ts` around lines 133 - 135, Remove the
commented-out defaultOptions block (the lines containing "// defaultOptions:
{", "// autoResumeSuspendedTools: true,", and "// },") from
acpAgent.ts; simply delete these commented lines so no dead/commented code
remains—rely on git history to restore this configuration if needed later.
| // defaultOptions: { | ||
| // autoResumeSuspendedTools: true, | ||
| // }, |
There was a problem hiding this comment.
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.
Per coding guidelines, commented-out code should be removed. Delete the defaultOptions block entirely.
♻️ Proposed fix
options: {
tracingPolicy: {
internal: InternalSpans.ALL,
},
},
- // defaultOptions: {
- // autoResumeSuspendedTools: true,
- // },
})📝 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.
| // defaultOptions: { | |
| // autoResumeSuspendedTools: true, | |
| // }, | |
| options: { | |
| tracingPolicy: { | |
| internal: InternalSpans.ALL, | |
| }, | |
| }, | |
| }) |
🤖 Prompt for AI Agents
In `@src/mastra/agents/bgColorAgent.ts` around lines 23 - 25, Remove the
commented-out defaultOptions block in bgColorAgent.ts: delete the lines
containing the commented `defaultOptions` definition (the
`autoResumeSuspendedTools: true` entry and its surrounding comment markers) so
no unused commented code remains in the file; ensure no references to
`defaultOptions` elsewhere in the file need updating after removal.
| const userId = requestContext.get('userId') | ||
| return { | ||
| role: 'system', | ||
| content: `You are an expert at converting CSV data into Excalidraw diagrams. Your task is to analyze CSV data and create a visual representation using the Excalidraw JSON format. | ||
| user: ${userId} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handle undefined userId in the prompt.
When userId is undefined, the prompt will contain the literal string user: undefined, which may confuse the model or leak implementation details. Consider providing a fallback or conditionally including this line.
Suggested fix
const userId = requestContext.get('userId')
return {
role: 'system',
content: `You are an expert at converting CSV data into Excalidraw diagrams. Your task is to analyze CSV data and create a visual representation using the Excalidraw JSON format.
-user: ${userId}
+${userId ? `user: ${userId}` : ''}
Your response MUST be a JSON object with two fields:🤖 Prompt for AI Agents
In `@src/mastra/agents/csv_to_excalidraw.ts` around lines 21 - 25, The prompt
currently interpolates userId from requestContext.get('userId') and will include
the literal "user: undefined" if missing; update the logic in
src/mastra/agents/csv_to_excalidraw.ts that builds the returned system message
(the block that uses userId) to guard against undefined by either conditionally
omitting the "user: ..." line or substituting a safe fallback (e.g., "anonymous"
or "unknown"), ensuring you reference the userId variable and requestContext.get
call when making the change.
| // defaultOptions: { | ||
| // autoResumeSuspendedTools: true, | ||
| // }, |
There was a problem hiding this comment.
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 instead of leaving it in place.
Commented-out code should be removed and version control used to track history if needed. This applies to the defaultOptions block.
♻️ Remove commented-out code
options: {
tracingPolicy: {
internal: InternalSpans.ALL,
},
},
- // defaultOptions: {
- // autoResumeSuspendedTools: true,
- // },
})As per coding guidelines: "Never comment out code; remove it instead and use version control history if needed."
📝 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.
| // defaultOptions: { | |
| // autoResumeSuspendedTools: true, | |
| // }, | |
| options: { | |
| tracingPolicy: { | |
| internal: InternalSpans.ALL, | |
| }, | |
| }, | |
| }) |
🤖 Prompt for AI Agents
In `@src/mastra/agents/translationAgent.ts` around lines 130 - 132, Remove the
commented-out defaultOptions block (the lines containing "defaultOptions: {
autoResumeSuspendedTools: true, }") from the TranslationAgent code to avoid
leaving dead code in place; simply delete those commented lines from the
translationAgent.ts file (e.g., inside the TranslationAgent class or its
configuration section) and rely on VCS history if the code needs to be restored.
| // defaultOptions: { | ||
| // autoResumeSuspendedTools: true, | ||
| // }, |
There was a problem hiding this comment.
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 instead of leaving it in.
Per coding guidelines, commented-out code should be removed rather than kept in the codebase. Version control history preserves the previous implementation if needed. If autoResumeSuspendedTools behavior needs to be toggled, consider using a configuration flag or environment variable instead.
♻️ Suggested fix
maxRetries: 5,
- // defaultOptions: {
-// autoResumeSuspendedTools: true,
-// },
})📝 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.
| // defaultOptions: { | |
| // autoResumeSuspendedTools: true, | |
| // }, | |
| maxRetries: 5, | |
| }) |
🤖 Prompt for AI Agents
In `@src/mastra/agents/weather-agent.ts` around lines 79 - 81, Remove the
commented-out defaultOptions block (specifically the commented `defaultOptions`
object and `autoResumeSuspendedTools` line) from weather-agent.ts; if toggling
`autoResumeSuspendedTools` is required, implement it as a real configuration
option (e.g., read from an existing options/config structure or environment
variable) and wire that into the agent's initialization instead of leaving
commented code in place.
| // new BatchPartsProcessor({ | ||
| // batchSize: 10, | ||
| // maxWaitTime: 75, | ||
| // emitOnNonText: true, | ||
| // }), | ||
| ], |
There was a problem hiding this comment.
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 instead of leaving it in place.
As per coding guidelines, commented-out code should be removed entirely and version control should be used to track history if needed. If BatchPartsProcessor is no longer required, remove both the commented code and the unused import on line 4.
♻️ Proposed fix
Remove the commented code and update the import:
import type { GoogleGenerativeAIProviderOptions } from '@ai-sdk/google'
import { Agent } from '@mastra/core/agent'
-import {
- BatchPartsProcessor,
- TokenLimiterProcessor,
-} from '@mastra/core/processors'
+import { TokenLimiterProcessor } from '@mastra/core/processors'
import type { RequestContext } from '@mastra/core/request-context' outputProcessors: [
new TokenLimiterProcessor(128000),
- // new BatchPartsProcessor({
- // batchSize: 10,
- // maxWaitTime: 75,
- // emitOnNonText: true,
- // }),
],🤖 Prompt for AI Agents
In `@src/mastra/agents/webResearchAgent.ts` around lines 136 - 141, Remove the
commented-out BatchPartsProcessor block and the now-unused BatchPartsProcessor
import from the top of the file; ensure no other references to
BatchPartsProcessor remain in the module (e.g., any variables, array entries, or
configs that referenced BatchPartsProcessor) and run a quick build/lint to
confirm the unused import is gone.
| // defaultOptions: { | ||
| // autoResumeSuspendedTools: true, | ||
| // }, |
There was a problem hiding this comment.
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 defaultOptions block.
Same as above—commented-out code should be removed rather than left in place. If autoResumeSuspendedTools needs to be disabled, simply omit the defaultOptions property entirely.
♻️ Proposed fix
outputProcessors: [
new TokenLimiterProcessor(128000),
],
- // defaultOptions: {
- // autoResumeSuspendedTools: true,
- // },
})📝 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.
| // defaultOptions: { | |
| // autoResumeSuspendedTools: true, | |
| // }, | |
| outputProcessors: [ | |
| new TokenLimiterProcessor(128000), | |
| ], | |
| }) |
🤖 Prompt for AI Agents
In `@src/mastra/agents/webResearchAgent.ts` around lines 142 - 144, Remove the
commented-out defaultOptions block in src/mastra/agents/webResearchAgent.ts (the
lines containing "// defaultOptions: { // autoResumeSuspendedTools:
true, // },")—delete those commented lines entirely from the WebResearchAgent
configuration so no dead/commented code remains; if you intended to disable
autoResumeSuspendedTools, simply omit the defaultOptions property from the agent
setup (no alternative flag or commented placeholder).
| "convex/**/*.ts", | ||
| "convex/**/*.tsx", | ||
| "convex/**/*.d.ts", | ||
| "convex/mastra/**/*.ts", | ||
| "convex/**/*.js", | ||
| // Tests are excluded from the main typecheck run to avoid typechecking test-only imports | ||
| // that may pull in declaration files with unsupported syntax from node_modules. | ||
| "types/**/*.d.ts" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Remove redundant include patterns.
- Line 65 (
convex/mastra/**/*.ts) is already covered by line 62 (convex/**/*.ts) - Line 69 (
types/**/*.d.ts) duplicates line 49
♻️ Proposed fix
"convex/**/*.ts",
"convex/**/*.tsx",
"convex/**/*.d.ts",
- "convex/mastra/**/*.ts",
"convex/**/*.js",
// Tests are excluded from the main typecheck run to avoid typechecking test-only imports
// that may pull in declaration files with unsupported syntax from node_modules.
- "types/**/*.d.ts"
],📝 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.
| "convex/**/*.ts", | |
| "convex/**/*.tsx", | |
| "convex/**/*.d.ts", | |
| "convex/mastra/**/*.ts", | |
| "convex/**/*.js", | |
| // Tests are excluded from the main typecheck run to avoid typechecking test-only imports | |
| // that may pull in declaration files with unsupported syntax from node_modules. | |
| "types/**/*.d.ts" | |
| "convex/**/*.ts", | |
| "convex/**/*.tsx", | |
| "convex/**/*.d.ts", | |
| "convex/**/*.js", | |
| // Tests are excluded from the main typecheck run to avoid typechecking test-only imports | |
| // that may pull in declaration files with unsupported syntax from node_modules. |
🤖 Prompt for AI Agents
In `@tsconfig.json` around lines 62 - 69, The tsconfig include array contains
redundant patterns: remove the "convex/mastra/**/*.ts" entry (it's subsumed by
"convex/**/*.ts") and remove the duplicate "types/**/*.d.ts" entry so each
include pattern appears only once; update the include list accordingly in
tsconfig.json.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review continued from previous batch...
| instructions: ({ requestContext }) => { | ||
| const userId = requestContext.get('userId') | ||
| return { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused userId variable.
The userId is extracted from requestContext on line 61 but is never used in the instructions content. This is dead code that should be removed per coding guidelines on avoiding unused variables.
🔧 Proposed fix
instructions: ({ requestContext }) => {
- const userId = requestContext.get('userId')
return {
role: 'system',📝 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.
| instructions: ({ requestContext }) => { | |
| const userId = requestContext.get('userId') | |
| return { | |
| instructions: ({ requestContext }) => { | |
| return { | |
| role: 'system', |
🤖 Prompt for AI Agents
In `@src/mastra/a2a/codingA2ACoordinator.ts` around lines 60 - 62, The
instructions function extracts a userId that is never used: inside the
instructions: ({ requestContext }) => { ... } block remove the dead line that
declares const userId = requestContext.get('userId') so there are no unused
variables; if the ID may be needed later, replace the declaration with a
commented note or retrieve it only where used (refer to the instructions
function in codingA2ACoordinator.ts).
| model: 'openai/gpt-4o-mini', | ||
| tools: { colorChangeTool }, | ||
| memory: new Memory(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# First, let's look at the bgColorAgent.ts file
cat -n src/mastra/agents/bgColorAgent.tsRepository: ssdeanx/AgentStack
Length of output: 1246
🏁 Script executed:
#!/bin/bash
# Now let's see how other agents configure memory and model
rg -n "memory:" --type=ts src/mastra/agents/ -A 1 -B 1Repository: ssdeanx/AgentStack
Length of output: 10428
🏁 Script executed:
#!/bin/bash
# Check which agents exist
fd -e ts src/mastra/agents/ --type fRepository: ssdeanx/AgentStack
Length of output: 439
🏁 Script executed:
#!/bin/bash
# Find pgMemory definition/import to confirm it's the shared configuration
rg -n "pgMemory" --type=ts src/mastra/ -B 2 | head -30Repository: ssdeanx/AgentStack
Length of output: 1850
🏁 Script executed:
#!/bin/bash
# Check the imports at the top of a similar agent
head -10 src/mastra/agents/calendarAgent.tsRepository: ssdeanx/AgentStack
Length of output: 487
Replace new Memory() with pgMemory from the shared configuration.
This agent is the only one in the codebase using an unconfigured Memory() instance. All other agents import and use pgMemory from src/mastra/config/pg-storage.ts, which is a properly configured Memory instance with PgVector and embeddings support. Update the import and usage to match the shared configuration pattern:
- import { Memory } from '@mastra/memory'
+ import { pgMemory } from '../config'- memory: new Memory(),
+ memory: pgMemory,🤖 Prompt for AI Agents
In `@src/mastra/agents/bgColorAgent.ts` around lines 15 - 17, Replace the ad-hoc
Memory usage in bgColorAgent by importing and using the shared pgMemory: remove
the direct instantiation new Memory() in the agent config and instead import
pgMemory from the shared pg-storage module (the same pgMemory used elsewhere)
and assign memory: pgMemory in the agent initialization (update the imports at
the top of bgColorAgent.ts to pull in pgMemory from
src/mastra/config/pg-storage.ts and replace the Memory reference in the object
where model/tools/memory are defined).
| content: `You are a Senior Legal Research Analyst. Your goal is to research legal topics thoroughly using authoritative sources. | ||
| Your working with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix typo in system prompt.
Line 91: "Your working with" should be "You're working with" (contraction of "You are").
📝 Proposed fix
content: `You are a Senior Legal Research Analyst. Your goal is to research legal topics thoroughly using authoritative sources.
- Your working with:
+ You're working with:
- User: ${userTier}📝 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.
| content: `You are a Senior Legal Research Analyst. Your goal is to research legal topics thoroughly using authoritative sources. | |
| Your working with: | |
| content: `You are a Senior Legal Research Analyst. Your goal is to research legal topics thoroughly using authoritative sources. | |
| You're working with: |
🤖 Prompt for AI Agents
In `@src/mastra/agents/businessLegalAgents.ts` around lines 90 - 91, Fix the typo
in the system prompt string in businessLegalAgents.ts: replace the phrase "Your
working with" with the correct contraction "You're working with" inside the
prompt content (the template literal assigned to content in the agent prompt) so
the prompt reads "You're working with:".
| }, | ||
| } | ||
| }, | ||
| model: googleAI3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Consider tier-based model selection for consistency.
contractAnalysisAgent, complianceMonitoringAgent, and businessStrategyAgent use a static googleAI3 model, while legalResearchAgent uses tier-based model selection. For enterprise cost optimization and user experience consistency, consider applying similar tier-based logic across all agents.
🤖 Prompt for AI Agents
In `@src/mastra/agents/businessLegalAgents.ts` at line 254, The three agents
contractAnalysisAgent, complianceMonitoringAgent, and businessStrategyAgent
currently hardcode model: googleAI3; change them to use the same tier-based
model selection used by legalResearchAgent (call the existing tier-to-model
resolver function used in legalResearchAgent to set the model property), ensure
the call accepts the agent's tier/user plan and preserves googleAI3 as a
sensible fallback, and update any related config/constructor parameters so all
four agents use the same tier-based selection logic for consistency and cost
control.
| memory: pgMemory, | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Missing tracingPolicy configuration for consistency.
The contractAnalysisAgent is missing the options.tracingPolicy configuration that other agents in this PR have. For consistency with the PR's standardization of InternalSpans.ALL tracing, add the tracing policy. This also applies to complianceMonitoringAgent (around line 363) and businessStrategyAgent (around line 459).
♻️ Proposed fix for contractAnalysisAgent
memory: pgMemory,
+ options: {
+ tracingPolicy: {
+ internal: InternalSpans.ALL,
+ },
+ },
scorers: {Apply similar changes to complianceMonitoringAgent and businessStrategyAgent.
📝 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.
| memory: pgMemory, | |
| memory: pgMemory, | |
| options: { | |
| tracingPolicy: { | |
| internal: InternalSpans.ALL, | |
| }, | |
| }, |
🤖 Prompt for AI Agents
In `@src/mastra/agents/businessLegalAgents.ts` around lines 266 - 267, Add the
missing tracingPolicy configuration to each agent creation so they match the PR
standard: in the contractAnalysisAgent, complianceMonitoringAgent, and
businessStrategyAgent initialization objects add options.tracingPolicy:
InternalSpans.ALL (i.e., set the agents' options.tracingPolicy to
InternalSpans.ALL where other agents do this) to ensure consistent tracing
behavior across these agents.
| // tools: { confirmationTool }, | ||
| options: {}, | ||
| outputProcessors: [ | ||
| new TokenLimiterProcessor(128000), | ||
| // new BatchPartsProcessor({ | ||
| // batchSize: 20, | ||
| // maxWaitTime: 100, | ||
| // emitOnNonText: true, | ||
| // }), | ||
| ], |
There was a problem hiding this comment.
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 instead of leaving it in place.
Per coding guidelines, commented-out code should be removed and version control used for history. The commented confirmationTool (line 132) and BatchPartsProcessor (lines 136-140) should be deleted rather than left as comments.
♻️ Suggested cleanup
},
- // tools: { confirmationTool },
options: {},
outputProcessors: [
new TokenLimiterProcessor(128000),
- // new BatchPartsProcessor({
- // batchSize: 20,
- // maxWaitTime: 100,
- // emitOnNonText: true,
- // }),
],
})📝 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.
| // tools: { confirmationTool }, | |
| options: {}, | |
| outputProcessors: [ | |
| new TokenLimiterProcessor(128000), | |
| // new BatchPartsProcessor({ | |
| // batchSize: 20, | |
| // maxWaitTime: 100, | |
| // emitOnNonText: true, | |
| // }), | |
| ], | |
| options: {}, | |
| outputProcessors: [ | |
| new TokenLimiterProcessor(128000), | |
| ], |
🤖 Prompt for AI Agents
In `@src/mastra/networks/learningNetwork.ts` around lines 132 - 141, Remove the
commented-out code: delete the commented `confirmationTool` entry in the tools
block and the commented `BatchPartsProcessor` block inside outputProcessors;
keep the active TokenLimiterProcessor(128000) and an empty options object as-is,
and reformat the surrounding array/object so there are no leftover blank comment
lines or trailing commas—verify compilation/linting after the cleanup.
| memory: pgMemory, | ||
| agents: { | ||
| researchPaperAgent, | ||
| documentProcessingAgent, | ||
| knowledgeIndexingAgent, | ||
| researchAgent, | ||
| }, | ||
| workflows: { | ||
| documentProcessingWorkflow, | ||
| contentReviewWorkflow, | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Consider adding scorers for quality monitoring.
The researchPipelineNetwork doesn't have any scorers configured, unlike other agents and coordinators in this PR which use relevancy and safety scorers. For a research pipeline that synthesizes academic content, relevancy scoring would help monitor output quality.
🤖 Prompt for AI Agents
In `@src/mastra/networks/researchPipelineNetwork.ts` around lines 136 - 146, The
researchPipelineNetwork configuration is missing a `scorers` section to monitor
output quality; add a `scorers` property to the researchPipelineNetwork object
(near `memory`, `agents`, `workflows`) and include at least the `relevancy`
scorer (and optionally `safety`) consistent with other agents/coordinators in
the PR so outputs from `researchPaperAgent`, `documentProcessingAgent`,
`knowledgeIndexingAgent`, and `researchAgent` are scored for relevancy and
safety.
| // tools: { confirmationTool }, | ||
| options: {}, | ||
| outputProcessors: [ | ||
| new TokenLimiterProcessor(128000), | ||
| // new BatchPartsProcessor({ | ||
| // batchSize: 20, | ||
| // maxWaitTime: 100, | ||
| // emitOnNonText: true, | ||
| // }), | ||
| ], |
There was a problem hiding this comment.
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.
Per coding guidelines, never comment out code; remove it instead and use version control history if needed. This includes:
- Line 147:
// tools: { confirmationTool } - Lines 151-155: Commented
BatchPartsProcessorblock
🤖 Prompt for AI Agents
In `@src/mastra/networks/researchPipelineNetwork.ts` around lines 147 - 156,
Remove the commented-out code from the outputProcessors/options block: delete
the line "// tools: { confirmationTool }" and the commented BatchPartsProcessor
block (the commented lines around BatchPartsProcessor) so only active
configuration remains (e.g., options: {} and outputProcessors with new
TokenLimiterProcessor(128000)); leave TokenLimiterProcessor and other active
settings untouched and rely on VCS to recover any removed code if needed.
| // tools: { confirmationTool }, | ||
| options: {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Add tracingPolicy to empty options object.
The options object is empty, but other agents and networks in this PR standardize on InternalSpans.ALL tracing. For observability consistency, add the tracing policy.
♻️ Proposed fix
// tools: { confirmationTool },
- options: {},
+ options: {
+ tracingPolicy: {
+ internal: InternalSpans.ALL,
+ },
+ },
outputProcessors: [Note: You'll also need to add the import for InternalSpans:
import { InternalSpans } from '@mastra/core/observability'🤖 Prompt for AI Agents
In `@src/mastra/networks/researchPipelineNetwork.ts` around lines 147 - 148, The
options object passed to the network is currently empty; add tracingPolicy:
InternalSpans.ALL to that options object and import InternalSpans from
'@mastra/core/observability' so the network uses the same InternalSpans.ALL
tracing policy as other agents/networks (refer to the options object and the
ResearchPipelineNetwork/constructor where options is defined).
|
|
||
| // tools: { confirmationTool }, | ||
| options: {}, | ||
| // defaultNetworkOptions: { autoResumeSuspendedTools: true } as unknown as any, | ||
| outputProcessors: [ | ||
| new TokenLimiterProcessor(128000), | ||
| // new BatchPartsProcessor({ | ||
| // batchSize: 20, | ||
| // maxWaitTime: 100, | ||
| // emitOnNonText: true, | ||
| // }), | ||
| ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Remove all commented-out code blocks.
Per coding guidelines, commented-out code should be removed:
- Line 175: Commented
confirmationTool - Line 177: Commented
defaultNetworkOptions(note: theas unknown as anypattern is also a type-safety concern) - Lines 180-184: Commented
BatchPartsProcessor
♻️ Suggested cleanup
reportAgent,
},
-
- // tools: { confirmationTool },
options: {},
- // defaultNetworkOptions: { autoResumeSuspendedTools: true } as unknown as any,
outputProcessors: [
new TokenLimiterProcessor(128000),
- // new BatchPartsProcessor({
- // batchSize: 20,
- // maxWaitTime: 100,
- // emitOnNonText: true,
- // }),
],
})📝 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.
| // tools: { confirmationTool }, | |
| options: {}, | |
| // defaultNetworkOptions: { autoResumeSuspendedTools: true } as unknown as any, | |
| outputProcessors: [ | |
| new TokenLimiterProcessor(128000), | |
| // new BatchPartsProcessor({ | |
| // batchSize: 20, | |
| // maxWaitTime: 100, | |
| // emitOnNonText: true, | |
| // }), | |
| ], | |
| options: {}, | |
| outputProcessors: [ | |
| new TokenLimiterProcessor(128000), | |
| ], |
🤖 Prompt for AI Agents
In `@src/mastra/networks/securityNetwork.ts` around lines 174 - 185, Remove all
commented-out code in the object literal: delete the commented reference to
confirmationTool, remove the commented defaultNetworkOptions entry (and the
problematic "as unknown as any" pattern), and remove the commented
BatchPartsProcessor block so outputProcessors only contains the active
TokenLimiterProcessor(128000). After removal, ensure the surrounding
options/outputProcessors structure remains valid JavaScript/TypeScript (commas
and indentation) and, if you actually need defaultNetworkOptions, replace the
commented line with a properly typed value instead of using "as unknown as any".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review continued from previous batch...
| options: {}, | ||
| // tools: { confirmationTool }, | ||
| outputProcessors: [ | ||
| new TokenLimiterProcessor(128000), | ||
| // new BatchPartsProcessor({ | ||
| // batchSize: 20, | ||
| // maxWaitTime: 100, | ||
| // emitOnNonText: true, | ||
| // }), |
There was a problem hiding this comment.
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 and empty options.
Per coding guidelines, remove commented-out code (confirmationTool, BatchPartsProcessor) instead of leaving it in place. Also consider removing the empty options: {} if not required.
♻️ Proposed fix
},
- options: {},
- // tools: { confirmationTool },
outputProcessors: [
new TokenLimiterProcessor(128000),
- // new BatchPartsProcessor({
- // batchSize: 20,
- // maxWaitTime: 100,
- // emitOnNonText: true,
- // }),
],
})📝 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.
| options: {}, | |
| // tools: { confirmationTool }, | |
| outputProcessors: [ | |
| new TokenLimiterProcessor(128000), | |
| // new BatchPartsProcessor({ | |
| // batchSize: 20, | |
| // maxWaitTime: 100, | |
| // emitOnNonText: true, | |
| // }), | |
| outputProcessors: [ | |
| new TokenLimiterProcessor(128000), | |
| ], | |
| }) |
🤖 Prompt for AI Agents
In `@src/mastra/networks/businessIntelligenceNetwork.ts` around lines 183 - 191,
Remove the dead/commented code and the unused empty options object: delete the
commented-out references to confirmationTool and the BatchPartsProcessor block
inside the outputProcessors array, and remove the empty options: {} property (or
replace it with undefined/null only if the surrounding code expects the key to
exist). Ensure outputProcessors retains the TokenLimiterProcessor(128000) entry
and that no other references to confirmationTool or BatchPartsProcessor remain
in the enclosing scope (e.g., the businessIntelligenceNetwork configuration).
| export class QualityChecker implements Processor { | ||
| id = 'quality-checker' | ||
|
|
||
| processOutputStep( | ||
| args: ProcessOutputStepArgs<unknown> | ||
| ): ProcessorMessageResult { | ||
| const { text, abort, retryCount } = args | ||
|
|
||
| // If there's no text to evaluate, do nothing. | ||
| if (typeof text !== 'string' || text.length === 0) { | ||
| return [] | ||
| } | ||
|
|
||
| // evaluateQuality may be asynchronous; return the promise directly to match the expected return type | ||
| return evaluateQuality(text).then((score) => { | ||
| if (score < 0.7 && (retryCount ?? 0) < 3) { | ||
| // Request retry with feedback for the LLM | ||
| abort('Response quality too low. Please be more specific.', { | ||
| retry: true, | ||
| metadata: { score }, | ||
| }) | ||
| } | ||
|
|
||
| return [] | ||
| }) | ||
| } | ||
| } | ||
| id = 'quality-checker' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Add TSDoc documentation for public class.
Per coding guidelines, public classes should have TSDoc documentation explaining their purpose and usage. The QualityChecker class is exported and implements Processor but lacks documentation.
📝 Add TSDoc documentation
+/**
+ * Processor that evaluates output quality and triggers retries for low-quality responses.
+ * Uses heuristic scoring based on content length, negative indicators, and positive markers.
+ * `@implements` {Processor}
+ */
export class QualityChecker implements Processor {📝 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.
| export class QualityChecker implements Processor { | |
| id = 'quality-checker' | |
| processOutputStep( | |
| args: ProcessOutputStepArgs<unknown> | |
| ): ProcessorMessageResult { | |
| const { text, abort, retryCount } = args | |
| // If there's no text to evaluate, do nothing. | |
| if (typeof text !== 'string' || text.length === 0) { | |
| return [] | |
| } | |
| // evaluateQuality may be asynchronous; return the promise directly to match the expected return type | |
| return evaluateQuality(text).then((score) => { | |
| if (score < 0.7 && (retryCount ?? 0) < 3) { | |
| // Request retry with feedback for the LLM | |
| abort('Response quality too low. Please be more specific.', { | |
| retry: true, | |
| metadata: { score }, | |
| }) | |
| } | |
| return [] | |
| }) | |
| } | |
| } | |
| id = 'quality-checker' | |
| /** | |
| * Processor that evaluates output quality and triggers retries for low-quality responses. | |
| * Uses heuristic scoring based on content length, negative indicators, and positive markers. | |
| * `@implements` {Processor} | |
| */ | |
| export class QualityChecker implements Processor { | |
| id = 'quality-checker' |
🤖 Prompt for AI Agents
In `@src/mastra/networks/codingTeamNetwork.ts` around lines 26 - 27, Add a TSDoc
block above the exported class QualityChecker (which implements Processor)
describing its purpose, responsibilities, and basic usage (what it processes,
expected inputs/outputs, and any important side effects or configuration),
include tags like `@remarks` if needed and `@example` showing how to instantiate/use
it, and document any public methods or properties (e.g., id) so the class is
fully documented according to project TSDoc guidelines.
| processOutputStep( | ||
| args: ProcessOutputStepArgs<unknown> | ||
| ): ProcessorMessageResult { | ||
| const { text, abort, retryCount } = args | ||
|
|
||
| // If there's no text to evaluate, do nothing. | ||
| if (typeof text !== 'string' || text.length === 0) { | ||
| return 0 | ||
| return [] | ||
| } | ||
|
|
||
| // Score increases with length up to a reasonable cap. | ||
| const lengthScore = Math.min(1, text.length / 500) | ||
|
|
||
| // Penalize for common low-quality indicators | ||
| const lower = text.toLowerCase() | ||
| const negatives = [ | ||
| 'todo', | ||
| 'fixme', | ||
| 'bug', | ||
| 'hack', | ||
| 'wip', | ||
| 'error', | ||
| 'undefined', | ||
| ] | ||
| const negativeCount = negatives.reduce( | ||
| (acc, kw) => acc + (lower.includes(kw) ? 1 : 0), | ||
| 0 | ||
| ) | ||
| const negativeScore = Math.max(0, 1 - negativeCount * 0.25) | ||
|
|
||
| // Small boost for presence of tests, examples, or documentation | ||
| const positives = [ | ||
| 'test', | ||
| 'unit test', | ||
| 'integration test', | ||
| 'example', | ||
| 'usage', | ||
| 'documentation', | ||
| 'docs', | ||
| ] | ||
| const positiveBoost = Math.min( | ||
| 0.2, | ||
| positives.reduce((acc, kw) => acc + (lower.includes(kw) ? 0.05 : 0), 0) | ||
| ) | ||
|
|
||
| const score = Math.max( | ||
| 0, | ||
| Math.min(1, lengthScore * negativeScore + positiveBoost) | ||
| ) | ||
| return score | ||
| // evaluateQuality may be asynchronous; return the promise directly to match the expected return type | ||
| return evaluateQuality(text).then((score) => { | ||
| if (score < 0.7 && (retryCount ?? 0) < 3) { | ||
| // Request retry with feedback for the LLM | ||
| abort('Response quality too low. Please be more specific.', { | ||
| retry: true, | ||
| metadata: { score }, | ||
| }) | ||
| } | ||
|
|
||
| return [] | ||
| }) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Find ProcessorMessageResult type definition
rg -n "ProcessorMessageResult" --type ts -C 3 | head -100Repository: ssdeanx/AgentStack
Length of output: 1026
🏁 Script executed:
#!/bin/bash
# Search for Processor interface and processOutputStep method
rg -n "interface Processor" --type ts -A 20Repository: ssdeanx/AgentStack
Length of output: 44
🏁 Script executed:
#!/bin/bash
# Check if ProcessorMessageResult includes Promise in its definition
rg -n "type ProcessorMessageResult" --type ts -B 2 -A 5Repository: ssdeanx/AgentStack
Length of output: 44
🏁 Script executed:
#!/bin/bash
# Find package.json to check `@mastra/core` version
fd -n "package.json" | xargs grep -l "@mastra/core" 2>/dev/null | head -5Repository: ssdeanx/AgentStack
Length of output: 292
🏁 Script executed:
#!/bin/bash
# Look for node_modules or type declaration files
fd -n "processors.d.ts" 2>/dev/null | head -20Repository: ssdeanx/AgentStack
Length of output: 44
🏁 Script executed:
#!/bin/bash
# Search for any local type definitions or stubs
rg -n "ProcessorMessageResult\s*=" --type ts -B 2 -A 5Repository: ssdeanx/AgentStack
Length of output: 44
🌐 Web query:
@mastra/core processors ProcessorMessageResult async support documentation
💡 Result:
Yes — processor handlers in @mastra/core may be async. The Processor interface and its per-phase methods (e.g., processInput, processInputStep, processOutputStream, processOutputStep, processOutputResult) are declared/used as async and return Promise-compatible results (you can implement them with async functions or return Promises). See the Processor reference and migration guide for examples and the exact result types. [1][2]
Sources:
- Processor interface and usage examples (shows async processor methods). [1]
- v1 migration guide (processor types and example signatures). [2]
🏁 Script executed:
#!/bin/bash
# Find the abort() function definition
rg -n "abort" --type ts src/mastra/networks/codingTeamNetwork.ts -C 3Repository: ssdeanx/AgentStack
Length of output: 639
🏁 Script executed:
#!/bin/bash
# Look for Processor implementation examples or documentation
find . -type f -name "*.ts" | xargs grep -l "processOutputStep" 2>/dev/null | head -10Repository: ssdeanx/AgentStack
Length of output: 104
🏁 Script executed:
#!/bin/bash
# Check ProcessOutputStepArgs type to understand abort signature
rg -n "ProcessOutputStepArgs" --type ts -B 5 -A 10 | head -80Repository: ssdeanx/AgentStack
Length of output: 2315
🌐 Web query:
@mastra/core ProcessOutputStepArgs abort callback timing async safety
💡 Result:
Short answer: call abort() from your processOutputStep/processOutputResult while the step is still running (before it finishes sending the final text/finish-step). abort() sets the tripwire/abort state and triggers the AbortSignal that Mastra forwards to running tools/steps; it will prevent further steps and can request a retry if you pass retry:true. If you call abort after the step has already completed/streamed its final chunk, it has no effect.
Key points and best practices:
- Mastra forwards an AbortSignal to tool/step contexts; use abortSignal (abortSignal.aborted or addEventListener('abort')) to cancel async work (fetch, timers, etc.). [1]
- processOutputStep/processOutputResult’s abort() is part of the per-step API (it accepts reason and options like { retry: true, metadata }). Call it while the processor is executing to trigger tripwire/abort behavior. [2]
- There are known reports that calling abort in certain output-processor hooks after streaming completion appears to do nothing — ensure you call it before the step emits its final “finish”/“text-end” chunks and rely on abortSignal for cancellable async tasks. [3]
- For workflow-level cancellation semantics (stop running steps, mark run canceled), use workflow.run.cancel() which triggers the same abort signal semantics. [4]
Sources:
- Mastra docs — Abort Signals and tool execute context. [1]
- Mastra changelog/release notes describing processOutputStep and abort API (retry/metadata). [2]
- Reported behavior / discussion about abort effects in output processors. [3]
- Workflows .cancel() docs (how cancellation/AbortSignal works). [4]
🏁 Script executed:
#!/bin/bash
# Find the evaluateQuality function implementation
rg -n "evaluateQuality" --type ts -A 20 src/mastra/networks/codingTeamNetwork.tsRepository: ssdeanx/AgentStack
Length of output: 1151
🏁 Script executed:
#!/bin/bash
# Check if there's a synchronous quality check available or if async is required
rg -n "function evaluateQuality|const evaluateQuality" --type ts -A 15Repository: ssdeanx/AgentStack
Length of output: 1228
Fix abort() timing in async quality evaluation callback and add proper documentation.
The abort() call inside the .then() callback will execute after the Promise resolves, potentially after the framework has already streamed the response. This makes the abort signal ineffective. Move the abort logic to execute synchronously before returning the Promise, or restructure the quality check to complete before the method returns.
Additionally:
- Replace magic numbers (500 for length score, 0.7 for quality threshold) with named constants at the top of the file per coding guidelines.
- Add TSDoc documentation to the
QualityCheckerclass describing its purpose and role in the processor pipeline.
Current code snippet
processOutputStep(
args: ProcessOutputStepArgs<unknown>
): ProcessorMessageResult {
const { text, abort, retryCount } = args
// If there's no text to evaluate, do nothing.
if (typeof text !== 'string' || text.length === 0) {
return []
}
// evaluateQuality may be asynchronous; return the promise directly to match the expected return type
return evaluateQuality(text).then((score) => {
if (score < 0.7 && (retryCount ?? 0) < 3) {
// Request retry with feedback for the LLM
abort('Response quality too low. Please be more specific.', {
retry: true,
metadata: { score },
})
}
return []
})
}🤖 Prompt for AI Agents
In `@src/mastra/networks/codingTeamNetwork.ts` around lines 29 - 51, The abort
call currently occurs inside the evaluateQuality Promise callback and may run
too late; change processOutputStep to perform the quality check synchronously by
making processOutputStep async and awaiting evaluateQuality(text) so you can
call abort(...) before returning/streaming; use the existing symbols
processOutputStep, evaluateQuality, and retryCount to implement the synchronous
check and retry logic. Replace magic numbers with named constants (e.g.,
MIN_QUALITY_THRESHOLD = 0.7 and MIN_LENGTH_SCORE = 500) declared at the top of
the file and use those constants in the score/length/retry decisions. Finally
add a TSDoc block to the QualityChecker class describing its responsibility in
the processor pipeline and how it uses the constants and processOutputStep to
enforce quality and retry behavior.
| return score | ||
| // evaluateQuality may be asynchronous; return the promise directly to match the expected return type | ||
| return evaluateQuality(text).then((score) => { | ||
| if (score < 0.7 && (retryCount ?? 0) < 3) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Extract retry limit to named constant.
The hardcoded 3 for maximum retry attempts is a magic number. Per coding guidelines, this should be a named constant for clarity and maintainability.
♻️ Extract constant
+/** Maximum number of quality check retries before accepting response */
+const MAX_QUALITY_RETRIES = 3
// In processOutputStep:
- if (score < 0.7 && (retryCount ?? 0) < 3) {
+ if (score < QUALITY_THRESHOLD && (retryCount ?? 0) < MAX_QUALITY_RETRIES) {🤖 Prompt for AI Agents
In `@src/mastra/networks/codingTeamNetwork.ts` at line 41, The magic number 3 used
in the retry condition should be extracted to a named constant (e.g.,
MAX_RETRY_ATTEMPTS) for clarity and reuse: define MAX_RETRY_ATTEMPTS near the
top of the module (or close to the function using it) and replace the hardcoded
`3` in the condition `if (score < 0.7 && (retryCount ?? 0) < 3)` with
`(retryCount ?? 0) < MAX_RETRY_ATTEMPTS`; update any other occurrences of the
same literal in this module to use the constant so the retry limit is
centralized and maintainable.
| async function evaluateQuality(text: string): Promise<number> { | ||
| // Basic heuristic to score output quality between 0 and 1. | ||
| if (typeof text !== 'string' || text.length === 0) { | ||
| return 0 | ||
| } | ||
|
|
||
| // Score increases with length up to a reasonable cap. | ||
| const lengthScore = Math.min(1, text.length / 500) | ||
|
|
||
| // Penalize for common low-quality indicators | ||
| const lower = text.toLowerCase() | ||
| const negatives = [ | ||
| 'todo', | ||
| 'fixme', | ||
| 'bug', | ||
| 'hack', | ||
| 'wip', | ||
| 'error', | ||
| 'undefined', | ||
| ] | ||
| const negativeCount = negatives.reduce( | ||
| (acc, kw) => acc + (lower.includes(kw) ? 1 : 0), | ||
| 0 | ||
| ) | ||
| const negativeScore = Math.max(0, 1 - negativeCount * 0.25) | ||
|
|
||
| // Small boost for presence of tests, examples, or documentation | ||
| const positives = [ | ||
| 'test', | ||
| 'unit test', | ||
| 'integration test', | ||
| 'example', | ||
| 'usage', | ||
| 'documentation', | ||
| 'docs', | ||
| ] | ||
| const positiveBoost = Math.min( | ||
| 0.2, | ||
| positives.reduce((acc, kw) => acc + (lower.includes(kw) ? 0.05 : 0), 0) | ||
| ) | ||
|
|
||
| const score = Math.max( | ||
| 0, | ||
| Math.min(1, lengthScore * negativeScore + positiveBoost) | ||
| ) | ||
| return score | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Unnecessary async and magic numbers violate coding guidelines.
-
Unnecessary async: The function contains no
awaitstatements—all operations are synchronous. Theasynckeyword adds unnecessary overhead. -
Magic numbers: Multiple hardcoded values violate the coding guideline "Avoid magic numbers and strings; use named constants instead":
500(length cap)0.25(negative penalty)0.05/0.2(positive boosts)0.7(quality threshold at line 41)
-
Missing TSDoc: Public function lacks documentation per coding guidelines.
♻️ Suggested refactor with named constants
+/** Minimum quality score threshold for acceptable responses */
+const QUALITY_THRESHOLD = 0.7
+/** Character length at which the length score reaches maximum */
+const LENGTH_SCORE_CAP = 500
+/** Penalty factor per negative keyword found */
+const NEGATIVE_KEYWORD_PENALTY = 0.25
+/** Boost factor per positive keyword found */
+const POSITIVE_KEYWORD_BOOST = 0.05
+/** Maximum total boost from positive keywords */
+const MAX_POSITIVE_BOOST = 0.2
+
+/**
+ * Evaluates the quality of generated text output.
+ * `@param` text - The text content to evaluate
+ * `@returns` A quality score between 0 and 1
+ */
-async function evaluateQuality(text: string): Promise<number> {
+function evaluateQuality(text: string): number {
// Basic heuristic to score output quality between 0 and 1.
if (typeof text !== 'string' || text.length === 0) {
return 0
}
// Score increases with length up to a reasonable cap.
- const lengthScore = Math.min(1, text.length / 500)
+ const lengthScore = Math.min(1, text.length / LENGTH_SCORE_CAP)
// ... apply similar changes for other magic numbersThen update the caller at line 40-41:
- return evaluateQuality(text).then((score) => {
- if (score < 0.7 && (retryCount ?? 0) < 3) {
+ const score = evaluateQuality(text)
+ if (score < QUALITY_THRESHOLD && (retryCount ?? 0) < MAX_RETRY_COUNT) {🤖 Prompt for AI Agents
In `@src/mastra/networks/codingTeamNetwork.ts` around lines 54 - 100, The
evaluateQuality function is marked async unnecessarily and uses hardcoded
"magic" numbers and lacks TSDoc; remove the async and Promise return (make it a
synchronous function evaluateQuality(text: string): number), introduce named
constants (e.g., LENGTH_CAP = 500, NEGATIVE_PENALTY = 0.25, POSITIVE_INCREMENT =
0.05, POSITIVE_CAP = 0.2, and QUALITY_THRESHOLD = 0.7) and replace all literals
in evaluateQuality with those constants, add a brief TSDoc above evaluateQuality
describing inputs/return, and update callers (the code that checked against 0.7)
to use QUALITY_THRESHOLD and to handle the synchronous numeric return instead of
awaiting a Promise.
| // tools: { confirmationTool }, | ||
| scorers: {}, | ||
| workflows: { weatherWorkflow }, | ||
| outputProcessors: [ | ||
| new TokenLimiterProcessor(128000), | ||
| // new BatchPartsProcessor({ | ||
| // batchSize: 20, | ||
| // maxWaitTime: 100, | ||
| // emitOnNonText: true, | ||
| // }), | ||
| ], |
There was a problem hiding this comment.
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 instead of leaving it in place.
As per coding guidelines, commented-out code should be removed and version control should be used to track history if needed. The commented-out confirmationTool and BatchPartsProcessor configuration should be deleted rather than retained.
♻️ Proposed fix
projectManagementAgent,
},
- // tools: { confirmationTool },
scorers: {},
workflows: { weatherWorkflow },
outputProcessors: [
new TokenLimiterProcessor(128000),
- // new BatchPartsProcessor({
- // batchSize: 20,
- // maxWaitTime: 100,
- // emitOnNonText: true,
- // }),
],
})🤖 Prompt for AI Agents
In `@src/mastra/networks/index.ts` around lines 105 - 115, Remove the
commented-out code in the network config: delete the commented reference to
confirmationTool and the commented BatchPartsProcessor block inside the
outputProcessors array; leave scorers, workflows (e.g., weatherWorkflow) and the
active TokenLimiterProcessor(128000) intact to preserve behavior and rely on VCS
for history.
| projectManagementAgent, | ||
| }, | ||
| // tools: { confirmationTool }, | ||
| scorers: {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Consider removing empty scorers object.
Similar to options, an empty scorers: {} object provides no functionality. Consider omitting it unless required by the Agent interface.
🤖 Prompt for AI Agents
In `@src/mastra/networks/index.ts` at line 106, The exported networks config
contains an unused empty property 'scorers: {}'; remove that key from the object
literal (or make it optional in the Agent type) so the config no longer includes
an empty scorers object—locate the object containing 'scorers' in
src/mastra/networks/index.ts and delete the 'scorers: {}' entry (or adjust the
Agent/interface to accept an absent scorers property if required).
| options: {}, | ||
| // tools: { confirmationTool }, | ||
| outputProcessors: [ | ||
| new TokenLimiterProcessor(128000), | ||
| // new BatchPartsProcessor({ | ||
| // batchSize: 20, | ||
| // maxWaitTime: 100, | ||
| // emitOnNonText: true, | ||
| // }), |
There was a problem hiding this comment.
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.
Per coding guidelines, commented-out code should be removed rather than retained. The commented-out confirmationTool and BatchPartsProcessor should be deleted. Version control preserves the history if needed.
♻️ Proposed fix
},
- options: {},
- // tools: { confirmationTool },
outputProcessors: [
new TokenLimiterProcessor(128000),
- // new BatchPartsProcessor({
- // batchSize: 20,
- // maxWaitTime: 100,
- // emitOnNonText: true,
- // }),
],
})🤖 Prompt for AI Agents
In `@src/mastra/networks/marketingAutomationNetwork.ts` around lines 167 - 175,
Remove the commented-out dead code inside the outputProcessors block of
marketingAutomationNetwork.ts: delete the commented reference to "tools: {
confirmationTool }" and the commented BatchPartsProcessor block (the commented
new BatchPartsProcessor({...}) lines), leaving only the active processors such
as TokenLimiterProcessor(128000); ensure no other commented-out remnants remain
in the outputProcessors array and run a quick lint/format to keep the file tidy.
| // options: { | ||
| // tracingPolicy: { internal: InternalSpans.ALL }, | ||
| // }, |
There was a problem hiding this comment.
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 tracingPolicy configuration.
Per coding guidelines, commented-out code should be removed. If tracing is intended to be enabled in the future, track it as a TODO issue or feature request instead.
♻️ Proposed fix
model: googleAI3,
memory: pgMemory,
- // options: {
- // tracingPolicy: { internal: InternalSpans.ALL },
- // },
agents: {📝 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.
| // options: { | |
| // tracingPolicy: { internal: InternalSpans.ALL }, | |
| // }, | |
| model: googleAI3, | |
| memory: pgMemory, | |
| agents: { |
🤖 Prompt for AI Agents
In `@src/mastra/networks/reportGenerationNetwork.ts` around lines 121 - 123,
Remove the commented-out tracingPolicy configuration block (the commented lines
referencing options: { tracingPolicy: { internal: InternalSpans.ALL } }) from
reportGenerationNetwork so the codebase has no dead/commented code; if tracing
should be tracked for future work, create a TODO or issue instead of leaving the
commented lines in place and reference tracingPolicy/InternalSpans.ALL in that
task.
| // tools: { confirmationTool }, | ||
| workflows: { | ||
| weatherWorkflow, | ||
| financialReportWorkflow, | ||
| researchSynthesisWorkflow, | ||
| learningExtractionWorkflow, | ||
| }, | ||
| outputProcessors: [ | ||
| new TokenLimiterProcessor(128000), | ||
| // new BatchPartsProcessor({ | ||
| // batchSize: 20, | ||
| // maxWaitTime: 100, | ||
| // emitOnNonText: true, | ||
| // }), |
There was a problem hiding this comment.
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.
Per coding guidelines, commented-out code should be removed. Delete the commented-out confirmationTool and BatchPartsProcessor configuration.
♻️ Proposed fix
},
- // tools: { confirmationTool },
workflows: {
weatherWorkflow,
financialReportWorkflow,
researchSynthesisWorkflow,
learningExtractionWorkflow,
},
outputProcessors: [
new TokenLimiterProcessor(128000),
- // new BatchPartsProcessor({
- // batchSize: 20,
- // maxWaitTime: 100,
- // emitOnNonText: true,
- // }),
],
})📝 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.
| // tools: { confirmationTool }, | |
| workflows: { | |
| weatherWorkflow, | |
| financialReportWorkflow, | |
| researchSynthesisWorkflow, | |
| learningExtractionWorkflow, | |
| }, | |
| outputProcessors: [ | |
| new TokenLimiterProcessor(128000), | |
| // new BatchPartsProcessor({ | |
| // batchSize: 20, | |
| // maxWaitTime: 100, | |
| // emitOnNonText: true, | |
| // }), | |
| workflows: { | |
| weatherWorkflow, | |
| financialReportWorkflow, | |
| researchSynthesisWorkflow, | |
| learningExtractionWorkflow, | |
| }, | |
| outputProcessors: [ | |
| new TokenLimiterProcessor(128000), |
🤖 Prompt for AI Agents
In `@src/mastra/networks/reportGenerationNetwork.ts` around lines 130 - 143,
Remove the commented-out configuration entries: delete the commented reference
to confirmationTool in the tools block and remove the commented
BatchPartsProcessor configuration inside outputProcessors; keep the active
workflows (weatherWorkflow, financialReportWorkflow, researchSynthesisWorkflow,
learningExtractionWorkflow) and the TokenLimiterProcessor(128000) intact so only
live code remains in the export/object that defines workflows and
outputProcessors.

No description provided.