Skip to content

[Bug]: Two desktops using the same SSH connection details can stop each other's remote server #41825

Done

Description

@juliusmarminge

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/desktop (packages/ssh)

What happens

When two desktop apps use the same SSH connection details for one host (same alias or hostname, user and port), they share one set of ownership files on the host. The second desktop to connect is treated as the owner of the server the first one launched. When the second desktop disconnects or removes the environment, it stops that server while the first desktop is still using it.

Steps to reproduce

  1. On two computers, install the desktop app. Pick an SSH host with no T3 server running.
  2. On computer 1, add the host under Settings → Environments → Add environment → SSH. T3 Code launches a server there. Start an agent turn that runs for a while.
  3. On computer 2, add the same host with exactly the same alias or hostname, user and port. It connects to the running server.
  4. On computer 2, disconnect that environment (or remove it).

I have not run this; the steps follow the code on main.

Expected behavior

Computer 2 leaves the server alone, because it did not launch it. The docs say a server that was already running is left alone.

Actual behavior

The server on the host is stopped. Computer 1 loses its connection and the running turn ends.

Impact

Running work on a shared SSH host is interrupted by another desktop.

Version or commit

main @ 6ac6817

Environment

Desktop app on two computers, one SSH host (Linux or macOS).

Where

  • command.ts: remoteStateKey hashes alias, hostname, user and port only, so both desktops use the same ~/.t3/ssh-launch/<key> folder.
  • tunnel.ts: the launch script overwrites the launcher file with its own id before it reads who launched the running server.
  • tunnel.ts: adopt_default_server returns early for a live managed PID, so the launcher comparison at L889-L893 never runs for this case.
  • tunnel.ts: REMOTE_STOP_SCRIPT stops any managed PID without reading the launcher file.

Likely fix: compare the recorded launcher id before taking ownership and again before stopping.

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