You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Provide an explicit SDK API for built-in shell tool startup env/scripts #1911
VS Code terminal shell integration evaluates these during shell startup. The SDK built-in shell tool does not have an equivalent host-provided startup hook. It uses fresh shell process execution for commands, so startup material must be applied on every shell-tool spawn for child processes like python to inherit the activated environment.
Current generated RPC fields only cover presets/flags:
shellInitProfile: "non-interactive" plus BASH_ENV can help for bash, but it is bash-specific and indirect. There is no cross-shell SDK API for host-provided startup env/scripts for built-in shell tool child processes.
Ask
Please add an explicit per-session shell startup config for built-in shell tools, accepted on session create and update:
Applied to every built-in shell tool command spawn.
Explicitly host-provided; not automatic user rc/profile sourcing.
Updatable mid-session, because VS Code's selected interpreter can change while a session is live.
Exported env should reach child processes (python). Shell functions/hooks only need to affect the shell process itself unless the shell explicitly exports them.
Thinking a bit more about the API shape here, I think the useful abstraction is probably a dedicated shell-tool startup config, separate from CopilotClientOptions.env.
Today CopilotClientOptions.env configures the spawned SDK runtime process:
// dist/types.d.tsexportinterfaceCopilotClientOptions{/** * Environment variables to pass to the runtime process. * If not set, inherits process.env. */env?: Record<string,string|undefined>;}
That is useful, but it does not explicitly model startup material for built-in shell tool child processes.
ShellOptions does not exist today ---> I am proposing it as a new shared shape.
Current generated RPC shell-related fields are roughly:
changed the title [-]Provide ways for built-in shell tool to take session-scoped shell env/scripts[/-][+]Provide an explicit SDK API for built-in shell tool startup env/scripts[/+]on Jul 5, 2026
I wouldn't elevate shell init/tool related options up to CopilotClient unless they already exist there (my recollection is that they don't). Configuring tools feels like a per-session type of operation. I do not consider the existing env: option on CopilotClient, which can be used to transitively pass env vars to all shell tool sessions, to be a "shell init/tool related option".
Was shellProcessFlags not migrated to the proposed interface ShellOptions purposefully? I'd assume it'd be there assuming there isn't some good reason I missed/am not anticipating.
I wouldn't elevate shell init/tool related options up to CopilotClient unless they already exist there (my recollection is that they don't).
Agreed, let's not elevate up to ClientOption. This actually suite us better for activation scripts since they're meant to be more workspace specific rather than a broader client scope.
Was shellProcessFlags not migrated to the proposed interface ShellOptions purposefully? I'd assume it'd be there assuming there isn't some good reason I missed/am not anticipating.
Good catch, we should have them for sure. Probably as processFlags?: string[] under ShellOptions
Will start a PR soon based on the draft and above feedbacks, thanks!
Activity
anthonykim1 commentedon Jul 5, 2026
Thinking a bit more about the API shape here, I think the useful abstraction is probably a dedicated shell-tool startup config, separate from
CopilotClientOptions.env.Today
CopilotClientOptions.envconfigures the spawned SDK runtime process:That is useful, but it does not explicitly model startup material for built-in shell tool child processes.
ShellOptionsdoes not exist today ---> I am proposing it as a new shared shape.Current generated RPC shell-related fields are roughly:
One possible shared shape could be:
Depending on the intended ownership model, this could be exposed at runtime/client scope:
Or, if the desired ownership is per SDK session, expose the same shape on session create/update:
At session creation:
And later, if the selected Python environment changes:
The distinction I am trying to make is:
CopilotClientOptions.envconfigures the spawned SDK runtime process.shell.envwould configure built-in shell tool child processes.shell.initScriptswould be explicit host-provided startup scripts.shellis client/runtime-scoped, session-scoped, or both, but the API should make that scope explicit.[-]Provide ways for built-in shell tool to take session-scoped shell env/scripts[/-][+]Provide an explicit SDK API for built-in shell tool startup env/scripts[/+]MRayermannMSFT commentedon Jul 6, 2026
CopilotClientunless they already exist there (my recollection is that they don't). Configuring tools feels like a per-session type of operation. I do not consider the existingenv:option onCopilotClient, which can be used to transitively pass env vars to all shell tool sessions, to be a "shell init/tool related option".shellProcessFlagsnot migrated to the proposedinterface ShellOptionspurposefully? I'd assume it'd be there assuming there isn't some good reason I missed/am not anticipating.MRayermannMSFT commentedon Jul 6, 2026
Overall, I have no qualms with the gist of the proposal, so long as my two bullets above are addressed.
anthonykim1 commentedon Jul 9, 2026
Agreed, let's not elevate up to ClientOption. This actually suite us better for activation scripts since they're meant to be more workspace specific rather than a broader client scope.
Good catch, we should have them for sure. Probably as
processFlags?: string[]underShellOptionsWill start a PR soon based on the draft and above feedbacks, thanks!