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.
Assistant
Let me look at the key files related to remote mode, models, and the API server connection.
Assistant
Now let me look at the remote mode logic. Let me search for remote-related code in the main files.
Assistant
Let me see the truncated middle portion of hermes.ts, especially the
sendMessageViaApifunction.Assistant
Now let me look at the config.ts file for
getConnectionConfigand the remote mode handling.Assistant
Let me look at the cronjobs.ts and find where the "remote list" and models listing happens.
Assistant
Let me look at the index.ts to find the remote connection handlers and how models are listed remotely.
Assistant
Let me look at the tests directory and understand the existing test structure.
Assistant
Now let me look at the tests related to remote mode and connection config. Let me check the connection-config-security.test.ts and remote-history.test.ts.
Assistant
Let me look at the ssh-remote.ts to understand the remote routes used, and check docs.
Assistant
Let me look at where the gateway is started and the spawn issue. Let me search for startGateway calls and gateway spawn.
Assistant
Let me look at the renderer to understand the connection setup and gateway start in remote mode.
Assistant
Let me find the remote connection settings UI where the remote URL is configured.
Assistant
Let me check how sessions, memory, skills, and kanban handle remote mode (HTTP vs SSH).
Assistant
So sessions, memory, skills don't have remote HTTP branches. Only cronjobs uses
/api/jobsin remote mode, and kanban returns unsupported. So cron is the only broken remote HTTP route.Let me check how sessions handle remote mode in index.ts.
Assistant
Let me look at the Gateway renderer screen and how start-gateway is invoked.
Assistant
Let me check App.tsx for gateway auto-start and remote mode handling on launch.
Assistant
Let me check existing tests that reference
getApiUrl,testRemoteConnection, or remote URL handling.Assistant
Let me check installer.ts around line 301 (checkInstall in remote mode).
Assistant
Let me run the existing tests to establish a baseline.
Assistant
All tests pass. Now let me write a reproduction script that mimics the Hermes Agent server and tests the remote URL handling. Let me create a temporary test.
Assistant
Reproduced the bug. The chat URL becomes
http://127.0.0.1:8642/v1/v1/chat/completionswhich 404s. Now let me implement the fix in hermes.ts. Let me view the relevant sections.Assistant
Now let me implement the fix. I'll add a
normalizeRemoteUrlhelper and use it ingetApiUrl(),resolveRemoteApiKey(), andtestRemoteConnection().Assistant
Now let me apply the edits. First, the
getApiUrland addnormalizeRemoteUrlhelper:Assistant
The heredoc got mangled. Let me use the
editcommand instead. Let me open the file.Assistant
Let me edit the
getApiUrlfunction to add thenormalizeRemoteUrlhelper.Assistant
Now let me update
resolveRemoteApiKeyto use normalized comparison so the key resolves regardless of/v1suffix.Assistant
Now let me update
testRemoteConnectionto normalize the URL and validate via the OpenAI/v1/modelsendpoint (with a/healthfallback). Let me find its current location.Assistant
There are leftover lines from the old function (1030-1032). Let me remove them.
Assistant
The
testRemoteConnectionfunction lost its closing brace. Let me fix it.Assistant
Let me add a blank line between the functions for formatting.
Assistant
Now let me guard the gateway IPC handlers against remote-only mode in index.ts. Let me view the relevant section.
Assistant
Let me check that
isRemoteOnlyModeis imported in index.ts.Assistant
Now let me update the gateway IPC handlers to guard against remote-only mode.
Assistant
Now let me update cronjobs.ts to gracefully degrade in remote-only mode (avoiding the
/api/jobs404). Let me view the relevant parts.Assistant
Let me look at how kanban implements
unsupportedInRemote.Assistant
Let me update cronjobs.ts to gracefully degrade in remote-only mode. First update the import.
Assistant
Let me add a helper and view the rest of the file to update each function.
Assistant
Let me add a helper and guard. First, add the helper after
remoteJsonError.Assistant
Now update
listCronJobsto add the remote-only guard.Assistant
Now update the mutation functions. Let me view and update
createCronJob.Assistant
Let me add the remote-only guard to
createCronJob.Assistant
The edit broke the
createCronJobsignature. Let me fix it.Assistant
Now add the guard to
removeCronJob.Assistant
Now update
pauseCronJob,resumeCronJob, andtriggerCronJob.Assistant
Let me check Settings.tsx remote connection test flow.
Assistant
Let me check the i18n hint strings for the remote URL to clarify both formats work.
Assistant
Let me update the English hint strings to clarify both URL formats work.
Assistant
Let me check the constants test which may verify locale key parity.
Assistant
Let me check if there's a test verifying locale key parity across locales.
Assistant
Now let me run my reproduction test to confirm the fix.
Assistant
The repro test passes. Let me write a more comprehensive temp test using a real HTTP server that mimics the Hermes Agent routes, to validate
testRemoteConnectionfor both URL formats and the cron remote-only behavior.Assistant
All pass. Now let me remove the temp tests and run the full suite.
Assistant
All 435 tests pass. Let me run the typecheck to make sure there are no TypeScript errors.
Assistant
Typecheck passes. Let me run the linter.
Assistant
Let me check whether the Gateway screen is gated in remote mode in the Layout.
Assistant
Let me check for any other direct calls to
startGatewaythat might run in remote mode.Assistant
Let me check line 424 and 498 (restartGateway) and 613 (startGateway in send-message). Line 613 is guarded by
!isRemoteMode(). Lines 424 and 498 are guarded byisGatewayRunning()checks. Let me verify.Assistant
Let me check
startOfficeStackin office-start.ts to ensure it guards remote mode.Assistant
Let me check
hermesCliArgsin installer.ts to understand the spawn args.Assistant
Let me review the full diff of my changes.
Assistant
The diffs look good. Let me run the most relevant tests once more to confirm everything passes after all changes.
Assistant
Let me check how the Models screen and ModelPicker handle remote mode, since the issue expects listing
hermes-agent.Assistant
Let me look at how models are consumed in the chat to decide on the remote model handling.
Assistant
Let me check which screens show RemoteNotice in remote mode (Models, Chat, Schedules).
Assistant
Let me look at the
sendMessageViaApibody construction to handle the model in remote-only mode.Assistant
Let me add a remote-only model resolution so the chat sends the agent's model id (
hermes-agent) instead of the local backend model.Assistant
The edit was applied to the wrong file (settings.ts) because it was the currently open file. Let me check and fix settings.ts.
Assistant
The hermes code was wrongly appended to settings.ts. Let me remove those lines from settings.ts.
Assistant
There's now a duplicate
} as const;at line 98. Let me remove it.Assistant
Let me verify settings.ts git diff is clean (only the intended hint change).
Assistant
The settings.ts lost its trailing newline. Let me restore it.
Assistant
Now let me apply the modelId change to hermes.ts using the
--fileoption. Let me find the exact line in hermes.ts.Assistant
Now let me apply the modelId change to hermes.ts (the currently open file is now hermes.ts).
Assistant
Now replace the two
model: mc.model || "hermes-agent"usages withmodelId.Assistant
Now let me run typecheck and the full test suite again.
Assistant
Let me write a final verification test to confirm the model override and chat URL work end-to-end.
Assistant
The verification passes. Let me clean up the temp test and run the full suite once more.
Assistant
Let me review the final cronjobs diff and run eslint on the changed main files.
Assistant
Let me check whether
npm run linttreats warnings as failures.Assistant
The repo's lint already has pre-existing errors (56) in unrelated test files; my changes add only prettier warnings. Let me reformat the welcome.ts hint to the multiline prettier style to keep it clean.
Assistant
Only the pre-existing hermes.ts import warning remains (untouched by me). Let me run the full test suite one final time.
Assistant
All tests and typecheck pass. Let me do a final review of the complete diff.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.