Repository navigation
Closed as not planned
Closed as not planned
Copy link
Labels
P3Low — cosmetic, nice to haveLow — cosmetic, nice to havearea/configConfig system, migrations, profilesConfig system, migrations, profilessweeper:implemented-on-mainSweeper: behavior already present on current mainSweeper: behavior already present on current maintype/bugSomething isn't workingSomething isn't working
Description
Describe the bug
On Windows, Hermes Desktop frequently fails to start due to a race condition during backend boot:
- Desktop launches backend process A on port 9120
- Desktop waits for 9120 to become ready, but times out before the Python backend finishes cold start (loading 125MB SQLite DB, scanning skills, etc.)
- Desktop considers the boot failed and launches backend process B — without killing process A
- Process B tries to bind 9120 →
EADDRINUSEbecause process A is still running - Process B crashes with exit code 1 → Desktop launches process C → same conflict
- This creates a zombie process accumulation loop. The only way to recover is to restart Desktop repeatedly ("lottery") until an old process happens to release the port.
Clicking "Repair" in the UI doesn't help — it only kills the "current" tracked process, leaving orphaned processes from previous failed attempts still holding the port.
Logs (desktop.log)
[boot] Starting Hermes backend via existing Hermes CLI
[boot] Waiting for Hermes backend to become ready
[boot] Desktop boot failed: Hermes backend did not become ready: connect ECONNREFUSED 127.0.0.1:9120
[bootstrap] repair requested by renderer; clearing marker + latched failure
[boot] Restarting desktop connection
Hermes backend exited (SIGTERM)
[boot] Starting Hermes backend via existing Hermes CLI
ERROR: [Errno 10048] error while attempting to bind on address ('127.0.0.1', 9120): 通常每个套接字地址(协议/网络地址/端口)只允许使用一次。
[boot] Hermes backend exited before it became ready (1).
This pattern repeats 5-10+ times before randomly succeeding.
To Reproduce
- Close Hermes Desktop
- Ensure no hermes/dashboard python process is running (clean state)
- Open Hermes Desktop
- Observe: boot takes a long time, often fails with port conflict, requires multiple restarts
Expected behavior
- Desktop should wait long enough for the backend to finish cold start (configurable timeout)
- On boot retry, Desktop should kill ALL previous backend processes it spawned, not just the last tracked one
- Repair should do a clean sweep of all hermes-related python processes
Environment
- OS: Windows 11
- Hermes Desktop version: 0.16.0 (release_date: 2026.6.5)
- Python: 3.11.15
- state.db size: 125MB (actual data: 3.7MB, 38MB fragmentation)
- Sessions: 17, Messages: 9275
Additional context
Root cause appears to be two issues:
- Boot timeout too aggressive — Windows cold start of the Python backend (venv activation + DB load + skill scan) takes longer than Desktop's wait window
- Process cleanup on retry —
ensureRuntimeinmain.cjsdoesn't track/kill previously spawned backend processes across retry attempts
Suggested fixes:
- Increase boot readiness timeout or make it configurable
- On each retry, ensure all previously spawned backend processes are killed before starting a new one
- Repair action should scan for and kill all
hermes dashboardprocesses on port 9120
Metadata
Metadata
Assignees
Labels
P3Low — cosmetic, nice to haveLow — cosmetic, nice to havearea/configConfig system, migrations, profilesConfig system, migrations, profilessweeper:implemented-on-mainSweeper: behavior already present on current mainSweeper: behavior already present on current maintype/bugSomething isn't workingSomething isn't working
Activity
teknium1 commentedon Jul 14, 2026
This is an automated hermes-sweeper review. The Desktop boot-loop behavior described here is implemented on current
main.apps/desktop/electron/main.ts:6750latches a backend-start failure, preventing subsequent connection attempts from spawning another backend automatically.apps/desktop/electron/main.ts:6795launches the local backend with OS-assigned port0, rather than fixed port 9120.apps/desktop/electron/main.ts:6324andapps/desktop/electron/main.ts:2358tree-kill the tracked Windows backend via synchronoustaskkill /T /F; the repair handler resets that connection atmain.ts:7601.apps/desktop/electron/backend-ready.ts:16uses a 90-second cold-start announcement timeout. This shipped in6bbacc223(fix(desktop): make cold-start port-announcement deadline tolerant) and releasev2026.7.1.The linked PR #45131 addresses the same prior failure mode, but current main already provides the relevant retry, cleanup, ephemeral-port, and cold-start-timeout guarantees.