Repository navigation
Conversation
Greptile SummaryThis PR fixes a proxy-bypass bug in proxy-only environments by calling Confidence Score: 4/5Safe to merge — the fix is minimal and well-scoped; only P2 style observations remain. P2-only findings: the test covers the extracted function but not the call site in No files require special attention. Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/gateway/server-startup.test.ts
Line: 58-64
Comment:
**Test only covers the function, not the call site**
`bootstrapGatewayNetworkEnvironment` is verified in isolation here, but the actual regression being fixed (the function not being called at gateway startup) lives in `server.impl.ts`. If `bootstrapGatewayNetworkEnvironment()` is removed from `startGatewayServer`, this test would still pass. A test that mocks `bootstrapGatewayNetworkEnvironment` and verifies it is called during `startGatewayServer` would fully close the regression loop.
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: src/gateway/server-startup.ts
Line: 231-235
Comment:
**`__testing` entry is redundant with the public export**
`bootstrapGatewayNetworkEnvironment` is already a named `export` on line 39, so exposing it again via `__testing` is redundant. The other entry in `__testing` (`prewarmConfiguredPrimaryModel`) is a private function not exported at module scope, which is why it needs `__testing`. Consider either removing the `__testing` entry for `bootstrapGatewayNetworkEnvironment`, or keeping the function private and only exporting it through `__testing` for consistency.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix(gateway): bootstrap env proxy dispat..." | Re-trigger Greptile |
| it("installs the env proxy dispatcher for gateway-side provider requests", async () => { | ||
| const { __testing } = await import("./server-startup.js"); | ||
|
|
||
| __testing.bootstrapGatewayNetworkEnvironment(); | ||
|
|
||
| expect(ensureGlobalUndiciEnvProxyDispatcherMock).toHaveBeenCalledTimes(1); | ||
| }); |
There was a problem hiding this comment.
Test only covers the function, not the call site
bootstrapGatewayNetworkEnvironment is verified in isolation here, but the actual regression being fixed (the function not being called at gateway startup) lives in server.impl.ts. If bootstrapGatewayNetworkEnvironment() is removed from startGatewayServer, this test would still pass. A test that mocks bootstrapGatewayNetworkEnvironment and verifies it is called during startGatewayServer would fully close the regression loop.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/gateway/server-startup.test.ts
Line: 58-64
Comment:
**Test only covers the function, not the call site**
`bootstrapGatewayNetworkEnvironment` is verified in isolation here, but the actual regression being fixed (the function not being called at gateway startup) lives in `server.impl.ts`. If `bootstrapGatewayNetworkEnvironment()` is removed from `startGatewayServer`, this test would still pass. A test that mocks `bootstrapGatewayNetworkEnvironment` and verifies it is called during `startGatewayServer` would fully close the regression loop.
How can I resolve this? If you propose a fix, please make it concise.| } | ||
|
|
||
| export const __testing = { | ||
| bootstrapGatewayNetworkEnvironment, | ||
| prewarmConfiguredPrimaryModel, |
There was a problem hiding this comment.
__testing entry is redundant with the public export
bootstrapGatewayNetworkEnvironment is already a named export on line 39, so exposing it again via __testing is redundant. The other entry in __testing (prewarmConfiguredPrimaryModel) is a private function not exported at module scope, which is why it needs __testing. Consider either removing the __testing entry for bootstrapGatewayNetworkEnvironment, or keeping the function private and only exporting it through __testing for consistency.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/gateway/server-startup.ts
Line: 231-235
Comment:
**`__testing` entry is redundant with the public export**
`bootstrapGatewayNetworkEnvironment` is already a named `export` on line 39, so exposing it again via `__testing` is redundant. The other entry in `__testing` (`prewarmConfiguredPrimaryModel`) is a private function not exported at module scope, which is why it needs `__testing`. Consider either removing the `__testing` entry for `bootstrapGatewayNetworkEnvironment`, or keeping the function private and only exporting it through `__testing` for consistency.
How can I resolve this? If you propose a fix, please make it concise.|
Thanks for the focused fix. I rewrote this on current Landed equivalent fix in d513dc7:
Closing this PR as superseded by the landed main commit. |
Summary
Why
Gateway-side provider/plugin paths can execute before an embedded agent attempt has installed the env proxy dispatcher. In proxy-only environments this leaves OpenAI SDK traffic without the configured HTTP(S) proxy and surfaces as
LLM request failed: network connection error/Connection error, even though credentials resolve correctly.Validation
pnpm exec vitest run --config vitest.gateway.config.ts src/gateway/server-startup.test.ts --pool=forkspnpm exec oxlint --type-aware src/gateway/server.impl.ts src/gateway/server-startup.ts src/gateway/server-startup.test.tspnpm exec oxfmt --check src/gateway/server.impl.ts src/gateway/server-startup.ts src/gateway/server-startup.test.tsCanary
Validated the same fix adapted onto an OpenClaw 2026.4.24 Atlas sandbox canary:
openai/gpt-5.5agent smoke returnedatlas 4.24 proxy bootstrap okopenai/gpt-5.4-minigateway model smoke returnedatlas 4.24 mini smoke okgpt-5.5smoke