fix(hooks): keep the hook protocol channel free of the setup nag - #3614
Open
rhishi99 wants to merge 1 commit into
Open
fix(hooks): keep the hook protocol channel free of the setup nag#3614rhishi99 wants to merge 1 commit into
rhishi99 wants to merge 1 commit into
Conversation
`rtk hook` and `rtk rewrite` are the hook. The agent that invokes them
parses their stdout and stderr as a protocol channel, so any extra line
there is corruption, not a diagnostic.
`maybe_warn()` was allowed to fire for them, which meant a developer with
Claude Code installed but without the rtk hook got
[rtk] /!\ No hook installed - run `rtk init -g` for automatic token savings
emitted mid-protocol once a day. Gain was already excluded for the same
reason; Hook and Rewrite were missed.
This is not theoretical: on such a machine ten tests in
`copilot_selfheal_test.rs` fail today, every one of them on the
`stderr must stay silent (protocol safety)` assertion. CI never sees it
because a fresh runner has no `~/.claude` at all, so `status()` reports
Ok and the warning never fires.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
rtk hookandrtk rewriteare the hook. The agent that invokes them parses their stdout and stderr as a protocol channel, so an extra line there is corruption, not a diagnostic.maybe_warn()was allowed to fire for both. On a machine that has Claude Code installed but not the rtk hook, that putsinto the protocol stream once a day.
Gainwas already excluded for exactly this reason;HookandRewritewere missed.This is not theoretical
On such a machine, ten tests in
tests/copilot_selfheal_test.rsfail today — every one on the same assertion:CI never sees it because a fresh runner has no
~/.claudeat all, sostatus()returns Ok and the warning never fires. The tests are correct; the nag was leaking into a channel it must never touch.Fix
Add
Commands::HookandCommands::Rewriteto the same exclusion listCommands::Gainalready sits in.Testing
No new test —
copilot_selfheal_test.rsalready pins this contract with 12 assertions on stderr silence; they were simply unreachable in CI. Before/after on an affected machine:Full suite,
cargo fmt --check, andcargo clippy --all-targetsclean onx86_64-pc-windows-gnu.🤖 Generated with Claude Code