Skip to content

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

Closed

Description

@oteissonniere

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

Summary

rtk hook vibe (v0.50.0) silently passes through — exit 0, empty stdout — when the
tool_name field in the hook stdin JSON is file_system.bash instead of bash.
This is exactly what the Mistral Vibe CLI sends when running on its Unified
Harness
backend, so the pre_tool rewrite hook never fires on those sessions,
with no warning or diagnostic.

Context

  • rtk version: 0.50.0 (Homebrew, rtk --version), macOS arm64 (/opt/homebrew/bin/rtk)

  • Host tool: Mistral Vibe CLI (vibe 2.25.8), hook type pre_tool, matcher bash

  • Hook config:

    [[hooks]]
    name = "rtk-rewrite"
    type = "pre_tool"
    match = "bash"
    command = "rtk hook vibe"
    timeout = 10.0
    strict = false

Vibe's hook wire protocol sends a JSON object on stdin containing, among other
fields: hook_event_name, session_id, transcript_path, cwd, tool_name,
tool_call_id, tool_input.

On the legacy harness backend the bash tool is named bash and the hook works
as expected. On the Unified Harness backend (current default for new
sessions), built-in tools are namespaced group.function, so the bash tool is
file_system.bash and that value is what appears in tool_name in the hook
payload.

Problem

rtk hook vibe compares tool_name strictly against "bash". When it receives
"file_system.bash" it treats the event as out of scope and exits 0 with empty
stdout — which Vibe interprets as "pass through", so the command runs unrewritten
and no token savings happen. There is no stderr, no warning, nothing to diagnose.

Note the asymmetry: Vibe's own hook matcher normalizes match = "bash" so that
the binding does fire for file_system.bash (confirmed in the session journal:
the hook action records hook_binding_ids: ["user:rtk-rewrite"] and
hook_run_started / hook_run_completed), but the rewrite is silently dropped
inside rtk. The net effect looks to the user like "the hook never runs".

Reproduction

# Control — bare tool name (legacy harness): rewritten
echo '{"hook_event_name":"pre_tool","session_id":"s","parent_session_id":null,
"transcript_path":"/tmp/t","cwd":"/tmp","tool_name":"bash",
"tool_call_id":"c1","tool_input":{"command":"git status"}}' | rtk hook vibe

# -> {"hook_specific_output":{"tool_input":{"command":"rtk git status"}},
#    "system_message":"rtk: rewrote to `rtk git status`"}

# Bugged — namespaced tool name (Unified Harness): silent pass-through
echo '{"hook_event_name":"pre_tool","session_id":"s","parent_session_id":null,
"transcript_path":"/tmp/t","cwd":"/tmp","tool_name":"file_system.bash",
"tool_call_id":"c1","tool_input":{"command":"git status"}}' | rtk hook vibe

# -> (no output, exit 0)

Same command string, same JSON shape, only tool_name differs. Verified with
rtk 0.50.0; the same behavior reproduces for other subcommands (git -C <path> status, git log …).

Expected behavior

rtk hook vibe should rewrite the command for tool_name: "file_system.bash"
exactly as it does for tool_name: "bash".

Suggested fix

Normalize tool_name before the scope check in the vibe hook handler:

  • strip a leading group. segment (i.e. accept <anything>.bash), and/or
  • explicitly accept bash and file_system.bash in the set of recognized
    tool names.

Case-insensitive comparison would also be consistent with Vibe's matcher
semantics. Keeping the match list extensible (e.g. a small set of known
namespaced variants) avoids surprises if Vibe renames groups again — the
Windows managed shell tools use bare names (git_bash, powershell), so the
normalization should not break those.

An alternative would be a flag or env var to extend the accepted tool names,
but the namespaced name is what Vibe actually sends today, so accepting it by
default seems right.

Workaround (used in the meantime)

Normalize the payload with jq before rtk:

command = "jq -c 'if .tool_name == \"file_system.bash\" then .tool_name = \"bash\" else . end' | rtk hook vibe"

This is fragile (it hardcodes the group name) and why an upstream fix is
preferred.

Activity

  1. added
    bug
    good first issue
    on Sep 30, 2026
  2. rtk-wshm-sync-bot commented on Sep 30, 2026

    @rtk-wshm-sync-bot

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟠 Priority high
    🎯 Confidence 90%

    Summary

    rtk hook vibe silently no-ops when tool_name is namespaced (file_system.bash) under Vibe's Unified Harness, defeating command rewriting without any diagnostic.

    This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.

    📁 Relevant files
    • src/hooks/vibe.rs

    Suggested Actions

    1. Normalize tool_name before the scope check: strip leading group. or match a known-alias set (bash, file_system.bash)
    2. Reference PR feat(hooks): transparent pre_tool rewrite for Mistral Vibe CLI (closes #800) #3391 which added the original Vibe pre_tool rewrite hook, since this regressed/missed its Unified Harness…
    3. Add a regression test feeding tool_name=file_system.bash alongside the existing bash case
    4. Consider emitting a diagnostic on stderr when a hook event is skipped as out-of-scope, to avoid silent pass-through in …

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clibuggood first issuepriority:high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions