Skip to content

Copilot CLI (Copilot SDK) agent sessions can't use visible VS Code terminals, so the user can't complete interactive auth (SSH/sudo passwords) #341462

Closed

Description

Summary

When I chat with a Copilot CLI / Copilot SDK agent session inside VS Code, the agent can't open a terminal I can see, or work in one that's already open. Its shell tool starts each command in a hidden process that only the agent can access. This means a common workflow doesn't work: the agent opens an SSH connection, I type my password or approve the auth prompt, and then the agent keeps running commands in that same authenticated session.

The built-in VS Code Agent mode does support this. Its terminal tools let the agent start a command in a visible integrated terminal, wait while the user types into it, then send more input and read the output. Copilot SDK sessions in the same VS Code window have no equivalent tool.

Environment

  • VS Code 1.141.0 (2a59476)
  • Windows 11 (10.0.26200)
  • Chat session type: Copilot CLI / Copilot SDK agent (not the built-in Agent mode)

Steps to reproduce

  1. Start a Copilot CLI / Copilot SDK chat session in VS Code.
  2. Ask the agent: "Open an SSH session to <host> with no command. I'll authenticate, and then you run the follow-up commands in that same session."
  3. The agent starts ssh in a background (async) shell. That process isn't visible in VS Code's terminal panel, so I can't type into it, approve a password/2FA prompt there, or see it at all.
  4. After I authenticate some other way, such as in a terminal I opened myself, the agent has no tool to reach that terminal. Each new command it runs starts a fresh, unauthenticated process.

Expected

Copilot SDK sessions should have tools like the built-in Agent mode's terminal tools, so the agent can:

  • start a command in a visible integrated terminal that the user can type into
  • send more input to that terminal after the user has authenticated
  • read that terminal's output

(Alternatively: a way to let the user type into the agent's own async shell sessions from the terminal UI.)

Actual

The only options are non-interactive workarounds: passwordless sudo rules, SSH keys that must already be set up, or having the user run the commands by hand. In practice the agent kept proposing these instead of what I asked for, and the task only worked after I moved it to the built-in Agent mode.

Use case

The task was deploying a Docker container to a home NAS over SSH. The docker commands needed sudo, and I wanted to type the password interactively instead of storing it or adding a sudoers rule. This comes up whenever a remote host needs interactive auth: sudo prompts, 2FA, hardware keys, or first-time host key confirmation.

Possibly related: #341333 (agent terminals run without a PTY).

Activity

  1. maheshbenke commented on Oct 15, 2026

    @maheshbenke

    I can reproduce this issue on the latest VS Code Insiders build on Windows ARM64.

    Environment

    • VS Code: 1.143.0-insider (user setup)
    • Commit: 4c6cba1
    • Date: 2026-10-14T18:58:45+02:00
    • OS: Windows_NT arm64 10.0.26200
    • Electron: 43.7.7
    • Chromium: 150.0.7871.250
    • Node.js: 24.21.0
    • @github/copilot: 1.0.98-0
    • @github/copilot-sdk: 1.0.22-preview.0

    Observed behavior

    When Copilot Agent executes a shell/PowerShell command, I can see the command execution in the Agent conversation, but I can no longer open or focus the underlying terminal in the VS Code Integrated Terminal.

    The Show and Focus Terminal option that was previously available is no longer present.

    The Agent-created shell also does not appear as an accessible terminal instance in the Integrated Terminal panel.

    Expected behavior

    I would like to be able to open/focus the Agent's terminal as before so I can:

    • Watch the command execute directly in the terminal.
    • See stdout/stderr in the terminal.
    • Interact with the PowerShell session when necessary.
    • Interrupt a running command directly from the terminal.

    This appears to reproduce the behavior described in this issue on Windows ARM64 with VS Code Insiders 1.143.0.

  2. conmilo commented on Oct 15, 2026

    @conmilo

    +1, same problem on Windows. A few details that may help:

    • Root cause on Windows. chat.agentHost.customTerminalTool.enabled routes Copilot sessions through Agent Host's own terminal tool, which creates real terminals that can be revealed in the Terminal view. It is forced off on Windows (process.platform !== 'win32' in both copilotSessionLauncher.ts and copilotSessionSandbox.ts), and its description says "Not supported on Windows, where sessions use the SDK's terminal and sandbox runtime." So on Windows the setting has no effect and every command goes through the SDK's hidden shell.
    • A possible lighter alternative. For running shells, the Background Shells pill above the chat input already streams live output into a small read-only terminal preview with a Stop Shell button. Letting that preview accept keyboard input for attached shells (forwarding it to the shell's input), plus an "Open in Terminal view" action, would cover interactive prompts like the SSH/sudo case here. It may need Copilot SDK support for writing to a running shell's input.

    I filed #341717 before finding this one and will close it as a duplicate.

  3. evoh81 commented on Oct 28, 2026

    @evoh81

    I want to add an important security consideration to this issue.

    Previously, interactive terminal access provided more than just a way to enter passwords. For sudo, the password prompt acted as a useful human-in-the-loop privilege escalation boundary.

    I could allow Copilot Agent to execute commands relatively freely as an unprivileged user. If the agent attempted a command requiring sudo, execution stopped. I could then open the terminal, inspect the exact command being proposed, and explicitly authorize the privilege escalation by entering my sudo password myself.

    The security model was effectively:

    Agent → sudo command → STOP → human reviews command → human authenticates

    With the current implementation, I cannot interact with the terminal at this point.

    Configuring passwordless sudo is not an equivalent workaround, because that changes the security model to:

    Agent → sudo command → executes as root

    Similarly, giving SSH or sudo passwords to the agent is undesirable because credentials that previously could be entered directly into the process would instead need to be exposed to the agent/model context.

    I think Copilot Agent needs a secure human-to-process input path that bypasses the model context, both for entering credentials and for explicitly authorizing privilege escalation.

    This would preserve the useful security boundary provided by interactive authentication while still allowing the agent to continue its workflow.

  4. petersonjdNIH commented on Oct 31, 2026

    @petersonjdNIH

    The Copilot session by default in VS Code's GitHub Copilot Chat has been the most frustrating new behavior ever. It results in unsigned commits and the entire session not being able to interact with the GitHub Codespace or the VS Code window. Users should be able to set up their default behavior and have it stick, but this one is entirely impossible right now.

    From my research, this is what I've been able to dig up:


    There is no documented setting that restricts Copilot Chat to Local only, and nobody has reported a complete fix. I found three partial controls and a few related open issues. I searched microsoft/vscode and github/copilot-cli, and I couldn't search GitHub-wide because gh isn't authenticated in this session.

    The gap: microsoft/vscode#342291 (open)

    The reporter confirms you can hide Cloud, Claude and Codex with these settings:
    github.copilot.chat.cloudAgent.enabled: false
    chat.agentHost.claudeAgent.enabled: false
    chat.agentHost.codexAgent.enabled: false
    No setting hides the built-in Copilot session type (agent-host-copilotcli). That is the one that can't sign commits for you. github.copilot.chat.backgroundAgent.enabled: false only affects the session list, not the picker.
    The reporter's analysis says Local is hardcoded and the Copilot entry is registered with no gating condition.
    The only workaround they found is injecting CSS into VS Code's shipped workbench.html, which is unsupported and breaks on every update.
    Other issues that match your situation:

    microsoft/vscode#343575 (open): New chats now default to the Copilot harness. Its agents fall back to a separate shell and fail where Local works. The reporter asks for documentation on keeping Local as the default, and there is no maintainer reply yet.
    microsoft/vscode#341462 (open, assigned): Copilot CLI sessions can't use the visible VS Code terminals. This is the isolation you described.
    microsoft/vscode#316791 (open): git commit hangs in the Agents App bash tool when SSH signing is on. The cause is that GIT_ASKPASS and the related variables aren't set. This is related to your Secretive setup, but it was reported for the Agents App, not Codespaces.
    microsoft/vscode#334495 (open): The Agents Window should respect git.enableCommitSigning.
    microsoft/vscode#334499 (open): This shows Copilot CLI can be disabled by an organization policy. VS Code still starts the CLI component and shows a sign-in popup, so the policy doesn't fully remove it.
    I found no report specifically about Codespaces signing failing in Copilot CLI sessions, and no github/copilot-cli issue on it.

    What you can do today:

    Org policy: An org owner can disable Copilot CLI under the organization's Copilot settings. Based on #334499, it blocks the sessions from working, but I haven't confirmed it removes the picker entry.
    Settings: Put the three settings above in your Codespaces default settings or dotfiles. That narrows the picker to Local plus Copilot.
    Instructions: Add a rule to AGENTS.md so agents never run git commit or git push. It's soft enforcement but works in every session type.

  5. added
    chat-terminal
    agent-host
    on Nov 11, 2026
  6. added
    feature-request
    on Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

agent-hostchat-terminalcopilotfeature-requeston-testplan

Type

No type

Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions