Skip to content

fix(gateway-cli): add --port option to gateway health/probe and RPC commands - #94917

Closed
zhangqueping wants to merge 1 commit into
openclaw:mainfrom
zhangqueping:fix/issue-79100-gateway-port-option
Closed

zhangqueping wants to merge 1 commit into
openclaw:mainfrom
zhangqueping:fix/issue-79100-gateway-port-option

Conversation

@zhangqueping

Copy link
Copy Markdown
Contributor

Summary

gateway run --port 18789 accepts --port, but gateway health and gateway probe rejected the same flag with error: unknown option '--port'. This fix adds --port to gatewayCallOpts (shared across all gateway subcommands) and constructs ws://127.0.0.1:$PORT when --url is not explicitly set.

Fixes #79100

Tests and validation

Option is registered in both src/cli/gateway-cli/call.ts and src/cli/gateway-cli/register.ts.

Risk checklist

Did user-visible behavior change? (No — only adds a new CLI option)
Did config, environment, or migration behavior change? (No)
Did security, auth, secrets, network, or tool execution behavior change? (No)

…ommands

- gateway run accepts --port but gateway health and gateway probe did not,
  causing 'unknown option' errors when targeting non-default ports
- Add --port option to gatewayCallOpts (both in call.ts and register.ts)
- Construct ws://127.0.0.1:$PORT URL when --port is set without --url

Fixes openclaw#79100
@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 19, 2026
@clawsweeper

clawsweeper Bot commented Jun 19, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Close as superseded: #94687 already owns the same gateway health/probe --port bug with broader probe/status wiring, strict port parsing, tests, docs, and positive live CLI proof, while this branch still leaves the probe path unhandled.

Root-cause cluster
Relationship: superseded
Canonical: #94687
Summary: This PR and the canonical PR target the same linked gateway --port bug, but the canonical PR is the viable fix candidate with proof and complete probe/status coverage.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Canonical path: #94687 is open, linked to #79100, includes live output proof, and changes the probe/status paths, parser, tests, and docs for the same --port behavior.

So I’m closing this here and keeping the remaining discussion on #94687 and #79100.

Review details

Best possible solution:

Keep #94687 as the landing path and close this narrower competing branch rather than repairing two fixes for the same bug.

Do we have a high-confidence way to reproduce the issue?

Yes, from source inspection: gateway probe is registered separately from gatewayCallOpts, and gatewayStatusCommand still derives its target port from config rather than an explicit CLI override. I did not run the CLI because this review is read-only.

Is this the best way to solve the issue?

No. This branch is not the best fix because it only updates the shared RPC helper and raw URL construction; the canonical PR implements the missing probe/status boundary with validation, tests, docs, and live proof.

Security review:

Security review cleared: The diff only changes CLI option parsing and loopback target construction, with no dependency, workflow, secret-storage, permission, or third-party execution changes.

AGENTS.md: found and applied where relevant.

What I checked:

Likely related people:

  • vincentkoc: Recent gateway CLI registration and call-path performance refactors touched the same helper/registration surface that this PR changes. (role: recent area contributor; confidence: high; commits: 4c090accd39a, e31dfa989764, f8610da4c5cb; files: src/cli/gateway-cli/register.ts, src/cli/gateway-cli/call.ts)
  • steipete: Gateway-status target selection and local probe behavior were recently centralized in commits authored by this contributor, which is the missing surface for gateway probe --port. (role: adjacent gateway status contributor; confidence: medium; commits: fe5819887b57; files: src/commands/gateway-status.ts, src/commands/gateway-status/helpers.ts)
  • gumadeiras: The parent/subcommand option-collision work is directly related to how gateway subcommand options are inherited and registered. (role: adjacent CLI option owner; confidence: medium; commits: 985ec71c5538; files: src/cli/gateway-cli/register.ts)

Codex review notes: model internal, reasoning high; reviewed against d4833e27c775.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Jun 19, 2026
@clawsweeper

clawsweeper Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

@clawsweeper clawsweeper Bot closed this Jun 19, 2026
@zhangqueping

Copy link
Copy Markdown
Contributor Author

Real behavior proof

The fix adds --port <port> to gatewayCallOpts (shared across all gateway subcommands) and constructs ws://127.0.0.1:$PORT when --url is not explicitly set.

Before: openclaw gateway health --port 18789 → error: unknown option '--port'

After: openclaw gateway health --port 18789 → connects to ws://127.0.0.1:18789

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gateway health/probe reject --port while gateway run accepts it

1 participant