Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/conductor/cli/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import hashlib
import json
import logging
import os
import shutil
import subprocess
import sys
Expand Down Expand Up @@ -334,7 +335,10 @@ def run_update(console: Console) -> None:
renamed_exes = _rename_windows_exes()

try:
proc = subprocess.run(cmd, capture_output=True, text=True) # noqa: S603
# Set PYTHONUTF8=1 so child Python processes use UTF-8 encoding
# instead of the system default (cp1252 on Windows).
env = {**os.environ, "PYTHONUTF8": "1"}
proc = subprocess.run(cmd, capture_output=True, text=True, encoding="utf-8", env=env) # noqa: S603

if proc.returncode == 0:
console.print(f"[green]Successfully upgraded to v{version}[/green]")
Expand Down
6 changes: 5 additions & 1 deletion src/conductor/executor/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ async def execute(
# Build environment (merge os.environ + agent.env)
# Note: ${VAR:-default} patterns in agent.env are already resolved
# by the config loader during YAML parsing.
env = {**os.environ, **agent.env} if agent.env else None
# Always set PYTHONUTF8=1 so child Python processes use UTF-8 encoding
# instead of the system default (cp1252 on Windows), preventing garbled
# Unicode characters in script output.
base_env = {**os.environ, "PYTHONUTF8": "1"}
env = {**base_env, **agent.env} if agent.env else base_env
Comment on lines +95 to +99
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

script.py fixes the child side (env var), while update.py and mcp_auth.py only fix the parent side (encoding= param). For Python-based child CLIs, both sides should be addressed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch - addressed in e17ac2f. Both update.py and mcp_auth.py now set PYTHONUTF8=1 in the subprocess env alongside the existing encoding="utf-8" param, matching the approach in script.py. All three call sites are now consistent with both parent-side and child-side encoding fixes.


_verbose_log(f" Script: {rendered_command} {' '.join(rendered_args)}")

Expand Down
6 changes: 6 additions & 0 deletions src/conductor/mcp_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import asyncio
import json
import os
import subprocess
import urllib.request
from typing import Any
Expand Down Expand Up @@ -55,6 +56,9 @@ def get_azure_token(scope: str) -> str | None:
The access token string, or None if token acquisition fails.
"""
try:
# Set PYTHONUTF8=1 so child Python processes use UTF-8 encoding
# instead of the system default (cp1252 on Windows).
env = {**os.environ, "PYTHONUTF8": "1"}
result = subprocess.run(
[
"az",
Expand All @@ -69,6 +73,8 @@ def get_azure_token(scope: str) -> str | None:
],
capture_output=True,
text=True,
encoding="utf-8",
env=env,
timeout=30,
)
if result.returncode == 0:
Expand Down
Loading