Repository navigation
Add settings toggle to isolate new threads in a git worktree by default - #2
Conversation
New defaultWorktree app setting. When enabled, plain 'New thread' creates a worktree thread (local projects only; explicit opts and remote projects are unaffected). Wired through store validation, AppSettings, useCoder.createThread, SettingsModal checkbox, and the dev/test doubles. Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Lines 544 to 546 in 4a15094
When defaultWorktree is enabled, this only injects worktree: true for threads created through the React hook. Scheduled automations bypass this path and create/run threads directly in electron/automations.js via services.createThread, so those agent runs still execute in the project checkout and can collide with other work even though the user enabled global isolation. Apply the default in the backend creation path, or pass it from automation, so all new agent threads honor the setting.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
What
Adds a defaultWorktree app setting (Settings → Threads → "Isolate new threads in a git worktree"). When enabled, the plain New thread button creates a worktree thread — its own branch and working directory under
<userData>/worktrees/<threadId>— instead of running the agent directly in the project checkout.Why
Worktree isolation already existed but only behind the caret menu's "New worktree thread", so most threads ran in the main checkout and concurrent threads on the same project could step on each other's files. This closes that gap by letting users make it the default while keeping plain threads available.
How
electron/store.js: newdefaultWorktreesetting — absent/junk on disk heals tofalse,setSettingsrejects non-booleans, persists alongside budget/auto-settle.src/shared/ipc.ts:AppSettings.defaultWorktree: boolean.src/useCoder.ts:createThreadis the single choke point — when the setting is on and the project is local it sendsworktree: true, so every plain-creation path (sidebar button, kanban empty state) gets isolation. Explicitopts.worktreestill wins; remote projects always get plain threads (worktrees are local-only, matching the existing IPC guard).src/components/SettingsModal.tsx: new Threads section with a save-on-toggle checkbox.src/devCoder.ts/test/support/fakeCoder.ts: dev and test doubles mirror the setting with the same validation.electron/test/auto-settle-settings.test.js; full-shape settings assertions updated there and inbudget-spend.test.js.No behavior change with the toggle off (the default). All downstream machinery (branch naming, merge, PR, checkpoints) is unchanged — this only changes who opts in.
Testing
npm run typecheck— cleannpm run test:electron— 650/650 passnpm run test:renderer— 699/699 passPR created by the Claude Code agent