Skip to content

Add direct dev environment connections - #4125

Open
wolegechu wants to merge 1 commit into
dstackai:masterfrom
wolegechu:issue_4123_direct_dev_connection
Open

Add direct dev environment connections#4125
wolegechu wants to merge 1 commit into
dstackai:masterfrom
wolegechu:issue_4123_direct_dev_connection

Conversation

@wolegechu

@wolegechu wolegechu commented Aug 10, 2026

Copy link
Copy Markdown

Summary

  • add a public Run.get_direct_connection() resolver and validated RunDirectConnection argument vectors for running, owner-accessible dev environments
  • add dstack connect for direct SSH or configured VS Code, Cursor, Windsurf, and Zed access through SSHProxy without a resident attach process
  • fail closed on missing or inconsistent proxy/IDE metadata, validate the complete record before local SSH state changes, and never invoke a shell or fall back to direct host SSH
  • document the CLI, Python API, SSHProxy requirements, and the boundary from dstack attach

Part of #4123.

CLI transcript

$ dstack connect --help
Usage: dstack connect [-h] [--project NAME]
                      [--ssh | --ide | --vscode | --cursor | --windsurf | --zed]
                      [--replica REPLICA] [--job JOB] [--expect-sshproxy HOST[:PORT]]
                      run_name
...
  --zed                 Open the dev environment in Zed
  --expect-sshproxy HOST[:PORT]
                        Fail unless the run uses this exact SSH proxy endpoint

$ dstack connect --ssh --zed dev-run
dstack connect: error: argument --zed: not allowed with argument --ssh

Validation

  • pytest -q src/tests/api/test_runs.py src/tests/api/test_direct_connect.py src/tests/_internal/cli/commands/test_connect.py (57 passed)

  • ruff format --check on all changed Python files

  • ruff check on all changed Python files

  • git diff --check

  • Pyright with the project virtual environment: 0 errors, 0 warnings

  • pre-commit for the PR diff: passed

  • mkdocs build --strict: passed

AI assistance

This PR was developed primarily with AI assistance from OpenAI Codex. I directed the design, reviewed the resulting diff, and ran the listed validations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant