Skip to content

fix: plugin hooks must fall back to uvx when deepwork not on PATH#386

Merged
nhorton merged 1 commit intomainfrom
fix/hook-deepwork-fallback
Apr 16, 2026
Merged

fix: plugin hooks must fall back to uvx when deepwork not on PATH#386
nhorton merged 1 commit intomainfrom
fix/hook-deepwork-fallback

Conversation

@nhorton
Copy link
Copy Markdown
Contributor

@nhorton nhorton commented Apr 16, 2026

Summary

  • Three plugin hooks (post_commit_reminder.sh, deepschema_write.sh, post_compact.sh) called bare deepwork .... End-user installs launch the MCP server via uvx deepwork serve, so deepwork is not on PATH — the hooks failed with exit 127 on every Bash tool use, surfacing as failed PostToolUse hooks in Claude Code. Each hook now probes command -v deepwork and falls back to uvx deepwork ....
  • Adds a narrowly-scoped .deepreview rule (claude_plugin_hook_deepwork_invocation in plugins/claude/.deepreview) that flags any plugin hook script with an unguarded deepwork invocation, to prevent the same regression from recurring.
  • Updates CHANGELOG.md under [Unreleased].

The regression was introduced in #361, which moved the post-commit reminder from a self-contained jq script to a Python hook delegated via deepwork hook .... The dev workflow masked the bug because direnv/Nix puts .venv/bin on PATH.

Test plan

  • uv run pytest tests/unit/test_post_commit_reminder_hook.py tests/unit/test_hook_cli.py tests/unit/plugins/test_claude_plugin.py — 68 passed
  • Manually confirmed dev path (deepwork on PATH) returns {} for non-commit Bash calls
  • Manually confirmed fallback path (PATH minimized so only uvx is reachable) successfully invokes uvx deepwork hook post_commit_reminder
  • Validated both .deepreview files against deepreview_schema.json

🤖 Generated with Claude Code

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) <noreply@anthropic.com>
@nhorton nhorton added this pull request to the merge queue Apr 16, 2026
Merged via the queue into main with commit 429ac9e Apr 16, 2026
5 checks passed
@nhorton nhorton deleted the fix/hook-deepwork-fallback branch April 16, 2026 22:13
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