[PR #15726] fix: resolve OpenClaw gateway launch timeout on Windows by enforcing … #41153

Open
opened 2026-04-23 01:52:39 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15726
Author: @UniquePratham
Created: 4/21/2026
Status: 🔄 Open

Base: mainHead: fix/windows-openclaw-timeout


📝 Commits (1)

  • f29f860 fix: resolve OpenClaw gateway launch timeout on Windows by enforcing IPv4 loopback

📊 Changes

2 files changed (+3 additions, -3 deletions)

View changed files

📝 cmd/launch/openclaw.go (+2 -2)
📝 cmd/launch/openclaw_test.go (+1 -1)

📄 Description

Description

This PR resolves a race condition/timeout bug that occurs when launching the OpenClaw integration natively on Windows (ollama launch openclaw).

The Root Cause

When running the launch command on Windows, the Node.js daemon successfully binds to the IPv4 loopback (127.0.0.1:18789). However, the Go health-check probes localhost:18789.

On modern Windows environments, localhost prioritizes resolving to the IPv6 loopback (::1). Because the net.DialTimeout is set to an aggressively short 500ms, it fails the IPv6 check and exits before falling back to IPv4. This results in Ollama falsely throwing the fallback "OpenClaw runs best on WSL2" error, leaving the Node process successfully running but orphaned in the background.

The Fix

  1. Bypass OS DNS Resolver: Explicitly poll 127.0.0.1 instead of localhost in the gateway health check inside cmd/launch/openclaw.go.
  2. Update UI Output: Modified printOpenclawReady to output the exact IPv4 address, preventing any browser routing delays upon clicking the link.
  3. Update Tests: Updated the corresponding string assertions in cmd/launch/openclaw_test.go to expect the new 127.0.0.1 output.

Verification & Logs

Before (The Bug)

The health check times out on IPv6 and throws a false error while the port is actually bound.

image

After (The Fix)

The Go test suite passes, confirming the URL formatting matches the explicit IPv4 binding.

image

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/15726 **Author:** [@UniquePratham](https://github.com/UniquePratham) **Created:** 4/21/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/windows-openclaw-timeout` --- ### 📝 Commits (1) - [`f29f860`](https://github.com/ollama/ollama/commit/f29f8605edef2a765b982fa5474aaf280868d602) fix: resolve OpenClaw gateway launch timeout on Windows by enforcing IPv4 loopback ### 📊 Changes **2 files changed** (+3 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `cmd/launch/openclaw.go` (+2 -2) 📝 `cmd/launch/openclaw_test.go` (+1 -1) </details> ### 📄 Description ## Description This PR resolves a race condition/timeout bug that occurs when launching the OpenClaw integration natively on Windows (`ollama launch openclaw`). ## The Root Cause When running the `launch` command on Windows, the Node.js daemon successfully binds to the IPv4 loopback (`127.0.0.1:18789`). However, the Go health-check probes `localhost:18789`. On modern Windows environments, `localhost` prioritizes resolving to the IPv6 loopback (`::1`). Because the `net.DialTimeout` is set to an aggressively short 500ms, it fails the IPv6 check and exits before falling back to IPv4. This results in Ollama falsely throwing the fallback "OpenClaw runs best on WSL2" error, leaving the Node process successfully running but orphaned in the background. ## The Fix 1. **Bypass OS DNS Resolver:** Explicitly poll `127.0.0.1` instead of `localhost` in the gateway health check inside `cmd/launch/openclaw.go`. 2. **Update UI Output:** Modified `printOpenclawReady` to output the exact IPv4 address, preventing any browser routing delays upon clicking the link. 3. **Update Tests:** Updated the corresponding string assertions in `cmd/launch/openclaw_test.go` to expect the new `127.0.0.1` output. ## Verification & Logs ### ❌ Before (The Bug) The health check times out on IPv6 and throws a false error while the port is actually bound. <img width="503" height="276" alt="image" src="https://github.com/user-attachments/assets/f95b1164-51df-4eb8-938b-1de4eef1a8f9" /> ### ✅ After (The Fix) The Go test suite passes, confirming the URL formatting matches the explicit IPv4 binding. <img width="1461" height="550" alt="image" src="https://github.com/user-attachments/assets/5078ee34-77ca-4d36-a8be-b97f8a258b57" /> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-23 01:52:39 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#41153