Skip to content
This repository was archived by the owner on Sep 23, 2026. It is now read-only.

fix: replace platform.version() with system+release for HTTP headers - #1360

Closed
T1mn wants to merge 1 commit into
MoonshotAI:mainfrom
T1mn:fix/platform-version-header-issue
Closed

T1mn wants to merge 1 commit into
MoonshotAI:mainfrom
T1mn:fix/platform-version-header-issue

Conversation

@T1mn

@T1mn T1mn commented Mar 7, 2026 •

Copy link
Copy Markdown

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 causes httpx.LocalProtocolError.

This PR replaces platform.version() with a combination of platform.system() and platform.release(), which provides clean, compliant values on all platforms:

  • Linux: "Linux 6.8.0-31-generic" instead of "#31-Ubuntu SMP..."
  • macOS: "Darwin 23.1.0" instead of "Darwin Kernel Version..."
  • Windows: "Windows 10.0.19044" (unchanged)

Changes

  • Updated src/kimi_cli/auth/oauth.py line 213
  • Updated src/kimi_cli/utils/environment.py line 31
  • Updated tests to mock platform.release() instead of platform.version()

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked the related issue, if any.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have run make gen-changelog to update the changelog.
  • I have run make gen-docs to update the user documentation.

Fixes #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.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

After upgrading Kimi CLI to version 1.17.0 on Ubuntu 22.04, I get the following error when trying to run the program:

1 participant