Skip to content

Reach teammates' terminals through the gateway #11

Open

Description

@iamnbutler

Terminals are owner-only and don't reach peers' or hosted channels' workspaces through another gateway. The owner already gets terminals by connecting directly to the host that runs a channel's workspace, including a hosted channel's workspace host. What's missing is forwarding through another gateway to that workspace, plus terminal session discovery and rights for teammates (scope audit).

Tracked by #58. Migrated from TODO.md — During dogfooding.

Activity

  1. iamnbutler commented on Oct 6, 2026

    @iamnbutler
    ContributorAuthor

    Read-only scope audit at main 6dc0f1c, linked to dogfooding #5 and distributed-work meta #58. These are code-path findings, not new runtime acceptance.

    Missing path: all four terminal operations are owner-only (gateway.ts); terminal open requires a local catalog record and has no peer/workspace forwarding (handler). The existing code does permit the owner's direct tailnet browser and hosted channels opened on their workspace host. Another gateway reaching that workspace remains unsupported; the hosted cell itself has no shell.

    Design required before implementation:

    • Creating a new shell in a teammate's checkout differs from discovering/attaching to their existing terminal. IDs currently live in client layouts; there is no session-discovery protocol.
    • Direct PTY access runs as the host OS user. Read, input, resize, and close rights are not defined by the existing switch, which controls only new agent invocations (team semantics). Preserve the tailnet trust model; don't silently broaden that flag.
    • Reattach and continuation operations currently trust terminal IDs. Peer exposure needs channel/participant binding and explicit existing-session semantics (terminal manager).
    • Define output/exit forwarding, reconnect/replay, simultaneous input/resize, close versus detach, orphan timeout, and kill/archive/delete behavior.

    Recommendation: no straight-proxy patch. An owner-only route through their other machines is a smaller possible first slice; teammate session access needs the decisions above. Validate the owner route on two machines and teammate rights with two people. #159 addresses transcript watches, while #53 addresses agent jobs; neither implements this terminal feature.

  2. iamnbutler commented on Oct 15, 2026

    @iamnbutler
    ContributorAuthor

    Status on main (October 15, fb3ff46)

    This still doesn't work. Verified from the code; no new runtime test.

    What works: the host's owner, in the app connected to that host, opens a terminal in a chat's lane or the project checkout. For a hosted channel, that host is its workspace host.

    What's refused:

    Who opens the terminal Result Where
    A teammate, on any channel Refused. terminal, terminal-input, terminal-resize and terminal-close are in localOps, which refuses every peer client and any user other than the owner. apps/host/src/gateway.ts (localOps, the check localOps.has(op) && (client.peer || …))
    The owner, from their other Mac Refused. The request reaches the other host as a peer, and peers "never act as its owner". The app's own host also answers "Terminals open on the channel's host". gateway.ts case "terminal"
    Anyone, on a cloud compute channel Refused: "A cloud compute channel's shell is in its container, not on this host". The compute runner has no PTY endpoint (#216, #417). gateway.ts case "terminal"

    What changed since the October 6 audit

    Suggested slices

    1. Owner terminals from another of their machines: recognise the same owner arriving from a peer (by Tailscale login), and relay terminal* to the channel's host.
    2. Teammate terminals on shared channels: a new terminal, not attaching to someone else's, allowed when sharing is on. Copy states it's a shell as the owner. Terminals are bound to their channel, and kill, archive and delete close them.
    3. Compute channel terminals: a PTY in the container, through the compute service.
  3. iamnbutler commented on Oct 15, 2026

    @iamnbutler
    ContributorAuthor

    Cloud compute channels (#216, now closed) also fall under this issue, as #58 lists. Their workspace is a container on the compute service, and the host opens no terminal for a compute record (docs/architecture.md, Cloud compute (beta)). So today even the owner gets no terminal for a cloud channel.

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