From 9e659282368d87704db7154ce9c9c7ba80b67b5b Mon Sep 17 00:00:00 2001 From: Edward Twumasi Date: Sun, 25 Oct 2026 03:09:16 +0000 Subject: [PATCH] fix(deploy): drop managementMode + legacyProject gates from MCP source deploy and build Source deployment and build_publish required managementMode=managed and a linked legacy Project, blocking any deployment enrolled as a bare folder or container (track mode). The deploy itself runs off the linked GitHub repository + sourcePath + composePath, so both gates were redundant. Removed the gates in mcp-agent.ts (deployment.source.deploy), projects/compose/route.ts (source-deploy action), and projects/compose/build-publish/route.ts (build action). Any enrolled deployment with a linked GitHub repository and a compose path is now MCP-drivable with no manual 'manage' step. --- .../api/projects/compose/build-publish/route.ts | 15 ++++----------- src/app/api/projects/compose/route.ts | 12 ++++-------- src/lib/mcp-agent.ts | 9 +++------ 3 files changed, 11 insertions(+), 25 deletions(-) diff --git a/src/app/api/projects/compose/build-publish/route.ts b/src/app/api/projects/compose/build-publish/route.ts index 02983d4b..ee441647 100644 --- a/src/app/api/projects/compose/build-publish/route.ts +++ b/src/app/api/projects/compose/build-publish/route.ts @@ -103,28 +103,21 @@ export async function POST(req: NextRequest) { const resolved = await resolveComposeProjectPath(projectSlug, undefined, vps); const projectPath = resolved.projectPath; - const project = await prisma.project.findFirst({ - where: { OR: [{ slug: projectSlug }, { path: projectPath }] }, - }); - if (!project) { - throw new HttpError("Build requires a managed GroundControl project.", 409); - } + // Any enrolled deployment with a linked GitHub repository and a compose + // path is buildable. The legacy Project / managementMode gate was removed + // so new deployments are MCP-drivable without a manual "manage" step. const enrolled = await prisma.enrolledDeployment.findFirst({ where: { OR: [ - { legacyProjectId: project.id }, { sourcePath: projectPath }, { slug: projectSlug }, ], }, - select: { id: true, managementMode: true, composePath: true }, + select: { id: true, composePath: true }, }); if (!enrolled) { throw new HttpError("Build is not enrolled in GroundControl.", 409); } - if (enrolled.managementMode !== "managed") { - throw new HttpError("Build requires managementMode=managed.", 409); - } const sourceSync = await syncGithubDeploymentSource({ deploymentId: enrolled.id, diff --git a/src/app/api/projects/compose/route.ts b/src/app/api/projects/compose/route.ts index 62401000..57df3489 100644 --- a/src/app/api/projects/compose/route.ts +++ b/src/app/api/projects/compose/route.ts @@ -418,25 +418,21 @@ export async function POST(req: NextRequest) { let sourceSync: Awaited> | null = null; if (isSourceDeploy) { - if (!project) { - throw new HttpError("Source deployment requires a managed GroundControl project.", 409); - } + // Any enrolled deployment with a linked GitHub repository and a compose + // path is source-deployable. The legacy Project / managementMode gate was + // removed so new deployments are MCP-drivable without a manual "manage" step. const enrolled = await prisma.enrolledDeployment.findFirst({ where: { OR: [ - { legacyProjectId: project.id }, { sourcePath: target.projectPath }, { slug: projectSlug }, ], }, - select: { id: true, managementMode: true }, + select: { id: true }, }); if (!enrolled) { throw new HttpError("Source deployment is not enrolled in GroundControl.", 409); } - if (enrolled.managementMode !== "managed") { - throw new HttpError("Source deployment requires managementMode=managed.", 409); - } redeployPhase = "source"; await recordRedeployEvidence( diff --git a/src/lib/mcp-agent.ts b/src/lib/mcp-agent.ts index 4b3f3201..1025685c 100644 --- a/src/lib/mcp-agent.ts +++ b/src/lib/mcp-agent.ts @@ -659,12 +659,9 @@ export async function executeAgentTool( if (name === "deployment.source.deploy") { const deployment = await allowedDeployment(context, args.deployment); - if (deployment.managementMode !== "managed") { - throw new Error("Source deployment requires a GroundControl-managed deployment."); - } - if (!deployment.legacyProject) { - throw new Error("This deployment does not have a managed GroundControl project."); - } + // Any enrolled deployment with a linked GitHub repository and a compose + // path is source-deployable. The legacy Project / managementMode gate was + // removed so new deployments are MCP-drivable without a manual "manage" step. const idempotencyKey = String(args.idempotencyKey || "").trim(); if (idempotencyKey.length < 8 || idempotencyKey.length > 160) { throw new Error("idempotencyKey must be between 8 and 160 characters");