Skip to content

fix(hook): include pipeline decisions in hook check - #4792

Open
Aschenbath wants to merge 1 commit into
rtk-ai:developfrom
Aschenbath:fix/hook-check-pipeline-decisions
Open

Aschenbath wants to merge 1 commit into
rtk-ai:developfrom
Aschenbath:fix/hook-check-pipeline-decisions

Conversation

@Aschenbath

@Aschenbath Aschenbath commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Make rtk hook check --agent claude preview trusted pipeline rules before the existing permission/rewrite gate. A pipeline denial or passthrough now reports its rule and origin instead of printing the ordinary rewrite. Route and swap previews follow the native hook's decision and permission gate.
  • Keep the preview free of classifier calls, task/command execution, and pipeline-status writes. Classifier-dependent decisions report that runtime data is needed; invalid rules retain the runtime's validation and fallback.
  • Distinguish diagnostic outcomes: rewrite 0, passthrough/no rewrite 1, denial/invalid agent 2, missing runtime classifier results 3. Permission denials previously returned 1. Document the behavior and correct the rtk rewrite help text, which incorrectly claimed it evaluated pipeline rules.

Fixes #4629. This follows the current Claude-only pipeline scope; it does not extend pipeline execution to additional agents.

Test plan

  • Complete pre-commit verification: root/proxy formatting, cargo clippy --workspace --all-targets -- -D warnings, and cargo test --all --no-fail-fast — 5,221 passed, zero failed, eight existing ignored, zero name filters. Source-tree guards bind these checks to this change.
  • Reproduced the reported mismatch with the checksum-verified official 1.0.1 Linux executable in an isolated profile. On the source baseline, the new regression target reports nine failures and one passing other-agent control; all ten pass after the fix.
  • Real CLI tests compare native hook responses with the diagnostic, covering deny/allow precedence, passthrough, no match, host scope, untrusted files, route/swap, invalid configuration, and classifier previews. Loopback and file snapshots check that previewing does not contact a model or execute the supplied command.
  • Original cross-platform CI on the fork: all 14 jobs passed, including Linux, macOS, Windows MSVC/GNU, OSS edition, proxy, security checks, and benchmark. The tested merge has the same Git tree as this PR's head. The ten new trusted-project integration tests passed on Linux and macOS; that target is Unix-only so its profile and trust store can be isolated. Windows builds and its existing tests passed. The optional AI documentation review skipped because the fork has no API key. Upstream CI still requires maintainer approval.

AI-assisted — Tool: Codex; model: unavailable; version: unavailable.

Evaluate Claude pipeline rules before the permission/rewrite gate in
the diagnostic, without writing pipeline status or executing model
classifiers or tasks. Distinguish denials from no-rewrite results and
correct the rewrite command help.

*AI-assisted — Tool: Codex; model: unavailable; version: unavailable.*
@rtk-wshm-sync-bot

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟡 Risk medium

Summary

Updates rtk hook check --agent claude to preview trusted pipeline rules (deny/passthrough/route/swap) before falling back to the existing permission/rewrite gate, so pipeline decisions are no longer misreported as ordinary rewrites. Introduces distinct exit codes (0 rewrite, 1 passthrough/no-rewrite, 2 denial/invalid agent, 3 missing runtime classifier data), updates troubleshooting docs, and corrects the rtk rewrite help text that incorrectly claimed it evaluated pipeline rules.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #4629


Analyzed automatically by wshm · This is an automated analysis, not a human review.

@Aschenbath
Aschenbath marked this pull request as ready for review October 25, 2026 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rtk hook check ignores pipeline rules: it reports a rewrite for commands the hook denies or passes through

1 participant