Skip to content

[Bug]: SSH ControlMaster socket path exceeds macOS limit with IPv6 hosts #11840

@theerror

Description

@theerror

Bug Description

On macOS, Unix domain socket paths are limited to 104 characters. When connecting to an SSH host via IPv6, the ControlMaster socket path generated by SSHEnvironment exceeds this limit, causing all terminal/file operations to fail immediately.

Steps to Reproduce

  1. Configure Hermes with an SSH environment pointing to an IPv6 address
  2. Start Hermes
  3. Any tool call fails immediately

Expected Behavior

Hermes can connect and use tools on remote server.

Actual Behavior

Any command or tool requiring remote execution is not available.

Affected Component

Setup / Installation, Tools (terminal, file ops, web, code execution, etc.)

Messaging Platform (if gateway-related)

No response

Debug Report

RuntimeError: SSH connection failed: unix_listener: path "/var/folders/2t/wbkw5yb158jc3zhswgl7tz9c0000gn/T/hermes-ssh/hermes@9373:9b91:4480:558d:708e:e601:24e8:d8d0:22.sock.O4Mllpst3K7uFRmH" too long for Unix domain socket

Operating System

macOS Sequoia 15.7.3

Python Version

3.14.3

Hermes Version

v0.10.0

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

In tools/environments/ssh.py, the control socket path embeds the full host address literally:

self.control_socket = self.control_dir / f"{user}@{host}:{port}.sock"

macOS's long temp directory (/var/folders/.../T/) + the IPv6 address + SSH's random suffix easily exceeds the 104-char Unix socket path limit.

Proposed Fix (optional)

Use a hash of the connection parameters instead of embedding them literally:

import hashlib

# In __init__:
socket_id = hashlib.sha256(f"{user}@{host}:{port}".encode()).hexdigest()[:12]
self.control_socket = self.control_dir / f"{socket_id}.sock"

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions