acoustic-carpenter-78188
07/07/2026, 5:10 PMPORT environment variable set (common in Kubernetes), the code-server subprocess binds to the wrong port despite being launched with --bind-addr 0.0.0.0:{self.port}.
Root cause
code-server reads the PORT environment variable as one of its bind-address sources. execute_command launches the subprocess via subprocess.Popen(cmd, shell=True, ...), which inherits the parent process's full environment — so an inherited PORT overrides the explicit --bind-addr flag.
Fix
• execute_command now accepts an optional env dict, merged on top of os.environ (preserving other inherited vars) and passed to Popen(..., env=...).
• The vscode decorator passes env={"PORT": str(self.port)} to the code-server subprocess, pinning PORT so an inherited value can't override --bind-addr.
Tests
• test_vscode_passes_port_env_to_child_process — asserts the child process receives env={"PORT": "1234"} even when the surrounding environment has PORT=9999.
• test_execute_command_passes_env_to_subprocess — asserts the override reaches Popen while other inherited vars survive.
All 19 interactive unit tests pass.
flyteorg/flytekitacoustic-carpenter-78188
07/07/2026, 6:00 PM