fix: replace platform.version() with system+release for HTTP headers#1360
Open
T1mn wants to merge 1 commit intoMoonshotAI:mainfrom
Open
fix: replace platform.version() with system+release for HTTP headers#1360T1mn wants to merge 1 commit intoMoonshotAI:mainfrom
T1mn wants to merge 1 commit intoMoonshotAI:mainfrom
Conversation
Fixes MoonshotAI#1332 platform.version() on Ubuntu returns strings starting with '#' which violates HTTP header spec and causes httpx to reject requests. Replace with platform.system() + platform.release() which provides clean, compliant values across all platforms.
This was referenced Mar 7, 2026
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.
Related Issue
Fixes #1332
Description
On Ubuntu and other Linux distributions,
platform.version()returns kernel version strings that start with#(e.g.,#101~22.04.1-Ubuntu SMP...), which violates HTTP header specifications and causeshttpx.LocalProtocolError.This PR replaces
platform.version()with a combination ofplatform.system()andplatform.release(), which provides clean, compliant values on all platforms:"Linux 6.8.0-31-generic"instead of"#31-Ubuntu SMP...""Darwin 23.1.0"instead of"Darwin Kernel Version...""Windows 10.0.19044"(unchanged)Changes
src/kimi_cli/auth/oauth.pyline 213src/kimi_cli/utils/environment.pyline 31platform.release()instead ofplatform.version()Checklist
make gen-changelogto update the changelog.make gen-docsto update the user documentation.