microsoft / microsoft/vscode-python-environments

`python-envs.terminal.autoActivationType` migration script incorrectly targets Workspace settings instead of User settings

Aperta
#1,608 0 commenti 1 reazione 2 assegnatari Vedi su GitHub

@StellaHuang95 ci sta già lavorando.

Dal 24/6/2026.

Lingua principale
TypeScript
Stelle
138
Fork
62
Merge medio
1g 4h
PR unite (30g)
35

Descrizione

## Environment data

- Python Environments extension version: 1.37.2026062401
- Python extension (ms-python.python) version: 2026.4.0
- VS Code version (Help -> About): 1.126.0
- OS and version: Win 11
- Python version (& distribution if applicable, e.g. Anaconda): Different CPython versions managed with Pyenv.
- Environment manager in use (venv / conda / pyenv / poetry / pipenv / system / uv / other): pyenv, pipenv, uv, venv, poetry...
- Shell (bash / zsh / fish / pwsh / cmd / other): bash, pwshell
- Remote / container scenario (none / WSL / SSH Remote / Dev Container / Codespaces): none
- Workspace type (single folder / multi-root / mono-repo): single folder multi repo
- Is this a regression? If yes, last known working extension version: No afaik

## Repro Steps

1. Configure legacy Python terminal activation settings to be disabled (off or none).
* "python.terminal.activateEnvironment": false,
2. Open a project workspace folder.
3. Check Extension Host Output channel.

## Expected behavior

The settings migration logic should evaluate target permissions and write the updated `python-envs.terminal.autoActivationType` key directly to the global User Settings.

Extension setting *"Docstring"*:
> **Legacy Setting Support**: This setting takes precedence over the legacy `python.terminal.activateEnvironment` setting.
> **If this setting is not explicitly set and `python.terminal.activateEnvironment` is set to false, this setting will
> automatically be set to `off` to preserve your preference.**

## Actual behavior

The extension migration routine incorrectly targets the local workspace configuration scope rather than the user scope. Because VS Code explicitly bans this particular property from living inside local workspaces for security/stability profiles, it hard-blocks the save execution and triggers the following ERROR:

```log
CodeExpectedError: Unable to write python-envs.terminal.autoActivationType to Workspace Settings.
This setting can be written only into User settings.
```

## Logs

Logs from `Extension Host` output channel:
```log
2026-06-24 21:21:26.780 [error] CodeExpectedError: Unable to write python-envs.terminal.autoActivationType to Workspace Settings. This setting can be written only into User settings.
at M4e.toConfigurationEditingError (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:7060)
at M4e.validate (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:10319)
at M4e.doWriteConfiguration (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:3453)
at Object.factory (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:3309)
at dg.consume (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:434:77539)
at vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:434:77358
at new Promise ()
at dg.queue (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:434:77282)
at M4e.writeConfiguration (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:3278)
at eoi.writeConfigurationValue (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:60043)
at async Promise.all (index 0)
at async Object.a [as settled] (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:434:84659)
at async eoi.updateValue (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:43135)
2026-06-24 21:21:26.780 [error] CodeExpectedError: Unable to write python-envs.terminal.autoActivationType to Workspace Settings. This setting can be written only into User settings.
at M4e.toConfigurationEditingError (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:7060)
at M4e.validate (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:10319)
at M4e.doWriteConfiguration (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:3453)
at Object.factory (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:3309)
at dg.consume (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:434:77539)
at vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:434:77358
at new Promise ()
at dg.queue (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:434:77282)
at M4e.writeConfiguration (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:3278)
at eoi.writeConfigurationValue (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:60043)
at async Promise.all (index 0)
at async Object.a [as settled] (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:434:84659)
at async eoi.updateValue (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:43135)
```

## Additional context

Manual Fix:
The exception loop can be completely stopped by opening the global user configuration and adding the setting manually:

```json
"python-envs.terminal.autoActivationType": "off"
```

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.