Skip to content

fix(gateway): honor custom ports for usage and stability queries - #126832

Merged
steipete merged 1 commit into
mainfrom
codex/autoqa-gateway-cli-port-20260820
Aug 20, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/autoqa-gateway-cli-port-20260820

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where operators querying a custom-port Gateway through gateway usage-cost or live gateway stability would silently contact the default Gateway instead, even when --port was supplied before or after the nested command.

Why This Change Was Made

Gateway command registration duplicated the canonical shared client-option set, omitted its local-port option on two RPC leaves, and dispatched those leaves through an authentication-only resolver. Reuse the existing shared Gateway client options for every applicable RPC command, delete redundant leaf option declarations, and route usage-cost plus live stability through the existing parent-aware local-port resolver. Offline stability bundles, support exports, managed service status, and discovery retain their distinct owners and existing behavior.

User Impact

Operators can reliably run gateway --port 19001 usage-cost, gateway usage-cost --port 19001, gateway --port 19001 stability, and gateway stability --port 19001 against the intended local Gateway. Explicit child ports override parent ports; conflicting --url and --port values fail visibly. Offline bundle inspection, diagnostics export, service-managed status targeting, authentication, JSON output, and command-specific timeouts remain unchanged.

Evidence

  • Six authentic real-Commander regression cases failed against untouched production: parent-position, child-position, and explicit-child-precedence cases for both usage-cost and live stability all omitted localPortOverride.
  • OPENCLAW_VITEST_MAX_WORKERS=1 OPENCLAW_VITEST_FS_MODULE_CACHE=0 node scripts/run-vitest.mjs src/cli/gateway-cli/register.option-collisions.test.ts src/cli/gateway-cli.coverage.test.ts src/cli/daemon-cli/register-service-commands.test.ts --configLoader runner — 76 tests passed across three suites.
  • Regression coverage includes both option positions, child precedence, --url conflicts, existing call/health/suspend/resume RPC siblings, offline bundle reads, service-owned stability exports, distinct export timeout contracts, and managed Gateway service commands.
  • Focused formatter and direct core oxlint checks passed; max-lines and assertion-safety ratchets passed.
  • Production delta: +16/-18 (net −2); tests strengthen canonical owner-boundary behavior without production-only seams.
  • Frozen reviewed head: 86edb055437cfbb9adc0018a6ee655242e05636d.
  • Independent owner/dependency review and fresh authenticated complete-branch automated review: clean; no actionable findings.
  • AI-assisted; no agent transcript attached.

@clawsweeper

clawsweeper Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: S maintainer Maintainer-authored PR labels Aug 20, 2026
@steipete
steipete marked this pull request as ready for review August 20, 2026 20:39
@steipete
steipete merged commit 21bab3a into main Aug 20, 2026
228 checks passed
@steipete
steipete deleted the codex/autoqa-gateway-cli-port-20260820 branch August 20, 2026 20:51
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

cli CLI command changes maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant