Skip to content

fix(vis): reject malformed port values - #2304

Open
xianjianlf2 wants to merge 1 commit into
MoonshotAI:mainfrom
xianjianlf2:markxian/fix-vis-port-strict
Open

fix(vis): reject malformed port values#2304
xianjianlf2 wants to merge 1 commit into
MoonshotAI:mainfrom
xianjianlf2:markxian/fix-vis-port-strict

Conversation

@xianjianlf2

Copy link
Copy Markdown

Related Issue

No linked issue.

Problem

kimi vis --port silently ignored or partially accepted malformed port values, making invalid input hard to notice.

What changed

Add a strict visualizer port parser, pass parsed options directly into handleVis, and cover malformed and out-of-range values.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1a0f55a

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 chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1a0f55a444

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

...(port === undefined || Number.isNaN(port) ? {} : { port }),
...(options.host === undefined ? {} : { host: options.host }),
...(sessionId === undefined ? {} : { sessionId }),
port: parseVisPort(options.port),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Route invalid ports through synchronous CLI parsing

When a user runs kimi vis --port 123abc, parseVisPort throws inside this async action, turning the error into a rejected promise. The real entrypoint uses program.parse(process.argv) at apps/kimi-code/src/main.ts:223, so Commander does not await that rejection; the installed global handler consequently records ordinary invalid input as a crash and Node emits an unhandled-rejection stack trace instead of a normal CLI validation error. Commander’s async-action guidance says to use parseAsync rather than parse for async handlers; alternatively, parse this option synchronously with an Option.argParser/InvalidArgumentError before entering the async action.

Useful? React with 👍 / 👎.

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.

1 participant