Skip to content

Hermes Desktop remote gateway mode flaps back to local backend after successful remote readiness #38873

Description

@pinoymt

Environment

  • Windows desktop app
  • Remote Hermes backend hosted on VPS over Tailscale
  • Remote URL: http://:8642/v1

Summary
Hermes Desktop successfully reaches and validates the remote backend, but the app does not remain attached to it. After reporting the remote backend as ready, the desktop app restarts the connection and starts the local Windows backend instead. The UI then returns to the error screen:

  • Hermes couldn't start
  • Could not connect to Hermes gateway

Observed behavior
From desktop.log:

[hermes] [boot] Connecting to remote Hermes backend at http://xxxxx:8642/v1
[hermes] [boot] Remote Hermes backend is ready
[hermes] [boot] Restarting desktop connection
[hermes] [boot] Finding an open local port
[hermes] [boot] Starting Hermes backend via Hermes at C:\Users<redacted>\AppData\Local\hermes\hermes-agent
[hermes] Hermes Web UI → http://127.0.0.1:9120
[hermes] [boot] Hermes backend is ready. Finalizing desktop startup
[hermes] [boot] Restarting desktop connection
[hermes] Hermes backend exited (SIGTERM)
[hermes] [boot] Connecting to remote Hermes backend at http://:8642/v1
[hermes] [boot] Remote Hermes backend is ready

This repeats. The app appears to flap between:

  • remote backend mode
  • local gateway/backend mode

Expected behavior
If the remote backend is reachable and reports ready, Desktop should stay attached to the remote backend and proceed normally without restarting into local backend mode.

Actual behavior
Desktop confirms:

  • Remote Hermes backend is ready

But then immediately:

  • restarts desktop connection
  • starts local backend on 127.0.0.1:9120
  • shows gateway startup failure UI again

What was verified
Remote VPS side was tested and is working:

  • API listener active on 0.0.0.0:8642
  • GET /health returns 200 OK
  • GET /v1/models works with auth
  • Added compatibility for desktop-style probing:
    • accepts X-Hermes-Session-Token
    • serves GET /v1/api/status
  • Windows client can reach the VPS over Tailscale
  • Desktop logs explicitly show:
    • Connecting to remote Hermes backend at http://:8642/v1
    • Remote Hermes backend is ready

This strongly suggests the remaining failure is in the Desktop app’s startup/state logic rather than backend connectivity.

Related notes
Earlier issues were fixed during testing:

  • initial ECONNREFUSED
  • initial 404 on remote path
  • local Windows Hermes install dependency issue (annotated_doc) was repaired

After those fixes, the current remaining issue is specifically the Desktop app switching away from the successful remote connection.

Potential cause
Desktop may be incorrectly:

  • falling back to local gateway after remote readiness
  • running both remote and local boot paths concurrently
  • treating local gateway as mandatory even when remote backend is healthy
  • resetting renderer/bootstrap state after successful remote handshake

User-visible symptom
Error screen:

  • Hermes couldn't start
  • The background gateway didn’t come up
  • Could not connect to Hermes gateway

Even though the log shows:

  • Remote Hermes backend is ready

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/desktopElectron desktop app (apps/desktop/*)sweeper:implemented-on-mainSweeper: behavior already present on current maintype/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions