Repository navigation
Conversation
`gateway run --port` accepts a port, but the adjacent query subcommands `gateway health` and `gateway probe` rejected the same flag, so scripts targeting a non-default local port had to hand-build a WebSocket URL (and then also pass --token/--password, since --url disables config credential fallback). Route the existing parent `gateway --port` flag through to the query commands by patching `config.gateway.port` rather than synthesizing a ws:// URL, so configured local auth and the TLS scheme (ws:// vs wss://) are preserved: - resolveGatewayRpcOptions inherits the parent --port (covers health, call, usage-cost, stability via callGatewayCli) - callGatewayCli loads the real config and overrides only gateway.port - gateway probe gains its own --port and passes a numeric port to gatewayStatusCommand, which patches config.gateway.port before resolveTargets derives the scheme Invalid ports are rejected via the shared strict parsePort. Fixes openclaw#79100 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Closing this PR because the author has more than 20 active PRs in this repo. Please reduce the active PR queue and reopen or resubmit once it is back under the limit. You can close your own PRs to get back under the limit. |
This was referenced Jun 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gateway run --port 18789accepts--port, but the adjacent query subcommands rejected the same flag:openclaw gateway health --port 18789→error: unknown option '--port'openclaw gateway probe --port 18789→error: unknown option '--port'So scripts that start a gateway on a controlled local port could not target it through
health/probewith the same visible flag shape asrun, and the--urlworkaround disables config credential fallback (forcing explicit--token/--password).Fix
Route the existing parent
gateway --portflag through to the query commands by patchingconfig.gateway.port— not by synthesizing aws://URL — so configured local auth and the TLS scheme (ws://vswss://) are preserved:resolveGatewayRpcOptionsnow inherits the parent--port(covershealth,call,usage-cost,stabilityviacallGatewayCli).callGatewayCliloads the real config and overrides onlygateway.port, so configured credentials still apply (no forced--token/--password).gateway probegains its own--portand passes a numeric port togatewayStatusCommand, which patchesconfig.gateway.portbeforeresolveTargetsderives the scheme.parsePort.Usage:
openclaw gateway --port 18789 health(port before the subcommand, the same place the parent--portalready lives forgateway run).Fixes #79100
Real behavior proof
Behavior addressed:
gateway healthandgateway proberejected the--portthatgateway runaccepts; they now honor the parentgateway --port <N>flag by patchingconfig.gateway.port(preserving local auth/TLS) instead of erroring or ignoring it.Real environment tested: vitest (
src/cli/gateway-cli.coverage.test.ts) driving the realregisterGatewayCliCommander program throughrunGatewayCommand([...])argv parsing, withcallGatewayandgatewayStatusCommandmocked at the RPC boundary to capture the resolved options.Exact steps or command run after this patch:
node scripts/run-vitest.mjs src/cli/gateway-cli.coverage.test.tsEvidence after fix:
Test Files 1 passed (1)/Tests 21 passed (21), including the two new #79100 cases. Reverting only the three source edits (keeping the tests) flips exactly those two cases to failing (Tests 2 failed | 19 passed), proving the tests bind the fix.Observed result after fix:
gateway --port 18799 healthcallscallGatewayonce withconfig.gateway.port === 18799andurl === undefined(the port is patched onto config, not turned into a url override).gateway --port 18799 probecallsgatewayStatusCommandonce with a numericport === 18799and no stringurl, soresolveTargetsderivesws://vswss://from the loaded config's TLS settings rather than a hard-coded plaintext URL.What was not tested: A live gateway socket round-trip on a real non-default port — the change is in CLI option resolution and config patching, verified by driving the real Commander program and asserting the resolved RPC/probe options; the downstream connect path is unchanged and already covered elsewhere.
🤖 Generated with Claude Code