fix(windows): UTF-8 CLI stdio so GBK consoles don't crash setup/host - #2
Open
scwf wants to merge 7 commits into
Open
fix(windows): UTF-8 CLI stdio so GBK consoles don't crash setup/host#2scwf wants to merge 7 commits into
scwf wants to merge 7 commits into
Conversation
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
force-pushed
the
fix/windows-cli-stdio-utf8
branch
from
July 23, 2026 06:55
c34f9d7 to
a109d2e
Compare
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>
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
force-pushed
the
fix/windows-cli-stdio-utf8
branch
from
July 24, 2026 03:10
ecfa0a2 to
3694837
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.