Bug Description
Copilot setup preserves an existing .vscode/settings.json when it cannot parse
the file, but a non-UTF-8 file escapes that preservation path and aborts setup
with a raw UnicodeDecodeError. _merge_vscode_settings catches
json.JSONDecodeError and OSError; Path.read_text(encoding="utf-8") raises
the sibling UnicodeDecodeError first.
Steps to Reproduce
- Create
.vscode/settings.json containing non-UTF-8 bytes such as ff fe.
- Run Copilot integration setup on current
main.
- Setup aborts while reading the existing settings file.
Expected Behavior
Treat the file like the existing JSONC/invalid-JSON path: preserve it, skip the
merge, and emit the existing manual-settings warning.
Actual Behavior
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
Specify CLI Version
0.14.4.dev0 (main)
AI Agent
GitHub Copilot
Operating System
macOS
Python Version
Python 3.13.11
Error Logs
UnicodeDecodeError
'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
Additional Context
I'd like to fix this by routing UnicodeDecodeError through the existing
preservation/warning branch and adding a regression test that drives
CopilotIntegration.setup with a non-UTF-8 settings file.
Bug Description
Copilot setup preserves an existing
.vscode/settings.jsonwhen it cannot parsethe file, but a non-UTF-8 file escapes that preservation path and aborts setup
with a raw
UnicodeDecodeError._merge_vscode_settingscatchesjson.JSONDecodeErrorandOSError;Path.read_text(encoding="utf-8")raisesthe sibling
UnicodeDecodeErrorfirst.Steps to Reproduce
.vscode/settings.jsoncontaining non-UTF-8 bytes such asff fe.main.Expected Behavior
Treat the file like the existing JSONC/invalid-JSON path: preserve it, skip the
merge, and emit the existing manual-settings warning.
Actual Behavior
Specify CLI Version
0.14.4.dev0(main)AI Agent
GitHub Copilot
Operating System
macOS
Python Version
Python 3.13.11
Error Logs
Additional Context
I'd like to fix this by routing
UnicodeDecodeErrorthrough the existingpreservation/warning branch and adding a regression test that drives
CopilotIntegration.setupwith a non-UTF-8 settings file.