Skip to content

viewer: native host is unreachable when the host.sock path is longer than 107 bytes #376

Closed

Description

@ElbertePlinio

Problem

The native viewer fails to start when the session's viewer/host.sock path is longer than 107 bytes, the Linux limit for a Unix socket path.

The host listens through a short /proc/self/fd capability path, so listen succeeds. Clients connect with the absolute path in host.json: requestNativeViewerHost in packages/desktop-linux/src/viewer-host.ts calls net.connect(host.socket). That path is $PICKFORGE_HOME/sessions/<id>/viewer/host.sock, so it is 40 bytes longer than PICKFORGE_HOME. With a PICKFORGE_HOME longer than 67 bytes, or a default home path longer than 52 bytes, connect fails with EINVAL. findNativeViewerHost treats the error as "not ready", and watch reports "Native viewer host did not report readiness" after the 12 second budget. The host log stays empty. watch then falls back to the browser viewer.

To reproduce:

  1. Set PICKFORGE_HOME to a directory with a path of about 70 bytes.
  2. Create a desktop session and run pickforge-lab watch --session <id> on a graphical display with a matching pickforge-viewer.
  3. watch reports that the native host did not report readiness. node -e 'require("net").connect(process.argv[1]).on("error", e => console.log(e.code))' <host.sock path> prints EINVAL.

Found in the 0.7.0 release device pass. A 111-byte path failed. The same host started in 0.5 s and showed the session when run by hand.

Acceptance criteria

  • The launcher, watch, MCP, and takeover reach the host for any PICKFORGE_HOME that the rest of Pickforge accepts. For example, connect through a verified directory handle or a short socket path, and keep the identity checks on the socket.
  • A test covers a session directory whose host.sock path is longer than 107 bytes.
  • If a path cannot work, the error names the path length, not readiness.

Checklist

  • Fix the connect path
  • Add the long-path test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions