diff --git a/cli/loop_cli.py b/cli/loop_cli.py index 5d76b62d..9e3bc113 100644 --- a/cli/loop_cli.py +++ b/cli/loop_cli.py @@ -41,6 +41,7 @@ from core.application.errors import ApplicationError from core.config import ConfigError from core.domain.thread_goal import ThreadGoalStatus +from core.platform_compat import configure_utf8_stdio _STATUS_STYLE = { "succeeded": "bold green", @@ -161,6 +162,9 @@ def on_progress(goal) -> None: def main(argv: list[str] | None = None) -> int: + # Windows consoles default to GBK/cp936; rich and model output emit UTF-8. + # Reconfigure early so headless runs never crash rendering non-GBK text. + configure_utf8_stdio() parser = argparse.ArgumentParser( prog="deepcode loop", description="Run a durable Goal on the shared ordinary-Turn runtime.", diff --git a/core/harness/hooks/discovery.py b/core/harness/hooks/discovery.py index 0ef40663..c98164a8 100644 --- a/core/harness/hooks/discovery.py +++ b/core/harness/hooks/discovery.py @@ -103,7 +103,7 @@ def _load_hook_events(path: Path, warnings: list[str]) -> dict | None: if not path.is_file(): return None try: - data = json.loads(path.read_text()) + data = json.loads(path.read_text(encoding="utf-8")) except (OSError, ValueError) as exc: warnings.append(f"failed to read hooks config {path}: {exc}") return None