Skip to content

[Bug]: Hermes Agent self diagnosed as' killing herself 'and cannot automatically restart #45508

Closed as not planned

Description

@boosteryuge

Bug Description

Query:when Hermes Agent was updated(hermes version:v 0.16.0),launch the Hermes desktop WebUI successfully, but show the log info:Error occurred in handler for 'hermes:api': Error: Timed out connecting to Hermes backend after 15000ms at ClientRequest. (/Users/duanmbpro/.hermes/hermes-agent/apps/desktop/release/mac-arm64/Hermes.app/Contents/Resources/app.asar/electron/main.cjs:2627:19)
at Object.onceWrapper (node:events:622:28)
at ClientRequest.emit (node:events:508:28)
at Socket.emitRequestTimeout (node:_http_client:927:9)
at Object.onceWrapper (node:events:622:28)
at Socket.emit (node:events:520:35)
at Socket._onTimeout (node:net:604:8)
at listOnTimeout (node:internal/timers:605:17)
at process.processTimers (node:internal/timers:541:7)

BTW,Hermes' connection to the gateway is very slow after updating, taking more than 5 seconds. Loading historical session records is also very slow, taking more than 5 seconds to display. Why?


Then, Hermes Agent starts to diagnose, and then kill itself process and can not restart

Steps to Reproduce

  1. input the above Query;
  2. wait the Hermes agent process;

Expected Behavior

restart the Hermes Agent

Actual Behavior

kill itself process and cannot restart

Affected Component

CLI (interactive chat)

Messaging Platform (if gateway-related)

No response

Debug Report

Debug report uploaded:
  Report       https://dpaste.com/AQEQEVX7M
  agent.log    https://dpaste.com/CZBH3LMSJ
  gateway.log  https://dpaste.com/AC22CYWNM
  desktop.log  https://paste.rs/FqpyS

Operating System

macOS 26.5.1

Python Version

3.11.15

Hermes Version

v 0.16.0

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

No response

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Activity

  1. AIalliAI commented on Jun 13, 2026

    @AIalliAI

    Thanks for the report. The phrasing aside, the described chain (backend connection times out → gateway tears down → does not auto-restart) looks like a manifestation of #45361 — the macOS launchd /restart respawn deadlock. On macOS the gateway exits expecting launchd's KeepAlive to relaunch it, but if a detached respawn watcher is waiting on the old PID (while kill -0 <pid>) and the process tears down without actually exiting, launchd sees it as still-running and never revives it → a silent hang rather than a restart.

    To confirm this is #45361 rather than a separate bug, could you share: (1) are you running the gateway as a launchd service (LaunchAgent), (2) after the hang does launchctl print gui/$(id -u)/<gateway-label> show state = running with a live PID, and (3) does launchctl kickstart -k gui/$(id -u)/<gateway-label> bring it back? If so, this is a duplicate of #45361 and the fix should land there. Workaround in the meantime is the manual kickstart -k.

  2. added
    type/bugSomething isn't working
    P2Medium — degraded but workaround exists
    comp/cliCLI entry point, hermes_cli/, setup wizard
    on Jun 13, 2026
  3. teknium1 commented on Jul 14, 2026

    @teknium1
    Collaborator

    Thanks for the report. This is an automated hermes-sweeper review; the reported macOS launchd restart failure is implemented on current main.

    • Commit abc3662bf6076045e4d4dc1e14a74cb35d69b86e detects launchd through XPC_SERVICE_NAME and routes /restart to the service-managed path in gateway/slash_commands.py:1296-1309, rather than the detached watcher path.
    • The shutdown path sets the controlled service-restart exit code in gateway/run.py:8412-8433; the gateway entry path raises SystemExit(75) in gateway/run.py:20927-20934 so its supervisor relaunches it.
    • The launchd plist now uses unconditional KeepAlive in hermes_cli/gateway.py:3959-3963.
    • Regression coverage is present in tests/gateway/test_restart_service_detection.py:46-53 and tests/gateway/test_gateway_shutdown.py:162-172.
    • This shipped in v2026.7.1 and addresses the same launchd restart failure discussed in related issue macOS launchd: /restart can leave the gateway process alive-but-torn-down — kill -0 respawn watcher deadlocks, KeepAlive sees it 'running' (distinct from #43475) #45361.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/cliCLI entry point, hermes_cli/, setup wizardsweeper:implemented-on-mainSweeper: behavior already present on current maintype/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions