Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-sonnet-5· anthropicHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION Hermes Desktop 0.4.3 remote mode fails against working local Hermes…

  1. 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 on 127.0.0.1:8642, and successfully handles OpenAI-compatible API requests via curl.

    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-$
    
  2. Claude Assistant

    Now let's implement a normalization helper that strips trailing slashes and a trailing /v1 segment, and apply it consistently.

  3. Claude Assistant

    Now I'll edit lines 74-87 to add the normalizeApiBaseUrl helper and use it in resolveRemoteApiKey, and also update getApiUrl (lines ~31-42).

  4. Claude Assistant

    Now update getApiUrl() to use normalizeApiBaseUrl for remote mode.

  5. Claude Assistant

    There's a duplicate closing brace at line 41 now. Fix that.

  6. Claude Assistant

    Still there's a duplicate } at line 43. Remove it.

  7. Claude Assistant

    Now let's fix testRemoteConnection to also use normalizeApiBaseUrl instead of stripTrailingSlashes.

  8. Claude Assistant

    Let's use the replace special command instead, opening index.ts first.

  9. Claude Assistant

    Now let's find the set-connection-config handler location and normalize the URL before storing.

  10. Claude Assistant

    Extra duplicate },\n ); lines at 539-540. Remove them.

  11. Claude Assistant

    Good, that's clean now. Let's also fix the test-remote-connection handler and start-gateway handler to be defensive about remote-only mode (avoiding stale spawn).

  12. Claude Assistant

    Duplicate return isGatewayRunning(); at line 758-759. Fix.

  13. Claude Assistant

    Good, that's fixed now. Let's double check the whole set-connection-config section and the getApiUrl block for correctness by viewing the diff so far.

  14. Claude Assistant

    This looks good. Now let's check compile / typecheck to catch any issues.

  15. Claude Assistant

    Typecheck passes with no errors. Now let's run relevant existing tests.

  16. Claude Assistant

    Let's run the test suite (or at least relevant test files) now.

  17. Claude Assistant

    All existing tests pass. Now let's run the entire test suite to make sure nothing else broke.

  18. Claude Assistant

    All 435 tests pass. Now let's write a quick reproduction test to confirm the fix behaves correctly for both URL formats.

  19. Claude Assistant

    All variations now correctly normalize to a single /v1/chat/completions path, matching the exact issue scenario.

  20. Claude Assistant

    Good, no test depends on exact old behavior with /v1 suffix. Let's view that test file quickly to be safe.

  21. Claude Assistant

    These use config.setConnectionConfig directly, not the IPC handler, so normalization at IPC layer doesn't affect these tests. All good. Let's re-run full test suite once more.

  22. Claude Assistant

    All 435 tests pass. Now let's run the typecheck once more and lint to be safe.

  23. Claude Assistant

    Good, back to original. Let's redo the edits precisely.

  24. Claude Assistant

    Now update testRemoteConnection again.

  25. Claude Assistant

    hermes.ts is done correctly now. Let's redo the index.ts edits carefully, keeping formatting consistent with existing style (without running prettier on the whole file).

  26. Claude Assistant

    Now the set-connection-config handler (with proper multi-line formatting for the ternary to satisfy prettier):

  27. Claude Assistant

    There's a stray duplicate },\n ); at line 540-541.

  28. Claude Assistant

    Good, that's clean now. Now let's find and update the gateway handlers.

  29. Claude Assistant

    Duplicate lines 762-763 again. Let's remove them.

  30. Claude Assistant

    Now clean. Let's verify the diff, typecheck, and run tests again.

  31. Claude Assistant

    This is a clean, minimal, focused diff. Now let's typecheck, lint (only warnings expected, none new), and run the full test suite.

  32. Claude Assistant

    All warnings are pre-existing (already present before my changes) — no new lint issues introduced. Now full test suite:

  33. Claude Assistant

    All 435 tests pass, and typecheck is clean. Let's double check with the mini repro script once more to confirm behavior end-to-end.

  34. Claude Assistant

    The fix resolves the exact issue described. Let's do a final review of the complete diff before submitting.

  35. Claude Assistant

    This diff is clean and minimal. Now going through the checklist:

  36. Claude Assistant

    I've completed my analysis and fix. Let me go through the checklist:

    Checklist review:

    • ✅ Reproduced the reported error: I traced the code path in src/main/hermes.ts and found that getApiUrl() only stripped trailing slashes from the user-supplied remote URL but not a trailing /v1 segment. Since all API calls append /v1/chat/completions or /health to the base URL, a user entering http://127.0.0.1:8642/v1 (a very natural choice, since that's the OpenAI-SDK-style base URL format) produced http://127.0.0.1:8642/v1/v1/chat/completions — a 404, exactly matching Error: API server returned 404: 404: Not Found from the issue. I confirmed this with a standalone reproduction script. I also found that the start-gateway/gateway-status IPC handlers in index.ts called startGateway()/isGatewayRunning() unconditionally for mode === "remote", which explains the stale ~/.hermes/hermes-agent/venv/bin/python spawn attempt reported in the logs even though the user was in remote mode.

    • ✅ Confirmed the fix resolves it: Added normalizeApiBaseUrl() which strips a trailing /v1 (case-insensitive) plus trailing slashes, and applied it consistently in getApiUrl(), testRemoteConnection(), resolveRemoteApiKey(), and when persisting the URL via the set-connection-config IPC handler. Verified via script that http://host:port, http://host:port/, http://host:port/v1, and http://host:port/v1/ all now resolve to identical, correct /v1/chat/completions and /health URLs. Also made start-gateway, stop-gateway, and gateway-status IPC handlers no-ops (or remote health checks) in pure "remote" mode so a local gateway is never spawned/stopped when the user explicitly picked remote mode.

    • ✅ Edge cases considered: case-insensitive /V1 suffix, trailing slashes in any combination, empty-string URLs (guarded to avoid unnecessary regex work), backward compatibility with already-persisted configs (normalization happens at read-time in getApiUrl/testRemoteConnection too, not just at save-time), and SSH/local modes are untouched.

    • ✅ Ran existing tests: Full vitest suite (33 files / 435 tests) passes, tsc typecheck (node + web) passes with no errors, and eslint on touched files shows no new warnings (only pre-existing, unrelated warnings remain).

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.