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 to understand the codebase and identify the issues described in the bug report.
Assistant
Let me read the rest of the file and explore related files:
Assistant
Now let me look at the
models.tsfile, which is likely where the 404 error for listing models comes from:Assistant
Now let me look at the
cronjobs.tsfile, since the error mentions[CRON] remote list failed: HTTP 404:Assistant
Now let me look at the main
index.tsfile to see how IPC handlers are set up and where the errors are triggered:Assistant
Let me look at more of the index.ts for any routes that hit
/modelsor/api/health:Assistant
Now let me look at where the
/modelsand/api/healthendpoints are being called in the renderer/frontend:Assistant
Now let me look for where the remote connection validation happens and any fetch calls that might hit wrong endpoints:
Assistant
Let me look at the Settings screen where the remote connection configuration is handled:
Assistant
Now I need to find where the remote connection is tested and where it might be hitting wrong endpoints. Let me look at the
test-remote-connectionIPC handler and any related model listing:Assistant
Now let me search for where remote models are listed and where the
/modelsendpoint might be called:Assistant
I see that
list-modelsdoesn't handle theremotemode — it only has a special case forsshmode. In remote mode, it falls through tolistModels()which reads from the local~/.hermes/models.jsonfile. Let me now check for any code that might call/modelsor/api/health:Assistant
Let me search more carefully for the 404-related code paths and the stale spawn issue:
Assistant
Now I see a critical issue. In the
send-messagehandler, when in remote mode, the code doesn't properly check and is trying to start the local gateway. Let me look more closely:Assistant
Good - the
send-messagehandler correctly checksisRemoteMode()and doesn't start gateway in remote mode. Now let me look at thegateway-statushandler - it seems like it might be called in remote mode and could be trying to access the local gateway:Assistant
Now let me look at the
start-gatewayhandler:Assistant
I found a key issue! The
start-gatewayhandler checks for SSH mode but not for remote mode. In remote mode, it falls through tostartGateway(), which tries to spawn the local Hermes installation. Let me also checkstop-gatewayandgateway-status:Assistant
Now let me look at the
startGateway()function inhermes.ts:Assistant
Now let me look at the
isGatewayRunning()function and theHERMES_PYTHONandhermesCliArgsto confirm the spawn issue:Assistant
Now I understand the issues. Let me search for all places where remote mode is not being properly checked:
Assistant
Now I can see several issues:
-
start-gatewayhandler (line 720-727): Only checks for SSH mode, falls through tostartGateway()in remote mode, which tries to spawn the local Hermes. -
stop-gatewayhandler (line 728-735): Only checks for SSH mode, falls through tostopGateway(true)in remote mode. -
gateway-statushandler (line 737-741): Only checks for SSH mode, falls through toisGatewayRunning()in remote mode.
Now let me also check where the 404 errors come from. The issue mentions
[CRON] remote list failed: HTTP 404. The cronjobs module calls/api/jobswhich doesn't exist on the Hermes API server. Let me also look at the config module:-
Assistant
Now I have a comprehensive understanding of the issues. Let me also check the
getApiUrl()function again and look at how it handles the remote URL:Assistant
Now let me check what routes are used in the cronjobs for remote mode that would cause 404s:
Assistant
Now I have a clear picture of all the issues:
-
start-gateway,stop-gateway,gateway-statusIPC handlers: They check for SSH mode but not for remote mode. In remote mode, they fall through to local gateway operations, which tries to spawn the local Hermes installation. -
Cron jobs in remote mode: The cronjobs module tries to hit
/api/jobsendpoints that don't exist on the Hermes API server (which only exposes OpenAI-compatible routes like/v1/models,/v1/chat/completions, etc.). This causes the404: Not Founderrors. -
The
modelslisting in remote mode: Thelist-modelsIPC handler only has special handling for SSH mode. In remote mode, it falls through tolistModels()which reads the local~/.hermes/models.jsonfile.
Let me also check if there are any other handlers that need remote mode checks:
-
Assistant
Now I can see the pattern clearly. There are many IPC handlers that check for SSH mode but not for remote mode. For remote mode (HTTP), the handlers should either:
- Return a sensible default/error
- Skip the local operation
The key fixes needed are:
-
Gateway management handlers (
start-gateway,stop-gateway,gateway-status): Should not try to manage local gateway in remote mode. -
Cron job remote endpoints: The
/api/jobsendpoints don't exist on the standard Hermes API server. Cron operations should be disabled/no-ops in remote mode (like they are for SSH, cron uses local file ops).
Let me now create a test script to understand the structure better:
Assistant
Now let me look at the existing tests to understand the testing patterns, then look at what needs to be fixed:
Assistant
Good. Now I understand the testing patterns. Let me run the existing tests to make sure they pass first:
Assistant
All 435 tests pass. Now let me analyze the issues and create the fix:
Summary of Issues
Based on my analysis, there are three main issues causing the reported bugs:
-
Gateway management in remote mode (
start-gateway,stop-gateway,gateway-statushandlers): These handlers only check for SSH mode but not remote mode. In remote mode, they fall through to local gateway operations, which tries to spawn the local Hermes installation at~/.hermes/hermes-agent/venv/bin/python. -
Cron jobs in remote mode: The cronjobs module tries to hit
/api/jobsendpoints that don't exist on the standard Hermes API server. This causes[CRON] remote list failed: HTTP 404errors. -
Health polling in remote mode: The
startHealthPolling()function andensureInitialized()run health checks and API server config even in remote mode.
Let me now fix all these issues:
-
Assistant
Let me fix the gateway management handlers first:
Assistant
Now I'll apply the fix for the gateway handlers. In remote mode, gateway management should be a no-op:
Assistant
Let me use the
replaceapproach instead:Assistant
<parameter=command> replace << 'EOF'
SEARCH // Gateway ipcMain.handle("start-gateway", async () => { const conn = getConnectionConfig(); if (conn.mode === "ssh" && conn.ssh) { await sshStartGateway(conn.ssh); return true; } return startGateway(); }); ipcMain.handle("stop-gateway", async () => { const conn = getConnectionConfig(); if (conn.mode === "ssh" && conn.ssh) { await sshStopGateway(conn.ssh); return true; } stopGateway(true); return true; }); ipcMain.handle("gateway-status", () => { const conn = getConnectionConfig(); if (conn.mode === "ssh" && conn.ssh) return sshGatewayStatus(conn.ssh); return isGatewayRunning(); }); REPLACE // Gateway ipcMain.handle("start-gateway", async () => { const conn = getConnectionConfig(); if (conn.mode === "ssh" && conn.ssh) { await sshStartGateway(conn.ssh); return true; } // In remote mode, the gateway is managed externally — no local spawn. if (conn.mode === "remote") return false; return startGateway(); }); ipcMain.handle("stop-gateway", async () => { const conn = getConnectionConfig(); if (conn.mode === "ssh" && conn.ssh) { await sshStopGateway(conn.ssh); return true; } // In remote mode, the gateway is managed externally — no local stop. if (conn.mode === "remote") return true; stopGateway(true); return true; }); ipcMain.handle("gateway-status", () => { const conn = getConnectionConfig(); if (conn.mode === "ssh" && conn.ssh) return sshGatewayStatus(conn.ssh); // In remote mode, treat the remote server as always running (health // is validated separately via test-remote-connection and chat requests). if (conn.mode === "remote") return true; return isGatewayRunning(); }); EOF
Assistant
I need to use the
replacecommand properly. Let me use the heredoc syntax correctly.Assistant
I need to use a different approach since python3 is not available. Let me try using sed or a node script instead.
Assistant
I can use Node.js to apply the patch since python3 is not available.
Assistant
I successfully replaced the gateway handlers. Now I need to verify the changes were applied correctly and then move on to fix the other issues:
- ✅ Gateway management in remote mode - DONE
- Cron jobs in remote mode - Need to fix
/api/jobsendpoints that don't exist - Health polling in remote mode - Need to check if this is an issue
Let me verify the gateway fix first, then address the cron jobs issue.
Assistant
The gateway fix looks correct. Now let me fix the cron jobs issue. The problem is that in remote mode, the cron jobs code tries to hit
/api/jobsendpoints that don't exist on the standard Hermes API server. Let me check the cronjobs.ts file:Assistant
Now I need to fix the cron jobs issue. The problem is that in remote mode (HTTP), the cron jobs code tries to hit
/api/jobsendpoints that don't exist on the standard Hermes API server. I need to change it to useisRemoteOnlyMode()so that pure HTTP remote mode doesn't try to access non-existent endpoints.Assistant
I need to fix the cronjobs.ts file. The issue is that
isRemoteMode()returnstruefor both "remote" (HTTP) and "ssh" modes. But the/api/jobsendpoint only works through the SSH tunnel (which exposes the full API). For pure remote HTTP mode, it should NOT try to hit these non-existent endpoints.Assistant
The last command executed successfully and now I need to verify the changes were applied correctly to the cronjobs.ts file. Let me check the file to make sure the changes look correct.
Assistant
Good, the import was updated. Now let me verify that the
isRemoteMode()calls were updated toisRemoteMode() && !isRemoteOnlyMode()throughout the file.Assistant
Now let me verify the cron job logic is correct. In remote HTTP mode, the code should now skip the remote fetch and fall through to local file-based operations. Let me check one of the key functions:
Assistant
The cronjobs fix is now in place. Let me update the JSDoc comment to reflect that it only applies to SSH mode, and then run the tests to make sure everything still works.
Assistant
Now let me verify the JSDoc was updated correctly:
Assistant
Now let me run the tests to make sure my changes don't break anything:
Assistant
All 435 tests pass. Now let me review the changes I've made and make sure I've addressed all the issues mentioned in the bug report. Let me also check if there are any other places in the codebase that might have similar issues with remote mode.
Assistant
I need to check the git diff to see the changes I made, and then continue verifying the fix.
Assistant
The changes look correct. Let me verify the tests still pass and review the complete fix against the issue checklist.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.