Skip to content

feat: add code command to run Next.js server and interact with the co…

53a4335
Select commit
Loading
Failed to load commit list.
Merged

Feat/code router orchestrator #608

feat: add code command to run Next.js server and interact with the co…
53a4335
Select commit
Loading
Failed to load commit list.
Cursor / Cursor BugBot completed Jul 11, 2025 in 3m 48s

BugBot Review

BugBot completed review and found 4 potential issues

Request ID: serverGenReqId_31772e95-c69f-44f3-9216-1e2c973462de

Details

Bug: Loop Counter Not Incremented Causes Infinite Loop

The count variable, intended as a loop depth limit, is never incremented in the while loop of findProjectRoot and getProjectRoot. This makes the count > 10 termination condition always false, effectively disabling the infinite loop protection and potentially causing an infinite loop if the 'microfox-root' file is not found and the filesystem root is not reached.

packages/cli/src/utils/findProjectRoot.ts#L3-L19

export async function findProjectRoot(startPath: string = process.cwd()): Promise<string | null> {
let currentPath = startPath;
let count = 0
while (true) {
const microfoxRootPath = path.join(currentPath, 'microfox-root');
if (fs.existsSync(microfoxRootPath)) {
return currentPath;
}
const parentPath = path.dirname(currentPath);
if (parentPath === currentPath || count > 10) {
// Reached the root of the file system
return null;
}
currentPath = parentPath;
}

apps/code/lib/helpers/utils.ts#L3-L19

export async function getProjectRoot(startPath: string = process.cwd()): Promise<string | null> {
let currentPath = startPath;
let count = 0
while (true) {
const microfoxRootPath = path.join(currentPath, 'microfox-root');
if (fs.existsSync(microfoxRootPath)) {
return currentPath;
}
const parentPath = path.dirname(currentPath);
if (parentPath === currentPath || count > 10) {
// Reached the root of the file system
return null;
}
currentPath = parentPath;
}

Fix in CursorFix in Web


Bug: Agent Input Parameter Access Issue

Multiple agents are incorrectly accessing input parameters (e.g., packageName, functionName, topic, context, textToSummarize) via ctx.request.params?.fieldName. Based on their inputSchema definitions and how they are called by other agents using ctx.next.callAgent, these parameters should be directly available on ctx.request (e.g., ctx.request.fieldName). This leads to parameters being undefined.

apps/code/lib/agents/slsFox/genFullSls.ts#L21-L22

.agent('/', async (ctx) => {
const packageName = ctx.request.params?.packageName as string

apps/code/lib/agents/slsFox/genOpenApi.ts#L65-L66

.agent('/', async (ctx) => {
const packageName = ctx.request.params?.packageName as string

apps/code/lib/agents/slsFox/genSdkMap.ts#L134-L135

.agent('/', async (ctx) => {
const packageName = ctx.request.params?.packageName as string

apps/code/lib/agents/slsFox/genOpenApiMd.ts#L96-L97

.agent('/', async (ctx) => {
const packageName = ctx.request.params?.packageName as string

apps/code/lib/agents/slsFox/genPathSpec.ts#L189-L191

.agent('/', async (ctx) => {
const packageName = ctx.request.params?.packageName as string
const functionName = ctx.request.params?.functionName as string

apps/code/lib/agents/slsFox/mergePathSpec.ts#L17-L18

.agent('/', async (ctx) => {
const packageName = ctx.request.params?.packageName as string

apps/code/lib/agents/slsFox/index.ts#L27-L28

.agent('/', async (ctx) => {
const { query, packageName: initialPackageName } = ctx.request.params as z.infer<typeof schema>;

apps/code/lib/agents/docs.ts#L18-L20

.agent('/', async (ctx) => {
const topic = ctx.request.params?.topic as string
const context = ctx.request.params?.context as any

apps/code/lib/agents/summarize.ts#L17-L18

.agent('/', async (ctx) => {
const textToSummarize = ctx.request.params?.textToSummarize as string

Fix in CursorFix in Web


Bug: Unhandled Null in Project Root Initialization

The getProjectRoot() function, now awaited, can return null. This null value is directly assigned to taskContext.projectRoot without validation, causing runtime errors in subsequent path operations if the project root is not found.

apps/code/lib/middlewares/getPackageInfo.ts#L19-L20

// 1. Initialize Paths
taskContext.projectRoot = await getProjectRoot();

apps/code/lib/middlewares/getPackageDocs.ts#L17-L18

// 1. Initialize Paths
taskContext.projectRoot = await getProjectRoot();

Fix in CursorFix in Web


Bug: Agent Fails to Execute Tool Calls

The receptionistAgent generates tool calls but fails to execute them, instead writing them as text to the response, preventing the intended actions from being performed. Furthermore, the prompt parameter is accessed inconsistently via ctx.request.prompt instead of ctx.request.params?.prompt, which could lead to runtime errors.

apps/code/lib/agents/index.ts#L21-L44

.agent('/', async (ctx) => {
const { prompt } = ctx.request
ctx.response.write({ type: 'text', text: 'Finding the right agent for the job...\n' });
const { toolCalls } = await generateText({
model: google('gemini-2.5-pro-preview-06-05'),
prompt: `You are a highly intelligent routing system. Your purpose is to deeply analyze a user's request to understand its fundamental intent. From this analysis, you will determine the single most appropriate specialized function to execute.
Analyze the following user prompt:
---
${prompt}
---
Now, determine the core task the user wants to accomplish and invoke the corresponding function.`,
tools: {
slsfox: ctx.next.agentAsTool("/slsfox"),
summarize: ctx.next.agentAsTool("/summarize"),
docs: ctx.next.agentAsTool("/docs"),
code: ctx.next.agentAsTool("/code"),
}
});
ctx.response.write({ type: 'text', text: `\nExecution complete. Tool Calls:\n${toolCalls}` });

Fix in CursorFix in Web


BugBot free trial expires on July 22, 2025
You have used $0.00 of your $50.00 spend limit so far. Manage your spend limit in the Cursor dashboard.

Was this report helpful? Give feedback by reacting with 👍 or 👎