fix(kimi-code): format IPv6 server origins correctly#1402
Open
VectorPeak wants to merge 1 commit into
Open
Conversation
🦋 Changeset detectedLatest commit: 2b1236a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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
No linked issue; this is a focused, reproducible CLI server URL formatting bug fix.
Problem
serverOrigin(host, port)builds the shared server origin used by multiplekimi serversubcommands. It currently interpolates the host directly into a URL string:`http://${host}:${port}`That works for IPv4 addresses and hostnames, but it produces an invalid URL for IPv6 literal hosts. IPv6 addresses contain
:characters, so a raw value such as::1conflicts with the URL'shost:portseparator:This is not just a display issue.
serverOrigin()is shared by server lifecycle, daemon, status, kill, and health-check paths, so a malformed origin can be passed intonew URL(...)/ fetch-style call sites that require bracketed IPv6 host literals.The behavior should match URL syntax and the existing server access URL formatter: IPv6 literal hosts must be wrapped in brackets, while IPv4 addresses and hostnames should remain unchanged.
What changed
serverOrigin()to format IPv6 hosts with the existingformatHostForUrl()helper.@moonshot-ai/kimi-code.Validation run locally:
Observed URL-construction proof:
Note: local validation used
ELECTRON_SKIP_BINARY_DOWNLOAD=1/ELECTRON_SKIP_DOWNLOAD=1; this parser/URL formatting test path does not require the Electron binary.Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.