fix(tui-rpc): register the missing shell.exec handler#213
Open
AmirF194 wants to merge 1 commit into
Open
Conversation
`!`-prefixed bang commands in the TUI always failed with
`[rpc -32601] method_not_found`: useSubmission.ts's shellExec/interpolate
call `gw.request('shell.exec', {command})`, but the backend never
registered a shell.exec handler, and shell.exec is absent everywhere from
raven/**/*.py.
EverMind-AI#171's own root-cause evidence was gathered against the released v0.1.6
bundle, which called a method named command.dispatch. That name is gone
from the current frontend source; only shell.exec is called on this path
now (useSubmission.ts:180,212). command.dispatch survives only as dead
code in createSlashHandler.ts's unreachable .catch() fallback, since
slash.exec never rejects. On current HEAD, shell.exec is the missing
method, so the suggested command.dispatch registration would not have
fixed the bug.
Add register_shell_methods (raven/tui_rpc/methods/shell_exec.py), wired
into the umbrella in methods/__init__.py the same way slash_routing is.
shell.exec carries no session_id (both call sites pass only {command}),
so there is no session-scoped sandbox executor to route through; it runs
via DirectExecutor, matching a plain host shell escape.
Co-authored-by: Claude (claude-sonnet-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.
Summary
!-prefixed bang commands in the TUI always fail with[rpc -32601] method_not_found.useSubmission.ts'sshellExecandinterpolatecallgw.request('shell.exec', {command}), but the backend never registers ashell.exechandler; it is absent from everydispatcher.register(...)call inraven/**/*.py.#171's root-cause section points at a different method,
command.dispatch, based on evidence gathered against the released v0.1.6 bundle (ui-tui/dist/entry.js, a gitignored build artifact). That name is gone from the current frontend source:command.dispatchonly survives as dead code increateSlashHandler.ts's.catch()fallback, which is unreachable becauseslash.execnever rejects (see its own docstring). On currentmain,useSubmission.ts:180and:212callshell.execdirectly for every bang command, and that is the method that is actually unregistered. Registeringcommand.dispatchper the issue's suggested fix would not have fixed the bug on currentmain.shell.execcarries nosession_id(both call sites pass only{command}), so there is no session-scoped sandbox executor to route the command through. The fix runs it viaDirectExecutor, the same host-execution pathExecToolfalls back to when no sandbox is configured, matching a plain shell escape.Type
Verification
Reproduced end to end in a clean
python:3.12-slimcontainer (uv sync --frozen --extra dev --dev):tests/test_tui_rpc_shell_exec.py(registration, stdout capture, non-zero exit code, empty-command guard) fails to import onmain(module does not exist yet) and passes on this branch (4 passed), in the same container. Also ran the fulltests/test_tui_rpc_*.pysuite (380 tests) to check for regressions: all pass.ruff check/ruff format --checkon the changed files, andpre-commit run --files <changed>(ruff, trailing-whitespace, end-of-file-fixer, large-files, merge-conflict, private-key), all clean.shell.exec, none needed.Not verified:
make test-pythononly runs a fixed list of four test files (test_commit_lint.py,test_large_file_check.py,test_cli_smoke.py,test_litellm_setup.py), which does not include this or any othertest_tui_rpc_*.pyfile, so CI'spython checksjob will not execute the new test. I ran it manually in the container described above; ran the fixed CI list too (58 passed) with no regressions.Risk
shell.execruns on the host with no sandbox, same as the existingcli.dispatchpath for non-sandboxed setups; it is reachable only from the local TUI subprocess bridge, not the network.Related Issues
Fixes #171