Repository navigation
fix(cli): honor gateway --port on the status leaf - #130847
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 27, 2026, 5:04 AM ET / 09:04 UTC. ClawSweeper reviewWhat this changesThe PR makes Gateway and daemon status honor an explicit local Gateway port whether it appears before or after the status subcommand. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep this maintainer-owned PR open for normal exact-head CI and maintainer handling. The reviewed source implements the missing leaf option through the shared port resolver, with no blocking correctness finding. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherGateway and daemon status commands parse operator options, resolve a Gateway endpoint and credentials, then collect service diagnostics and optionally call the Gateway status RPC. The selected endpoint feeds both the diagnostic report and probe result. flowchart LR
A[Operator CLI command] --> B[Gateway or daemon status parser]
B --> C[Port and URL validation]
C --> D[Local Gateway resolution]
D --> E[Service diagnostics]
D --> F[Status RPC probe]
E --> G[Status output]
F --> G
Decision needed
Why: The Before merge
Agent review detailsSecurityNone. PR surfaceSource -5, Tests +125, Docs +5. Total +125 across 11 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the shared resolver and status registration after exact-head CI confirms the existing real-parser coverage on this branch. Do we have a high-confidence way to reproduce the issue? No live current-main reproduction was run because this read-only checkout cannot create Corepack cache state; current main source omits the leaf option and the branch adds real-parser regression coverage for the reported forms. Is this the best way to solve the issue? Yes. Moving the shared parent/leaf resolution into the Gateway RPC owner avoids another status-only workaround while preserving the existing port validation boundary. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1847e9ac9945. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
gateway statuswas the last RPC sibling that ignored the gateway--portoption.openclaw gateway status --port Nerrored with "unknown option", whileopenclaw gateway --port N statusparsed and then silently reported the config-derived gateway instead of the requested one — the operator reads a status/probe report for the wrong gateway with no indication anything was dropped. This exact invariant (parent options declared on every applicable leaf, both positions honored) has been repaired leaf-by-leaf four times before: #94687 (health/probe), #119046 (call), #126832 (usage-cost/stability), #130513 (logs).Why This Change Was Made
Rather than a fifth leaf patch, port handling moved into the shared owner:
gateway-rpc.tsnow exposes the existing auth and local-port resolution to both the gateway and daemon registrations, and one shared status declaration supplies--portto both command groups (daemon status --port Nis fixed by the same declaration). Non-default leaf values win over the parent; a leaf default cannot mask an explicit parent value; parsing and--url/--portconflict validation stay owned bygateway-port-option.ts. The refactor deleted the duplicated daemon auth resolver, gateway-local validation, and three empty lazy-loader wrappers (net −5 production LOC).addGatewayClientOptionswas deliberately not reused wholesale because it exposes--expect-final, which status cannot implement. Explicit local selection uses the invoking CLI config and remains local when that config selects remote mode; native service details stay diagnostic-only. Both CLI docs updated, including an adjacent incorrect claim about status--urlprobing.User Impact
gateway status --port N,gateway --port N status, anddaemon status --port Nall target the explicitly selected local gateway — summary, port diagnostics, connectivity probe, and the required status RPC included.Evidence
unknown option '--port', and the parent form probingwss://127.0.0.1:19001(service config) instead of the requestedws://127.0.0.1:19002.origin/main.portSource: cli; five probesrpc.ok: true; gateway stopped cleanly, state removed.cliStartupbuild green with bootstrap-import guard. All four historical sibling fixes read; Commander positional parsing andinheritOptionFromParentinspected directly.