fix(worktree): executor agents verify and fix branch base on Windows
When EnterWorktree creates a branch from main instead of the current HEAD (a known issue on Windows), executor agents now detect the mismatch and reset their branch base to the correct commit before starting work. - execute-phase: capture EXPECTED_BASE before spawning, inject <worktree_branch_check> block into executor prompts - execute-plan: document Pattern A worktree_branch_check requirement - quick.md: inject worktree_branch_check into executor prompt - diagnose-issues: inject worktree_branch_check into debugger prompts - settings: add workflow.use_worktrees option so Windows users can disable worktree isolation via /gsd:settings without editing files Closes #1510 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -550,6 +550,11 @@ Offer: 1) Force proceed, 2) Abort
|
||||
|
||||
**Step 6: Spawn executor**
|
||||
|
||||
Capture current HEAD before spawning (used for worktree branch check):
|
||||
```bash
|
||||
EXPECTED_BASE=$(git rev-parse HEAD)
|
||||
```
|
||||
|
||||
Spawn gsd-executor with plan reference:
|
||||
|
||||
```
|
||||
@@ -557,6 +562,15 @@ Task(
|
||||
prompt="
|
||||
Execute quick task ${quick_id}.
|
||||
|
||||
${USE_WORKTREES !== "false" ? `
|
||||
<worktree_branch_check>
|
||||
FIRST ACTION before any other work: verify this worktree branch is based on the correct commit.
|
||||
Run: git merge-base HEAD ${EXPECTED_BASE}
|
||||
If the result differs from ${EXPECTED_BASE}, run: git reset --soft ${EXPECTED_BASE}
|
||||
This corrects a known issue on Windows where EnterWorktree creates branches from main instead of the feature branch HEAD.
|
||||
</worktree_branch_check>
|
||||
` : ''}
|
||||
|
||||
<files_to_read>
|
||||
- ${QUICK_DIR}/${quick_id}-PLAN.md (Plan)
|
||||
- .planning/STATE.md (Project state)
|
||||
|
||||
Reference in New Issue
Block a user