Hook check-issue.sh blocks cross-repo agent dispatches in /tmp worktrees #305
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ldraney/pal-e-platform#305
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Bug
Lineage
Discovered scope from Track A of westside-admin bootstrap (2026-04-25). Dev agent reported the hook blocking Write operations against absolute paths outside the spawning agent's worktree, and
.claude-no-enforceopt-out file in the target repo not bypassing it. Cross-repo dispatch is becoming common (every multi-repo bootstrap arc hits this), so worth fixing before it shapes agent prompts into Bash-heredoc workarounds that defeat the safety the hook is meant to enforce.Repo
~/.claude/hooks/ (claude-custom repo)
What Broke
The PreToolUse hook on
Writerejects writes to absolute paths whose nearest containing repo is NOT the spawning session's branch context. A dev agent dispatched to cloneforgejo_admin/westside-adminto/tmp/westside-admin-scaffold-sveltekitand write files there had itsWritecalls blocked. Adding a.claude-no-enforcefile inside the target repo did NOT bypass the hook.The agent worked around it by switching every file creation to Bash heredoc (
cat <<EOF > /tmp/.../file), which bypasses the hook entirely — defeating the safety the hook was designed to enforce.Repro Steps
~/pal-e-platformon branch290-payment-pipeline-observability)git clone <other-repo> /tmp/test-clonecd /tmp/test-clone && git checkout -b some-branchWriteon/tmp/test-clone/foo.txt/tmp/test-clone/foo.txtlives in a completely different repo from the spawning session's cwd/tmp/test-clone/.claude-no-enforceand retry — observe still blockedExpected Behavior
.git) and apply enforcement based on THAT repo's branch and opt-out files..claude-no-enforceplaced in a target repo should bypass the hook for Writes into that repo.Environment
~/.claude/hooks/check-issue.sh(suspected — verify withgrep -r check-issue ~/.claude/hooks/)~/.claude/hooks/check-issue-template.sh(the cousin hook that just blocked Ava's own issue creation in this same session — different surface, possibly same enforcement-scoping bug)/tmp/{repo}-{branch}clone pattern (3 of 5 tracks in the current westside-admin bootstrap wave hit it)User Story
story:agent-dispatch-ergonomics — As a main-session orchestrator, I need to dispatch dev agents to clone target repos to
/tmp/{repo}-{branch}and Write files there without the PreToolUse hook on the spawning session's cwd blocking those Writes, so that cross-repo bootstrap arcs (typical for any new service onboarding) don't force agents into Bash-heredoc workarounds that bypass safety entirely.Context
Cross-repo dispatch pattern is now standard. Today's westside-admin bootstrap dispatch wave: Track A (clone westside-admin to /tmp), Track B (clone pal-e-deployments to /tmp), Track E (clone pal-e-services to /tmp) — 3 of 5 tracks use it. Same pattern will recur on every new-service bootstrap arc.
File Targets
Acceptance Criteria
.claude-no-enforcein a target repo bypasses the hook for Writes into that repo/tmp/{repo}-{branch}cwd: agent canWritefreely without falling back to Bash heredocsTest Expectations
/tmp/test-clone, dispatch a child agent with cwd/tmp/test-clone, have it callWrite /tmp/test-clone/foo.txt— should succeedWrite ~/pal-e-platform/foo.txt(a path outside its assigned worktree) should still be blockedConstraints
Checklist
Closes #THISRelated
feedback_smaller_scopes_parallel(cross-repo parallel dispatch is the model — this hook is friction against it)