fix(vis): reject malformed port values - #2304
Conversation
🦋 Changeset detectedLatest commit: 1a0f55a 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 |
There was a problem hiding this comment.
💡 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), |
There was a problem hiding this comment.
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 👍 / 👎.
Related Issue
No linked issue.
Problem
kimi vis --portsilently 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
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.