mirror of
https://github.com/open-jarvis/OpenJarvis.git
synced 2026-07-28 14:07:55 +00:00
Closes #455. @wishwanto on Linux Mint hit two distinct bugs in the desktop launcher that ship together because they share the same boot_backend code path. Bug A — AppImage hang on "starting server": When the desktop is shipped as an AppImage on Linux, the AppImage runtime sets LD_LIBRARY_PATH to its temp-extracted lib dir. Children we spawn (uv, ollama) inherit that env, then Python's numpy/cryptography extensions dlopen the AppImage's mismatched libstdc++/libssl versions and python dies silently. Stderr drainer sees immediate EOF → GUI hangs forever. Fix: new helper prepare_subprocess_for_appimage strips LD_LIBRARY_PATH, LD_PRELOAD, APPIMAGE, APPIMAGE_UUID, APPDIR, ARGV0 when $APPIMAGE is set. Linux-only via #[cfg(target_os = "linux")] — true no-op on macOS/Windows. Called at all 3 spawn sites: ollama sidecar, uv sync, uv run jarvis serve. Bug B — Desktop force-kills the user's already-running `jarvis serve`: Old code (post #437) ran fuser -k 8000/tcp / taskkill /PID /F on ANY HTTP response from :8000/health — including 200 OK from a healthy user-launched serve. Fix: replace the indiscriminate kill with a health-aware decision tree: * 2xx /health → confirm with a 500ms-apart second probe, then attach (set server/model/ollama ready, return without spawning) * 503 → user-facing error "wait for engine or stop it" * other 4xx/5xx → user-facing error with lsof -i :8000 (unix) / netstat (windows) hint * Err → fall through to normal spawn (unchanged) Adversarial review caught and fixed 5 real issues pre-commit: - HIGH: parallel cargo-test env mutation race → APPIMAGE_ENV_LOCK Mutex - HIGH: 2xx attach left model_ready/ollama_ready false → set both true before return - MEDIUM: #[allow(unused_variables)] suppressed lint on Linux too → cfg_attr - MEDIUM: single-probe attach trusted a 2s snapshot → confirmatory second probe - MEDIUM: /bin/true would silently mislead on Windows → HARMLESS_BIN const per platform 2 new unit tests; CI green on all gates including rust. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>