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 first map the Electron application’s remote/local mode code paths, endpoint construction, and test setup. Then I’ll reproduce the URL mismatch with the smallest relevant test or mock server, patch normalization/routing and remote-mode isolation, and run the affected test suite.
- Assistant
The project is a TypeScript Electron app with dependencies already installed. I’ll now focus searches on source/tests for remote settings, health/model/chat endpoints, cron calls, and gateway spawning to identify where mode selection leaks into local startup.
- Assistant
The main HTTP client currently concatenates
/healthand/v1/chat/completionsdirectly onto the saved URL. Thus a user-supplied/v1necessarily produces/v1/health(valid) but/v1/v1/chat/completions(404). I’ll inspect the complete connection config and startup handlers next, because root URL should be canonicalized once and local gateway startup must be explicitly guarded by mode. - Assistant
There are two likely independent defects: endpoint prefix duplication and unguarded gateway callbacks. I’ll extract exact implementations around config persistence, connection testing/saving, chat initialization, model listing, and cron routing before changing anything.
- Assistant
A critical mode leak is confirmed: when the remote health probe fails for any reason,
sendMessagefalls back to the local Hermes CLI, which can reference the stale installation. Also, exportedstartGatewayitself has no remote guard, so unrelated IPC callbacks can spawn locally. I’ll inspect model behavior and all direct start/restart call sites to apply defense in depth without disrupting SSH mode. - Assistant
The current branch already prevents CLI fallback inside
sendMessage, but gateway management remains callable in remote mode and model listing still reads localmodels.jsonfor plain HTTP remote mode. I’ll review repository history/status and UI expectations, then introduce a reusable canonical URL helper and OpenAI/v1/modelsfetch while preserving the app’s richer saved-model shape. - Assistant
Remote chat currently derives its request model from local
config.yaml, so merely listinghermes-agentwould not guarantee it is sent. I’ll inspect request construction and setup flow to decide whether remote mode should force the gateway’s exposedhermes-agentfacade (as the working curl does) or use selected remote model. - Assistant
The API body uses the local configured model when available; for a Hermes Agent API the stable OpenAI facade model is
hermes-agent, so remote requests can fail even after URL repair. I’ll implement: canonical root URLs accepting either root or terminal/v1; persistence/key comparisons using that canonical form; remote requests usinghermes-agent; no local gateway start/restart/status in explicit HTTP mode; and no plain-remote cron probing of non-OpenAI/api/jobsroutes. SSH retains its extended management behavior. - Assistant
I’ll now make the source changes. The canonicalizer will only remove a terminal
/v1(not arbitrary path components), trim whitespace/trailing slashes, and make root and/v1equivalent for saved-key retention. Remote model discovery will map OpenAI model objects into the existingSavedModelshape without introducing a new interface. - Assistant
Python is unavailable in this image, so no files were changed. I’ll apply the same deterministic edits using the installed Node runtime and immediately inspect the diff.
- Assistant
The URL and process guards are in place. Next I’ll add remote model discovery and route the existing IPC handler to it. I’ll also change plain HTTP cron behavior from probing proprietary endpoints to returning an explicit unsupported result, while leaving SSH’s current remote extension calls unchanged.
- Assistant
Formatting succeeded, but the diff size indicates Prettier reformatted some pre-existing compact code. I’ll inspect the complete patch for accidental broad substitutions, especially gateway status handlers and cron action branches, before compiling.
- Assistant
The functional diff is correct; extra hunks are only Prettier bringing previously unformatted lines into compliance. I’ll run node/web typechecks and the full test suite now. These should catch the new
fetch/AbortSignaltyping and any IPC return-shape issues. - Assistant
Typechecks passed. The only test failures are caused by a full module mock that intentionally omits newly added config exports, not runtime behavior. Rather than modify tests, I’ll move URL normalization to a small dependency-free module imported by both config and Hermes; this preserves test isolation and is cleaner layering. Then I’ll rerun the failing test and full suite.
- Assistant
All 435 tests now pass. I’ll perform an end-to-end endpoint reproduction with a temporary mock Hermes server that exposes exactly
/health,/v1/health,/v1/models, and/v1/chat/completions: first demonstrate the old/v1/v1/...404, then verify canonical root construction reaches models/chat with Bearer auth. Afterward I’ll run lint/build and remove any temporary artifacts. - Assistant
The mock reproduction succeeded: the old path returned 404 at
/v1/v1/chat/completions, while canonicalized health, model listing, and chat all reached the supported routes with auth. Repository-wide lint fails on 56 pre-existing errors across unrelated files (including.agents, tests, and renderer hooks), so the chained build did not run. I’ll lint only changed files, run the production build separately, and inspect status/diff for artifacts. - Assistant
Changed-file lint and the full production build pass. The only lint failure is repository-wide baseline debt, not this patch. I’ll make one small documentation clarification in the English UI so users know the root URL is recommended and a trailing
/v1is accepted, then rerun the focused checks and review final diff. - Assistant
The UI clarification is added and all changed files lint clean. I’ll do a final targeted code review of endpoint creation, request model selection, process guards, model mapping, and persisted URL behavior, then rerun typecheck/tests once more after the text-only change.
- Assistant
Final verification is complete.
Checklist:
- Reproduced the reported error. A temporary mock Hermes server with the reported route set showed the old
/v1input producingPOST /v1/v1/chat/completionsand a 404. - Confirmed the fix resolves it. The same mock accepted canonicalized
GET /health, authenticatedGET /v1/models, andPOST /v1/chat/completions; model discovery returnedhermes-agent. - Considered edge cases. Root URLs, trailing slashes, terminal
/v1(case-insensitive), stored-key retention across equivalent URL forms, remote model selection, SSH behavior, unsupported cron routes, and stale local gateway state are handled. Plain remote mode cannot start/restart/report a stale local gateway. - Ran affected existing tests. All 33 test files and 435 tests pass; node/web typechecks pass; production build passes; changed-file ESLint passes. Repository-wide ESLint still reports unrelated pre-existing baseline errors, which were not modified.
I’ll submit the verified changes now.
- Reproduced the reported error. A temporary mock Hermes server with the reported route set showed the old
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →