From 538477865d20785a39f10ce000eaf54b45ceb489 Mon Sep 17 00:00:00 2001 From: ymajoros Date: Thu, 4 Jun 2026 15:05:40 +0200 Subject: [PATCH] Ignore the worktree option when resuming a session (fix at the source) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --worktree creates a fresh isolated git worktree, which only makes sense when STARTING a session. On resume (isNew === false) it makes claude try to spin up a new worktree and fail to attach — so a plain sidebar click, and equally the "Create scheduled task" flow (launchScheduleCreator also resumes via openTerminal with isNew=false), silently broke. Rather than stripping the option at each renderer call site, gate it in the open-terminal handler: only append --worktree when isNew. That closes every current and future resume path in one place, and avoids mutating the caller's options object. --- main.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 9bae4d77..dae3350c 100644 --- a/main.js +++ b/main.js @@ -1494,7 +1494,13 @@ ipcMain.handle('open-terminal', async (_event, sessionId, projectPath, isNew, se } else if (sessionOptions.permissionMode) { claudeCmd += ` --permission-mode "${sessionOptions.permissionMode}"`; } - if (sessionOptions.worktree) { + // --worktree only applies when STARTING a session — it creates a fresh + // isolated git worktree. Resuming (isNew === false) must reuse the + // session's existing directory, so ignore the worktree option on resume + // regardless of which call site supplied it (sidebar click, schedule + // creator, fork, …). Otherwise a resume tries to spin up a new worktree + // and fails to attach. + if (isNew && sessionOptions.worktree) { claudeCmd += ' --worktree'; if (sessionOptions.worktreeName) { claudeCmd += ` "${sessionOptions.worktreeName}"`;