Follow-up to #313160 / #313679.
#313679 made the agent host respect the user's preferred shell executable by piping terminal.integrated.agentHostProfile.<os> (with fallback to defaultProfile.<os>) down to the agent host as AgentHostConfigKey.DefaultShell. Only the path is honored today — args and env from the profile are silently dropped.
That means a user with, say:
…gets bash.exe spawned in the agent host without --login -i, so their ~/.bash_profile doesn't run, PATH tweaks/aliases/exports the user expects don't apply. Same story for --noprofile, custom --rcfile, oh-my-zsh-style -i, etc. macOS bash/zsh --login is the only argument added automatically today (in AgentHostTerminalManager.createTerminal).
Reasons we deferred this on #313679:
- Args splicing has order-sensitivity with shell-integration injection.
getShellIntegrationInjection overwrites shellArgs with its own newArgs (e.g. --init-file … for bash, -NoProfile -Command "& …" for pwsh). Mixing user args needs per-shell-family rules (before the integration script for bash, before -Command for pwsh, etc.).
- Env merging needs an explicit precedence policy with the agent host's curated env. We already set
LC_ALL=C.UTF-8, PAGER='', GIT_TERMINAL_PROMPT=0, DEBIAN_FRONTEND=noninteractive, VSCODE_PREVENT_SHELL_HISTORY, plus shell integration's envMixin. User-profile env (e.g. LC_ALL=en_US.UTF-8, PAGER=less, custom PROMPT_COMMAND) can break agent output parsing if merged naively.
- The single-string
defaultShell wire shape stays clean for headless code agent-host and SSH/tunnel agent hosts, where workbench profile semantics don't apply.
What this issue should cover:
/cc #313160 #313679
Follow-up to #313160 / #313679.
#313679 made the agent host respect the user's preferred shell executable by piping
terminal.integrated.agentHostProfile.<os>(with fallback todefaultProfile.<os>) down to the agent host asAgentHostConfigKey.DefaultShell. Only thepathis honored today —argsandenvfrom the profile are silently dropped.That means a user with, say:
…gets
bash.exespawned in the agent host without--login -i, so their~/.bash_profiledoesn't run, PATH tweaks/aliases/exports the user expects don't apply. Same story for--noprofile, custom--rcfile, oh-my-zsh-style-i, etc. macOS bash/zsh--loginis the only argument added automatically today (inAgentHostTerminalManager.createTerminal).Reasons we deferred this on #313679:
getShellIntegrationInjectionoverwritesshellArgswith its ownnewArgs(e.g.--init-file …for bash,-NoProfile -Command "& …"for pwsh). Mixing user args needs per-shell-family rules (before the integration script for bash, before-Commandfor pwsh, etc.).LC_ALL=C.UTF-8,PAGER='',GIT_TERMINAL_PROMPT=0,DEBIAN_FRONTEND=noninteractive,VSCODE_PREVENT_SHELL_HISTORY, plus shell integration'senvMixin. User-profile env (e.g.LC_ALL=en_US.UTF-8,PAGER=less, customPROMPT_COMMAND) can break agent output parsing if merged naively.defaultShellwire shape stays clean for headlesscode agent-hostand SSH/tunnel agent hosts, where workbench profile semantics don't apply.What this issue should cover:
AgentHostConfigKey.DefaultShellArgsas a sibling string-array key, keepingDefaultShellas-is for back-compat).AgentHostTerminalContribution._pushDefaultShellresolves and pushes both keys.AgentHostTerminalManager.createTerminalreads the configured args from root config and splices them in correctly relative to shell-integration injection.AgentHostConfigKey.DefaultShellJSDoc to remove the "args/env are ignored" caveat (or update it to reflect the new behavior)./cc #313160 #313679