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-mode connection logic that talks to the Hermes API server.
- Assistant
Next I'll inspect the Hermes API client and remote-connection code paths.
- Assistant
Let me look at the heres.ts main file for remote connection logic, health checks, API paths, etc.
- Assistant
I'll open the core API helpers and connection validation in
hermes.ts. - Assistant
Let me read more of the file - especially health checks and connection testing.
- Assistant
Let me search for testRemoteConnection and related functions more carefully.
- Assistant
I'll examine
testRemoteConnectionand the remote cron/list/message call sites next. - Assistant
I'm diving into the send-message path and how the gateway is started in remote mode.
- Assistant
I'll check how remote URLs are normalized and when the local gateway still gets started.
- Assistant
I'll review remote-connection tests/docs and the startGateway path next.
- Assistant
I'll check git history and any notes about remote mode or API path mismatches.
- Assistant
I'll inspect model configuration for remote mode and the full set of API endpoints the client hits.
- Assistant
I'll read the gateway start code and the API server docs for the expected routes.
- Assistant
I'm checking residual local-gateway starts and other remote URL edge cases.
- Assistant
I'm checking whether remote chat sends the wrong model id and scanning related code.
- Assistant
I'll search the repo for past fixes and any notes about remote URL or
/v1handling. - Assistant
I'll inspect install paths and how connection config is stored next.
- Assistant
I'll implement URL normalization and prevent local gateway spawn in remote mode, then verify with a mock server.
- Assistant
I'll update
hermes.tswith URL normalization, dual health probes, and a remote-mode gateway guard. - Assistant
I introduced a duplicate
stripTrailingSlashes— removing it and updating the related helpers. - Assistant
Need to open the right place in the file first.
- Assistant
There's still stripTrailingSlashes at the top (line 54) and another at 106. Let me read the top again.
- Assistant
I'll remove the duplicate and update resolveRemoteApiKey, health checks, testRemoteConnection, and startGateway.
- Assistant
I'll update the health checks and gateway start next, and check remaining uses of
stripTrailingSlashes. - Assistant
I'll replace isApiServerReady and testRemoteConnection with a shared multi-endpoint health probe and guard startGateway.
- Assistant
Updating
testRemoteConnectionand guardingstartGatewayagainst remote-only mode. - Assistant
Also need to look at startGateway around line 891.
- Assistant
I'll update startGateway and testRemoteConnection
- Assistant
Now update testRemoteConnection and restartGateway.
- Assistant
Update testRemoteConnection and restartGateway. Also remove unused stripTrailingSlashes if no longer used.
- Assistant
I'll remove the unused helper and normalize the remote URL when saving connection config.
- Assistant
I'll normalize URLs on save next, and point remote chat at the
hermes-agentmodel id. - Assistant
I'll add shared URL helpers to
utils.tssoconfigandhermescan both use them without circular imports. - Assistant
I'll add the URL helpers to
utils.tsand wire them throughhermes/config. - Assistant
I'll append the URL helpers to utils.ts and update hermes.ts to import from utils ren-export, and config.ts to use them.
- Assistant
Now update hermes.ts to import from utils and remove local definitions.
- Assistant
Replace local definitions with re-exports from utils.
- Assistant
Updating
config.tsto normalize and compare remote URLs consistently. - Assistant
Also normalize when reading remoteUrl in getConnectionConfig - so even stale saved URLs with /v1 work correctly when comparing.
- Assistant
Updating the chat request model ID for remote mode and guarding the start-gateway IPC handler.
- Assistant
I'll force the remote API model id to
hermes-agentand harden the gateway start path. - Assistant
Also update probeRealError to use apiModel.
- Assistant
Updating the start-gateway IPC handler and making remote cron 404s quieter.
- Assistant
Let me update cronjobs to try alternate paths and silent 404; and index start-gateway. Also the remoteFetch with double /v1 is already fixed via getApiUrl normalization.
- Assistant
Update start-gateway to skip remote only mode. restartGateway already handles it.
- Assistant
I'll quiet non-fatal remote cron 404s and clarify the remote URL hint in English copy.
- Assistant
There's an extra brace left in
cronjobs.ts— removing it. - Assistant
Remove line 126 duplicate brace.
- Assistant
There's a duplicate filePath line now.
- Assistant
I'll clarify the English remote URL hint, then write a temporary reproduction script.
- Assistant
Update the hint.
- Assistant
I'll write a temporary script to reproduce the bug and verify the fix.
- Assistant
Reproduced the 404 with the double
/v1path; next I'll run the existing tests and an integration check against the hermes module. - Assistant
The hermes tests mock
utilsincompletely. I'll move the URL helpers into their own module so those tests keep working. - Assistant
The create command seems to have created empty file - the heredoc might not have worked with create. Let me use edit or shell.
- Assistant
Updating imports across hermes, config, and utils to use the new module.
- Assistant
Update config.ts and utils.ts.
- Assistant
Re-running the tests again.
- Assistant
All tests passed. Next I'll run an integration check against the real modules.
- Assistant
tsx is available globally. Let me write a proper integration test.
- Assistant
Need to wrap in async main.
- Assistant
Integration checks passed. Cleaning up temps and running a final typecheck.
- Assistant
submitmay skip untracked files, so I'll fold the helpers into existing modules instead of a new file. - Assistant
I need to restore
api-url.tsand finish the import wiring —python3wasn’t available. - Assistant
I'll restore the shared URL helpers with Node and point hermes/config/utils at them.
- Assistant
There was a typo with Arabic characters. Let me rewrite carefully.
- Assistant
Verifying the regex patterns were written correctly into the source files.
- Assistant
utils looks correct. The tsx -e works and returns correct values. Let me check hermes.ts helpers too.
- Assistant
All unit tests passed. Recreating and re-running the integration script.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.