From d6399c20e10e3ade5cc381ae562ff66e384989f0 Mon Sep 17 00:00:00 2001 From: Matthieu Date: Mon, 16 Mar 2026 09:26:36 +0100 Subject: [PATCH] fix : fix MCP create-task tool crashing on task creation CreateTaskTool called nonexistent findMaxNumberByProject instead of findMaxNumberByProjectForUpdate. Also removed FOR UPDATE clause from the query as PostgreSQL does not support it with aggregate functions. Co-Authored-By: Claude Opus 4.6 --- src/Mcp/Tool/Task/CreateTaskTool.php | 2 +- src/Repository/TaskRepository.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Mcp/Tool/Task/CreateTaskTool.php b/src/Mcp/Tool/Task/CreateTaskTool.php index 716de42..9e71ea3 100644 --- a/src/Mcp/Tool/Task/CreateTaskTool.php +++ b/src/Mcp/Tool/Task/CreateTaskTool.php @@ -54,7 +54,7 @@ class CreateTaskTool $task = new Task(); $task->setProject($project); $task->setTitle($title); - $task->setNumber($this->taskRepository->findMaxNumberByProject($project) + 1); + $task->setNumber($this->taskRepository->findMaxNumberByProjectForUpdate($project) + 1); if (null !== $description) { $task->setDescription($description); diff --git a/src/Repository/TaskRepository.php b/src/Repository/TaskRepository.php index d2fb050..99857a5 100644 --- a/src/Repository/TaskRepository.php +++ b/src/Repository/TaskRepository.php @@ -28,7 +28,7 @@ class TaskRepository extends ServiceEntityRepository $conn = $this->getEntityManager()->getConnection(); $result = $conn->fetchOne( - 'SELECT COALESCE(MAX(number), 0) FROM task WHERE project_id = :project FOR UPDATE', + 'SELECT COALESCE(MAX(number), 0) FROM task WHERE project_id = :project', ['project' => $project->getId()], );