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 explore the repository structure and locate the remote-mode connection logic that's failing against the Hermes API server.
- Assistant
Next I'll inspect the Hermes API client and remote connection handling.
- Assistant
Let me search more thoroughly in the source code for remote connection, API paths, etc.
- Assistant
I'll open the core Hermes API and remote URL resolution code next.
- Assistant
Let me continue reading hermes.ts for API call paths
- Assistant
I'll inspect health-check and connection-test flows plus cron remote list handling.
- Assistant
There's a mention in the issue that certain routes return 404. Let me look at the test connection function and any route assumptions. Also look at git log and any recent fixes, as well as tests.
- Assistant
Let me look at more of the codebase - maybe there's documentation about expected routes, git history for related bugs, and the send-message handler that returns 404.
- Assistant
I'll review the agent notes and how remote URL base paths are normalized.
- Assistant
Let me look at the hermes-agent skill - it might have documentation about the issue or expected API.
- Assistant
Let me read the hermes-agent SKILL.md for API endpoint documentation
- Assistant
Let me look at the API server section more carefully in the SKILL.md
- Assistant
I'll inspect gateway startup and the send-message path, especially local fallthrough in remote mode.
- Assistant
Let me look at the send-message handler more carefully around line 603
- Assistant
Let me read send-message handler fully
- Assistant
I'll check initialization/gateway startup and recent commits related to remote mode.
- Assistant
I'll dig into
sendMessageViaApiand remote history endpoints that could be returning 404. - Assistant
I'll inspect installer paths and any remote base-URL normalization logic.
- Assistant
I'll check remote history handling and whether remote mode still requires a local install.
- Assistant
I'll inspect sessions and other remote endpoints that could return 404.
- Assistant
I'll inspect how connection config and API keys are persisted.
- Assistant
I'll search for code that still starts the local gateway regardless of connection mode.
- Assistant
Let me look at office-start.ts - might start gateway incorrectly in remote mode. Also let me check git for any open branches or patches related to this issue.
- Assistant
I'll inspect office-start and chat startup for remote-mode crawl paths.
- Assistant
I found that
start-gatewaycan still spawn local Hermes in remote mode — checking callers next. - Assistant
I'll check how models are loaded in remote mode and whether missing
/v1listing is involved. - Assistant
I'll review session handling and any remaining remote path mismatches.
- Assistant
I'll scan tests and then implement URL normalization plus remote-mode gateway guards.
- Assistant
I'll reproduce the double-
/v1failure with a mock server before applying the fix. - Assistant
Confirmed: a trailing
/v1makes health pass and chat 404. Implementing URL normalization and remote-mode gateway guards. - Assistant
I'll edit the hermes.ts file for URL normalization and gateway guards.
- Assistant
Next I'll update health checks and prevent local gateway starts in remote mode.
- Assistant
stripTrailingSlashes might only be used in testRemoteConnection and resolveRemoteApiKey now. Let me check usages.
- Assistant
I'll update health checks, remote connection testing, and gateway start/restart for remote-only mode.
- Assistant
The file got corrupted during editing — restoring from git and reapplying the changes carefully.
- Assistant
I'll apply the hermes.ts changes with a Python script to avoid edit-range corruption.
- Assistant
python3 not found - try python or node
- Assistant
I'll use Node instead to apply the same patch.
- Assistant
I'll verify the hermes.ts structure, then update gateway IPC and connection-config saving.
- Assistant
Brace balance looks off — I'll inspect the gateway section for structural issues.
- Assistant
I'll harden gateway IPC handlers and normalize remote URLs when saving connection config.
- Assistant
I'll normalize URL comparison when updating API keys and clarify the remote URL UI hints.
- Assistant
I need to check that
normalizeStoredRemoteUrlwas inserted in the correct place. - Assistant
I'll normalize URLs on read and when resolving API key updates.
- Assistant
I'll fix the typo and confirm
setConnectionConfigstill uses normalization. - Assistant
Let me fix the typo in config comment and update English hints. Also fix Welcome placeholder maybe already has goodquick.
- Assistant
I'll run a verification script and the related existing tests.
- Assistant
I'll check for synchronous
gateway-statuscallers and run a broader test pass. - Assistant
All tests passed. I'll review the full diff and clean up any leftover temp files.
- Assistant
Typecheck output may have been truncated — checking it specifically.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.