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
Integrated terminals retain stale variables from workspace .env #1838
Remote/container scenario: none; local integrated terminal
Workspace type: single folder
Regression: unknown
Relevant settings:
User: "python.terminal.useEnvFile": true
Workspace: "python.envFile": ""
Repro Steps
Open a Python workspace with a .env file containing environment variables and terminal env-file injection enabled.
Open a VS Code integrated terminal.
Change or remove those variables in .env (or disable env-file injection), then create a new integrated terminal.
Observe the terminal receiving the previous values instead of the current values.
Expected behavior
New terminals should receive values from the current environment-file configuration. When values change or env-file injection is disabled, previously contributed values should be updated or removed.
Actual behavior
New VS Code integrated terminals continued to receive old values after the workspace .env had been updated. A clean login zsh outside VS Code did not have these values, and sourcing .venv/bin/activate did not add them.
The workspace's VS Code state database contained the old values in terminal.integrated.environmentVariableCollectionsV2, under the ms-python.vscode-python-envs collection. The collection was workspace-scoped and marked applyAtProcessCreation. This suggests stale contributed environment values are being retained and reapplied when terminal processes are created.
Variable names and local filesystem paths are omitted. The active GitHub reporter is Jim Katz (@jimk-bdrc).
Activity