ISSUE DESCRIPTION Hermes Desktop 0.4.3 remote mode fails against working local Hermes…
- User
ISSUE DESCRIPTION
Hermes Desktop 0.4.3 remote mode fails against working local Hermes API server
Bug: Hermes Desktop 0.4.3 fails to connect reliably to existing local Hermes API server
Summary
Hermes Desktop 0.4.3 fails to work as a frontend for an already-running local Hermes Agent API server.
The Hermes Agent backend is installed separately under
/opt/hermes-agent, runs correctly with Python 3.12, exposes the API server on127.0.0.1:8642, and successfully handles OpenAI-compatible API requests viacurl.However, Hermes Desktop fails to connect or send messages in remote mode. It either reports that it cannot reach the server, returns
404: Not Found, or tries to spawn a removed/incorrect local Hermes installation under~/.hermes/hermes-agent.Environment
- OS: Ubuntu 24.04.3 LTS
- Kernel: Linux 6.17.0-14-generic x86_64
- Desktop: KDE/Plasma
- Hermes Agent version: 0.14.0
- Hermes Desktop version: 0.4.3
- Hermes Agent install path:
/opt/hermes-agent - Hermes config/home:
~/.hermes - Python used by working Hermes Agent: Python 3.12.3
- GPU: NVIDIA RTX 5060 Ti, 16 GB VRAM
- Model backend: Ollama
- Ollama model:
gemma4:e4b - Ollama API endpoint:
http://127.0.0.1:11434/v1 - Hermes API server:
http://127.0.0.1:8642
Working backend configuration
Hermes Agent works correctly from CLI/API with this model configuration:
model: default: gemma4:e4b provider: custom base_url: http://127.0.0.1:11434/v1 The Hermes API server is enabled: API_SERVER_ENABLED=true API_SERVER_HOST=127.0.0.1 API_SERVER_PORT=8642 API_SERVER_KEY=<redacted> The backend works correctly via curl: KEY="$(grep '^API_SERVER_KEY=' ~/.hermes/.env | cut -d= -f2- | tr -d '\"'\'' ')" curl -i http://127.0.0.1:8642/v1/models \ -H "Authorization: Bearer $KEY" Expected/actual result from curl: { "object": "list", "data": [ { "id": "hermes-agent", "object": "model", "owned_by": "hermes", "root": "hermes-agent" } ] } Chat completions also work: curl -sS http://127.0.0.1:8642/v1/chat/completions \ -H "Authorization: Bearer $KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "hermes-agent", "messages": [ {"role": "user", "content": "Respond exactly: ok"} ] }' This returns a valid response from Hermes Agent, and Ollama confirms that the local model is loaded on GPU: gemma4:e4b 11 GB 100% GPU CONTEXT 65536 Problem in Hermes Desktop When using Hermes Desktop 0.4.3 and selecting: Connect to Remote Hermes with: URL: http://127.0.0.1:8642 API key: <API_SERVER_KEY> or: URL: http://127.0.0.1:8642/v1 API key: <API_SERVER_KEY> the GUI does not connect reliably. Observed GUI errors include: Could not reach Hermes at this URL. Check the URL and API key. and: Error: API server returned 404: 404: Not Found and: Error: API request failed: connect ECONNREFUSED 127.0.0.1:8642 Logs Hermes Desktop log includes: [CRON] remote list failed: HTTP 404 Error occurred in handler for 'send-message': Error: API server returned 404: 404: Not Found At one point, Hermes Desktop also attempted to spawn an old local Hermes installation that no longer exists: [MAIN UNCAUGHT] Error: spawn /home/patrick/.hermes/hermes-agent/venv/bin/python ENOENT spawnargs: [ '/home/patrick/.hermes/hermes-agent/hermes', 'gateway' ] This suggests that even after choosing remote mode, Hermes Desktop may still retain or use stale local-install state under ~/.hermes/hermes-agent. Route testing The local Hermes API server exposes these routes successfully: GET /health -> 200 OK GET /v1/health -> 200 OK GET /v1/models -> 200 OK POST /v1/chat/completions -> 200 OK But these routes return 404: GET /models -> 404 Not Found GET /api/health -> 404 Not Found This may indicate that Hermes Desktop remote mode expects routes that are not provided by the Hermes Agent OpenAI-compatible API server. Expected behavior Hermes Desktop remote mode should work with an existing Hermes Agent API server when provided: URL: http://127.0.0.1:8642 API key: API_SERVER_KEY or clearly document whether the required URL should be: http://127.0.0.1:8642 or: http://127.0.0.1:8642/v1 It should then list the exposed remote model: hermes-agent and send chat requests through the existing Hermes API server. Actual behavior Hermes Desktop does not list hermes-agent, fails validation, returns 404, or tries to spawn a stale local Hermes installation under: ~/.hermes/hermes-agent even though the remote Hermes API server is alive and working via curl. Why this appears to be a Hermes Desktop issue The backend works outside Hermes Desktop: curl /v1/models succeeds. curl /v1/chat/completions succeeds. Hermes Agent CLI works. Ollama backend works. GPU model loading works. The only failing component is Hermes Desktop remote frontend mode. Request Please clarify or fix Hermes Desktop remote mode behavior: Which URL format is expected for remote Hermes? http://host:8642 or http://host:8642/v1 Which endpoint does Hermes Desktop use to validate remote connectivity? Should remote mode depend on routes like /models, /api/health, /cron, or local gateway-management endpoints? Can Hermes Desktop avoid trying to spawn ~/.hermes/hermes-agent/... when the user explicitly chooses remote mode? Can stale local install state be ignored or reset when using remote mode? thanks!!! ## Interface No new interfaces are introduced. # ADDITIONAL ADVICE Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use `git checkout <file>` to restore the file to its original state. You can also reset all changes in the repository using `git reset --hard` command. Additionally, you can use `git stash` and `git stash pop` to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call `submit`) using `git status` or `git diff` commands. However you don't need to use `git add` or `git commit` before submitting your changes. In fact, `submit` only submits currently unstaged changes because it uses `git diff` to get the changes that need to be submitted. # CHECKLIST Before submitting your solution, please go over the following checklist and make sure you've done everything: - [ ] If an error was reported in the issue description, I have successfully reproduced it. - [ ] If an error was reported in the issue description, I have confirmed that my fix resolves the error. - [ ] I have thought about edge cases and made sure my fix handles them as well. - [ ] I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to. Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue! (Current directory: /hermes-desktop, current file: none) bash-$ - Assistant
I'll start by exploring the repository structure and locating the remote-connection logic that talks to the Hermes API.
- Assistant
I'll search the codebase for remote-mode connection handling and the endpoints that produce those 404s.
- Assistant
rg is not available, let me use grep instead.
- Assistant
Next I'll inspect the API URL construction and the remote connectivity checks.
- Assistant
Let me look at the health check, testRemoteConnection, getApiUrl, and the hermes-api tests more carefully. Also cronjobs and Welcome for how URLs are formed.
- Assistant
Looking at cronjobs and other endpoints the desktop uses in remote mode, plus the Welcome connection flow.
- Assistant
Let me examine sessions, model listing, and the send-message flow next.
- Assistant
I'll check the hermes-agent skill docs and recent history for remote API URL/endpoint expectations.
- Assistant
I'll dig into the API server docs and how remote mode handles sessions and chat requests.
- Assistant
I'll inspect gateway startup in remote mode and how API base URLs are normalized.
- Assistant
I'll inspect sendMessageViaApi and the connection-related IPC handlers for path or mode mistakes.
- Assistant
Let me look at App.tsx startup for how local mode handles checking hermes install and remote mode, and what could cause spawning even in remote mode.
- Assistant
Let me look for existing open issues or test files related to URL normalization. Also check the SSE/error path more carefully around the 404 response handling. I understand the bug report you're sharing—Hermes Desktop 0.4.3 remote mode isn't connecting reliably to a working local Hermes Agent API server at
http://127.0.0.1:8642. - Assistant
Looking at the health check server test - it checks
/healthpath... actually looking at the test server: - Assistant
I'll search the repo for notes on remote URL handling and what the API server expects.
- Assistant
I'll check gateway auto-start and any roadblocks when connection mode is remote.
- Assistant
Found gateway start IPC:
- Assistant
Let me check the hermes agent documentation online or look at what endpoints might have changed. Also look at git history for remote mode related fixes. I understand the core issue you're describing: Hermes Desktop 0.4.3's remote mode isn't reliably connecting to a working Hermes Agent API server at
http://127.0.0.1:8642, even though curl tests succeed and the server exposes the expected OpenAI-compatible endpoints.From the logs and 404 responses, it looks like the Desktop frontend is hitting paths that don't exist on the Agent side (like
/api/jobsor/modelswithout the/v1prefix), and there's also stale local spawn logic that shouldn't run in remote mode.To fix this, I need to:
- Normalize the base URL (strip trailing slashes and optional
/v1). - Make the connectivity test more robust by trying
/health,/v1/health, and/v1/models. - Ensure auth is properly sent on all test requests.
- Skip spawning local gateway code entirely in remote mode.
- Normalize the base URL (strip trailing slashes and optional
- Assistant
I'll pull the Hermes Agent API server provenance so we know the real routes and auth rules.
- Assistant
The docs say base URL is
http://localhost:8642/v1, while Desktop appends/v1/...itself — that double-path is a prime candidate for the 404. Checking jobs endpoints and path building next. - Assistant
Confirmed routes:
- GET /health and /v1/health
- Assistant
Basic
/healthdoes not require auth;/health/detaileddoes. So a wrong key alone shouldn't fail the connection test if the URL is right. Normalizing a trailing/v1looks like the main fix — I'll verify how models are resolved and whether gateway start still runs in remote mode. - Assistant
Interesting - capabilities says
"jobs_admin": False- so jobs might be disabled. I'll inspect how chat completions resolve the model name next. - Assistant
Let me find _resolve_model_name
- Assistant
Checking how list jobs is handled and whether it can return 404.
- Assistant
URL ending with
/v1explains the 404s: health works at/v1/health, but chat hits/v1/v1/...and jobs hit/v1/api/jobs. I'll normalize the base URL and guard gateway start next. - Assistant
I'll inspect model route resolution to see if a local model name can trigger a 404.
- Assistant
Implementing URL normalization and blocking local gateway spawn in remote-only mode.
- Assistant
I'll replace the getApiUrl and helper functions section.
- Assistant
Updating
testRemoteConnectionand gateway guards next. - Assistant
Let me update isApiServerReady and testRemoteConnection and startGateway.
- Assistant
I'll replace isApiServerReady cake with a more robust helper and⛓ update testRemoteConnection.
- Assistant
Refining
testRemoteConnectionso a wrong API key fails the check when a key is provided. - Assistant
Also need to find startGateway earlier and update it.
- Assistant
I introduced a syntax error — cleaning that up with a clearer
testRemoteConnection. - Assistant
Next I'll guard
startGatewayand normalize the URL when saving the connection config. - Assistant
I'll add guard at start of startGateway
- Assistant
Normalizing the remote URL when the connection config is saved.
- Assistant
I'll normalize on read and write in config so old
/v1URLs are fixed automatically. - Assistant
I'll import the shared normalizer into
hermes.tsand remove the duplicate. - Assistant
I accidentally edited the wrong file — restoring
config.tsnow. - Assistant
Re-applying the config changes carefully and verifying hermes.ts.
- Assistant
hermes.ts still looks good. Updating config.ts properly now.
- Assistant
Need a blank line after the function, and update get/set connection config.
- Assistant
Removing the duplicate comment and updating get/set.
- Assistant
Cleaning up the duplicate with a more precise edit.
- Assistant
I'll rewrite the config header with a Python script to avoid further edit glitches.
- Assistant
python3 not found, try python or node
- Assistant
Updating hermes.ts to import the shared normalizer and drop the duplicate.
- Assistant
Cleaning up the export and ensuring remote chat uses the right model default.
- Assistant
Simplifying the model selection logic — always use
hermes-agentin remote-only mode. - Assistant
Simplify the model selection block.
- Assistant
Checking whether
mcis still referenced after the model change. - Assistant
Updating UI hints and the start-gateway IPC path.
- Assistant
Checking for leftover helpers and running tests.
- Assistant
Fixing import order: the re-export was inserted between import statements.
- Assistant
Running the connection and hermes-api unit tests next.
- Assistant
Avoiding the hermes-api mock breakage by keeping a local normalizer in
hermes.tsinstead of importing it from config. - Assistant
Fixing the garbled comment text.
- Assistant
Writing a temporary integration test for normalization and remote connection behavior.
- Assistant
Placing the temp test under
tests/, running it, then removing it. - Assistant
All temp tests passed. Running the full suite and cleaning up minor comment typos.
- Assistant
Verifying a clean tree and typecheck before submit.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.