Skip to content

[Bug]: starting a second agent-server in the same sandbox kills tmux sessions on the shared openhands socket #2965

@neubig

Description

@neubig

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

  1. Start an OpenHands Cloud conversation (or otherwise run one agent-server in a sandbox).
  2. In the same sandbox, start a second agent-server process with default settings.
  3. Use the original conversation's terminal tool.
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions