Skip to content

worktree-enter hook uses wrong config-file gate, skipping valid projects #49

@plx

Description

@plx

Problem Statement

Severity: High

The worktree-enter hook uses a config-file gate that is inconsistent with Trop's actual config discovery behavior.
Today, the hook only runs trop autoreserve when it finds trop.yaml or .trop.yaml, but Trop config discovery supports trop.yaml and trop.local.yaml.

As a result, repositories that validly use only trop.local.yaml are skipped on worktree entry, so pre-reservation does not happen.

Affected Files / Lines

  • plugins/trop/hooks/scripts/worktree-enter.sh
    • :3 comment says hook runs only if trop.yaml exists
    • :23-24 gate checks trop.yaml or .trop.yaml only
  • trop/src/config/loader.rs
    • :112 docs: discovery stops on trop.yaml or trop.local.yaml
    • :137 code checks trop.local.yaml
  • trop-cli/src/utils.rs
    • :194 docs: searches trop.local.yaml or trop.yaml
    • :206-215 code prefers trop.local.yaml, then trop.yaml

Recommended Fix

Update the hook gate to match supported project config files (trop.local.yaml + trop.yaml) and update stale comments.

diff --git a/plugins/trop/hooks/scripts/worktree-enter.sh b/plugins/trop/hooks/scripts/worktree-enter.sh
@@
-# Runs trop autoreserve if a trop.yaml exists in the worktree directory.
+# Runs trop autoreserve if a trop project config exists in the worktree directory.
@@
-# Check for trop.yaml in the worktree
-if [[ -f "${WORKTREE_PATH}/trop.yaml" ]] || [[ -f "${WORKTREE_PATH}/.trop.yaml" ]]; then
+# Check for supported project config files in the worktree
+if [[ -f "${WORKTREE_PATH}/trop.local.yaml" ]] || [[ -f "${WORKTREE_PATH}/trop.yaml" ]]; then
     cd "$WORKTREE_PATH"
     trop autoreserve --quiet 2>/dev/null || true
 fi

Validation Strategy

Automated regression coverage

Add hook-level tests (or a small shell test harness run in CI) for these cases:

  1. trop.local.yaml only -> trop autoreserve is invoked.
  2. trop.yaml only -> trop autoreserve is invoked.
  3. No config files -> trop autoreserve is not invoked.

Manual verification

  1. Create a temp repo/worktree containing only trop.local.yaml.
  2. Feed hook input with that path (same JSON shape used by the hook).
  3. Confirm the hook executes trop autoreserve --quiet (e.g., with a stubbed trop on PATH).
  4. Repeat with only trop.yaml and with no config file to confirm expected behavior in each case.

🤖 Discovered by Codex · expanded by Codex · filed by Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority issues—significant semantic, correctness, completeness, or stability impact.claude-code-pluginConcerns trop's claude code plugin.discovered-by-codexIssues discovered by codex.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions