gh-pr-create-orchestration-cwd-wrong-headlisted
Install: claude install-skill wan-huiyan/agent-traffic-control
# `gh pr create` from orchestration worktree picks wrong head branch
## Problem
In a parallel-execution setup, an orchestrator dispatches sub-agents to feature
worktrees (`<repo>/.claude/worktrees/feature-A/`, `feature-B/`, etc.) and waits
on their completion. When the orchestrator then runs `gh pr create` to open
the PR for one of those features, **it gets opened against whatever branch is
currently checked out in the orchestrator's CWD** — not the feature
branch the subagent committed to.
Result: a PR with the right title and body but the wrong head branch
(typically the orchestrator's `docs/sNNN-handoff` or `main`-tracking branch).
The PR's diff is unrelated to the change description, and the actual feature
work never gets a PR.
## Trigger conditions
You're hitting this skill if **all** of:
1. Your workflow has multiple worktrees: one orchestrator + N feature
worktrees.
2. You ran `gh pr create` (with title + body via heredoc) from the
orchestrator's working directory.
3. `gh pr view <N> --json headRefName` returns your orchestrator's branch
(e.g. `docs/sNNN-handoff`), NOT the feature branch (e.g.
`fix/issue-XXX`).
4. The PR's diff in `gh pr diff <N>` doesn't match the body text.
Optional secondary signal:
- A revived subagent later opens a SECOND PR on the correct branch (because
it ran `gh pr create` from the feature worktree where its CWD was). Now you
have two PRs.
## Root cause
`gh pr create` defaults `--head` to the **current branch in the C