Repository navigation
fix(gateway): avoid loopback connections for embedded config reads - #146226
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 12, 2026, 1:27 PM ET / 17:27 UTC (Revision 2). ClawSweeper reviewWhat this changesRoutes admitted agents’ configuration reads through their hosting Gateway’s existing dispatcher, with routing tests and documentation, while preserving explicit connection overrides and standalone client access. Merge readiness✅ Ready for maintainer review Keep open: current main still uses the socket path, and this focused change remains useful. No actionable correctness or security defect was found; the protected maintainer label also excludes automated closure. Priority: P2 Review scores
Verification
How this fits togetherThe built-in Gateway tool lets agents inspect configuration and schema. It sends requests to shared Gateway handlers, which authorize reads and return configuration with sensitive values redacted. flowchart TD
A[Agent config read] --> B{Admitted Gateway without override?}
B -->|Yes| C[In-process dispatcher]
B -->|No| D[Gateway WebSocket client]
C --> E[Shared authorization and config handlers]
D --> E
E --> F[Config or schema result]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +8, Tests +182, Docs +5. Total +195 across 3 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep configuration reads on the existing admitted-Gateway dispatcher, preserving shared authorization, redaction, deadlines, and explicit remote access. Do we have a high-confidence way to reproduce the issue? Yes, from source: an admitted agent invoking either config read on fetched main unconditionally enters the Gateway client path. Runtime execution was not performed in this read-only review. Is this the best way to solve the issue? Yes. Reusing the existing dispatcher removes connection overhead without duplicating config handlers or changing stored settings, and retains the supported transport exceptions. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 50877be9476d. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
3430ad3 to
468cd64
Compare
|
Merged via squash.
|
What Problem This Solves
Fixes an issue where an agent running inside the Gateway opened another WebSocket connection to read that same Gateway's configuration. Repeated config reads paid connection and authentication overhead and could wait on the local transport under load.
Why This Change Was Made
Route
config.getandconfig.schema.lookupthrough the existing in-process dispatcher when the caller has an admitted Gateway binding. Reuse its current-authority checks, least-privilege read scope, cancellation, deadline, and typed errors. Retired bindings reject locally.Explicit URL/token overrides and standalone local agents retain the existing Gateway client. Configuration handlers, redaction, and the model-facing tool schema are unchanged.
User Impact
Embedded configuration reads avoid unnecessary sockets and handshakes while preserving explicit remote access and existing response behavior.
Evidence
pnpm buildpassed on the same reviewed production tree. Exact-head CI supplies hosted proof.The branch includes #146212’s shared typecheck-shard repair, with a patch-identical rebase. An earlier hosted run also failed an unchanged IPv6 portal fixture; no portal code is changed by this PR.