Skip to content

fix(android): manual gateway entry for IPv6 hosts#63814

Closed
MayankSharma-ops wants to merge 2 commits into
openclaw:mainfrom
MayankSharma-ops:fix/ipv6-manual-gateway
Closed

fix(android): manual gateway entry for IPv6 hosts#63814
MayankSharma-ops wants to merge 2 commits into
openclaw:mainfrom
MayankSharma-ops:fix/ipv6-manual-gateway

Conversation

@MayankSharma-ops

Copy link
Copy Markdown

Summary

  • bracket raw IPv6 literals when building manual Android gateway URLs
  • fix manual gateway entry for hosts like ::1
  • add regression coverage for manual IPv6 input

Testing

  • added focused tests in GatewayConfigResolverTest
  • attempted the Android unit test locally, but full Gradle verification was blocked by local SDK/toolchain setup in this environment

@greptile-apps

greptile-apps Bot commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes Android manual gateway entry for raw IPv6 host literals (e.g. ::1) by bracketing them in composeGatewayManualUrl before constructing the URL, and adds regression tests for both the URL composer and the higher-level resolver.

  • P1 — .gitignore binary corruption: The gradle-user-home/ line was appended in UTF-16 LE, making git treat the file as binary. The entry will not be honored by git, and the corruption should be fixed before merging.

Confidence Score: 4/5

The Kotlin fix is correct and the tests are sound, but the .gitignore binary corruption should be resolved before merging.

One P1 finding (UTF-16 encoded .gitignore entry that will be silently ignored by git) blocks a clean merge. The core logic change is small, targeted, and correct.

.gitignore — needs to be re-saved as UTF-8/ASCII to fix the binary corruption before merging.

Vulnerabilities

No security concerns identified. The IPv6 bracketing fix is purely syntactic URL normalization; the existing isPrivateLanGatewayHost / TLS enforcement path in parseGatewayEndpointResult operates on the already-stripped host and is not bypassed by this change.

Comments Outside Diff (1)

  1. .gitignore, line 1 (link)

    P1 Binary corruption in .gitignore

    The .gitignore file was modified with a UTF-16 LE encoded suffix. The last line — intended to add gradle-user-home/ — was written with null bytes between every character (g\0r\0a\0d\0l\0e\0-\0u\0s\0e\0r\0-\0h\0o\0m\0e\0/\0\r\0\n\0), making git report the file as binary. The entry will not be recognized by git as a valid pattern and Gradle user-home artifacts will not be excluded. The file needs to be regenerated as UTF-8/ASCII before merging.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: .gitignore
    Line: 1
    
    Comment:
    **Binary corruption in `.gitignore`**
    
    The `.gitignore` file was modified with a UTF-16 LE encoded suffix. The last line — intended to add `gradle-user-home/` — was written with null bytes between every character (`g\0r\0a\0d\0l\0e\0-\0u\0s\0e\0r\0-\0h\0o\0m\0e\0/\0\r\0\n\0`), making git report the file as binary. The entry will not be recognized by git as a valid pattern and Gradle user-home artifacts will not be excluded. The file needs to be regenerated as UTF-8/ASCII before merging.
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: .gitignore
Line: 1

Comment:
**Binary corruption in `.gitignore`**

The `.gitignore` file was modified with a UTF-16 LE encoded suffix. The last line — intended to add `gradle-user-home/` — was written with null bytes between every character (`g\0r\0a\0d\0l\0e\0-\0u\0s\0e\0r\0-\0h\0o\0m\0e\0/\0\r\0\n\0`), making git report the file as binary. The entry will not be recognized by git as a valid pattern and Gradle user-home artifacts will not be excluded. The file needs to be regenerated as UTF-8/ASCII before merging.

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

---

This is a comment left during a code review.
Path: apps/android/app/src/test/java/ai/openclaw/app/ui/GatewayConfigResolverTest.kt
Line: 481-486

Comment:
**Missing test for already-bracketed IPv6 input**

The new guard `host.startsWith("[") && host.endsWith("]")` prevents double-bracketing, but there is no test exercising that branch. A user passing `[::1]` directly should produce a valid URL, not `http://[[::1]]:port`. Consider adding a test case for pre-bracketed input to lock in that behaviour.

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

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

Comment on lines +481 to +486
@Test
fun composeGatewayManualUrlWrapsBareIpv6Hosts() {
val url = composeGatewayManualUrl("::1", "18789", tls = false)

assertEquals("http://[::1]:18789", url)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Missing test for already-bracketed IPv6 input

The new guard host.startsWith("[") && host.endsWith("]") prevents double-bracketing, but there is no test exercising that branch. A user passing [::1] directly should produce a valid URL, not http://[[::1]]:port. Consider adding a test case for pre-bracketed input to lock in that behaviour.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/android/app/src/test/java/ai/openclaw/app/ui/GatewayConfigResolverTest.kt
Line: 481-486

Comment:
**Missing test for already-bracketed IPv6 input**

The new guard `host.startsWith("[") && host.endsWith("]")` prevents double-bracketing, but there is no test exercising that branch. A user passing `[::1]` directly should produce a valid URL, not `http://[[::1]]:port`. Consider adding a test case for pre-bracketed input to lock in that behaviour.

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

gradle-user-home/

P2 Badge Store gradle ignore pattern as plain UTF-8 text

The new .gitignore entry is committed as UTF-16LE bytes (embedded NULs), so Git does not read it as gradle-user-home/; it is effectively parsed as g, which can ignore unrelated paths while still leaving gradle-user-home/ tracked. This breaks the intended ignore behavior for local Android/Gradle artifacts and introduces a surprising global ignore side effect.

ℹ️ 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".

@MayankSharma-ops

Copy link
Copy Markdown
Author

Fixed .gitignore by restoring upstream version (removes encoding issue)

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