Skip to content

Conversation

etherandrius
Copy link

@etherandrius etherandrius commented Sep 19, 2025

Description

Enabling the terminal command for all remotes; I'm pretty sure this is no longer needed?

The fallback says it's not enabled because it does not work for SSH but at the same time the feature is explicitly enabled for ssh-remote

See definition of vscode.env.remoteName

        /**
         * The name of a remote. Defined by extensions, popular samples are `wsl` for the Windows
         * Subsystem for Linux or `ssh-remote` for remotes using a secure shell.
         *
         * *Note* that the value is `undefined` when there is no remote extension host but that the
         * value is defined in all extension hosts (local and remote) in case a remote extension host
         * exists. Use {@link Extension.extensionKind} to know if
         * a specific extension runs remote or not.
         */
        export const remoteName: string | undefined;

Summary by cubic

Enables terminal command execution across all environments by removing remoteName gating and using a single spawn-based path. SSH, WSL, Dev Containers, Codespaces, and local now get live output, background support, and clear status messages.

  • New Features

    • Works across all remote names (SSH, WSL, Dev Containers, Codespaces, etc.).
    • Streaming output, background mode, and waitForCompletion supported everywhere.
    • Color-capable environment applied to all runs.
  • Refactors

    • Removed ENABLED_FOR_REMOTES and ide.runCommand fallback; unified on child_process.spawn.
    • Dropped util.promisify/exec and unused imports.
    • Safer cwd resolution (workspace → home → process.cwd → os.tmpdir) and better process cleanup.

@etherandrius etherandrius requested a review from a team as a code owner September 19, 2025 17:26
@etherandrius etherandrius requested review from RomneyDa and removed request for a team September 19, 2025 17:26
@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Sep 19, 2025
import iconv from "iconv-lite";
import childProcess from "node:child_process";
import os from "node:os";
import util from "node:util";
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not used

Copy link


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


agrabauskas seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

} from "../../util/processTerminalStates";
import { getBooleanArg, getStringArg } from "../parseArgs";

const asyncExec = util.promisify(childProcess.exec);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not used

const ideInfo = await extras.ide.getIdeInfo();
const toolCallId = extras.toolCallId || "";

if (ENABLED_FOR_REMOTES.includes(ideInfo.remoteName)) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actual change is removing this if.

All lines below are just indentation changes

Comment on lines -433 to -444
// For remote environments, just run the command
// Note: waitForCompletion is not supported in remote environments yet
await extras.ide.runCommand(command);
return [
{
name: "Terminal",
description: "Terminal command output",
content:
"Terminal output not available. This is only available in local development environments and not in SSH environments for example.",
status: "Command failed",
},
];
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing fall-back

@RomneyDa
Copy link
Collaborator

RomneyDa commented Oct 6, 2025

@etherandrius I think the original reason for this logic was to enable running commands in the remote environment, i.e. less as a fallback for environments that don't support it and more of a way to enable running commands in remotes at all (through IDE interface). It seems like this has slowly been watered down so not all commands are run locally, partly because the support for local commands is so much better now (partial output, backgrounding, etc.)

@chezsmithy you've done a lot of work here, noticed your reaction, do you have any thoughts on running commands remote vs locally when in a remote filesystem?

@chezsmithy
Copy link
Contributor

@RomneyDa there are explicit ways to use local vscode with remote terminals. I've had a few ideas I've tinkered with but it gets odd when vscode makes file creates/edits locally but runs terminal commands remotely. See a dev container use case for example.

This is also quite different from what jetbrains expects using their remote ssh support.

This PR might work fine in both tools but I'm not sure without testing.

My take so far has been to install the entire extension in the remote host for vscode. IM not a huge jetbrains user (tho we have many in our organization).

@RomneyDa
Copy link
Collaborator

RomneyDa commented Oct 9, 2025

@chezsmithy thanks!

@etherandrius what was the original intent for this PR, does it fix a specific problem with commands being run remotely when they shouldn't for a given remote?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants