Skip to content

fix(embed): use family-agnostic localhost probe and port helpers (#3527) - #3529

Open
chethanuk wants to merge 1 commit into
vectorize-io:mainfrom
chethanuk:fix/issue-3527-hindsightembed-isuirunning-hardcodes-127001-so-ui
Open

fix(embed): use family-agnostic localhost probe and port helpers (#3527)#3529
chethanuk wants to merge 1 commit into
vectorize-io:mainfrom
chethanuk:fix/issue-3527-hindsightembed-isuirunning-hardcodes-127001-so-ui

Conversation

@chethanuk

Copy link
Copy Markdown
Contributor

Description

hindsight-embed ui start and ui status report failure when the control plane binds IPv6 ([::1]) under --hostname localhost or in dual-stack environments. The UI health probe previously hardcoded IPv4 127.0.0.1, which is refused when Next.js binds IPv6-only ::1.

Root Cause

  • daemon_embed_manager.py:is_ui_running hardcoded 127.0.0.1 for /api/health.
  • _is_port_in_use used an AF_INET-only socket, treating live IPv6 listeners as free ports.
  • _find_pid_on_port filtered Windows netstat output for 127.0.0.1:{port} substring.

Fix

  1. get_ui_url: Default host fallback to localhost instead of 0.0.0.0.
  2. is_ui_running: Remove hardcoded 127.0.0.1 override; probe localhost so httpx resolves both IPv4 and IPv6 families via getaddrinfo.
  3. _is_port_in_use: Use stdlib socket.create_connection(("localhost", port), timeout=1) for dual-stack support.
  4. _find_pid_on_port: Replace substring check with bounds-checked netstat column parsing.
  5. Printed URLs: Update CLI messages to http://localhost:{port}.

Testing

Added hindsight-embed/tests/test_ui_health_probe.py covering:

  • IPv6-only (::1) health probe response (failing before fix, passing now)
  • IPv4-only (127.0.0.1) health probe response
  • Closed port fail-fast (<5s)
  • Windows netstat parsing for [::1]:port and 127.0.0.1:port

All 169 unit & integration tests pass cleanly:

============================= 169 passed in 22.22s =============================

Fixes #3527

Comment thread hindsight-api-slim/hindsight_api/engine/memory_engine.py Outdated
@chethanuk
chethanuk force-pushed the fix/issue-3527-hindsightembed-isuirunning-hardcodes-127001-so-ui branch from 916aef1 to 37535c8 Compare August 17, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hindsight-embed: is_ui_running() hardcodes 127.0.0.1 so ui start/status always fail when the UI binds [::1] (localhost)

2 participants