Skip to content

mind_commit_guard v1.2: honour a leading cd away from Mind#138

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/mind-guard-cd-fix
Jul 17, 2026
Merged

mind_commit_guard v1.2: honour a leading cd away from Mind#138
Jammy2211 merged 1 commit into
mainfrom
feature/mind-guard-cd-fix

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Summary

Fixes a false positive in the Mind-commit guard (shipped in #132/#133; campaign #155 Phase 5). v1.1 decided is this a Mind commit? from the ambient cwd the hook is handed. A command that cds into a PyAutoBuild worktree before committing — with the session cwd still PyAutoMind from a prior command — was wrongly denied. It bit its own author committing PyAutoBuild#165's step-3 change (twice), which is exactly the noisy-refusal-trains-bypass failure the doc's §4 warns about.

check_command now walks clauses tracking the effective cwd (honouring cd), resolves each commit's target repo (git -C <path> wins, else the effective cwd), and guards only when that repo is a PyAutoMind checkout. A cd/-C away from Mind → allow; a cd/-C into Mind, or a bare commit with Mind cwd → still deny. Dead _mind_root helper and the now-unused re import removed.

API Changes

None — guard internals.

Test Plan

  • 4 new regression tests: cd-away allowed, git -C away allowed, cd-into-Mind denied, git -C into-Mind denied.
  • All prior guard behaviour preserved (bare commit / directory pathspec still denied). Full suite: 140 passed.

Generated by the PyAutoLabs agent workflow.

… positive)

v1.1 keyed is-this-a-Mind-commit off the ambient cwd the hook is handed. A
command that cd s into a PyAutoBuild worktree before committing (with the
session cwd still PyAutoMind from a prior command) was wrongly denied — it bit
its own author committing PyAutoBuild#165 step 3. check_command now walks
clauses tracking the effective cwd, resolves each commit target repo (git -C
wins, else effective cwd), and guards ONLY when that repo is a PyAutoMind
checkout. Dead _mind_root/re removed. Four regression tests pin the cd-away and
git -C-away allows plus the cd-into / -C-into denies.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Jammy2211
Jammy2211 merged commit 86e0cd0 into main Jul 17, 2026
@Jammy2211
Jammy2211 deleted the feature/mind-guard-cd-fix branch July 17, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant