Summary
When an OpenHands Cloud sandbox already has an agent-server running for the active conversation, starting another agent-server process inside the same sandbox can break the original conversation's terminal tools.
Why this happens
Current agent-server startup calls _cleanup_stale_tmux_sessions() and uses the shared openhands tmux socket (TMUX_SOCKET_NAME = "openhands"). In a shared runtime, the second server treats the first server's live tmux sessions as stale and kills them.
After that, the original conversation starts failing with errors like:
Error executing tool 'terminal': ['no server running on /tmp/tmux-10001/openhands']
Reproduction outline
- Start an OpenHands Cloud conversation (or otherwise run one
agent-server in a sandbox).
- In the same sandbox, start a second
agent-server process with default settings.
- Use the original conversation's
terminal tool.
- Observe tmux socket / missing server failures.
Expected behavior
Running another agent-server in the same sandbox should not kill tmux sessions owned by a different live server instance.
Possible fixes
- Namespace the tmux socket per server instance or per conversation.
- Make tmux cleanup opt-in or scope it to sessions created by the current server instance.
- Refuse to start when another live server is already using the shared tmux socket.
Related context
This issue was created by an AI agent (OpenHands) on behalf of the user.
Summary
When an OpenHands Cloud sandbox already has an
agent-serverrunning for the active conversation, starting anotheragent-serverprocess inside the same sandbox can break the original conversation's terminal tools.Why this happens
Current
agent-serverstartup calls_cleanup_stale_tmux_sessions()and uses the sharedopenhandstmux socket (TMUX_SOCKET_NAME = "openhands"). In a shared runtime, the second server treats the first server's live tmux sessions as stale and kills them.After that, the original conversation starts failing with errors like:
Reproduction outline
agent-serverin a sandbox).agent-serverprocess with default settings.terminaltool.Expected behavior
Running another
agent-serverin the same sandbox should not kill tmux sessions owned by a different live server instance.Possible fixes
Related context
This issue was created by an AI agent (OpenHands) on behalf of the user.