Repository navigation
Description
Problem
The BashExecutor in openhands/tools/execute_bash/impl.py currently requires tmux to be installed on the local machine. When tmux is not available, it throws an unhelpful TmuxCommandNotFound exception that confuses users.
Current Error
When tmux is not installed, users see this error:
Traceback (most recent call last):
File "/Users/rohitmalhotra/Documents/Openhands/OpenHands-CLI/openhands_cli/agent_chat.py", line 74, in setup_agent
bash = BashExecutor(working_dir=cwd)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/rohitmalhotra/Documents/Openhands/OpenHands-CLI/.venv/lib/python3.12/site-packages/openhands/tools/execute_bash/impl.py", line 14, in __init__
self.session.initialize()
File "/Users/rohitmalhotra/Documents/Openhands/OpenHands-CLI/.venv/lib/python3.12/site-packages/openhands/tools/execute_bash/bash_session.py", line 65, in initialize
self.session = self.server.new_session(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/rohitmalhotra/Documents/Openhands/OpenHands-CLI/.venv/lib/python3.12/site-packages/libtmux/server.py", line 517, in new_session
if self.has_session(session_name):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/rohitmalhotra/Documents/Openhands/OpenHands-CLI/.venv/lib/python3.12/site-packages/libtmux/server.py", line 342, in has_session
if exact and has_gte_version("2.1"):
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/rohitmalhotra/Documents/Openhands/OpenHands-CLI/.venv/lib/python3.12/site-packages/libtmux/common.py", line 354, in has_gte_version
return get_version() >= LooseVersion(min_version)
^^^^^^^^^^^^^
File "/Users/rohitmalhotra/Documents/Openhands/OpenHands-CLI/.venv/lib/python3.12/site-packages/libtmux/common.py", line 284, in get_version
proc = tmux_cmd("-V")
^^^^^^^^^^^^^^
File "/Users/rohitmalhotra/Documents/Openhands/OpenHands-CLI/.venv/lib/python3.12/site-packages/libtmux/common.py", line 225, in __init__
raise exc.TmuxCommandNotFound
libtmux.exc.TmuxCommandNotFound
Proposed Solution
-
Fallback to local terminal: When tmux is not installed,
BashExecutorshould automatically fallback to using the local terminal (or subprocess equivalent) instead of failing completely. -
User-friendly warning: When falling back to the local terminal, display a clear warning message to the user with instructions on how to install tmux locally for better functionality.
Requirements
- Detect when tmux is not available (catch
TmuxCommandNotFoundor similar exceptions) - Implement a fallback mechanism using local terminal/subprocess
- Display a warning message like: "Warning: tmux not found. Using local terminal instead. For better session management, install tmux: [installation instructions]"
- Ensure the fallback works seamlessly without breaking existing functionality
Context
This issue was originally reported in the OpenHands-CLI repository but belongs in agent-sdk since the BashExecutor implementation is part of the openhands/tools package.
Original issue: OpenHands/OpenHands-CLI#14
Activity
xingyaoww commentedon Sep 5, 2025
Should solved by #109