<#1241 replace with asyncssh so that no install at...
# flyte-github
a
#1241 replace with asyncssh so that no install at runtime Pull request opened by kumare3 What Replace the system
sshd
used by SSH-into-task debug with the pure-Python asyncssh server, so there's no runtime package install on the pod. The default task image runs as the non-root
flyte
user with a root-owned venv, so
apt-get install openssh-server
(or relying on a preinstalled
sshd
) isn't viable at runtime.
asyncssh
is added as a flyte dependency (pure-Python, ~370 KB; its only requirement
cryptography
already ships via pyOpenSSL), so it's always present in the image. The in-process
SshServer
(in
src/flyte/_debug/ssh.py
) generates its host key and authorizes the user's key in-process, serves PTY login shells and
ssh host <cmd>
execs, allows client-initiated TCP forwarding (`ssh -L`/`-D`, needed by VS Code Remote-SSH), and exposes SFTP.
import asyncssh
is kept local to the server methods so importing the module (e.g. for the
WsBridge
) doesn't pull asyncssh. Changes • `pyproject.toml`: add
asyncssh>=2.14
runtime dependency. • `src/flyte/_debug/ssh.py`: in-process asyncssh server replacing the
sshd
subprocess (host-key gen, key auth, PTY/pipe sessions, SFTP, TCP forwarding); lazy
import asyncssh
. • `src/flyte/_debug/vscode.py`: generated
.vscode/launch.json
now uses the modern
"type": "debugpy"
instead of the deprecated
"type": "python"
, which fails to resolve a debug adapter on current
ms-python.debugpy
versions and would break F5 "Interactive Debugging" over VS Code Remote-SSH. • `tests/flyte/test_ssh_debug.py`: updated for the asyncssh server. •
uv.lock
+ all `plugins/*/uv.lock`: relock for the new asyncssh dependency (it propagates into every plugin that depends on flyte). CI fixes (post-merge with
main
)
• mypy: annotated
SshServer._acceptor: Optional["asyncssh.SSHAcceptor"]
(via a
TYPE_CHECKING
import) — now that asyncssh is a hard dep, mypy resolves `asyncssh.listen()`'s return type and flagged the assignment to the bare
_acceptor = None
. • check uv.lock: regenerated every plugin lockfile so
uv lock --check
is green across the repo. End-to-end validation (demo cluster:
demo.hosted.unionai.cloud
)
Built the local wheel (
make dist
, baked into a
from_debian_base
image), ran a task, then
flyte debug <run>
to relaunch it with ssh-debug and connected: • ✅ SSH connect through the
:6060
WebSocket bridge → in-pod asyncssh server (
asyncssh 2.24.0
, baked into the image, no runtime install) • ✅ Command exec, PTY interactive shell (
/dev/pts/0
,
TERM=xterm-256color
), and SFTP subsystem (VS Code Remote-SSH / scp) • ✅ Workspace staged (code bundle downloaded) + debug helpers written (
.vscode/launch.json
,
flyte-debug-task.sh
pdb helper) VS Code Remote-SSH debugging path specifically verified: • ✅
x86_64
+ glibc 2.36 →
server-linux-x64
compatible; egress to the VS Code CDN returns HTTP 200 (server bootstraps) • ✅ Local forward (
ssh -L
) and dynamic SOCKS forward (
ssh -D
) both return HTTP 200 —
direct-tcpip
forwarding works (the extension host + port forwarding Remote-SSH relies on) • ✅
launch.json
"Interactive Debugging" entrypoint (
/opt/venv/bin/runtime.py
) present; debugpy is supplied by the VS Code extension (not required in the task venv) flyteorg/flyte-sdk