← Back to PRs

#22804: fix: prioritize loopback for internal gateway calls (issue #22706)

by ambicuity open 2026-02-21 17:57 View on GitHub →
gateway size: XS
Fixes #22706. Recreating PR 22784 from a clean branch to resolve bot closure. <!-- greptile_comment --> <h3>Greptile Summary</h3> Forces internal gateway calls to use loopback interface instead of remote URLs. When the gateway server starts, it sets `OPENCLAW_IS_GATEWAY_SERVER="true"`. The `buildGatewayConnectionDetails` function now checks this env var (or explicit `forceLocal` option) to prevent remote URL resolution, ensuring internal RPC calls from within the gateway process always connect to `127.0.0.1` regardless of remote gateway configuration. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with minimal risk - The changes are well-scoped and address a clear architectural issue where internal gateway calls could incorrectly attempt to use remote URLs. The implementation is clean, follows existing patterns, adds proper documentation, and includes the forceLocal parameter threading through the call stack correctly. - No files require special attention <sub>Last reviewed commit: 2914903</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs