Skip to content

fix(android): normalize IPv6 host input in manual gateway URLs#64440

Closed
MayankSharma-ops wants to merge 1 commit into
openclaw:mainfrom
MayankSharma-ops:fix/android-ipv6-url
Closed

fix(android): normalize IPv6 host input in manual gateway URLs#64440
MayankSharma-ops wants to merge 1 commit into
openclaw:mainfrom
MayankSharma-ops:fix/android-ipv6-url

Conversation

@MayankSharma-ops

Copy link
Copy Markdown

Summary

  • Normalize raw IPv6 host input by wrapping it in brackets when constructing manual gateway URLs
  • Ensure compatibility with URL formatting requirements for IPv6 addresses
  • Add test coverage for bare IPv6 host inputs (e.g., ::1)

Why

Manual gateway configuration accepted raw IPv6 literals, but URLs require IPv6 hosts to be enclosed in brackets. Without normalization, inputs like ::1 produced invalid URLs (e.g., http://::1:18789), causing connection failures.

Testing

  • Added unit test for IPv6 host normalization in GatewayConfigResolver
  • Verified URL generation for both IPv4 and IPv6 inputs

@greptile-apps

greptile-apps Bot commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a bug where bare IPv6 literals (e.g. ::1) entered as the manual gateway host produced invalid URLs like http://::1:18789 instead of the RFC-correct http://[::1]:18789. The fix adds a normalization step in composeGatewayManualUrl that wraps raw IPv6 hosts in brackets, with two new tests covering the direct URL composer and the full resolveGatewayConnectConfig flow. The logic is correct — parseGatewayEndpointResult already strips brackets via uri.host?.trim('[', ']'), so GatewayConnectConfig.host continues to store the bare address without brackets as expected.

Confidence Score: 5/5

Safe to merge — the fix is correct, well-scoped, and the new tests pass through the full resolution path.

The normalization logic correctly handles all three cases (already-bracketed, raw IPv6, and non-IPv6), and the downstream parser already strips brackets before storing the host. No P0/P1 issues found; all remaining observations are P2 or lower.

No files require special attention.

Reviews (1): Last reviewed commit: "fix(android): normalize IPv6 host input ..." | Re-trigger Greptile

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant