-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
Silent port fallback on invalid --port in node run command #83923
Copy link
Copy link
Closed
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Severity: medium / Confidence: high / Category: bug
Triage: confirmed-bug
Detected against: openclaw v2026.5.18 (latest stable at time of scan, 2026-05-18)
Tooling: clawpatch 0.3.0 + acpx/claude-sonnet-4-5 via Brad Mills protocol
Evidence
src/cli/node-cli/register.ts:15-16(parsePortWithFallback)src/cli/node-cli/register.ts:58-68(None)src/cli/node-cli/daemon.ts:89-97(runNodeDaemonInstall)Reasoning
The
runsubcommand usesparsePortWithFallback, which silently returns the fallback value (config port or 18789) when the supplied--portvalue is non-numeric or out of range. This meansopenclaw node run --port abcstarts the node host on the fallback port with no diagnostic. Theinstallsubcommand validates the same value and callsfailwithformatInvalidPortOption. A user who mis-types a port forrunwill get a silently wrong runtime address, which is hard to diagnose — especially when TLS fingerprinting or a NAT target is involved.Reproduction
Run
openclaw node run --port abc— the host starts on port 18789 without any error or warning.Recommendation
Validate the port in the
runaction the same wayrunNodeDaemonInstalldoes: callparsePort, and ifopts.portwas provided but parsed asnull, print an error and exit rather than falling back silently. TheparsePortWithFallbackhelper should either be removed or renamed toparsePortWithSilentFallbackto make the silent behavior explicit at each call-site.Why existing tests miss this
No tests exist for this feature (the feature definition lists an empty
testsarray), so this path has never been exercised in a test environment.Suggested regression test
In a Vitest unit test for
registerNodeCli, invoke therunaction with{ port: 'abc' }and assert thatrunNodeHostis NOT called (or is called only after an error is surfaced), mirroring the existing validation contract inrunNodeDaemonInstall.Minimum fix scope
Add port validation to the
runaction handler insrc/cli/node-cli/register.ts, matching the pattern inrunNodeDaemonInstall.Standardized clawpatch finding. Persistent in v2026.5.18 (not resolved by upgrading from v2026.5.12). Finding ID:
fnd_sig-feat-cli-command-264278dce9-_0ae855a8ab.