feat(sagemaker): support VS Code window restore for SSH connections#8804
Draft
aws-ajangg wants to merge 1 commit into
Draft
feat(sagemaker): support VS Code window restore for SSH connections#8804aws-ajangg wants to merge 1 commit into
aws-ajangg wants to merge 1 commit into
Conversation
|
⏳ I'm reviewing this pull request for security vulnerabilities and code quality issues. I'll provide an update when I'm done |
|
|
✅ I finished the code review, and didn't find any security or code quality issues. |
Enable SageMaker/HyperPod SSH connections to survive VS Code restarts by making the connect scripts self-healing when environment variables are unavailable during window restore. - Connect scripts (bash/PowerShell) resolve missing env vars from the server info JSON and script directory, restart the detached server if it's not running, and locate the SSM plugin from a known relative path - Detached server writes nodePath and serverScriptPath to info JSON so scripts can restart it autonomously - Set useLocalServer=true for SageMaker hosts on Windows (enables restore) and configure system SSH path when unset - Handle EPERM same as ESRCH when stopping old server process
|
@aws-ajangg hello 👋 is there a workaround in the meantime. we are having the same issue - vs code is always trying to reconnect to a stale session. how do we close the session cleanly to force a fresh start? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When VS Code restarts and attempts to reconnect to a SageMaker/HyperPod remote SSH session, the connection fails because:
SAGEMAKER_LOCAL_SERVER_FILE_PATH,AWS_SSM_CLI,SAGEMAKER_SERVER_SCRIPT_PATH,SAGEMAKER_NODE_PATH) are not preserved across window restoresremote.SSH.useLocalServerwas set tofalse, which prevents VS Code from restoring remote windowsSolution
Make the SSH connect scripts self-healing so they can recover from a stale environment:
nodePath/serverScriptPathfrom the info file, waiting up to 10s for it to come online. Locate the SSM plugin from a known relative path whenAWS_SSM_CLIis unset.nodePathandserverScriptPathinto the info JSON so scripts can restart it autonomously.useLocalServer=truefor SageMaker/HyperPod hosts to enable window restore. Configure the system SSH path (C:\Windows\System32\OpenSSH\ssh.exe) when unset.EPERMthe same asESRCHwhen stopping old server processes to avoid hard failures when the PID is owned by another session.Testing
startVscodeRemotecovering Windows-specific settings behavior (useLocalServer,remotePlatform, SSH path) for all SageMaker host prefixes (sm_,smc_,smhp_,smhpc_) and non-SageMaker hostsgetSmSsmEnvverifying the new env vars (SAGEMAKER_SERVER_SCRIPT_PATH,SAGEMAKER_NODE_PATH) are correctly setstopLocalServertests for the new EPERM handling behavior