Skip to content

One reusable OpenSSH connection per workspace #422

Description

@blooop

Question

Give each workspace one reusable OpenSSH connection instead of a new one per
dl run. Per #390 — read its
resolution comment first, and note the framing that makes this small: dl already
runs OpenSSH into containers, so this adds -o flags to an argv it already
builds. It is not a new transport.

The change:

  • ControlMaster=auto, ControlPath=<derived socket>, ControlPersist=60 as
    three -o flags. A ControlPersist constant, so the value is named once.
  • A derived ControlSocket whose digest covers the SendEnv permit list and
    SSH_AUTH_SOCK. This is the load-bearing part and the reason it is derived
    rather than a path someone writes: What a devpod ssh trip costs per connection, and whether it can be reused #389 measured that a reused master
    filters SendEnv against its own permit list, silently, at exit 0, so a
    master opened without GH_TOKEN in its list yields an empty GH_TOKEN and an
    unauthenticated gh with no error. Putting the permit list in the socket's
    identity makes that mismatch unrepresentable — a different permit list is a
    different socket, so it cannot be silently reused.
  • Reuse::Multiplexed | Reuse::Direct as a sum, not an Option (principle 3).
  • The mandatory test is a property test over the permit-list key: two argvs
    whose permit lists differ must never derive one socket.

Expected: ~100x on reuse (#390 measured 2590-3140ms to 16-28ms on a load-21 rig),
and #389's 2s-per-trip concurrency staircase collapses, because non-multiplexed
trips serialize on a per-workspace lock.

Safety is already measured, in #389: a ControlMaster fails closed four ways —
a recreate under a live master leaves the socket gone and -O check at rc=255
(40 trips across a concurrent recreate: 28 to the old container, trip 29 rc=255,
30-40 correctly to the new one), and docker stop/start plus a SIGKILLed
master both recover. Note also that any devpod up rewrites devpod's ssh
config and deletes anything inside its markers, so nothing may be persisted
there.

Spawn counts do not move — auto needs no pre-warm — but the pinned argv
does, so expect the argv pins to change and say so.

Blocked on dl finding devpod's ssh config where devpod writes it.

Notes for the builder

  • Cut from origin/main; use your own worktree.
  • Guards in rust/: cargo test --workspace, cargo clippy --locked --all-targets -- -D warnings,
    cargo fmt --check.
  • Known flake, do not chase: aid's a_pasted_multi_line_prompt_arrives_whole_rather_than_leaking.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions