Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/app/api/agents/[agentName]/next-task/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
createFollowupPrTask,
createGroomTask,
} from "@/lib/agent-task";
import { isBacklogLane } from "@/lib/lane-config";
import { isBacklogLane, isValidLane, getLaneIds } from "@/lib/lane-config";

export async function GET(
request: Request,
Expand Down Expand Up @@ -122,6 +122,16 @@ export async function GET(
const issueLane = lane?.toLowerCase();
const prFixLane = lane;

// Validate lane against configured lanes (allow omitting lane for backward compatibility)
if (issueLane && !isValidLane(issueLane)) {
return NextResponse.json(
{
error: `Invalid lane: "${lane}". Must be one of: ${getLaneIds().join(", ")}`,
},
{ status: 400 },
);
}

const leasedIssueIds = await findLeasedIssueIds(agentName);

const prFixItems = await listQueuedPrFixItems(
Expand Down
Loading