Merge pull request #21 from madhura68/fix/idea-job-claim-leftjoin

fix: idea-jobs never claimed — LEFT JOIN tasks (v0.6.1)
This commit is contained in:
Janpeter Visser 2026-05-05 12:46:22 +02:00 committed by GitHub
commit 1ac87deb0e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View file

@ -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": {

View file

@ -249,12 +249,14 @@ export async function tryClaimJob(
): Promise<string | null> {
// 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<Array<{ id: string; implementation_plan: string | null }>>`
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<Array<{ id: string; implementation_plan: string | null }>>`
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