Skip to content

fix(cli): open localhost instead of the wildcard bind address when auto-opening the web UI - #3560

Merged
sailist merged 1 commit into
MoonshotAI:mainfrom
kimi-agent-bot:fix/web-open-wildcard-host
Sep 6, 2026
Merged

fix(cli): open localhost instead of the wildcard bind address when auto-opening the web UI#3560
sailist merged 1 commit into
MoonshotAI:mainfrom
kimi-agent-bot:fix/web-open-wildcard-host

Conversation

@kimi-agent-bot

Copy link
Copy Markdown
Collaborator

Fixes #3559

What

kimi web --host 0.0.0.0 auto-opened the browser on http://0.0.0.0:<port>/#token=..., which is not navigable — the browser shows an unreachable page even though the server is fine and the ready banner prints the correct Local: http://localhost:<port> line.

  • Add browserOpenOrigin() in access-urls.ts: rewrites a wildcard bind host (0.0.0.0 / :: / empty) in the bound origin to localhost, keeping the actual bound port; navigable origins pass through unchanged. This reuses the same wildcard rule the banner's Local: line already applies.
  • handleWebCommand's auto-open path now goes through it, so the opened URL matches the banner.
  • Same family, one line: formatReadyBanner computed the port with new URL(origin), which throws Invalid URL on the http://:::<port> origin of a --host :: bind and killed the startup banner. It now takes the port from the origin's last segment.

Tests

  • web.test.ts: auto-open on a 0.0.0.0 bind opens http://localhost:<port>/#token=...; a :: bind opens http://localhost:<port> (also covers the banner crash fix, since the banner renders on that path).
  • browserOpenOrigin unit tests: wildcard rewrites (IPv4 + IPv6) and pass-through for loopback / LAN / bracketed IPv6 origins.
  • 66/66 apps/kimi-code/test/cli/web tests, tsc --noEmit, check-no-comments, and oxlint --type-aware all green.

…to-opening the web UI

`kimi web --host 0.0.0.0` (or `--host ::`) auto-opened the browser on the
wildcard bind address, which is not navigable. Open localhost on the same
port instead, matching the ready banner's Local: line. Also make the ready
banner's port parsing tolerate the `::` wildcard origin, which crashed
`new URL()` at startup.

Co-authored-by: qer <wbxl2000@outlook.com>
@changeset-bot

changeset-bot Bot commented Sep 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 46c465c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

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

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@pkg-pr-new

pkg-pr-new Bot commented Sep 5, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@46c465c
npx https://pkg.pr.new/@moonshot-ai/kimi-code@46c465c

commit: 46c465c

@sailist
sailist merged commit af81bb9 into MoonshotAI:main Sep 6, 2026
16 checks passed
@github-actions github-actions Bot mentioned this pull request Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

kimi web --host 0.0.0.0 auto-opens the browser on the wildcard bind address (unreachable)

2 participants