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:
yaml - Assistant
I’ll first map the Electron application’s remote/local mode, URL construction, validation, chat, and cron paths. Then I’ll reproduce the route mismatch with the existing tests or a small temporary mock server, implement URL normalization and strict remote-mode behavior, and run the relevant test suite.
- Assistant
The repository already has focused API, remote-history, and IPC tests, so I’ll inspect those alongside all URL concatenation and mode-selection call sites. This should reveal whether “remote Hermes” currently targets the gateway management API rather than the OpenAI-compatible API.
- Assistant
The primary chat path is hard-coded as
${remoteUrl}/v1/chat/completions; therefore an entered URL ending in/v1becomes/v1/v1/chat/completionsand reproduces the reported 404. I’ll now inspect connection persistence, health validation, startup/spawn guards, and whether model discovery exists, to make one canonicalization point rather than patching individual endpoints. - Assistant
The API implementation confirms a single root-base assumption and uses
/healthfor validation, which the reported server supports. The/v1form is nevertheless advertised ambiguously and is not normalized. Next I’ll inspect the exact IPC startup flow and remote feature calls (cron/history/models), because remote-only unsupported management endpoints should fail gracefully and must never trigger local gateway startup. - Assistant
A second concrete defect is present:
startGateway()has no remote-mode guard. The send-message handler calls it whenever its readiness cache is false, so a slow/initial remote health poll can spawn the stale local Python path exactly as reported. I’ll examine the send handler and connection save transition to ensure the fix handles both direct IPC gateway starts and automatic sends, and resets cached readiness when switching modes. - Assistant
Connection startup correctly skips installation verification in remote mode, but readiness and gateway management remain global/local-oriented. I’ll inspect the omitted handler sections and model list handler, then implement canonical remote roots (accepting either host root or
/v1), protect every local gateway lifecycle entry point in remote mode, and add remote/v1/modelsdiscovery if the existing model IPC shape allows it. - Assistant
The send handler itself already has a remote guard, so the reported spawn most likely comes from explicit gateway UI/office calls or a race after mode switching; guarding
startGatewaycentrally is still required. Model listing currently reads local desktop models in plain HTTP remote mode, explaining whyhermes-agentis absent. I’ll inspect the model data contract and then add a small authenticated remote model fetch to the existinglist-modelsIPC path without introducing a new interface. - Assistant
The existing
SavedModelshape can represent/v1/modelsresults without an interface change. I’ll implement: canonical URL normalization in persisted/read config; authenticated remote model discovery; a remote-only model config default based on the first exposed model; and central local gateway lifecycle guards. This also prevents remote mode from reading or mutating stale local model/install state. - Assistant
Chat currently sends the locally configured model ID even in pure remote mode. For a Hermes API server the advertised OpenAI model is
hermes-agent, so a stale local Ollama/provider choice can also break remote requests. I’ll make pure HTTP remote chat usehermes-agent, while leaving SSH/local behavior unchanged, and expose the server’s actual models in listing. - Assistant
Python is unavailable in this container (the repository is Node-based), so no files were changed by that command. I’ll apply the same targeted edits with a Node script and immediately inspect the diff.
- Assistant
Canonicalization and lifecycle guards are now in place. I’ll add authenticated
/v1/modelsdiscovery with defensive response parsing and wire only plain remote mode to it; local and SSH model management remain unchanged. Then I’ll adjust connection validation to use the canonical root and verify type/test behavior. - Assistant
Node typechecking passes. Before tests, I noticed module mocks replace
config.tswholesale, so importing normalization from that mocked module would make existing hermes API tests brittle. I’ll isolate URL normalization into a dependency-free utility and use it in both config and API code. I’ll also normalize URL comparison when preserving a saved API key, so changing display input between root and/v1does not silently discard credentials. - Assistant
Focused tests pass (51/51). The key flows are fixed, but I’ll now verify the production build and full suite, inspect the final diff for unintended formatting, and use a temporary mock Hermes HTTP server to confirm both accepted URL forms normalize to
/healthand/v1/chat/completionsrather than/v1/v1/.... - Assistant
All 435 tests and both TypeScript projects pass. Prettier reformatted several unrelated pre-existing lines, so I’ll revert only those noise hunks while retaining the functional edits. Then I’ll run a temporary route-level reproduction and the final build/checks.
- Assistant
One unrelated config formatting hunk remains; I’ll restore it exactly. I’ll also run a temporary compiled utility against a mock server that deliberately returns 404 for
/v1/v1/*, demonstrating that both user inputs hit only supported routes. - Assistant
The reproduction succeeds: both
http://host:portandhttp://host:port/v1/generate exactly/health,/v1/models, and/v1/chat/completions, with no doubled/v1. I’ll now inspect the complete functional diff, ensure the user-facing English hint explicitly documents both accepted forms, and run the packaged build. - Assistant
The diff is functionally focused except for one lingering formatter-only line in config. I’ll restore that exact line and update the English hint to say the server root is preferred while
/v1is accepted and normalized. Then I’ll build. - Assistant
The production Electron/Vite build succeeds. Final review shows only the intended URL/config, remote API, model-listing, gateway guard, and help-text changes. I’ll do one last concise status/diff check, including the new utility, before submission.
- Assistant
Final verification/checklist:
- Reproduced the reported error: the original concatenation turns an entered
/v1URL into/v1/v1/chat/completions; I’ll run that old construction once against the mock server below to explicitly confirm its 404. - Confirmed the fix: the post-fix mock run reached
/health,/v1/models, and/v1/chat/completionsfor both root and/v1/inputs, with no doubled path. - Considered edge cases: trailing slashes, case-insensitive
/v1, saved-key preservation across equivalent URL forms, malformed model payloads/network failures, stale local model choice, and all local gateway lifecycle entry points in remote/SSH modes are handled. - Ran affected tests: focused tests passed 51/51; the full suite passed 435/435; node and renderer typechecks passed; the production build passed.
I’ll execute the explicit pre-fix reproduction, make the gateway comment accurately cover both remote modes, and submit.
- Reproduced the reported error: the original concatenation turns an entered
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.