Skip to content

TPI) Agent host (local) terminal and shell tools respects user shell from terminal profile #315395

@anthonykim1

Description

@anthonykim1

Refs: #313679, #313160

Complexity: 3

Create Issue


This test verifies that Agent host (local) terminals and shell tools from Agent Host Copilot CLI use the shell path from the user's terminal profile preferences, instead of always defaulting to the system shell.

This PR adds three new settings:

  • terminal.integrated.agentHostProfile.linux
  • terminal.integrated.agentHostProfile.osx
  • terminal.integrated.agentHostProfile.windows

Resolution order for the shell used by agent host (local) terminals:

  1. terminal.integrated.agentHostProfile.<os> — if set, takes priority.
  2. terminal.integrated.defaultProfile.<os> — used when the agent host profile is unset.
  3. System default shell — fallback when neither is set.

Caveats:

  • Only the profile's executable path is honored. args and env from the profile are ignored.
  • Applies to the local agent host only.
  • The shell tool the model gets routed to (bash vs. powershell) is derived from the resolved executable basename. Examples: pwsh / powershellpowershell; bash / zsh / fish / shbash. The "wrong" tool is stubbed so the model can't bypass the override.

Requirements

  • Latest VS Code Insiders
  • chat.agentHost.enabled set to true
  • Copilot CLI installed and authenticated
  • At least two distinct shells available on the test machine

Steps

Part 1: agentHostProfile.<os> takes priority

  1. Open VS Code Insiders.
  2. Set terminal.integrated.agentHostProfile.<your-os> to a non-default shell (e.g., on macOS set it to a profile pointing at /bin/bash even though zsh is your default).
  3. Open a Copilot CLI agent host session in the chat panel.
  4. Ask the agent to run a shell command that reveals the shell, or print something and ask which shell agent used to run something in the terminal.
  5. Verify the agent's tool execution used the configured agentHostProfile.<os> shell — not the OS default.

Part 2: Fallback to defaultProfile.<os>

  1. Unset (or remove) terminal.integrated.agentHostProfile.<os>.
  2. Set terminal.integrated.defaultProfile.<os> to a non-system-default shell.
  3. In a fresh Copilot CLI agent host session, ask the agent to run a shell command that reveals the shell.
  4. Verify the agent uses the defaultProfile.<os> shell.
  5. Unset defaultProfile.<os> as well and verify the agent falls back to the system default shell.

Part 3: Shell-tool routing (bash vs. powershell)

  1. Configure agentHostProfile.<os> so the resolved executable is a POSIX shell (e.g., bash, zsh, fish, sh, or on Windows: Git Bash / WSL).
  2. In a Copilot CLI agent host session, ask the agent to run a basic command. Verify it succeeds (the agent should be using the bash tool).
  3. Switch agentHostProfile.<os> to a PowerShell executable (e.g., pwsh or powershell.exe).
  4. Reload / start a fresh session and ask the agent to run a basic command. Verify it succeeds and uses PowerShell semantics.

Part 4: Invalid / inaccessible path

  1. Set terminal.integrated.agentHostProfile.<os> to an executable path that does not exist (e.g., /does/not/exist/sh).
  2. Start a Copilot CLI agent host session and ask the agent to run a command.
  3. Verify the agent host falls back to the system shell rather than failing the session (a warning should be logged in the Output panel for the agent host).

Notes for filing issues

If the agent host doesn't pick the expected shell, please include:

  • Values of terminal.integrated.agentHostProfile.<os> and terminal.integrated.defaultProfile.<os>
  • The shell the agent actually used (output of the reveal command)
  • Whether the wrong-shell tool stub message appeared in the response
  • Value of chat.agentHost.enabled
  • OS, OS version, and VS Code Insiders commit

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions