Repository navigation
fix(hooks): own Gemini hooks by exact command, not substring - #4235
Open
amandeavor wants to merge 2 commits into
Open
amandeavor wants to merge 2 commits into
amandeavor wants to merge 2 commits into
Conversation
`patch_gemini_settings` / `uninstall_gemini` treated any BeforeTool entry whose first hook command merely contained \"rtk\" as RTK's. That skipped install when a user path contained the substring, and on uninstall deleted whole groups — including sibling user hooks. Reuse the shared grouped hook helpers with an exact ownership check (installed path, `rtk-hook-gemini.sh`, or `rtk hook gemini`), and remove only matching hook entries so user siblings stay put. Closes rtk-ai#4227
📊 Automated PR Analysis
SummaryFixes RTK's Gemini hook ownership detection, which previously used a substring match on "rtk" and could delete or ignore unrelated user hooks sharing the same BeforeTool group. The PR reuses shared grouped-hook helpers to own hooks only by exact installed path, the rtk-hook-gemini.sh filename, or the literal 'rtk hook gemini' command, and updates uninstall to remove only matching entries while preserving sibling hooks. Review Checklist
Linked issues: #4227 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
Satisfy clippy::collapsible_if (denied via -D warnings) by combining the settings parse and remove_gemini_hook_from_json check.
5 tasks done
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.
Summary
Closes #4227.
patch_gemini_settingsanduninstall_geminidecided ownership withcommand.contains(\"rtk\")on the first hook in eachBeforeToolgroup. That caused two failures:rtk(e.g./opt/smartkit/check.sh).Changes
rtk-hook-gemini.sh, or isrtk hook geminiTests
test_gemini_hook_ownership_is_exact_and_preserves_siblings— mixed group keeps/opt/audit/log-shell.shtest_gemini_hook_presence_ignores_unrelated_rtk_substring_paths—/opt/smartkit/check.shis not treated as RTK'scargo test --bin rtk -- test_gemini_hook_— green locally