Skip to content

fix(gateway): keep explicit loopback binds on 127.0.0.1 - #65635

Closed
neeravmakwana wants to merge 1 commit into
openclaw:mainfrom
neeravmakwana:fix/65619-gateway-loopback-bind
Closed

neeravmakwana wants to merge 1 commit into
openclaw:mainfrom
neeravmakwana:fix/65619-gateway-loopback-bind

Conversation

@neeravmakwana

Copy link
Copy Markdown
Contributor

Summary

Test plan

  • pnpm test src/gateway/net.test.ts -t "resolveGatewayBindHost"
  • pnpm test src/gateway/server-runtime-config.test.ts -t "loopback binding that resolves to non-loopback host|respects explicit loopback config even inside a container"
  • IDE lints clean for src/gateway/net.ts, src/gateway/net.test.ts, and CHANGELOG.md

Notes

  • AI assistance: used for implementation and author-reviewed before submission.

Made with Cursor

@greptile-apps

greptile-apps Bot commented Apr 13, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a regression where gateway.bind=loopback would silently fall back to 0.0.0.0 — and then immediately abort — whenever a transient preflight canBindToHost("127.0.0.1") probe returned false. The fix removes the probe entirely for the loopback mode, making it unconditionally return 127.0.0.1, and injects a canBindToHost override into resolveGatewayBindHost for targeted unit testing. The logic change is minimal and well-targeted.

Confidence Score: 5/5

Safe to merge — the change is narrowly scoped to the loopback path, is covered by a new regression test, and has no security implications.

Only a P2 stale-comment finding; no logic, security, or correctness issues found.

No files require special attention.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/gateway/net.ts
Line: 290

Comment:
**Stale JSDoc comment**

The comment on the `loopback` entry still reads `(rarely fails, but handled gracefully)`, which described the old probe-with-fallback behaviour. Now that the loopback path unconditionally returns `127.0.0.1`, the parenthetical is inaccurate.

```suggestion
 * - loopback: 127.0.0.1 (always; probe is skipped for explicit loopback)
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (2): Last reviewed commit: "fix(gateway): keep explicit loopback bin..." | Re-trigger Greptile

@neeravmakwana

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. What shall we delve into next?

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant