Repository navigation
Conversation
The /exec parallel-group marker filename was a global constant (`claude-parallel-group-1.marker`), and the hooks globbed the whole `$TMPDIR` namespace and took the first hit. A parallel group in one project therefore redirected worktree enforcement for every concurrent Claude session on the machine — blocking legitimate edits with a foreign worktree path and, for the session that lost the race, silently pointing the guard nowhere. - Add hooks/parallel-marker.sh: the single shared naming contract (AC-4). It exposes parallel_marker_path/prefix and derives the owning project root identically in skill- and hook-context (CLAUDE_PROJECT_DIR, falling back to git toplevel). Mirrored in all three hook dirs. - Filename is now `claude-parallel-<project-hash>-<group-id>.marker` (AC-1); readers glob only the project-scoped prefix at all three sites (pre-tool enforcement + agent-id, post-tool agent-id) (AC-2). - Marker stores worktree path (line 1) + owning project root (line 2); the enforcement reader skips any marker whose stored root != current, as defense-in-depth (AC-3). - /exec skill sources the helper instead of hardcoding the path. - Regression test (AC-5): a foreign live marker no longer blocks an edit in the real worktree; a positive control proves same-project enforcement still fires. Parametrized over all three hook copies. All three skill copies and all three hook mirrors updated in sync (check-skill-sync + sync-hooks pass). Entire-Checkpoint: f9e68dba3115
Entire-Checkpoint: d4657e89ee71
5 tasks
…hooks-parallel-group-marker-filename-is-g # Conflicts: # CHANGELOG.md
…hooks-parallel-group-marker-filename-is-g # Conflicts: # CHANGELOG.md
admarble
deleted the
feature/881-bug-exec-hooks-parallel-group-marker-filename-is-g
branch
August 3, 2026 13:58
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #881 — the
/execparallel-group marker filename was a global constant, so a parallel group in one project silently redirected worktree enforcement for every concurrently-running Claude session on the machine./tmp/claude-parallel-group-1.marker) and both hooks resolved the enforced worktree by globbing the whole${TMPDIR}namespace and taking the first matching marker, with no project scoping.${TMPDIR}/claude-parallel-<project-hash>-<group-id>.marker— and the readers glob only their own project-scoped prefix. The naming scheme lives in a single sourced helper (parallel-marker.sh) shared by the writer (the/execskill) and the two readers (the hooks), so they cannot drift. The marker also stores its owning project root (line 2), and the enforcement reader ignores any marker whose stored root ≠ the current project as defense-in-depth.AC coverage
parallel-marker.sh:parallel_marker_prefix→claude-parallel-<md5(project-root)>-pre-tool.shenforcement (~648) + agent-id (~250);post-tool.shagent-id (~84) — all use the project-scoped prefixpre-tool.shenforcement; implemented via stored project root, not worktree-path containment (per spec's flagged tension)parallel-marker.shis the only site constructing the name; hooks + skill source it.claude-parallel-groupliteral survives in zero other sites#881describe block inpre-tool-hook.integration.test.ts, parametrized over all 3 hook copiesMutation verification (AC-5 hard gate)
Per the repo testing rule, AC-5 was mutation-verified:
templates/hooks/pre-tool.sh(global globclaude-parallel-*restored and the line-2 owner guard neutralized toif false).#881block: exactlyAC-5 [templates/hooks/pre-tool.sh]failed (1 failed, 5 passed) — the foreign live marker blocked the real-worktree edit withHOOK_BLOCKED: File operation must be within worktree, exactly the original bug.git checkoutand confirmed all 6#881assertions pass.The suite also includes a positive control proving the scoping did not disable enforcement: a marker under this project's own scoped name + owner still blocks an edit outside its worktree.
Files changed
templates/hooks/parallel-marker.sh(new) + mirrors inhooks/,.claude/hooks/pre-tool.sh/post-tool.shacross all three hook dirsexec/SKILL.mdacross all three skill dirs__tests__/pre-tool-hook.integration.test.ts(AC-5 regression + positive control)CHANGELOG.mdAll three skill copies and all three hook mirrors updated in sync (
check-skill-sync+sync-hookspass).Test plan
npm run build(tsc clean)npm run lint(eslint clean)pre-tool-hook.integration.test.ts+hook-sync.test.ts+check-skill-sync.test.ts— 198 passedCloses #881
🤖 Generated with Claude Code