microsoft / microsoft/vscode-python-environments

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

Đang mở
#1,608 0 bình luận 1 reaction 2 người được giao Xem trên GitHub

@StellaHuang95 đang làm issue này rồi.

Từ ngày 24/6/2026.

Ngôn ngữ chính
TypeScript
Star
138
Fork
62
Merge trung bình
1 ngày 4 giờ
Pull request đã merge (30 ngày)
35

Mô tả

## 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"
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.