Skip to content

feat(tasks): add From Branch worktree default setting#1998

Merged
arnestrickmann merged 1 commit into
generalaction:mainfrom
benjaminshoemaker:codex/from-branch-worktree-default
May 13, 2026
Merged

feat(tasks): add From Branch worktree default setting#1998
arnestrickmann merged 1 commit into
generalaction:mainfrom
benjaminshoemaker:codex/from-branch-worktree-default

Conversation

@benjaminshoemaker
Copy link
Copy Markdown
Contributor

@benjaminshoemaker benjaminshoemaker commented May 12, 2026

Summary

  • add a task-level app setting for creating a branch/worktree by default
  • surface the setting in General settings next to the existing task/worktree controls
  • apply the setting only to From Branch task creation; From Issue and PR flows retain their existing defaults

Validation

  • pnpm run format
  • pnpm run format:check
  • pnpm run typecheck
  • pnpm run lint (passes with one existing warning in command-palette-modal.tsx)
  • pnpm run test
  • Computer Use local dev app verification: setting appears in General settings, can be toggled off, persists to app_settings, and From Branch task modal opens with Create task branch and worktree unchecked

@benjaminshoemaker benjaminshoemaker force-pushed the codex/from-branch-worktree-default branch from fab226e to b8ba5a0 Compare May 12, 2026 20:38
@benjaminshoemaker benjaminshoemaker changed the title Add From Branch worktree default setting feat(tasks): add From Branch worktree default setting May 12, 2026
@benjaminshoemaker
Copy link
Copy Markdown
Contributor Author

01-emdash-dev-setting-default-on 02-emdash-dev-setting-off 03-emdash-dev-from-branch-worktree-off

@arnestrickmann
Copy link
Copy Markdown
Contributor

This was fast @benjaminshoemaker
Thanks for the PR - will have a look soon and keep you up to date here!

@benjaminshoemaker benjaminshoemaker marked this pull request as ready for review May 12, 2026 22:03
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 12, 2026

Greptile Summary

This PR adds a new app-level setting (createBranchAndWorktree) that controls whether the "Create task branch and worktree" checkbox in the "From Branch" task modal is checked by default. The setting is surfaced in General Settings alongside the existing task controls and defaults to true, preserving the previous hardcoded behaviour.

  • Schema & defaults: createBranchAndWorktree: boolean is added to the Zod schema and registry with a default of true, consistent with the prior hardcoded value.
  • State refactor in use-branch-selection: the internal boolean state is replaced with a boolean | undefined override that falls back to the new prop, so the in-modal toggle still works as a one-shot override while the setting drives the initial state.
  • Scope: the setting is intentionally threaded only through useFromBranchMode; From Issue and From PR flows continue to receive the true default via the function parameter default, matching the stated design intent.

Confidence Score: 5/5

Safe to merge — the change is additive, backwards-compatible, and well-scoped to the From Branch flow.

All three callers of useBranchSelection are accounted for: From Branch now receives the setting value, while From Issue and From PR continue to use the true default via the parameter default. The override/fallback pattern in use-branch-selection is reactive and correct. Defaults across the schema, registry, and hook fallback all agree on true, so existing users see no behaviour change.

No files require special attention.

Important Files Changed

Filename Overview
src/main/core/settings/schema.ts Adds createBranchAndWorktree: z.boolean() to the task settings Zod schema — straightforward, no issues.
src/main/core/settings/settings-registry.ts Adds createBranchAndWorktree: true to the task settings defaults — consistent with both the schema and the useTaskSettings fallback.
src/renderer/features/tasks/hooks/useTaskSettings.ts Extends TaskSettingsModel with createBranchAndWorktree, its updater, and its reset — follows the exact same pattern as the two existing settings.
src/renderer/features/settings/components/TaskSettingsRows.tsx New CreateBranchAndWorktreeRow component mirrors AutoTrustWorktreesRow exactly; correctly wires isFieldOverridden, reset, and toggle callbacks.
src/renderer/features/settings/components/SettingsPage.tsx Imports and renders CreateBranchAndWorktreeRow between AutoTrustWorktreesRow and EnableTmuxRow — clean insertion, no issues.
src/renderer/features/tasks/create-task-modal/use-branch-selection.ts Adds createBranchAndWorktreeByDefault parameter (default true) and refactors internal state to an override pattern so the prop drives the default while user in-modal toggling still works correctly.
src/renderer/features/tasks/create-task-modal/use-from-branch-mode.ts Reads createBranchAndWorktree from useTaskSettings and forwards it as the default to useBranchSelection, scoping the new setting exclusively to the From Branch flow as intended.

Reviews (1): Last reviewed commit: "feat(tasks): add From Branch worktree de..." | Re-trigger Greptile

Copy link
Copy Markdown
Contributor

@arnestrickmann arnestrickmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@arnestrickmann arnestrickmann merged commit 16e58c8 into generalaction:main May 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants