Skip to content

Terminal plugin disconnects immediately on macOS after install #1

@samwei12

Description

@samwei12

Summary

After installing the official cloudcli-plugin-terminal through CloudCLI Settings > Plugins on macOS, opening the Terminal tab connects briefly and then immediately shows disconnected.

Environment

  • CloudCLI: 1.29.0
  • Plugin: cloudcli-plugin-terminal 1.0.1
  • Platform: macOS arm64
  • Install path: CloudCLI plugin manager (npm install --ignore-scripts, then build)

What I observed

  • The UI briefly shows a connected state and then disconnects immediately.
  • CloudCLI-side logs show the plugin websocket connection being established.
  • The plugin backend then fails when spawning the PTY shell.

Reproduction

  1. Install cloudcli-plugin-terminal from the official repo through Settings > Plugins.
  2. Open the Terminal tab on macOS.
  3. The session disconnects almost immediately.

Root cause

The plugin depends on node-pty, and on macOS the packaged prebuilds/darwin-*/spawn-helper can be present without execute permission.

CloudCLI's plugin installer intentionally runs:

  • npm install --ignore-scripts

So install-time postinstall hooks are blocked by design. That means the main CloudCLI app's own node-pty fix pattern cannot be reused here via plugin install hooks.

As a result, the terminal plugin can reach websocket-ready state, but then fail on pty.spawn(...) with a macOS-side spawn error (posix_spawnp failed), which surfaces as an immediate disconnect in the UI.

Expected behavior

The plugin should recover from this packaging/permission issue at runtime, before calling pty.spawn(...), without requiring install-time scripts.

Suggested fix

Do a darwin-only, best-effort runtime self-heal inside the plugin server right before pty.spawn(...):

  • locate the actual loaded node-pty module root
  • target only the current architecture's spawn-helper
  • add only the minimal execute bit needed
  • no-op on non-macOS platforms

This stays within CloudCLI's plugin security model because it does not require relaxing --ignore-scripts.

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