Skip to content

fix(hooks): emit allow with Claude updatedInput#3012

Open
eejd wants to merge 1 commit into
rtk-ai:masterfrom
eejd:fix/claude-updatedinput-allow
Open

fix(hooks): emit allow with Claude updatedInput#3012
eejd wants to merge 1 commit into
rtk-ai:masterfrom
eejd:fix/claude-updatedinput-allow

Conversation

@eejd

@eejd eejd commented Jul 15, 2026

Copy link
Copy Markdown

Summary

  • update the Claude native hook response so every updatedInput payload includes permissionDecision: "allow"
  • add a regression test for the emitted JSON shape
  • update the hook permission-model docs to reflect the current Claude hook validator contract

Why

Current Claude hook validation rejects PreToolUse responses that return updatedInput without an explicit allow decision:

PreToolUse hook returned updatedInput without permissionDecision:allow

RTK's Claude hook previously omitted permissionDecision for default/ask rewrites. That makes the rewrite payload invalid even though the rewritten command itself is fine.

This change keeps deny/defer passthrough behavior unchanged, but when RTK does return a rewritten updatedInput, it emits:

{
  "hookSpecificOutput": {
    "hookEventName": "PreToolUse",
    "permissionDecision": "allow",
    "permissionDecisionReason": "RTK auto-rewrite",
    "updatedInput": { "command": "rtk git status" }
  }
}

Scope

This PR branch was created from upstream/master and contains only one commit. Diff is limited to:

  • src/hooks/hook_cmd.rs
  • src/hooks/README.md

Testing

On the fork branch that originally carried this change:

/opt/local/bin/cargo test hooks::hook_cmd

passed: 77 hook tests.

On a clean branch based directly on upstream/master, the same test command currently fails before running tests due to pre-existing upstream dead-code warnings unrelated to this PR:

error: constant `FILTERS_TOML` is never used
error: associated function `load` is never used

I also verified the runtime payload shape locally with:

printf '%s\n' '{"tool_name":"Bash","tool_input":{"command":"git status","description":"Check repo status"}}' | rtk hook claude

and confirmed the response includes permissionDecision: "allow" next to updatedInput.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@rtk-release-bot rtk-release-bot Bot added the wrong-base PR targets master instead of develop label Jul 15, 2026
@rtk-release-bot

Copy link
Copy Markdown
Contributor

Automatic message from CI checks : It seems like this branch is targeting the wrong branch, any contribution should target develop branch.

See CONTRIBUTING.md for details.

@tapheret2 tapheret2 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: fix(hooks): emit allow with Claude updatedInput

Files: src/hooks/README.md, src/hooks/hook_cmd.rs
Size: +19 / -16

Notes

  • Static pass on the patch: no obvious blockers from the diff alone.

Thanks @eejd — independent review on the patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wrong-base PR targets master instead of develop

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants