You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Agent-blocklist scripts use wrong project_root and missing vig_utils dependency #238
Three agent-blocklist scripts in .devcontainer/scripts/ have two implementation defects from #163:
A. Wrong project_root resolution
All three scripts use Path(__file__).resolve().parent.parent, which resolves to .devcontainer/ — not the repo root. The blocklist at .github/agent-blocklist.toml is never found, so every check silently no-ops.
check-agent-identity.py and check-pr-agent-fingerprints.py import from vig_utils.agent_blocklist, which doesn't exist in downstream repos (and isn't declared as a dependency). The import would fail even if the path were correct.
C. Inverted IN_CONTAINER guard in .githooks/prepare-commit-msg
The hook checks IN_CONTAINER = "false", but outside the devcontainer the variable is typically unset (not the literal string "false"). The guard never triggers. Should check != "true" to fail closed.
Steps to Reproduce
Clone any downstream repo using this devcontainer template (e.g. devcontainer-smoke-test)
Run python .devcontainer/scripts/check-agent-identity.py — exits 0 without checking anything
Commit from the host — prepare-commit-msg hook does not block it
Expected Behavior
Scripts resolve the repo root correctly and enforce the blocklist
IN_CONTAINER guard blocks commits when the variable is unset
Actual Behavior
All three scripts silently no-op (blocklist path never found)
Host commits are not blocked by the prepare-commit-msg hook
Issue #238 describes three defects (A, B, C) from #163. After analysing the current codebase, two of the three were already resolved by the vig-utils migration (#218):
Defect
Status
Explanation
A. Wrong project_root
✅ Already fixed
The old standalone scripts used Path(__file__).resolve().parent.parent which resolved to .devcontainer/ instead of the repo root. The migration to vig-utils replaced this with find_repo_root(start=Path(__file__)) (packages/vig-utils/src/vig_utils/utils.py L122-147), which traverses up from cwd looking for .github/. Pre-commit hooks run with cwd = repo root, so this resolves correctly now.
B. Missing vig_utils dependency
✅ Already fixed
The old scripts imported from vig_utils.agent_blocklist which didn't exist in downstream repos. The scripts now live insidevig-utils and import from vig_utils.utils. They're invoked as entry points (uv run check-agent-identity), so the dependency is always available.
C. Inverted IN_CONTAINER guard
❌ Still present
All three workspace githooks (assets/workspace/.githooks/{pre-commit,prepare-commit-msg,commit-msg}) use = "false" but IN_CONTAINER is typically unset (not the literal "false") outside the devcontainer. The guard never triggers on the host.
Task 2: Fix IN_CONTAINER guard from = "false" to != "true" in all three hooks — assets/workspace/.githooks/{pre-commit,prepare-commit-msg,commit-msg} — verify: all 12 BATS tests pass
Activity
c-vigo commentedon Mar 9, 2026
Implementation Plan
Triage
Issue #238 describes three defects (A, B, C) from #163. After analysing the current codebase, two of the three were already resolved by the
vig-utilsmigration (#218):project_rootPath(__file__).resolve().parent.parentwhich resolved to.devcontainer/instead of the repo root. The migration tovig-utilsreplaced this withfind_repo_root(start=Path(__file__))(packages/vig-utils/src/vig_utils/utils.pyL122-147), which traverses up fromcwdlooking for.github/. Pre-commit hooks run withcwd= repo root, so this resolves correctly now.vig_utilsdependencyvig_utils.agent_blocklistwhich didn't exist in downstream repos. The scripts now live insidevig-utilsand import fromvig_utils.utils. They're invoked as entry points (uv run check-agent-identity), so the dependency is always available.IN_CONTAINERguardassets/workspace/.githooks/{pre-commit,prepare-commit-msg,commit-msg}) use= "false"butIN_CONTAINERis typically unset (not the literal"false") outside the devcontainer. The guard never triggers on the host.Tasks
IN_CONTAINERguard —tests/bats/githooks.bats— verify: 6 tests fail (unset, empty, "false" × 3 hooks)IN_CONTAINERguard from= "false"to!= "true"in all three hooks —assets/workspace/.githooks/{pre-commit,prepare-commit-msg,commit-msg}— verify: all 12 BATS tests passCHANGELOG.mdunder### Fixed— verify: entry references [BUG] Agent-blocklist scripts use wrong project_root and missing vig_utils dependency #238test: add failing tests for IN_CONTAINER guard in workspace githooks
fix: use != "true" for IN_CONTAINER guard in workspace githooks
docs: add changelog entry for IN_CONTAINER guard fix
fix: correct IN_CONTAINER guard in workspace githooks (#239)
test: fix bats warnings in githooks and tmux crash in worktree tests