Skip to content

[Bug] Rex doesn't fire on managed project PRs — hook walker resolves to portfolio root instead of ops root #424

@atlas-apex

Description

@atlas-apex

Driver

Rex (code reviewer) only fires on PRs in the framework repo because the auto-code-review.sh PostToolUse hook is wired in the ops repo's .claude/settings.json. Managed project repos (yumyum, apexyard-admin) and the portfolio repo don't have the hooks, so PRs skip Rex entirely with no reminder. In a single session, 15 PRs were merged without Rex review — self-discipline failed without mechanical enforcement.

Scope

Make the auto-code-review.sh hook fire on gh pr create regardless of which repo the PR targets. The hook already resolves the ops root via the walker — it just needs to match PR-create commands that target any repo, not just the ops repo.

Two changes:

  1. Update auto-code-review.sh — the hook currently fires on PostToolUse for Bash matching gh pr create *. It already works for any repo (it reads the PR URL from stdout). The issue is that the hook only exists in the ops repo's settings.json, so when CWD is inside a managed project workspace, the walker finds the portfolio root (which has no hooks) instead of the ops root.

  2. Fix the hook walker for managed project workspaces — the root walker (r=$PWD; while ... onboarding.yaml ...) needs to also check the ops repo when CWD is inside workspace/<name>/. Either:

    • Walk up past the portfolio root to find the ops repo (if they're siblings)
    • Or use APEXYARD_OPS_ROOT env var (already set in .mcp.json) as a fallback

Acceptance Criteria

  • gh pr create in any managed project workspace triggers Rex review reminder
  • gh pr create in the portfolio repo triggers Rex review reminder
  • gh pr create in the ops repo still works as before
  • Hook resolves ops root correctly from workspace// CWD
  • No false positives on non-apexyard repos

Root cause: hooks only fire when the walker finds the ops root. Managed project workspaces resolve to the portfolio root instead, which has no hooks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions