fix(#3021): recognize worktree-wf_* branch namespace in all guards (#3109)

* fix(#3021): recognize worktree-wf_* branch namespace in all guards

The Claude-orchestration Workflow backend (#1143) creates per-plan
worktrees on branches named worktree-wf_<runid>-<n>. Four independent
copies of the agent branch allow-list regex (^(worktree-)?agent-...) never
learned this namespace:
- hooks/gsd-worktree-path-guard.js:176 — FAILED OPEN (process.exit(0)),
  silently disabling path containment for exactly the concurrent dispatch
  mode where cross-worktree writes are most likely
- src/worktree-safety.cts:21 — silently dropped cleanup-wave manifest
  entries
- agents/gsd-executor.md:503 — FATAL halt on branch check
- gsd-core/references/worktree-branch-check.md:33 — same FATAL halt

Extended all four to ^((worktree-)?agent-|worktree-wf_)[A-Za-z0-9._/-]+$.
The path guard now correctly blocks cross-worktree writes for Workflow-
backend branches instead of no-op'ing.

* chore(#3021): backfill changeset PR number 3109

---------

Co-authored-by: sim <sim@local>
This commit is contained in:
Tom Boucher
2026-08-06 04:26:59 -04:00
committed by GitHub
parent bbdf34a332
commit 10da377794
11 changed files with 36 additions and 22 deletions

View File

@@ -167,9 +167,9 @@ describe('canonical worktree-branch-check fragment is the single source of truth
assert.ok(/\brelease\b/.test(block), 'fragment protected-ref alternation must include release');
});
test('fragment block positive allow-list matches ^(worktree-)?agent- pattern', () => {
const allowListRe = /grep\s+-Eq?\s+'\^\(worktree-\)\?agent-/;
assert.ok(allowListRe.test(block), 'fragment block must enforce a positive allow-list matching ^(worktree-)?agent-');
test('fragment block positive allow-list matches ^((worktree-)?agent-|worktree-wf_) pattern', () => {
const allowListRe = /grep\s+-Eq?\s+'\^\(\(worktree-\)\?agent-\|worktree-wf_/;
assert.ok(allowListRe.test(block), 'fragment block must enforce a positive allow-list matching ^((worktree-)?agent-|worktree-wf_) (#3021)');
});
test('fragment block contains update-ref prohibition text', () => {