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 connection paths, endpoint construction, and persisted mode handling. Then I’ll reproduce the URL/route mismatch with the existing tests or a small temporary harness, make the narrow fix, and run the relevant test and build checks.
- Assistant
The project is a TypeScript Electron app with dependencies already installed. I’ll now focus on all URL constants, health/model/chat routes, remote-mode state, gateway spawning, and cron calls so the fix addresses both the reported 404s and unintended local startup rather than only changing one validation request.
- Assistant
The UI already treats pure HTTP remote mode as feature-restricted, so cron/gateway-management routes should not be required for basic chat. The key behavior is likely centralized in the main process. I’ll inspect complete connection config normalization and each IPC handler, including app startup order, before editing.
- Assistant
The combined output was truncated by the large test corpus. I’ll query targeted definitions and their surrounding code separately. I’m particularly checking whether a URL ending in
/v1gets another/v1appended and whether startup decisions read persisted mode consistently. - Assistant
One mismatch is confirmed by inspection:
getApiUrl()returns the user URL verbatim (minus trailing slash), while chat always appends/v1/chat/completions; therefore entering the explicitly reportedhttp://host:8642/v1produces/v1/v1/chat/completions. Root URLs should remain supported, and/v1inputs should normalize to the same canonical API origin. I’ll inspect fallback/probe behavior and startup lifecycle now to ensure no separate route or race explains the root-URL failures. - Assistant
Persisted mode is consulted on every send and the send handler guards local spawning with
!isRemoteMode(), so the reported spawn can occur if mode was never saved because validation failed—especially for/v1, where validation currently probes/v1/health(which happens to pass) and then saves the unnormalized URL, causing later chat 404. Root validation itself should pass against the described server. I’ll inspect model selection and exact startup/gateway code for any asynchronous stale-state path, then introduce a single canonical URL helper used for validation, persistence comparison, health, and API paths. - Assistant
There is no main-process auto-start for HTTP remote mode, and remote chat explicitly has no CLI fallback. The stale spawn is therefore a consequence of connection state not being successfully established (or a user switching back), not an unconditional remote action. To satisfy reliable compatibility, I’ll also inspect whether remote model listing incorrectly reads local disk; if so, the OpenAI-compatible
/v1/modelsendpoint should be used in remote mode without requiring Hermes management APIs. - Assistant
A second concrete bug is present: pure remote mode’s model picker calls local
getModelConfig()/listModels(), and chat sends that local model name. Thus stale~/.hermesdata influences an explicitly remote connection, exactly contrary to expected behavior. I’ll implement remote model discovery through/v1/modelsand make pure remote chat use the gateway model identifier rather than local configuration. SSH mode remains unchanged because it intentionally manages the remote Hermes installation through SSH. No new preload interface is needed. - Assistant
The API request body indeed uses the local
config.yamlmodel in all modes. I’ll review the existing Hermes API tests to match their mocking conventions and identify assertions that can validate the behavior without adding repository tests (as required). Then I’ll edit production code only and use both existing tests and an external temporary server harness for reproduction. - Assistant
I’ll make the canonical form the server origin/base path without a terminal
/v1; both accepted inputs then resolve to identical health, models, and chat routes. Existing persisted/v1values will be normalized on read, so users do not need to reset stale desktop settings. Remote model state will be isolated in memory, initialized tohermes-agent, refreshed from/v1/models, and never written into local Hermes configuration. - Assistant
The environment lacks
python3, so the scripted edits did not run; Prettier then exposed unrelated pre-existing formatting differences. I’ll revert those formatting-only changes and apply the intended targeted transformations with Node.js, avoiding whole-file formatting so the final diff remains focused. - Assistant
The focused diff now fixes three linked causes: accepted URL forms are canonicalized (including old persisted values), remote chat ignores local model config, and remote model listing uses the standard authenticated OpenAI endpoint. I’ll run type checking and the directly affected API/config/IPC tests first; failures will reveal any typing or mocked-environment compatibility issues before the full suite.
- Assistant
Both TypeScript projects passed; the affected test failure is due to a fully mocked config module not knowing about the new helper export. Rather than altering tests, I’ll improve separation of concerns: move URL normalization into a small dependency-free main-process module, re-export it from config for config callers, and have Hermes import it directly. This preserves existing mocks and avoids coupling networking utilities to configuration persistence.
- Assistant
The targeted tests now all pass. I’ll reproduce the reported routing scenario with a temporary Node script against a strict local mock server that exposes only
/health,/v1/models, and/v1/chat/completions. It will test both user-entered URL forms and assert the canonical model/chat paths (never/modelsor/v1/v1/...), then I’ll remove the script and run the full suite/build checks. - Assistant
The strict mock-server reproduction passed for root,
/v1, and/v1/inputs, and all 435 tests plus the production build pass. Before finalizing, I’ll harden two edge cases found during review: keep selected remote models scoped per server URL so changing servers cannot leak stale model state, and bound/v1/modelsdiscovery with the same five-second expectation as connection testing. Then I’ll run lint and final focused verification. - Assistant
The project-wide lint command fails on 56 pre-existing errors across skill reference files, build scripts, tests, and unrelated source; it reports no new error in the changed code (only existing formatting warnings in already nonconforming files). Type checking and focused tests still pass after hardening. I’ll now inspect the exact final diff, run ESLint only on the new helper plus a final full test suite, and verify no temporary/build artifacts are tracked.
- Assistant
Final review found one minor race: if connection settings change while model discovery is in flight, returned entries should retain the URL that was actually queried rather than re-reading current settings. I’ll make that one-line correction, rerun type checking, and then submit.
Checklist:
- Reproduced the reported error. Code inspection showed
/v1input became/v1/v1/chat/completions; the temporary strict mock-server harness exercised both URL forms and route behavior. - Confirmed the fix resolves it. The harness passed for root,
/v1, and/v1/, using only/health,/v1/models, and/v1/chat/completions, with no/modelsor doubled/v1. - Considered edge cases. Existing persisted URLs are normalized on read, API keys survive equivalent URL forms, trailing slashes are handled, local model state is ignored in pure remote mode, model choices are scoped per server, discovery is authenticated and timeout-bounded, and SSH behavior remains unchanged.
- Reproduced the reported error. Code inspection showed
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.