Feature request
Allow users to explicitly choose whether an agent-created independent session uses a new Git worktree. The create_session tool should honor that choice rather than relying only on inherited isolation.
Implemented by #335076.
Expected behavior
- Set
worktree: true only when the user explicitly requests a new worktree.
- Set
worktree: false only when the user explicitly requests working without a worktree.
- Omit
worktree when the user has not made an explicit choice, preserving existing isolation inheritance/defaults.
- Never combine
worktree with relationship: currentSession; either boolean value is rejected before creating a chat or session.
- With
worktree: false, resolve a known existing worktree folder to its project root before creating the independent session.
Verification steps
Use the Agents window with a Git project and inspect the create_session tool arguments and the resulting working directory/branch, not just the assistant summary.
- Explicit worktree: Ask “Start implementation in a new independent session with a new worktree.” Verify
relationship: independent, worktree: true, and a newly created worktree.
- No worktree from an existing worktree: Start from a session already using a managed worktree and ask “Start implementation in a new independent session without a worktree.” Verify
worktree: false; the new session uses the known project root, not the parent worktree, and no additional worktree is created.
- No explicit choice: Ask for an independent session without mentioning worktrees. Verify the agent omits
worktree. For the same project, existing isolation is inherited; a different project retains the existing worktree default.
- Current-session work: Ask for a new chat in the current session. Verify
relationship: currentSession, no worktree argument, and the existing workspace is shared.
- Folder fallback: Request an independent session without a worktree for a folder with no known project mapping. Verify that the supplied folder is used directly.
- If available, repeat step 2 for a remote project and verify that its remote URI/authority is preserved.
Unit tests additionally cover invalid boolean values and rejection of currentSession combined with either worktree: true or worktree: false.
Feature request
Allow users to explicitly choose whether an agent-created independent session uses a new Git worktree. The
create_sessiontool should honor that choice rather than relying only on inherited isolation.Implemented by #335076.
Expected behavior
worktree: trueonly when the user explicitly requests a new worktree.worktree: falseonly when the user explicitly requests working without a worktree.worktreewhen the user has not made an explicit choice, preserving existing isolation inheritance/defaults.worktreewithrelationship: currentSession; either boolean value is rejected before creating a chat or session.worktree: false, resolve a known existing worktree folder to its project root before creating the independent session.Verification steps
Use the Agents window with a Git project and inspect the
create_sessiontool arguments and the resulting working directory/branch, not just the assistant summary.relationship: independent,worktree: true, and a newly created worktree.worktree: false; the new session uses the known project root, not the parent worktree, and no additional worktree is created.worktree. For the same project, existing isolation is inherited; a different project retains the existing worktree default.relationship: currentSession, noworktreeargument, and the existing workspace is shared.Unit tests additionally cover invalid boolean values and rejection of
currentSessioncombined with eitherworktree: trueorworktree: false.