fix(windows): patch platform._syscmd_ver to survive non-UTF-8 output under PEP 540 - #16
Closed
webtecnica wants to merge 2 commits into
Closed
webtecnica wants to merge 2 commits into
webtecnica wants to merge 2 commits into
Conversation
…large contexts (NousResearch#69424) Three-pronged fix for the stale-stream detector killing connections before a slow local/cloud model finishes prompt prefill: 1. Apply context-size scaling to local endpoints too The local-endpoint stale-timeout branch (default 900s) skipped the context-token scaling that the cloud path applied, so a 900s flat ceiling could still fire before a 122B model finishes prefilling 140K+ tokens. Move scaling out of the branch so both local and cloud paths get proportional timeouts: - >200K tokens → 1800s (30 min) - >100K tokens → 1200s (20 min) - >50K tokens → 600s (10 min) 2. Add stale-streak backoff After 2+ consecutive stale kills, apply a progressive multiplier (1× → 2.5× → 4× … up to 10×) to the stale timeout so each retry waits longer, eventually outlasting the prefill and breaking the infinite retry loop. Resets on successful response. 3. Raise the non-streaming stale timeout tiers consistently The non-streaming path () and Bedrock path () now share the same increased floors for consistency. Closes NousResearch#69424.
…under PEP 540 On Windows with PYTHONUTF8=1 (PEP 540 UTF-8 mode), platform._syscmd_ver() calls subprocess.check_output(..., text=True, encoding='locale', shell=True) to run the Windows 'ver' command. Under PEP 540, locale.getencoding() returns 'utf-8', but the 'ver' command emits output in the system's active ANSI code page (cp1252 on US-English). Bytes that are valid in cp1252 but not in UTF-8 — e.g. 0xe9 (é) — raise a UnicodeDecodeError inside the subprocess reader thread. The patch wraps platform._syscmd_ver with a try/except that catches UnicodeDecodeError and gracefully returns input defaults, matching the existing OSError/CalledProcessError fallback that _win32_ver already handles. Fixes NousResearch#69413
Owner
Author
|
This PR accidentally targets my own fork ( |
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.
Fixes NousResearch#69413
Description
Windows subprocess reader thread crashes on non-UTF-8 output when platform._syscmd_ver() calls subprocess.check_output with encoding='locale'.
Changes
Test results
All 23 tests pass, 5 Windows-only skipped on Linux.