pet server logs warnings as ANSI-colored stderr, shown as errors
Maintainer thường phản hồi trong vòng 1 ngày
@karthiknadig đang làm issue này rồi.
Từ ngày 5/10/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Problem: Since #314, pet server writes its diagnostics as ANSI-colored text on stderr instead of sending log notifications. The VS Code Python Environments extension logs every stderr chunk at error level, so routine warnings show up as [error] lines full of escape codes in the Python Environments output channel.
For example, on a Windows machine with only per-user Python installs, every startup logs:
[error] [pet] ␛[2m 0.008930700s␛[0m ␛[33m WARN␛[0m ␛[2mpet_windows_registry::environments␛[0m␛[2m:␛[0m Failed to open HKLM\Software\Python, Os { code: 2, kind: NotFound, message: "The system cannot find the file specified." }
![Output channel filtered to [pet]: a WARN line logged as [error], with ESC control characters](https://github.com/karthiknadig/python-environment-tools/blob/e924f6408caaf8fca71046d1ad4c5b3dffd3238e/pet-stderr-logs/output-channel.png?raw=true)
These are the first "errors" users and triagers see in logs. Of 33 microsoft/vscode-python-environments issues that quote [error] [pet] lines, 15 include warnings logged this way (as ^[[33m WARN^[[0m), mostly pet_conda::package: Unable to find conda package … and pet_windows_registry::environments: Failed to open HKLM\Software\Python. For example microsoft/vscode-python-environments#1370 (71 such lines), microsoft/vscode-python-environments#1099 and microsoft/vscode-python-environments#1491.
Cause:
start_jsonrpc_servercallsinitialize_tracing(false)instead ofpet_reporter::jsonrpc::initialize_logger, which sentlognotifications withdebug/info/warning/errorlevels.initialize_tracingwrites to stderr with ANSI colors on. That is tracing-subscriber's default (onlyNO_COLORturns it off), even when stderr is a pipe.pet findwith redirected stderr gets the same escape codes.- The extension maps
lognotifications to the matching level (nativePythonFinder.ts), but it logs raw stderr as errors (nativePythonFinder.ts:684).
Suggested fix:
- In server mode, forward tracing events as
lognotifications with their level (a tracing layer that reusespet_reporter::jsonrpc::Log), and keep stderr for panics. - Disable ANSI colors when stderr is not a terminal (
.with_ansi(std::io::stderr().is_terminal())). - Optionally, in the extension: log stderr by the level token in each line, not as errors.
Environment: Windows 11, VS Code 1.140.0, PET main @ 4ca7c03 with Python Environments main @ 52f6ace.
Steps to verify fix:
- On Windows without a machine-wide Python (no
HKLM\Software\Pythonkey), open a Python file in VS Code with Python Environments. - Open the Output panel, select Python Environments, and filter by
[pet]. - Verify the
Failed to open HKLM\Software\Pythonmessage is logged as[warning](or not at all at the default level) and contains no␛[sequences. - Point
python.defaultInterpreterPathat a missing file and reload; verify PET's resolve failure is still logged as[error]. - Run
pet find 2> err.txtand verifyerr.txthas no ANSI escape codes.
Found by Copilot
- Ngôn ngữ chính
- Rust
- Star
- 207
- Fork
- 45
- Merge trung bình
- 1 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 18
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/python-environment-tools
-
Free-threaded python3.13t interpreters are not discovered on LinuxCó thể đã có người làm @karthiknadig đã nhận 3 ngày trước. Đang mởbug
microsoft/python-environment-tools#569 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
uv's Windows launchers in ~/.local/bin are reported as duplicate global PythonsCó thể đã có người làm @karthiknadig đã nhận 4 ngày trước. Đang mởbug
microsoft/python-environment-tools#567 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
microsoft/python-environment-tools#537 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
debt
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
microsoft/python-environment-tools#538 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
microsoft/python-environment-tools#539 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của microsoft/python-environment-tools
Issue tương tự
-
test(executor_l0): assert execute() TaskOutcome, not only bus events / 断言 execute() 返回的 TaskOutcomeĐang mởtype:debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
skaiy/wild_agentos#425 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Default-import note suggests `import * as process` for velt:process, which does not name the builtinĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug ticket
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
cratestack/cratestack#1154 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
status:needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
agentic-os-org/ANOLISA#6742 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày