microsoft / microsoft/vscode-remote-release

SendEnv does not work

Open
#11,447 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ssh
Dominant language
Dockerfile
Stars
4.2k
Forks
469
Avg merge
1d 1h
Merged PRs (30d)
1

Description

Is there an existing issue for this bug?
  • I have searched the existing open issues and found none that apply.
  • If I find any issue of interest that is related or closed, I will included a link to it in this issue.
Required Troubleshooting Steps
  • I have read and performed the troubleshooting steps
  • I have tried both values of the remote.SSH.useLocalServer setting
  • My issue was not covered in the Tips and Tricks linked from the Troubleshooting Wiki.
  • I will include a complete copy of my Remote - SSH logs by running Remote-SSH: Show Log in the command palette or from View > Output in the menu bar
[Optional] Diagnose with Copilot

I did not ask the @remote-ssh participant for help

In step 2 of the troubleshooting wiki, what was the result of running the generated SSH command verbatim outside of VS Code?

When I ran

ssh -T -D 56389 -o ConnectTimeout=15 bashbox2 sh

it complained about the port being already in use, so I used 56388 instead. Then inside that shell session the command

env | rg GOOGLE

showed the env var as expected.

Remote-SSH Log
Remote-SSH Log

[14:39:12.808] Log Level: 2
[14:39:12.815] SSH Resolver called for "ssh-remote+bashbox2", attempt 1
[14:39:12.817] remote.SSH.useLocalServer = false
[14:39:12.817] remote.SSH.useExecServer = true
[14:39:12.817] remote.SSH.bindHost = {}
[14:39:12.817] remote.SSH.showLoginTerminal = false
[14:39:12.817] remote.SSH.remotePlatform = {"bashbox2":"linux"}
[14:39:12.817] remote.SSH.path = 
[14:39:12.817] remote.SSH.configFile = 
[14:39:12.817] remote.SSH.useFlock = true
[14:39:12.818] remote.SSH.lockfilesInTmp = false
[14:39:12.818] remote.SSH.localServerDownload = auto
[14:39:12.818] remote.SSH.remoteServerListenOnSocket = false
[14:39:12.818] remote.SSH.defaultExtensions = []
[14:39:12.818] remote.SSH.defaultExtensionsIfInstalledLocally = []
[14:39:12.818] remote.SSH.loglevel = 2
[14:39:12.818] remote.SSH.enableDynamicForwarding = true
[14:39:12.818] remote.SSH.enableRemoteCommand = false
[14:39:12.818] remote.SSH.serverPickPortsFromRange = {}
[14:39:12.818] remote.SSH.serverInstallPath = {}
[14:39:12.818] remote.SSH.permitPtyAllocation = false
[14:39:12.818] remote.SSH.preferredLocalPortRange = undefined
[14:39:12.818] remote.SSH.useCurlAndWgetConfigurationFiles = false
[14:39:12.819] remote.SSH.experimental.chat = true
[14:39:12.819] remote.SSH.experimental.enhancedSessionLogs = true
[14:39:12.819] remote.SSH.httpProxy = {"*":""}
[14:39:12.819] remote.SSH.httpsProxy = {"*":""}
[14:39:12.823] VS Code version: 1.108.1
[14:39:12.823] Remote-SSH version: remote-ssh@0.122.0
[14:39:12.823] darwin arm64
[14:39:12.827] SSH Resolver called for host: bashbox2
[14:39:12.827] Setting up SSH remote "bashbox2"
[14:39:12.832] Using commit id "585eba7c0c34fd6b30faac7c62a42050bfbc0086" and quality "stable" for server
[14:39:12.832] Extensions to install: 
[14:39:12.834] Install and start server if needed
[14:39:12.835] PATH: /opt/homebrew/opt/gnu-sed/libexec/gnubin:/opt/homebrew/opt/gnu-tar/libexec/gnubin:/opt/homebrew/opt/gnu-sed/libexec/gnubin:/opt/homebrew/opt/grep/libexec/gnubin:/opt/homebrew/opt/coreutils/libexec/gnubin:/Users/kerrick/Library/Python/3.12/bin:/Users/kerrick/Library/Python/3.11/bin:/Users/kerrick/Library/Python/3.10/bin:/Users/kerrick/go/bin:/Applications/VLC.app/Contents/MacOS:/opt/homebrew/Cellar/ruby/3.4.7/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Library/TeX/texbin:/Applications/VMware Fusion.app/Contents/Public:/Users/kerrick/bin:/Users/kerrick/.local/bin:/Applications/Sublime Text.app/Contents/SharedSupport/bin:/Applications/Visual Studio Code.app/Contents/Resources/app/bin:/opt/homebrew/opt/fzf/bin
[14:39:12.835] Checking ssh with "ssh -V"
[14:39:12.840] > OpenSSH_9.9p2, LibreSSL 3.3.6

[14:39:12.843] Running script with connection command: ssh -T -D 56389 -o ConnectTimeout=15 bashbox2 sh
[14:39:12.843] Generated SSH command: 'ssh -T -D 56389 -o ConnectTimeout=15 bashbox2 sh << 'EOSSH'
# shellcheck shell=sh

echo "74531aae2f14: running"
echo "Script executing under PID: $$"

VSC_TMP="${XDG_RUNTIME_DIR:-/tmp}"

# Configuration
UUID="74531aae2f14"
COMMIT_ID="585eba7c0c34fd6b30faac7c62a42050bfbc0086"
QUALITY="stable"
TOKEN="305015e3-4306-4fc0-a28e-c36965d25a9f"
VSCODE_AGENT_FOLDER="$HOME/.vscode-server"
ALLOW_CLIENT_DOWNLOAD="1"
FORCE_CLIENT_DOWNLOAD="0"
CLI_NAME_IN_ARCHIVE="code"
IGNORE_WGET_CONFIG_FLAG=" --no-config "
IGNORE_CURL_CONFIG_FLAG=" --disable "
WGET_TRIES_SEGMENT="--tries=1"
LISTEN_ARGS="--on-host=127.0.0.1 --on-port"
VERBOSE="0"
HTTP_PROXY_INPUT=""
HTTPS_PROXY_INPUT=""
RECONNECTION_GRACE_TIME=""

CLI_NAME_ON_DISK="${CLI_NAME_IN_ARCHIVE}-${COMMIT_ID}"
CLI_PATH="${VSCODE_AGENT_FOLDER}/${CLI_NAME_ON_DISK}"
CLI_LOG_FILE="${VSCODE_AGENT_FOLDER}/.cli.${COMMIT_ID}.log"

# Marker strings
GET_DOWNLOAD_SERVER_START_TRIGGER="74531aae2f14:trigger_server_download"
GET_DOWNLOAD_SERVER_END_TRIGGER="74531aae2f14:trigger_server_download_end"
GET_PROGRESS_DOWNLOADING="74531aae2f14%%1%%"
GET_PROGRESS_INSTALLING="74531aae2f14%%2%%"

UNPACK_RESULT=
DID_LOCAL_DOWNLOAD=0
DOWNLOAD_TIME=
INSTALL_TIME=
SERVER_START_TIME=

fail_with_exitcode() {
	echo "${UUID}: start"
	echo "exitCode==$1=="
	echo_common_results
	echo "${UUID}: end"
	exit 0
}

echo_common_results() {
	echo "listeningOn==$LISTENING_ON=="
	echo "osReleaseId==$OSRELEASEID=="
	echo "arch==$ARCH=="
	echo "vscodeArch==$VSCODE_ARCH=="
	echo "bitness==$BITNESS=="
	echo "tmpDir==$VSC_TMP=="
	echo "platform==$PLATFORM=="
	echo "unpackResult==$UNPACK_RESULT=="
	echo "didLocalDownload==$DID_LOCAL_DOWNLOAD=="
	echo "downloadTime==$DOWNLOAD_TIME=="
	echo "installTime==$INSTALL_TIME=="
	echo "serverStartTime==$SERVER_START_TIME=="
	echo "execServerToken==${TOKEN}=="
	echo "platformDownloadPath==$PLATFORM_DOWNLOAD_PATH=="
	echo "SSH_AUTH_SOCK==$SSH_AUTH_SOCK=="
echo "DISPLAY==$DISPLAY=="
}

millis() {
	d=$(date +%s%N)
	# Test if 'd' contains any non-digit characters
	if [ -z "${d##*[!0-9]*}" ] || [ "$PLATFORM" != "linux" ]; then
	    # Fallback for MacOS or any date binary that doesn't handle '%N'
		echo $(($(date +%s)*1000))
		return
	fi
	echo $((d/1000000))
}

elapsed() {
	echo $(($(millis) - $1))
}

printenv_indent() {
	if [ "$VERBOSE" = "1" ]; then
		echo "printenv:"
		printenv | sed 's/^/    /'
	fi
}

[ -z "${http_proxy}" ] && [ "${HTTP_PROXY_INPUT}" != "" ] && export http_proxy="$HTTP_PROXY_INPUT"
[ -z "${https_proxy}" ] && [ "${HTTPS_PROXY_INPUT}" != "" ] && export https_proxy="$HTTPS_PROXY_INPUT"

#
# Get OS name
#
OSRELEASEID=$(cat /etc/os-release 2>/dev/null | grep -a -E '^ID=' | sed 's/^[Ii][Dd]=//g' | sed 's/"//g')
if [ -z "$OSRELEASEID" ]
then
	OSRELEASEID=$(cat /usr/lib/os-release 2>/dev/null | grep -a -E '^ID=' | sed 's/^[Ii][Dd]=//g' | sed 's/"//g')
	if [ -z "$OSRELEASEID" ]
	then
		OSRELEASEID=$(uname -s)
	fi
fi

#
# Get host platform/architecture
#
UNAME=$(uname -s)
case $UNAME in
	Linux) PLATFORM=linux;;
	Darwin) PLATFORM=macOS;;
	*)
		echo "Unsupported platform: $UNAME"
		fail_with_exitcode 203
		;;
esac

BITNESS=$(getconf LONG_BIT)
ARCH=$(uname -m)
case $ARCH in
	x86_64) VSCODE_ARCH="x64";;
	armv7l | armv8l)
		VSCODE_ARCH="armhf"
		;;
	arm64 | aarch64)
		if [ "$BITNESS" = 32 ]; then
			# Can have 32-bit userland on 64-bit kernel
			VSCODE_ARCH="armhf"
		else
			VSCODE_ARCH="arm64"
		fi
		;;
	*)
		OSRELEASE=$(uname -r)
		case $OSRELEASE in
			*x86_64*) VSCODE_ARCH="x64";;
			*)
				echo "Unsupported architecture: $ARCH"
				fail_with_exitcode 196
			;;
		esac
		;;
esac

if [ "$PLATFORM" = linux ]; then
	if [ "$VSCODE_ARCH" = armhf ]; then
		PLATFORM_DOWNLOAD_PATH=cli-linux-armhf
	else
		PLATFORM_DOWNLOAD_PATH=cli-alpine-$VSCODE_ARCH
	fi
elif [ "$VSCODE_ARCH" = "arm64" ]; then
	PLATFORM_DOWNLOAD_PATH=cli-darwin-arm64
else
	PLATFORM_DOWNLOAD_PATH=cli-darwin-x64
fi

if [ ! -d "$VSCODE_AGENT_FOLDER" ]; then
	mkdir -p "$VSCODE_AGENT_FOLDER"
	chmod 750 "$VSCODE_AGENT_FOLDER"

	error_code=$?
	if [ "${error_code}" -gt 0 ]; then
		echo "Creating the server install dir failed..."
		fail_with_exitcode 202
	fi
fi

#
# Delete old CLIs if needed
#

# shellcheck disable=SC2010
TO_DELETE=$(ls -1 -t "$VSCODE_AGENT_FOLDER" | grep -E "code(-insiders)?-[a-fA-F0-9]{40}" | tail -n +6)
for CLI_TO_DELETE in $TO_DELETE; do
	target_dir="$VSCODE_AGENT_FOLDER/$CLI_TO_DELETE"
	echo "Deleting old install $target_dir"
	rm -rf "$target_dir"
done

do_client_download() {
	DID_LOCAL_DOWNLOAD=1
	echo "Trigger local server download"
	echo "${GET_DOWNLOAD_SERVER_START_TRIGGER}"
	echo artifact==$PLATFORM_DOWNLOAD_PATH==
	echo destFolder==$VSCODE_AGENT_FOLDER==
	echo destFolder2==/vscode-cli-$COMMIT_ID.tar.gz==
	echo "${GET_DOWNLOAD_SERVER_END_TRIGGER}"
	echo "Waiting for client to transfer server archive..."
	echo "Waiting for $VSCODE_AGENT_FOLDER/vscode-cli-$COMMIT_ID.tar.gz.done and vscode-server.tar.gz to exist"

	while true; do
		if [ -f "$VSCODE_AGENT_FOLDER/vscode-cli-$COMMIT_ID.tar.gz.done" ]; then
			if [ ! -f "$VSCODE_AGENT_FOLDER/vscode-cli-$COMMIT_ID.tar.gz" ]; then
				echo "Found flag but not server tar - server transfer failed"
				fail_with_exitcode 199
			fi

			echo "Found flag and server on host"
			rm "$VSCODE_AGENT_FOLDER/vscode-cli-$COMMIT_ID.tar.gz.done"
			break
		else
			printf ' '
			sleep 3
		fi
	done
}

do_client_download_or_fail() {
	error_code="${1:-"1"}"
	if [ "$DID_LOCAL_DOWNLOAD" = "1" ]; then
		echo "Already attempted local download, failing"
		fail_with_exitcode "$error_code"
	elif [ $ALLOW_CLIENT_DOWNLOAD = "1" ]; then
		do_client_download
	else
		fail_with_exitcode "$error_code"
	fi
}

is_program_from_busybox() {
	program=$1
	if command -v busybox > /dev/null 2>&1
	then
		# Check symlink from program to busybox
		if [ -L "$(command -v "$program")" ] && [ "$(readlink -f "$(command -v "$program")")" = "$(command -v busybox)" ]
		then
			echo "Program '$program' is provided by busybox" >&2
			echo 'yes'
			return
		fi
	fi
	echo 'no'
}

supports_flag() {
    program="$1"
    flag="$2"

    if command -v "$program" > /dev/null 2>&1; then
        if "$program" --help 2>&1 | grep -q -- "$flag"
		then
			echo "Program '$program' appears to support flag '$flag'" >&2
			echo 'yes'
			return
		fi
    fi
		echo "Program '$program' is not available or does not appear to support flag '$flag'" >&2
        echo 'no'
}

do_host_download() {
	start=$(millis)
	echo "${GET_PROGRESS_DOWNLOADING}"

	UPDATE_URL="https://update.code.visualstudio.com"
	DOWNLOAD_URL=$UPDATE_URL/commit:$COMMIT_ID/$PLATFORM_DOWNLOAD_PATH/${QUALITY}

	if command -v wget > /dev/null 2>&1
	then
		echo "Downloading with wget"
		IS_WGET_BUSYBOX=$(is_program_from_busybox wget)

		echo "wget is from busybox: $IS_WGET_BUSYBOX"

		if [ "$IS_WGET_BUSYBOX" = 'no' ]
		then
			# Not busybox.
			# Assuming its GNU wget or similar

			if [ -n "$IGNORE_WGET_CONFIG_FLAG" ] && [ "$(supports_flag 'wget' '--no-config')" = "no" ]; then
				echo "Detected that this version of wget does not support '--no-config'. Will not ignore wget default configuration files."
				IGNORE_WGET_CONFIG_FLAG=""
			fi

			WGET_ERRORS=$(2>&1 wget ${IGNORE_WGET_CONFIG_FLAG} ${WGET_TRIES_SEGMENT} --connect-timeout=7 --dns-timeout=7 -nv -O vscode-cli-$COMMIT_ID.tar.gz ${DOWNLOAD_URL})
		else
			# Is busybox.
			# Remove flags for the sake of compatibility

			WGET_ERRORS=$(2>&1 wget -O vscode-cli-$COMMIT_ID.tar.gz ${DOWNLOAD_URL})
		fi

		error_code=$?
		if [ $error_code -ne 0 ]
		then
			echo "wget download failed"
			echo "$WGET_ERRORS"
			printenv_indent

			do_client_download_or_fail 193
		else
			echo "Download complete"
			DOWNLOAD_TIME=$(elapsed $start)
		fi
	else
		command -v curl > /dev/null 2>&1
		error_code=$?
		if [ $error_code -eq 0 ]
		then
			echo "Downloading with curl"
			CURL_STATUS_CODE_RESULT=$(curl ${IGNORE_CURL_CONFIG_FLAG} --connect-timeout 7 -L $DOWNLOAD_URL --output vscode-cli-$COMMIT_ID.tar.gz -w "%{http_code}")
			error_code=$?
			curl_status_code_if_2xx=$(echo "$CURL_STATUS_CODE_RESULT" | grep -E "^2[0-9]{2}$")
			if [ $error_code -ne 0 ] || [ -z "$curl_status_code_if_2xx" ]
			then
				echo "curl download failed"
				echo "HTTP status code: $CURL_STATUS_CODE_RESULT"
				printenv_indent

				do_client_download_or_fail 193
			else
				echo "Download complete"
				DOWNLOAD_TIME=$(elapsed $start)
			fi
		else
			printenv_indent
			echo "Neither wget nor curl is installed"

			do_client_download_or_fail 194
		fi
	fi
}

do_install() {
	start=$(millis)
	echo "${GET_PROGRESS_INSTALLING}"
	UNPACK_RESULT="success"
	echo "tar --version: $(tar --version)"
	tar -xf vscode-cli-$COMMIT_ID.tar.gz --no-same-owner
	TAR_EXIT=$?
	INSTALL_TIME=$(elapsed $start)

	if [ $TAR_EXIT -ne 0 ]
	then
		echo "ERROR: tar exited with a non-zero exit code: $TAR_EXIT"
		UNPACK_RESULT="error"
		do_client_download_or_fail "205"
		do_install
		return
	fi

	mv "$CLI_NAME_IN_ARCHIVE" "$CLI_PATH"

	# cheap sanity check

	if ! eval "$CLI_PATH --version"
	then
		UNPACK_RESULT="missingFiles"
		echo "ERROR: $CLI_PATH don't exist"
		do_client_download_or_fail "205"
		do_install
		return
	fi

	# Delete the leftover folder which might have -web prefix, and the .tar.gz
	rm -rf vscode-cli*
}

#
# Install if needed
#
if [ ! -f "$CLI_PATH" ]
then
	echo "Installing to $VSCODE_AGENT_FOLDER..."
	STASHED_WORKING_DIR="$(pwd)"
	cd "$VSCODE_AGENT_FOLDER" || fail_with_exitcode 206

	if [ $FORCE_CLIENT_DOWNLOAD = "1" ]; then
		do_client_download
	else
		do_host_download
	fi

	do_install
	cd "$STASHED_WORKING_DIR" || fail_with_exitcode 206
else
	echo "Found existing installation at $VSCODE_AGENT_FOLDER..."
fi


#
# Start the server
#
start_server() {
	echo "Starting VS Code CLI..."
	printenv_indent
	start=$(millis)
	if [ -f $CLI_LOG_FILE ]; then
		echo "Removing old logfile at $CLI_LOG_FILE"
		rm "$CLI_LOG_FILE" # See #6265
	fi

	# Stop exporting VSCODE_AGENT_FOLDER once https://github.com/microsoft/vscode/pull/228287 is available and replace with:
	# --extensions-dir "$VSCODE_AGENT_FOLDER/extensions" --user-data-dir "$VSCODE_AGENT_FOLDER/data"
	# See https://github.com/microsoft/vscode-internalbacklog/issues/2604, https://github.com/microsoft/vscode-remote-release/issues/10255
	export VSCODE_AGENT_FOLDER

	touch $CLI_LOG_FILE
	chmod 600 $CLI_LOG_FILE

	LOG_LEVEL_FLAG=""
	if [ "$VERBOSE" = "1" ]; then
	    echo "Setting '--log trace' on CLI"
		LOG_LEVEL_FLAG="--log trace"
	fi

	RECONNECTION_FLAG=""
	if [ -n "$RECONNECTION_GRACE_TIME" ]; then
		RECONNECTION_FLAG="--reconnection-grace-time $RECONNECTION_GRACE_TIME"
	fi

	VSCODE_CLI_REQUIRE_TOKEN=${TOKEN} "$CLI_PATH" command-shell ${LOG_LEVEL_FLAG} ${RECONNECTION_FLAG} --cli-data-dir "$VSCODE_AGENT_FOLDER/cli" --parent-process-id $$ ${LISTEN_ARGS} > "$CLI_LOG_FILE" 2>&1 < /dev/null &
	CLI_PID=$!
	echo "Spawned remote CLI: $!"

	count=0
	max_retries=15
	while [ $count -lt $max_retries ]; do
		count=$((count + 1))
		LISTENING_ON=$(cat "$CLI_LOG_FILE" | grep -a -E 'Listening on .+' | grep -v grep | sed 's/Listening on //')
		if [ "$LISTENING_ON" != '' ]
		then
			break
		fi

		# "If sig is 0 (the null signal), error checking is performed but no signal is actually sent.
		# The null signal can be used to check the validity of pid.""
		# Source: https://pubs.opengroup.org/onlinepubs/007908799/xsh/kill.html
		if ! kill -0 $CLI_PID > /dev/null; then
			echo "Exec server process not found"
			cat $CLI_LOG_FILE
			if grep -q "This machine does not meet .* prerequisites, expected either..." "$CLI_LOG_FILE"; then
				fail_with_exitcode 207
			fi
			break
		fi

		echo "Waiting for server log..."
		sleep .03 || sleep 1
	done
	SERVER_START_TIME=$(elapsed $start)
}

start_server

# What we echo below cannot be wider than 80 characters
echo "${UUID}: start"
echo_common_results
echo "${UUID}: end"

while true; do sleep 180; printf ' '; done

EOSSH'
[14:39:12.843] Using connect timeout of 17 seconds
[14:39:13.591] > 74531aae2f14: running
> Script executing under PID: 1098854
[14:39:13.591] Got some output, clearing connection timeout
[14:39:13.597] > Found existing installation at /home/kerrick/.vscode-server...
> Starting VS Code CLI...
> Removing old logfile at /home/kerrick/.vscode-server/.cli.585eba7c0c34fd6b30faac7c62a42050bfbc0086.log
> Spawned remote CLI: 1098872
[14:39:13.605] > Waiting for server log...
[14:39:13.640] > Waiting for server log...
[14:39:13.679] > 74531aae2f14: start
> listeningOn==127.0.0.1:39969==
> osReleaseId==ubuntu==
> arch==x86_64==
> vscodeArch==x64==
> bitness==64==
> tmpDir==/run/user/1002==
> platform==linux==
> unpackResult====
> didLocalDownload==0==
> downloadTime====
> installTime====
> serverStartTime==75==
> execServerToken==111111a1-1111-1aa1-a11a-a11111a11a1a==
> platformDownloadPath==cli-alpine-x64==
> SSH_AUTH_SOCK==/tmp/ssh-xEXBZ7zp1B/agent.1098853==
> DISPLAY====
> 74531aae2f14: end
[14:39:13.679] Received install output: 
listeningOn==127.0.0.1:39969==
osReleaseId==ubuntu==
arch==x86_64==
vscodeArch==x64==
bitness==64==
tmpDir==/run/user/1002==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
serverStartTime==75==
execServerToken==111111a1-1111-1aa1-a11a-a11111a11a1a==
platformDownloadPath==cli-alpine-x64==
SSH_AUTH_SOCK==/tmp/ssh-xEXBZ7zp1B/agent.1098853==
DISPLAY====

[14:39:13.680] Remote server is listening on port 39969
[14:39:13.680] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":39969},"osReleaseId":"ubuntu","arch":"x86_64","sshAuthSock":"/tmp/ssh-xEXBZ7zp1B/agent.1098853","display":"","tmpDir":"/run/user/1002","platform":"linux","execServerToken":"111111a1-1111-1aa1-a11a-a11111a11a1a"},"serverStartTime":75,"installUnpackCode":""}
[14:39:13.694] Starting forwarding server. local port 56391 -> socksPort 56389 -> remotePort 39969
[14:39:13.694] Forwarding server listening on port 56391
[14:39:13.695] Waiting for ssh tunnel to be ready
[14:39:13.696] Tunneled port 39969 to local port 56391
[14:39:13.696] Resolved "ssh-remote+bashbox2" to "port 56391"
[14:39:13.702] Initizing new exec server for ssh-remote+bashbox2
[14:39:13.702] Resolving exec server at port 56391
[14:39:13.703] [Forwarding server port 56391] Got connection 0
[14:39:13.704] [Forwarding server port 56391] Got connection 1
[14:39:13.781] Exec server for ssh-remote+bashbox2 created and cached
[14:39:13.782] Extensions to install: 
[14:39:13.782] Updating $SSH_AUTH_SOCK: ln -f -s "/tmp/ssh-xEXBZ7zp1B/agent.1098853" "/run/user/1002/vscode-ssh-auth-sock-200947725"
[14:39:13.782] Using cwd: vscode-remote://ssh-remote%2Bbashbox2/
[14:39:13.783] Remote extension host environment: {"SSH_AUTH_SOCK":"/run/user/1002/vscode-ssh-auth-sock-200947725"}
[14:39:13.791] ------




[14:39:13.792] No hints found in the recent session.
[14:39:13.803] [server] Checking /home/kerrick/.vscode-server/cli/servers/Stable-585eba7c0c34fd6b30faac7c62a42050bfbc0086/log.txt and /home/kerrick/.vscode-server/cli/servers/Stable-585eba7c0c34fd6b30faac7c62a42050bfbc0086/pid.txt for a running server...
[14:39:13.844] [server] Found running server (pid=1085469)
[14:39:14.610] "Update SSH_AUTH_SOCK" terminal command done

Expected Behavior

The env var LC_GOOGLE_WORKSPACE_MCP_GOOGLE_OAUTH_CLIENT_ID is set when I open a terminal inside VSCode when connected to my remote machine.

Actual Behavior

LC_GOOGLE_WORKSPACE_MCP_GOOGLE_OAUTH_CLIENT_ID is unset.

Steps To Reproduce
  1. Install VSCode on a macOS client. Configure a Linux server in .ssh/config and include the setting SendEnv LC_GOOGLE_WORKSPACE_MCP_GOOGLE_OAUTH_CLIENT_ID. Set that env var in your ~/.zshrc file
  2. Open VSCode on the client and connect to your server
  3. Open the VSCode terminal and type env | grep GOOGLE
Anything else?

The env var is set in both of these scenarios:

  • When I run ssh bashbox2 from a terminal outside VSCode
  • When I open a local VSCode session and open its terminal

Here's some related issues, but they are closed and didn't answer my question:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Remote-SSH log and the generated SSH command, then compare the session launched through VS Code with the verbatim command run outside VS Code. Review the remote.SSH.useLocalServer setting and the observed SendEnv behavior. Done means the environment variable is reliably available in the Remote-SSH session and the failure mode is verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
devtools, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.