Skip to content

! shell commands in TUI always fail with [rpc -32601] method_not_found (backend never registers command.dispatch) #171

Description

@silverLXT

Summary

In raven tui, any input prefixed with ! (bang shell escape) fails with:

error: [rpc -32601] method_not_found

This happens for every bang command (!ls, !clear, !pwd, …) — it is not command-specific. The ! feature is effectively unusable in v0.1.6.

Environment

  • Raven: v0.1.6 (installed via install.shuv tool)
  • OS: macOS 15.6 (arm64, Apple Silicon)
  • Channel: tui

Steps to reproduce

  1. raven tui
  2. Type !ls and press enter
  3. Observe: error: [rpc -32601] method_not_found

Expected

The !ls shell command runs and its output is shown.

Actual

JSON-RPC error -32601 method_not_found.

Root cause

The frontend routes bang commands to an RPC method named command.dispatch, but the backend never registers it, so the dispatcher returns -32601.

Evidence:

  • Frontend (raven/ui-tui/dist/entry.js) calls it:
    gw.request("command.dispatch", { name, arg, session_id }).then((raw) => {
      const d = asCommandDispatch(raw); // expects { type: "exec"|"plugin"|"alias", output?, target? }
      ...
    })
  • Backend confirms it is unregistered — raven/tui_rpc/methods/slash_routing.py:12:
    ... the .catch() branch would fall through to
    ``command.dispatch`` which is also unregistered).
    
  • command.dispatch is absent from the umbrella registration in raven/tui_rpc/methods/__init__.py (register_aligned_methods_except_system).

Suggested fix

Add a register_command_methods() that registers command.dispatch and wire it into the umbrella in methods/__init__.py (same pattern as the existing register_slash_routing_methods). The handler should return the shape the frontend expects:

{ type: "exec" | "plugin" | "alias", output?: string, target?: string }

The existing slash.exec handler in slash_routing.py is a close template (shlex-split → delegate to executor → shape result → never raise -32xxx). Consider routing the exec path through the same executor the agent uses (build_executor()), so bang commands also respect tools.sandbox.backend.

Workaround

Ask the agent in natural language (e.g. "run ls") — that goes through the agent's exec tool and works. Use /-slash commands or Ctrl+L instead of !clear.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions