hindsight icon indicating copy to clipboard operation
hindsight copied to clipboard

hindsight-embed ui start: hardcoded 30s timeout is shorter than a cold npx install of the 79 MB control-plane package, and ui.log stays empty

Open JSJ189 opened this issue 3 weeks ago • 1 comments

Summary

hindsight-embed -p <profile> ui start fails on first launch with a bare 30s timeout and a 0-byte profiles/<profile>.ui.log. The identical command succeeds in ~2s on the next run. The first launch runs npx -y @vectorize-io/hindsight-control-plane@<version>, and that package is 79 MB, which takes longer than the hardcoded 30s health-check loop. Since #1196 added -y, npx no longer prints Ok to proceed? (y), so a cold install now produces no log output at all and the failure is undiagnosable from the surface.

Environment

  • Windows 11 (build 26300), Node v24.19.0, npm 12.1.0
  • hindsight-embed 1.2.1 (via uvx hindsight-embed@latest), control plane 1.2.1

Steps to reproduce

  1. Start from a cold npx cache (fresh machine, or remove the _npx entry for the package)
  2. hindsight-embed -p coding-agent ui start
    • ⏳ Waiting for UI... (29s elapsed) → ✗ UI Failed (Timeout) (:19077)
    • ~/.hindsight/profiles/coding-agent.ui.log is 0 bytes
  3. Run the same command again (npx cache now warm) → ✓ UI Started in 2s

Evidence

  • ~/.npm/_npx/<hash>/node_modules/@vectorize-io/hindsight-control-plane is 79 MB, written at 10:40:41; the first ui start began at ~10:39:50, so the download alone exceeded the 30s budget
  • profiles/coding-agent.ui.log was 0 bytes for both failed attempts
  • After the cache was warm: ✓ UI started at http://localhost:19077, and /api/health returns {"status":"ok","service":"hindsight-control-plane","dataplane":{"status":"connected",...}}
  • Running the same npx command by hand (npx -y @vectorize-io/[email protected] --port 19077 --hostname 0.0.0.0 --api-url http://127.0.0.1:9077) also comes up in ~2s, so the package itself is fine

Code references

  • hindsight_embed/daemon_embed_manager.py:1361 — while time.time() - start_time < 30: (hardcoded literal, no env override)
  • hindsight_embed/daemon_embed_manager.py:1231-1251 — _find_ui_command() spawns npx -y @vectorize-io/hindsight-control-plane@<version>
  • Contrast: hindsight_embed/daemon_embed_manager.py:72 — DAEMON_STARTUP_TIMEOUT = int(os.getenv("HINDSIGHT_EMBED_DAEMON_STARTUP_TIMEOUT", "180")) gives the daemon 180s for a comparable cold start, and is overridable; the UI path has neither

Suggested fixes (any one of these)

  1. Give the UI wait the same shape as the daemon wait: an env-overridable timeout (e.g. HINDSIGHT_EMBED_UI_STARTUP_TIMEOUT, default 180) instead of the literal 30
  2. Detect a cold control-plane install (npx cache miss) and extend the budget for that attempt only
  3. Keep some signal in the log for a cold install even with -y — e.g. pass --loglevel=notice, or write a "downloading control plane (~79 MB)…" line into the UI log before spawning. A failed first launch currently leaves an empty log, so the only observable symptom is "timeout"

Workaround

Pre-warm the cache once — npx -y @vectorize-io/[email protected] --help — after which ui start succeeds immediately.

JSJ189 avatar Nov 13 '26 02:11 JSJ189

Workaround for the first launch, verified on Windows 11 / embed 1.2.1:

# pre-warm the npx cache for the pinned control-plane version, then start normally
npx -y @vectorize-io/[email protected] --help
hindsight-embed -p coding-agent ui start     # ✓ in ~2s

After that, ui start reaches http://localhost:<daemon_port + 10000> and /api/health reports {"status":"ok","service":"hindsight-control-plane","dataplane":{"status":"connected",...}}.

Also worth noting: the control plane itself starts fine detached with the exact kwargs from _detach_popen_kwargs() (CREATE_NO_WINDOW | CREATE_NEW_PROCESS_GROUP, stdout/stderr to a file), so the spawn path is not the problem — only the (unmeasured) 30 s budget for a cold 79 MB download is.

JSJ189 avatar Nov 13 '26 02:11 JSJ189