Skip to content

fix(hook): match namespaced bash tool name in the Vibe hook - #4356

Merged
aeppling merged 2 commits into
rtk-ai:developfrom
drakeo338:claude/4355-fix
Oct 11, 2026
Merged

aeppling merged 2 commits into
rtk-ai:developfrom
drakeo338:claude/4355-fix

Conversation

@drakeo338

Copy link
Copy Markdown
Contributor

Summary

Fixes #4355.

  • The Vibe hook only rewrote commands when tool_name was exactly bash, but Vibe's Unified Harness sends the shell tool as file_system.bash, so nothing was rewritten. The hook now compares the last dot-separated segment of the name. Other namespaced tools such as file_system.read_file are still ignored.

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test (not run in full; only cargo test test_vibe, which passes: 38 passed, 0 failed)
  • Manual testing: rtk <command> output inspected (not done; covered by the two new unit tests)

Vibe's Unified Harness sends the shell tool as file_system.bash, which the
exact tool_name == "bash" check skipped, so no command was rewritten.
Compare the last dot-separated segment instead.
@CLAassistant

CLAassistant commented Sep 30, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@rtk-wshm-sync-bot rtk-wshm-sync-bot Bot added bug Something isn't working hooks labels Sep 30, 2026
@rtk-wshm-sync-bot

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟢 Risk low

Summary

Fixes the Vibe hook so it correctly rewrites bash commands when the tool name is namespaced (e.g. file_system.bash from Vibe's Unified Harness) instead of only matching the exact string bash. The fix compares only the last dot-separated segment of the tool name, and two new unit tests verify both the namespaced-bash match and that other namespaced tools are still ignored.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #4355


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

@pszymkowiak

Copy link
Copy Markdown
Collaborator

Reviewed and verified against mistral-vibe's source (harness _foreign_hooks.py: tool_name is group.tool, so the bash tool arrives as file_system.bash). Merged with develop: fmt/clippy/tests green; real payload from #4355 now rewritten; mutation check confirms the new test catches the regression.

One suggestion: matching on the last segment also rewrites MCP tools named bash (e.g. myserver.bash, which Vibe's own matcher also dispatches for match = "bash"). If such a tool runs the command remotely without rtk, the rewrite breaks it. Since file_system is a reserved namespace, an exact match is safer:

if !matches!(tool_name, "bash" | "file_system.bash") {

Ready for maintainer review once that's decided.

@aeppling aeppling left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for picking this up!

Matching the last segment also rewrites plugin tools: Vibe names those {group}.{tool} (_hook_matcher.py#L85), so docker.bash becomes rtk git status and breaks wherever rtk isn't installed. Vibe's own code checks its shell by exact name (_shell_tools.py#L49).

Fix: matches!(tool_name, "bash" | "file_system.bash") + a test that myplugin.bash returns None.

Matching the last dot-segment also accepted any plugin tool ending in
.bash (e.g. myplugin.bash). Accept only bash and file_system.bash.
@drakeo338

Copy link
Copy Markdown
Contributor Author

Pushed d47ef69: The Vibe hook now matches the tool name exactly against bash or file_system.bash instead of checking its last dot-segment, and a new test makes sure myplugin.bash is not rewritten.

@aeppling aeppling left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! Verified on current develop: suite green, and only bash and file_system.bash are rewritten, plugin *.bash tools are left alone.

@aeppling
aeppling merged commit 0eddb84 into rtk-ai:develop Oct 11, 2026
12 checks passed
@rtk-release-bot rtk-release-bot Bot mentioned this pull request Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working hooks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rtk hook vibe: no rewrite when tool_name is namespaced (file_system.bash`)

4 participants