Skip to content

feat: short-circuit post_commit_reminder when all reviews passed#361

Merged
nhorton merged 7 commits intomainfrom
feat/short-circuit-post-commit-reminder
Apr 11, 2026
Merged

feat: short-circuit post_commit_reminder when all reviews passed#361
nhorton merged 7 commits intomainfrom
feat/short-circuit-post-commit-reminder

Conversation

@nhorton
Copy link
Copy Markdown
Contributor

@nhorton nhorton commented Apr 11, 2026

Summary

  • Moves post-commit reminder hook from bash into a Python hook (src/deepwork/hooks/post_commit_reminder.py) that checks whether all non-catch-all review rules matching the committed files already have .passed markers
  • When all applicable reviews are passed (or no non-catch-all rules match the committed files), emits "No re-review needed" instead of nagging the agent to offer /review
  • Adds all_reviews_passed_for_files() helper to src/deepwork/review/mcp.py — pure, no side effects
  • Updates PLUG-REQ-001.7 spec with new requirements (catch-all exclusion, all-passed short-circuit)

Test plan

  • 7 unit tests for all_reviews_passed_for_files (empty files, no rules, catch-all only, non-matching, with/without markers, mixed)
  • 15 unit tests for post_commit_reminder_hook (early returns, review-aware paths, git failure fallback, exception fallback, _committed_files helper, main() entry point)
  • Updated test_hook_script_detects_git_commit to validate Python hook source
  • Full test suite passes (1288 tests)
  • ruff + mypy clean on all changed files
  • Both new source files at 100% coverage

🤖 Generated with Claude Code

Move the post-commit reminder hook from bash into a Python hook that
checks whether all non-catch-all review rules matching the committed
files already have .passed markers. When they do (or no applicable
rules exist), emit "No re-review needed" instead of nagging the agent.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@nhorton nhorton force-pushed the feat/short-circuit-post-commit-reminder branch from 6a219fa to 3da81dd Compare April 11, 2026 17:49
nhorton and others added 6 commits April 11, 2026 11:58
- Add per-test traceability comments for PLUG-REQ-001.7.2/3/4
- Fix 3 pre-existing misplaced traceability comments in TestRunReviewDiscoveryWarnings
- Type _rule_is_catch_all parameter as ReviewRule (removes type: ignore)
- Update doc/architecture.md and src/deepwork/hooks/README.md
- Add changelog entry

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
git show --no-patch and --name-only are mutually exclusive, causing
_committed_files to always fail and fall back to the nag reminder.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Prevents regression of the incompatible --no-patch + --name-only flags.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
The instruction file's "After Review" section now covers all three
cases: no findings, findings fixed, or findings explicitly dismissed.
The MCP tool description is updated to match.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Add Bash(make:*) to project allow list
- Sync mark_review_as_passed description in doc/mcp_interface.md

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@nhorton nhorton added this pull request to the merge queue Apr 11, 2026
Merged via the queue into main with commit 567ae88 Apr 11, 2026
5 checks passed
@nhorton nhorton deleted the feat/short-circuit-post-commit-reminder branch April 11, 2026 18:19
nhorton added a commit that referenced this pull request Apr 16, 2026
End-user installs launch the MCP server via `uvx deepwork serve`, so the
bare `deepwork` binary is not on PATH when hooks fire. Three plugin hooks
(`post_commit_reminder.sh`, `deepschema_write.sh`, `post_compact.sh`)
were calling `deepwork ...` directly and failing with exit 127 on every
Bash tool use — Claude Code reports them as failed PostToolUse hooks.

This regression was introduced in PR #361 when the bash-only commit
reminder was rewritten to delegate to a Python hook via the deepwork CLI.
The dev workflow masked the bug because direnv/Nix puts `.venv/bin` on
PATH.

Fix: each hook now probes `command -v deepwork` and falls back to
`uvx deepwork ...` when missing.

Adds a `.deepreview` rule (`claude_plugin_hook_deepwork_invocation` in
plugins/claude/.deepreview) that flags any plugin hook script with an
unguarded `deepwork` invocation, to prevent future regressions.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
github-merge-queue Bot pushed a commit that referenced this pull request Apr 16, 2026
…ATH (#386)

End-user installs launch the MCP server via `uvx deepwork serve`, so the
bare `deepwork` binary is not on PATH when hooks fire. Three plugin hooks
(`post_commit_reminder.sh`, `deepschema_write.sh`, `post_compact.sh`)
were calling `deepwork ...` directly and failing with exit 127 on every
Bash tool use — Claude Code reports them as failed PostToolUse hooks.

This regression was introduced in PR #361 when the bash-only commit
reminder was rewritten to delegate to a Python hook via the deepwork CLI.
The dev workflow masked the bug because direnv/Nix puts `.venv/bin` on
PATH.

Fix: each hook now probes `command -v deepwork` and falls back to
`uvx deepwork ...` when missing.

Adds a `.deepreview` rule (`claude_plugin_hook_deepwork_invocation` in
plugins/claude/.deepreview) that flags any plugin hook script with an
unguarded `deepwork` invocation, to prevent future regressions.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant