Skip to content

fix(cursor): #2719 handle rtk rewrite exit code 3 in preToolUse hook.#2720

Closed
denis-peshkov wants to merge 1 commit into
rtk-ai:developfrom
denis-peshkov:feat/cursor-hook-exit-3
Closed

fix(cursor): #2719 handle rtk rewrite exit code 3 in preToolUse hook.#2720
denis-peshkov wants to merge 1 commit into
rtk-ai:developfrom
denis-peshkov:feat/cursor-hook-exit-3

Conversation

@denis-peshkov

@denis-peshkov denis-peshkov commented Jun 29, 2026

Copy link
Copy Markdown

Fix Cursor preToolUse hook ignoring successful rtk rewrite results on exit code 3.

Closes #2719

Why

rtk rewrite uses exit 3 for Default/Ask verdicts while still printing the rewritten command. The Cursor hook treated exit 3 as failure via || { echo '{}'; exit 0; }, so rewrites were silently dropped.

Changes

  • hooks/cursor/rtk-rewrite.sh: explicit exit-code handling (align with Claude hook)
  • rtk-hook-version: 1 → 2

… hook.

Exit code 3 carries a rewritten command but must not be treated as failure.
The previous || fallback discarded successful rewrites on every matched command.
@KuSh

KuSh commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Hi, thanks for your PR. A better and more complete fix is available in #2609

@KuSh KuSh closed this Jun 29, 2026
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.

fix(cursor): Cursor preToolUse hook discards successful rtk rewrite on exit code 3

2 participants