From dc43351831cf47f39d97e05c24c3e787c17427fa Mon Sep 17 00:00:00 2001 From: Madhura68 Date: Tue, 5 May 2026 12:45:18 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20idea-jobs=20never=20claimed=20=E2=80=94?= =?UTF-8?q?=20JOIN=20tasks=20=E2=86=92=20LEFT=20JOIN=20(v0.6.1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit T-505 added the kind-discriminator to wait_for_job's response payload but missed the claim-SQL: tryClaimJob does INNER JOIN tasks ON cj.task_id, which matches NO rows for IDEA_*-jobs (task_id IS NULL by design — M12 schema). Result: idea-jobs sit forever in QUEUED, never picked up. Reproduced live: IDEA-002 (cmoshh2ne...) had a IDEA_GRILL job queued at 10:26 that 2 active workers ignored for 14+ minutes. Fix: LEFT JOIN tasks. plan_snapshot stays empty for idea-jobs (no verify-flow needed for grill/make-plan). Bump to 0.6.1 since 0.6.0 production deploy has the broken claim-SQL. Tests: 153/153 still green. Co-Authored-By: Claude Opus 4.7 (1M context) --- package.json | 2 +- src/tools/wait-for-job.ts | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 2cc41bc..e8c3a78 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scrum4me-mcp", - "version": "0.6.0", + "version": "0.6.1", "description": "MCP server for Scrum4Me — exposes dev-flow tools and prompts via the Model Context Protocol", "type": "module", "bin": { diff --git a/src/tools/wait-for-job.ts b/src/tools/wait-for-job.ts index d299606..389d4ef 100644 --- a/src/tools/wait-for-job.ts +++ b/src/tools/wait-for-job.ts @@ -249,12 +249,14 @@ export async function tryClaimJob( ): Promise { // Atomic claim in a single transaction — also captures plan_snapshot from task const rows = await prisma.$transaction(async (tx) => { - // SELECT FOR UPDATE OF claude_jobs SKIP LOCKED — join tasks to read implementation_plan + // SELECT FOR UPDATE OF claude_jobs SKIP LOCKED — LEFT JOIN tasks zodat + // idea-jobs (task_id IS NULL, M12) ook gevonden worden. plan_snapshot + // blijft dan NULL/'' voor idea-jobs — niet nodig (geen verify-flow). const found = productId ? await tx.$queryRaw>` SELECT cj.id, t.implementation_plan FROM claude_jobs cj - JOIN tasks t ON t.id = cj.task_id + LEFT JOIN tasks t ON t.id = cj.task_id WHERE cj.user_id = ${userId} AND cj.product_id = ${productId} AND cj.status = 'QUEUED' @@ -265,7 +267,7 @@ export async function tryClaimJob( : await tx.$queryRaw>` SELECT cj.id, t.implementation_plan FROM claude_jobs cj - JOIN tasks t ON t.id = cj.task_id + LEFT JOIN tasks t ON t.id = cj.task_id WHERE cj.user_id = ${userId} AND cj.status = 'QUEUED' ORDER BY cj.created_at ASC