Skip to content

Remote host stays bound to its first workspace: GUI removal leaves the bridge, other workspaces can't attach it #1017

Open

Description

@ZekeAranyLucas

Summary

A remote host attached in one workspace can't be added in another, and removing it from the first workspace doesn't release it. Three problems combine:

  1. Removing a remote project in the GUI leaves its bridge running. The remote-redials/<host>.redial marker survives and the bridge stays bound, re-binding on reconnect.
  2. Every workspace reverse-forwards to the same remote socket. The bridge runs ssh -N -o ExitOnForwardFailure=yes -R /home/<user>/.graphcode/graphcoded.sock:<workspace>/graphcoded.sock <host>. The remote path ignores the workspace, so the first workspace to bind a host owns it. A second workspace's add fails silently: its daemon log records no attempt or error.
  3. A dead bridge leaves a stale remote socket. ~/.graphcode/graphcoded.sock stays on the host without a listener. Without StreamLocalBindUnlink yes in the host's sshd, the next -R bind fails until the file is removed by hand.

Repro (graphcode 0.1.84, macOS, Codespaces hosts)

  1. In workspace Default, add ssh://user@kouign-amann_…:22/workspace/src/odang.
  2. Create a second workspace (odang-crash-loops, ~/.graphcode-odang-crash-loops) and try to add the same host. It fails. Another host not held by Default (brioche) adds fine.
  3. Remove the host from Default in the GUI, then add it to the second workspace again. It still fails.

Evidence after the GUI removal

  • ~/.graphcode/open-projects.json and recent-projects.json no longer listed kouign-amann.
  • ~/.graphcode/remote-redials/kouign-amann_20261022_191009.redial still existed.
  • Bridge sh -c gc_host='…kouign-amann…' was still alive (parent: Default's graphcoded), with child ssh -N … -R /home/zaranylucas/.graphcode/graphcoded.sock:/Users/zaranylucas/.graphcode/graphcoded.sock ….
  • ~/.graphcode/dials.log: 2026-11-18T22:02:29Z bridge graphcoded forward bind zaranylucas@kouign-amann_20261022_191009:22 ppid=1284 (re-bound after the host was in use elsewhere).
  • Second workspace's graphcoded.log: no entry for the host at all.
  • On the host, after killing the bridge: srw------- … ~/.graphcode/graphcoded.sock with no listener (ss -xl count 0).

Workaround

Move the .redial marker out of remote-redials/, kill the bridge sh and ssh processes, delete the stale remote ~/.graphcode/graphcoded.sock, then add the host in the other workspace.

Suggested fixes

  • Removing a remote project should delete its redial marker and stop its bridge.
  • Report a forward-bind failure in the UI. For example: "host is attached to workspace X".
  • Either make the remote socket path workspace-specific, so the remote CLI resolves the right daemon, or explicitly enforce one workspace per host with a clear error and a "move here" action.
  • Remove a stale remote socket before binding when nothing is listening on it.

Activity

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