Repository navigation
refactor(cli): unify gateway RPC transport - #117601
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 3:49 PM ET / 19:49 UTC. ClawSweeper reviewWhat this changesThe branch routes Gateway-facing CLI RPCs through one lazy shared transport, removes duplicate node and gateway wrappers, and uses the canonical credential resolver and deferred readiness helper. Merge readinessThe refactor appears correct: it centralizes duplicated Gateway CLI transport code while preserving each caller’s timeout, progress, authorization, and client-identity policy. Keep this PR open for the protected Priority: P2 Review scores
Verification
How this fits togetherGateway-facing CLI commands attach command-specific timeout, progress, credentials, scopes, and client identity before sending RPCs to the Gateway. The shared CLI transport then invokes the existing Gateway client and returns command output or approval readiness. flowchart LR
A[Gateway CLI commands] --> B[Shared CLI RPC facade]
C[Node and device commands] --> B
B --> D[Timeout progress and auth policy]
D --> E[Gateway call]
E --> F[Gateway RPC response]
F --> G[CLI output and approvals]
Decision needed
Why: No discrete source-level defect was found, but the protected label and in-progress checks require an explicit maintainer merge decision. Before merge
Agent review detailsSecurityNone. PR surfaceSource -167, Tests +44. Total -123 across 23 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one lazy CLI transport owner and preserve each caller’s explicit timeout, progress, authorization, and client-identity policy; merge after exact-head validation is complete. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR is an internal behavior-preserving refactor. The relevant verification is source and regression coverage for the existing caller contracts. Is this the best way to solve the issue? Yes. The existing lazy CLI Gateway facade is the appropriate canonical boundary because command-specific policy remains at the callers while transport implementation is unified. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 26aa884c6914. 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
|
|
ClawSweeper rank-up move completed: all exact-head hosted checks have finished with zero failures, and |
|
Merged via squash.
|
What Problem This Solves
Gateway-facing CLI flows had accumulated three parallel RPC transports and a redundant credential bridge. Their copies were already drifting in timeout defaults, progress labels, stored-device credentials, local backend auth, config overrides, and connection setup, making future transport and security changes easy to apply inconsistently.
Why This Change Was Made
All CLI-to-Gateway RPC calls now use one lazy transport owner while retaining each caller's explicit timeout, client identity, scopes, progress, and auth behavior. Callers now use the canonical credential resolver directly, and the two approval clients use the shared deferred primitive instead of local first-settlement state machines.
Removed paths:
src/cli/gateway-cli/call.tssrc/cli/nodes-cli/rpc.runtime.tssrc/gateway/connection-auth.tsThe public
callGatewayFromClisignature and Plugin SDK exports remain unchanged. No configuration, protocol, schema, dependency, or user-visible command surface changes.User Impact
No intended user-visible behavior change. Gateway CLI, nodes, devices, session compaction, health checks, node-host startup, and approval handling retain their existing flags, output, authentication precedence, cancellation, timeout, and reconnect behavior with less duplicate production code.
Production LOC: -167 (
+153/-320). Tests: +44. Repository total: -123 (+229/-352).Evidence
pnpm check:changedpassed on exact commita0e337b556a1ed518a2117bddadc94b49c34f2be(19m42s), including core/core-test typechecks, formatting, lint fan-out, dead-export scan, import-cycle guard, plugin boundaries, and Plugin SDK API baseline.pnpm buildpassed on the same commit (2m55s), including all 148 public Plugin SDK subpaths and CLI cold-bootstrap import guard.origin/main(c5090b9cf503afebc01a20bc47ac9309d4b3a3e2) completed without conflicts.No changelog entry: this is an internal refactor with unchanged shipped behavior.