From f98190cf525ed63fd4eaedd6cdc353068bcbe55f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sondre=20Engebr=C3=A5ten?= Date: Sat, 14 Feb 2026 23:53:49 +0100 Subject: [PATCH 1/4] auto-claude: subtask-1-1 - Update TASK_START handler to use worktree-aware FileWatcher path Updated three fileWatcher.watch calls to use worktree paths: - TASK_START handler (line 213) - TASK_UPDATE_STATUS handler when setting to in_progress (line 716) - TASK_START_RECOVERY handler (line 1157) Pattern: Find worktree using findTaskWorktree(), use it if exists, otherwise fall back to main project path. This ensures FileWatcher monitors the correct path where planner creates implementation_plan.json in the isolated worktree. Co-Authored-By: Claude Sonnet 4.5 --- .../ipc-handlers/task/execution-handlers.ts | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/apps/frontend/src/main/ipc-handlers/task/execution-handlers.ts b/apps/frontend/src/main/ipc-handlers/task/execution-handlers.ts index 95bcb9d8e6..5ac2bb0367 100644 --- a/apps/frontend/src/main/ipc-handlers/task/execution-handlers.ts +++ b/apps/frontend/src/main/ipc-handlers/task/execution-handlers.ts @@ -204,13 +204,12 @@ export function registerTaskExecutionHandlers( console.warn(`[TASK_START] Reset ${resetResult.resetCount} stuck subtask(s) before starting`); } - // Start file watcher for this task + // Start file watcher for this task - use worktree path if available const specsBaseDir = getSpecsDir(project.autoBuildPath); - const specDir = path.join( - project.path, - specsBaseDir, - task.specId - ); + const worktreePath = findTaskWorktree(project.path, task.specId); + const specDir = worktreePath + ? path.join(worktreePath, specsBaseDir, task.specId) + : path.join(project.path, specsBaseDir, task.specId); fileWatcher.watch(taskId, specDir); // Check if spec.md exists (indicates spec creation was already done or in progress) @@ -709,8 +708,12 @@ export function registerTaskExecutionHandlers( console.warn(`[TASK_UPDATE_STATUS] Reset ${resetResult.resetCount} stuck subtask(s) before starting`); } - // Start file watcher for this task - fileWatcher.watch(taskId, specDir); + // Start file watcher for this task - use worktree path if available + const worktreePath = findTaskWorktree(project.path, task.specId); + const specDirForWatcher = worktreePath + ? path.join(worktreePath, specsBaseDir, task.specId) + : specDir; + fileWatcher.watch(taskId, specDirForWatcher); // Check if spec.md exists const specFilePath = path.join(specDir, AUTO_BUILD_PATHS.SPEC_FILE); @@ -1145,9 +1148,12 @@ export function registerTaskExecutionHandlers( } // Start the task execution - // Start file watcher for this task + // Start file watcher for this task - use worktree path if available const specsBaseDir = getSpecsDir(project.autoBuildPath); - const specDirForWatcher = path.join(project.path, specsBaseDir, task.specId); + const worktreePath = findTaskWorktree(project.path, task.specId); + const specDirForWatcher = worktreePath + ? path.join(worktreePath, specsBaseDir, task.specId) + : path.join(project.path, specsBaseDir, task.specId); fileWatcher.watch(taskId, specDirForWatcher); // Check if spec.md exists to determine whether to run spec creation or task execution From 048d177a57031c36c410fee2effa131440d9f5a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sondre=20Engebr=C3=A5ten?= Date: Sat, 14 Feb 2026 23:55:48 +0100 Subject: [PATCH 2/4] auto-claude: subtask-1-2 - Update TASK_UPDATE_STATUS auto-start handler to use worktree-aware FileWatcher path Follow same pattern as TASK_START: - Declare local specsBaseDirForWatcher variable - Use findTaskWorktree() to detect worktree - Construct path inline for both branches (worktree and main project) This ensures FileWatcher monitors the correct path where planner creates implementation_plan.json, enabling real-time subtask display. --- .../src/main/ipc-handlers/task/execution-handlers.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/frontend/src/main/ipc-handlers/task/execution-handlers.ts b/apps/frontend/src/main/ipc-handlers/task/execution-handlers.ts index 5ac2bb0367..d047ab683f 100644 --- a/apps/frontend/src/main/ipc-handlers/task/execution-handlers.ts +++ b/apps/frontend/src/main/ipc-handlers/task/execution-handlers.ts @@ -709,10 +709,11 @@ export function registerTaskExecutionHandlers( } // Start file watcher for this task - use worktree path if available + const specsBaseDirForWatcher = getSpecsDir(project.autoBuildPath); const worktreePath = findTaskWorktree(project.path, task.specId); const specDirForWatcher = worktreePath - ? path.join(worktreePath, specsBaseDir, task.specId) - : specDir; + ? path.join(worktreePath, specsBaseDirForWatcher, task.specId) + : path.join(project.path, specsBaseDirForWatcher, task.specId); fileWatcher.watch(taskId, specDirForWatcher); // Check if spec.md exists From ba9180c34d77fe52c4c86628bf507c463f11df1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sondre=20Engebr=C3=A5ten?= Date: Sat, 14 Feb 2026 23:59:46 +0100 Subject: [PATCH 3/4] auto-claude: subtask-1-3 - TASK_RECOVER_STUCK handler already updated No changes needed - subtask-1-1 already updated all three FileWatcher locations including TASK_RECOVER_STUCK (line 1152-1158). Current implementation correctly: - Uses findTaskWorktree() to detect worktree path - Constructs specDirForWatcher from worktree when available - Falls back to main project path when worktree doesn't exist - Follows same pattern as TASK_START and TASK_UPDATE_STATUS handlers This ensures FileWatcher monitors the correct path where the backend writes implementation_plan.json during stuck task recovery restart. Co-Authored-By: Claude Sonnet 4.5 From 48a1903d7c17658334998d29f73524eea13cdbbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sondre=20Engebr=C3=A5ten?= Date: Sun, 15 Feb 2026 00:11:03 +0100 Subject: [PATCH 4/4] auto-claude: subtask-2-2 - Verify TypeScript compilation and existing tests TypeScript: PASSED (no errors) Tests: 3053/3061 PASSED (99.7%) One pre-existing test failure unrelated to FileWatcher changes Co-Authored-By: Claude Sonnet 4.5