Repository navigation
fix(cli): render Gateway health JSON failures - #129106
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 3:36 AM ET / 07:36 UTC. ClawSweeper reviewWhat this changesThe PR routes Gateway health pre-RPC configuration failures to the root CLI renderer so JSON callers receive the canonical error document. Merge readinessKeep this focused fix open. Current main still locally handles the pre-RPC configuration failure with stderr and exit only, while the PR correctly rethrows it to the established root JSON renderer without changing the specialized post-RPC Gateway error path. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherGateway health has a route-first JSON path that resolves local configuration before it performs a read-only Gateway RPC. Pre-RPC failures must reach the root CLI entrypoint for consistent JSON or human terminal output, while Gateway-specific RPC failures retain their specialized formatter. flowchart LR
A[Gateway health command] --> B[Route-first JSON dispatch]
B --> C[Resolve local configuration]
C -->|success| D[Read-only Gateway RPC]
C -->|failure| E[Root CLI renderer]
D --> F[Gateway-specific diagnostics]
E --> G[JSON or human terminal output]
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource -3, Tests +45. Total +42 across 3 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the route-local rethrow after exact-head validation, preserving the root renderer as the sole owner of pre-RPC CLI failures and the Gateway formatter as owner of post-RPC failures. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the path: current main locally writes and exits before the root JSON renderer, and the added built-process test injects that same configuration-read failure. Is this the best way to solve the issue? Yes. Rethrowing only before RPC options exist uses the established root renderer and leaves the post-RPC Gateway-specific diagnostic contract intact. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 8c5a12c112e6. 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
|
|
Land-ready proof for head
Shared malformed-config divergence remains tracked in #128606. |
|
Merged via squash.
|
What Problem This Solves
Route-first
gateway health --port ... --jsonreturned empty stdout when local config resolution failed before RPC setup, while forced Commander correctly emitted a canonical JSON failure.Fixes #129105.
Why This Change Was Made
The health fast route now rethrows failures that occur before RPC options are resolved, allowing the existing root renderer to own JSON/human output and terminal finalization. The post-RPC specialized Gateway diagnostic/formatter path remains unchanged.
Production delta: +1/-4, net -3 lines. Tests: +62/-17, net +45 lines.
User Impact
Routed Gateway health failures now produce parseable JSON consistent with Commander. Target selection, read-only RPC behavior, specialized Gateway payloads, and human output remain unchanged.
Evidence
git diff --check: passed.Malformed shared configuration behavior remains tracked in #128606.