<#1230 feat(debug): SSH-into-task debug over WebSo...
# flyte-github
a
#1230 feat(debug): SSH-into-task debug over WebSocket Pull request opened by kumare3 SSH-into-task debug over WebSocket (pod side) Adds an
_F_E_SSH
debug mode — a real-ssh sibling to the existing browser code-server
_F_E_VS
path. On the
a0
entrypoint it starts an
sshd
bound to
127.0.0.1:2222
and an in-process WebSocket→sshd bridge on the routed debug port (
:6060
), so a developer can attach plain
ssh
, `scp`/`rsync`, or VS Code Remote-SSH to a running task pod. Enabled via the
_F_E_SSH
env var (the SSH public key is injected via
_F_SSH_PK
), e.g. through
flyte.with_runcontext(env_vars=...)
. This PR is the pod-side server only; the matching desktop client is provided separately. What's here •
Sshd
class — daemon lifecycle: locate / best-effort apt-install the binary, generate the host key, write
authorized_keys
+ a minimal key-only
sshd_config
,
start()
(asyncio subprocess) /
wait(timeout)
/
stop()
. •
WsBridge
class — readiness endpoint + WebSocket↔️sshd bridge: `start()`/`stop()`; handles concurrent connections, ping/pong keepalive, and serializes frame writes under a lock. • key-only sshd with
internal-sftp
(VS Code Remote-SSH) and
AllowTcpForwarding
(
ssh -L
/ debugpy). • stages the code bundle and writes
.vscode/launch.json
+ a
python -m pdb
helper; interactive shells land in the code dir. • async-first throughout;
sys.exit()
after a max-uptime ceiling. Tests
tests/flyte/test_ssh_debug.py
(19): WS frame roundtrip (masked/large/oversize), RFC6455 accept key,
Sshd
config/keys/`find_binary`,
WsBridge
start/stop, and an end-to-end WS→sshd bridge echo. ruff clean. Verified on cluster Built the wheel, launched a debug run, resolved the route, then
ssh
→ landed a root shell in
/home/flyte
with the task code present (connected first attempt). flyteorg/flyte-sdk