Created
June 3, 2026 00:38
-
-
Save 0xdhx/504c5b895b40d3e30871d25ff956a5e0 to your computer and use it in GitHub Desktop.
Minimal isolation: git worktree list first-entry != the orchestrator's worktree (gsd-core execute-phase wave-cleanup, #3174 follow-up)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Minimal isolation: `git worktree list`'s first entry is the MAIN checkout, | |
| # not the worktree you are running from. Resolving PRIMARY_WT to the first | |
| # entry therefore mis-pins the orchestrator whenever it runs from a | |
| # non-primary worktree (a per-phase worktree "lane"). | |
| set -euo pipefail | |
| tmp=$(mktemp -d); cd "$tmp" | |
| git init -q r && cd r && git commit -q --allow-empty -m init | |
| git worktree add -q ../lane -b lane # second worktree on branch 'lane' | |
| cd ../lane # orchestrator runs from the lane, not the primary | |
| PRIMARY_WT=$(git worktree list --porcelain | awk '/^worktree /{print substr($0,10); exit}') | |
| echo "cwd (orchestrator worktree): $(pwd -P)" | |
| echo "PRIMARY_WT (first-entry): $(cd "$PRIMARY_WT" && pwd -P)" | |
| # => PRIMARY_WT is .../r (the main checkout), NOT .../lane. execute-phase.md then | |
| # cd's the orchestrator off its lane; the ORCH_BRANCH == EXPECTED_BRANCH assert | |
| # fails closed and merge-back is refused. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment