Skip to content

fix(windows): UTF-8 CLI stdio so GBK consoles don't crash setup/host - #2

Open
scwf wants to merge 7 commits into
mainfrom
fix/windows-cli-stdio-utf8
Open

fix(windows): UTF-8 CLI stdio so GBK consoles don't crash setup/host#2
scwf wants to merge 7 commits into
mainfrom
fix/windows-cli-stdio-utf8

Conversation

@scwf

@scwf scwf commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Legacy Windows code pages raise UnicodeEncodeError on emoji/checkmark glyphs, breaking setup/config and flapping the host tunnel. Configure UTF-8 at CLI entry, harden host banners with safe_console_print, and document the core Windows hardening plan.

@github-actions github-actions Bot added the size/L Pull request size: L label Jul 23, 2026
Legacy Windows code pages could crash CLI and host operations when user-facing output contained unsupported Unicode glyphs.

Make CLI stdio configuration aware of terminals versus redirected streams so console output uses UTF-8 without breaking CP936 subprocess capture. Avoid changing the console input code page or leaking UTF-8 mode into unrelated child processes.

Route host lifecycle and authentication messages through safe console output so encoding failures cannot interrupt tunnel handling after a runner has started or stopped.

Initialize stdio in the standalone host daemon and force its captured stdout and stderr to UTF-8 with replacement, keeping raw output consistent with the UTF-8 log handler.

Add regression coverage for GBK consoles, redirected streams, Unicode runner paths, daemon startup, and daemon log encoding.

Signed-off-by: scwf <wangfei_hello@126.com>
@scwf
scwf force-pushed the fix/windows-cli-stdio-utf8 branch from c34f9d7 to a109d2e Compare July 23, 2026 06:55
scwf added 3 commits July 23, 2026 17:13
Read agent YAML, instruction files, skill metadata, MCP configs, and harness JSON as UTF-8 so Windows locale encodings cannot reject valid project content.

Decode harness status output explicitly as UTF-8 and skip the POSIX orphan reaper when child-wait primitives are unavailable on Windows.

Add regression coverage for UTF-8 artifacts, CLI status output, and Windows host cleanup.

Signed-off-by: scwf <wangfei_hello@126.com>
Windows system proxies could intercept loopback runner-to-server callbacks, causing managed token mint requests to return empty 502 responses and fail subsequent callbacks with misleading authentication errors. Disable environment proxy discovery for runner HTTP clients, allow managed mint refreshes with no token to fall back to a bare request, and clarify the non-managed refresh error.

Add regression coverage for proxy bypass, transient mint failures, delegated-auth decline, and the updated error message.

Signed-off-by: scwf <wangfei_hello@126.com>
Claude Agent SDK passed complete system prompts on the command line, exceeding the Windows CreateProcess command-length limit for larger agents such as Polly. Spill Windows and oversized prompts to temporary Markdown files, reuse them per session, and remove them when the session or executor closes.

Add regression coverage for Polly-sized prompts, Windows short prompts, non-Windows inline prompts, cache reuse, updates, and cleanup.

Signed-off-by: scwf <wangfei_hello@126.com>
@github-actions github-actions Bot added size/XL Pull request size: XL and removed size/L Pull request size: L labels Jul 24, 2026
scwf added 3 commits July 24, 2026 11:10
Static API key helpers used the POSIX printf command, which is unavailable in Windows cmd.exe and allowed Claude Code to fall back to unrelated credentials from user settings. Generate a platform-safe Python helper with a base64 payload on Windows, use it across workflow and native provider paths, and run generic Codex gateway auth through PowerShell while retaining the Databricks shell path.

Add regression coverage for exact key bytes, special Python paths, Claude and Codex provider wiring, Windows auth execution, and Databricks compatibility.

Signed-off-by: scwf <wangfei_hello@126.com>
Windows OS helpers receive configuration through a temporary file because subprocess pass_fds is unavailable. Inactive sandbox policies previously had no private temporary directory, so sandbox.type none failed before sys_os_shell or sys_os_read could start the helper. Create the private directory for every Windows helper while keeping sandbox-specific write roots, environment, and backend setup gated on an active sandbox.

Add a cross-platform helper startup regression test and keep the PYTHONPATH integration assertion limited to POSIX shells.

Signed-off-by: scwf <wangfei_hello@126.com>
Claude Code user settings can inject authentication and endpoint variables with higher priority than process configuration, allowing stale local credentials to win the first managed gateway request. For Omnigent-managed gateways, provide invocation-local settings that clear competing credentials, pin the configured endpoint through the loopback shim, and fail loudly on invalid settings while preserving native authentication for non-gateway sessions.

Add regression coverage for managed and non-managed authentication, gateway URL pinning, invalid settings, environment restoration, and shim startup safety.

Signed-off-by: scwf <wangfei_hello@126.com>
@scwf
scwf force-pushed the fix/windows-cli-stdio-utf8 branch from ecfa0a2 to 3694837 Compare July 24, 2026 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XL Pull request size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant