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
Let me start by exploring the repository structure to understand what we're working with. This appears to be a Hermes Desktop application - let me understand the codebase first.
Assistant
Let me explore the source code structure to understand the codebase better.
Assistant
Let me look at the key files that are likely related to this issue - the remote connection logic and Hermes API connection handling.
Assistant
Let me look at the main files related to the remote Hermes connection. Let me start with
hermes.tsandGateway.tsx:Assistant
Now let me look at the Gateway screen, models.ts, and config.ts for the remote connection handling
Assistant
Let me look at models.ts, config.ts, cronjobs.ts, and the Setup screen:
Assistant
Let me now look at config.ts and cronjobs.ts - the cronjobs one is important because the issue mentions
[CRON] remote list failed: HTTP 404.Assistant
Let me now look at cronjobs.ts for the "remote list failed" error, and also search for where remote model listing happens.
Assistant
Let me look at the setup screen and the rest of hermes.ts for the API message sending:
Assistant
Let me see the rest of hermes.ts, especially the
sendMessageViaApifunction and model fetching:Assistant
Let me continue reading the rest of hermes.ts:
Assistant
Let me search for remote model fetching code and the
/modelsor/v1/modelsreferencesAssistant
Let me look at the Models screen and how remote model listing works
Assistant
Let me look at the main index.ts for IPC handlers, and the Welcome screen for remote setup.
Assistant
Let me look at the Welcome screen where remote connection is configured, and also at the installer.ts to understand the paths:
Assistant
Now let me look at installer.ts for
HERMES_HOMEandHERMES_PYTHONdefinitions, and also look at how the remote models endpointAssistant
Let me search for the
list-modelsIPC handler and see how remote models are fetchedAssistant
Let me search for all API paths used in remote mode, and also look at the full IPC handler in index.ts to understand the remote model fetching
Assistant
Let me look at the checkInstallStatus function and understand how it decides if installation is needed in remote mode:
Assistant
Let me see the full checkInstallStatus function:
Assistant
Let me look at the gateway-related IPC handlers in index.ts:
Assistant
Let me look at the Layout component to see if Gateway is shown in remote mode:
Assistant
Let me search for all endpoints used without
/v1/prefix:Assistant
Let me fix the grep pattern:
Assistant
Let me look at the Settings screen where the remote URL can also be configured, and search for where
/modelsmight be used for remote fetching:Assistant
Let me look at the chat/send-message IPC handler section in index
Assistant
Now let me look at the
setConnectionConfigIPC handler:<|DSML|tool_calls> <|DSML|invoke name="bash_terminal"> <|DSML|parameter name="command" string="true">grep -n "setConnectionConfig|set-connection-config|setSshConfig|set-ssh-config" src/main/index.ts</|DSML|parameter> </|DSML|invoke> </|DSML|tool_calls>
Assistant
Let me try again.
Assistant
Let me look at the connection config handlers
Assistant
Now I have a clear picture of the issues. Let me start by reproducing and understanding the key problems:
-
Double
/v1prefix: If the user enters the remote URL ashttp://127.0.0.1:8642/v1, thegetApiUrl()function preserves/v1, causing API calls to become.../v1/v1/chat/completions→ 404. -
Cron jobs use
/api/jobs: The Hermes Agent API server doesn't expose/api/jobs, only/v1/*+/health. -
Gateway start/stop in remote mode: No guard against running local gateway commands in remote mode.
-
No remote model fetching: Models are only read from local
models.json.
Let me first look at how
getApiUrlis used throughout, and check the test script to confirm behavior.-
Assistant
Now let me look at the Schedules screen to see if it handles remote mode
Assistant
Now I have a good understanding of all the issues. Let me implement the fixes. I'll start with the most critical one - the URL normalization.
Issue Analysis:
getApiUrl()doesn't strip/v1suffix, causing double/v1/in API paths when user enters URL likehttp://127.0.0.1:8642/v1startGateway/stopGatewaydon't guard against remote mode- Cron jobs use
/api/jobswhich doesn't exist on Hermes API server (404 noise)
Let me fix these:
Assistant
Let me just use the correct tool syntax.
Assistant
Now let me fix the
getApiUrl()function to strip/v1suffixAssistant
Let me use replace command
Assistant
Let me use sed directly:
Assistant
Let me use sed to replace the line:
Assistant
Let me verify the change
Assistant
The sed didn't work due to escaping. Let me use a different approach with Python
Assistant
Let me try with node:
Assistant
Let me try a different approach with node
Assistant
Let me use line number based approach
Assistant
Let me check what the file looks like now
Assistant
Let me restore the file and use a proper approach:
Assistant
Let me write a proper script to make the changes:
Assistant
Let me verify the changes:
Assistant
Good. Let me verify the gateway function fixes:
Assistant
Now let me fix the cron jobs to handle 404 more gracefully in remote mode:
Assistant
Let me just use bash commands to work with the file.
Assistant
Let me verify the cron changes:
Assistant
Now let me also normalize the URL when saving the connection config, so it's clean from the start
Assistant
Let me verify all the changes look correct:
Assistant
Let me also normalize the URL in
testRemoteConnectionfor consistencyAssistant
Let me check if
checkInstallStatusalso handles SSH mode properlyAssistant
Let me check
verifyInstall:Assistant
Let me search for where
verifyInstallis called:Assistant
Let me check App.tsx to see how it handles remote mode:
Assistant
Good -
verifyInstallis already guarded. Let me now also check howisRemoteis determined:Assistant
Let me check how checkInstallStatus is used
Assistant
Let me look at App.tsx more fully:
Assistant
Let me now run the existing tests to make sure the changes don't break anything:
Assistant
Let me also check if
restartGatewayis called anywhere in remote mode:Assistant
Let me check these call sites for remote mode guards:
Assistant
Let me check line 498:
Assistant
Let me check line 761:
Assistant
Let me do a final review of all changes:
Assistant
Let me write a quick test script to verify the URL normalization logic works correctly:
Assistant
Now let me run the tests one final time to confirm everything passes:
Assistant
All 435 tests pass. Let me also check the
hermes-api.test.tsto make sure our changes align:Assistant
Let me search for any other API endpoints that might be used in remote mode:
Assistant
I'm satisfied with the changes. Let me do a final verification of the key fixes:
Assistant
Let me run the full test suite one final time before submitting:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.