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 explore the repository structure to understand the codebase.
Assistant
Let me look at the rest of the file, especially the parts about remote mode, listing models, cron, etc.
Assistant
Let me look at the models.ts file and the remote listing, plus cronjobs.ts which references "remote list failed".
Assistant
Now let me search for remote models listing — the issue mentions "remote list failed: HTTP 404". Let me search for "remote" in the codebase.
Assistant
Let me look at the config.ts, index.ts IPC handlers, and how remote models are listed.
Assistant
Let me search for the IPC handlers related to remote connection and model listing.
Assistant
Let me look at the renderer side for remote connection and model listing.
Assistant
Let me look at how the renderer handles remote connection — particularly the App.tsx around line 51, Welcome.tsx, Settings.tsx. Let me also look at how the renderer spawns the local gateway even when in remote mode. The issue mentions that Hermes Desktop tried to spawn the local Hermes installation. Let me search for where gateway is started on app boot.
Assistant
Let me look at the renderer App.tsx and Settings.tsx to understand the remote connection flow and the gateway start.
Assistant
Now let me look at the Welcome.tsx and Settings.tsx to understand how testRemoteConnection is used and how the remote URL is set.
Assistant
Let me search for where start-gateway / gateway-status is invoked from the renderer, and how models are listed remotely.
Assistant
Let me look at the full sendMessageViaApi function to understand the request body and model selection.
Assistant
Let me look at getModelConfig in config.ts.
Assistant
Let me look at the existing tests to understand the expected contract.
Assistant
Let me look at the Models screen and useModelConfig to see how the model is chosen for chat.
Assistant
Assistant
Let me run the existing test suite to establish a baseline.
Assistant
Let me look at the connection-config-security test and check the full hermes.ts top section again for precise edits.
Assistant
Now I have a clear picture. Let me check the other spawn points (kanban, profiles, skills) for remote-mode guards.
Assistant
Let me check profiles.ts and skills.ts for remote-mode guards around their spawn calls.
Assistant
profiles.ts createProfile/deleteProfile/setActiveProfile spawn local python with cwd hermes-agent. These are not guarded by remote mode. In remote-only mode, the local hermes-agent install doesn't exist, so these would ENOENT. But profiles in remote mode — the profiles are managed on the remote server, not locally. So these should be guarded.
Let me check how the renderer uses profiles in remote mode. Let me check the Layout/profiles handling. Actually, this might be out of scope for the core issue, but the issue does mention "tries to spawn a stale local Hermes installation". To be thorough, I'll guard these profile functions with isRemoteOnlyMode. But I need to be careful about return types and existing tests.
Let me check the profiles test.
Assistant
The profiles.test.ts mocks installer but does NOT mock
./hermes. If I addisRemoteOnlyModeimport to profiles.ts, the test would import./hermeswhich imports./installer,./config,./ssh-tunnel,./utils,./models,./process-options. The test mocks./installer. But./hermesimports./config(getConnectionConfig),./ssh-tunnel, etc. The test doesn't mock those../configimports./installer(mocked) and./utils,./yaml-path. These might work without a real HERMES_HOME... but getConnectionConfig reads desktop.json which doesn't exist → returns mode "local". So isRemoteOnlyMode() returns false. The profile functions would proceed to spawn (execFileSync with /usr/bin/python3) — but the existing test already does this! Wait, does the existing profiles test call createProfile? Let me check.The existing test only calls listProfiles (which reads dirs, no spawn). It imports createProfile, deleteProfile, setActiveProfile but may not call them. Let me check the rest of the test.
Assistant
Let me view the exact lines around the functions I need to edit.
Assistant
Now let me make the edits. First,
getApiUrland add thenormalizeRemoteBaseUrlhelper:Assistant
Now update
resolveRemoteApiKeyto usenormalizeRemoteBaseUrlfor consistency:Assistant
Now let me refactor
isApiServerReadyto add a/v1/healthfallback and add a sharedhttpGetOkhelper:Assistant
Now let me update the model selection in
sendMessageViaApi. Let me view the relevant lines.Assistant
Let me use the
editcommand with line range instead. Let me view the exact lines.Assistant
Now update the
probeRealErrormodel to usemodelId:Assistant
Now let me update the
testRemoteConnectionfunction. Let me view it.Assistant
Now the gateway spawn guards. Let me view the
startGatewayfunction.Assistant
Now I'll add remote-only guards to the gateway functions. First
startGateway:Assistant
Now
stopGateway,isGatewayRunning, andrestartGateway:Assistant
Now let me handle the cron
/api/jobs404 gracefully, since the OpenAI-compatible server doesn't expose gateway-management endpoints. Let me updatecronjobs.ts:Assistant
The
/api/jobsendpoint is a gateway-management endpoint exposed by the full Hermes Agent gateway (when running the gateway process). The OpenAI-compatible API server (the issue's setup) doesn't expose/api/jobs→ 404.In remote-only mode (pure OpenAI-compatible), cron management isn't available. The list should return [] silently on 404 instead of logging an error. Let me update listCronJobs to treat 404 as "endpoint not exposed" → return [] without the noisy error log.
But wait — does the full Hermes gateway (which SSH mode connects to) expose
/api/jobs? SSH mode uses the tunnel to the remote gateway, which is a full Hermes install, so/api/jobswould work there. So I should only silence 404 for remote-only mode, not SSH. Actually, even for SSH, if/api/jobs404s it's not critical. But to be safe, let me only silence in remote-only mode. Actually isRemoteMode covers both remote and ssh. Let me distinguish: in the remote branch, if status === 404, return [] silently (endpoint not provided by this server). This applies to both remote and ssh but for ssh the endpoint should exist so 404 won't happen normally. Silencing 404 universally is fine — a 404 genuinely means "not available here".Let me update.
Assistant
Now let me run the affected tests and typecheck.
Assistant
Let me typecheck the project.
Assistant
That error is in
src/shared/i18n/index.ts(line 332), which I didn't touch — it's pre-existing. Let me confirm it's pre-existing and that my files have no errors:Assistant
The error is pre-existing. My changes introduce no new tsc errors. Now let me write a temporary verification test to confirm the fixes work (URL normalization, chat path, model id, no spawn), then delete it before submitting.
Assistant
5 of 6 pass. The
testRemoteConnectiontest timed out only because the mock'shttp.requestnever invokes the response callback (it can't resolve the promise) — that's a mock limitation, not a real bug. The real end-to-end behavior is already validated byconnection-config-security.test.ts(which uses a real HTTP server and passed). Let me delete the temp test file.Assistant
Let me validate the
/v1/healthfallback end-to-end with a real HTTP server (the existing test only covers/healthreturning 200). I'll create a temp test, run it, then delete it.Assistant
The
/v1/healthfallback works end-to-end. Let me delete the temp test.Assistant
Now let me run the full test suite to ensure nothing broke.
Assistant
All 435 tests pass. Let me verify the config-change handlers that call
restartGatewayare safe in remote mode (they should be guarded byisGatewayRunning, which now returns false in remote-only mode).Assistant
All
restartGatewaycall sites are now safe in remote-only mode (either gated byisGatewayRunning()which returns false, or covered by the new early-return guard inrestartGateway). Let me review the full diff.Assistant
The diff looks clean. Let me check there are no other places that construct remote API URLs bypassing
getApiUrl()(e.g. hardcoded/v1/orremoteUrldirectly).Assistant
Let me check
installer.tsline 301 andclaw3d.tsto ensure no remote-mode spawn issues remain.Assistant
checkInstallStatusalready skips local checks in remote mode. The fix is complete. Let me run eslint on the modified files to ensure no lint issues.Assistant
Only a pre-existing prettier warning on an import line I didn't touch; 0 errors. Let me confirm the final git status shows only the two intended files modified.
Assistant
Only the two intended files are modified; temp test files are deleted. Let me do one final full test run to confirm everything passes.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.