Don't apply the worktree default when resuming a session - #62
Conversation
resolveDefaultSessionOptions() is shared by new-session creation and resume.
The `worktree: true` global default makes sense only for NEW sessions (start
in a fresh isolated git worktree). On resume it's wrong: a plain click on a
session resolves to {worktree:true}, so it tries to resume the existing
session into a brand-new worktree and fails to attach — the terminal never
shows and the session looks stuck "inactive". "Resume with config" works
only because the resume dialog has no worktree control and never sets it.
Strip worktree/worktreeName from the resolved options on the resume path so
plain click resumes in place, matching the dialog.
|
Thanks for this — the bug is real and the diagnosis was spot on. Closing in favour of your other fix for the same issue. While reviewing this alongside #70, I found you'd written this twice: once here ( I went with the main-process version because of the gap your own commit message calls out. This PR strips the option inside const options = await resolveDefaultSessionOptions(project); // carries worktree: true
await window.api.openTerminal(result.sessionId, project.projectPath, false, options); // isNew=false → resumeSo "Create scheduled task" would have stayed broken on any project with the worktree default enabled. Gating at the One follow-up if you're up for it: neither version ships a test, and now that the decision lives at a single chokepoint in the main process it's straightforward to cover. A regression here is silent — the session just fails to attach — so it's worth pinning down. Same situation applies to #60: #70 carries your reconcile fix plus d9210b6, which adds a 1s throttle because |
Problem
A plain click on a session in the sidebar does nothing — no terminal appears, the session stays "inactive" — yet Resume with config works. So a session can only be interacted with through the config dialog.
Cause
openSession()resumes withresolveDefaultSessionOptions(), which is shared with new-session creation and includes the globalworktree: truedefault. Resuming an existing session with--worktreetries to spin it up in a fresh git worktree and fails to attach, so the terminal never shows.showResumeSessionDialog()has no worktree control and never sets the flag — which is exactly why "Resume with config" works. Plain click and the dialog should behave the same.Fix
Strip
worktree/worktreeNamefrom the resolved options on the resume path inopenSession():New-session creation is untouched (still honors the worktree default). Worktree is a new-session concept — resuming must reuse the session's existing directory.
Testing
Built locally (Electron 41, Linux) with
worktree: trueas the default: plain click now resumes in place and attaches, matching the dialog. New-session-in-worktree still works.