Skip to content

Hermes integration: sessions stay 'running' forever — cards never return to idle #303

Description

@al9000-max

Summary

Hermes Agent hook events reach CodeIsland correctly, but every session card is created and never returns to an idle/done state. The panel shows "N sessions running" indefinitely even when Hermes is idle — display never matches reality.

Environment

  • CodeIsland v1.0.31 (bridge installed 2026-07-23)
  • Hermes Agent (Nous Research), running as: macOS desktop app (long-lived serve backend process) + gateway daemon
  • macOS

Steps to reproduce

  1. Install the Hermes integration (hooks injected into ~/.hermes/config.yaml)
  2. Approve the hooks (Hermes consent model — note: unapproved hooks are silently dropped; see related hermes agent 通知不起作用 #226, whose empty hook-events.json had this same root cause on the Hermes side)
  3. Run any Hermes session that performs tool calls (desktop app or CLI)
  4. Observe: a session card appears and shows as active/running
  5. Wait minutes/hours — the card never goes idle, even with zero activity

Root cause

CodeIslands session model assumes a lifecycle: SessionStart → activity → SessionEnd/process exit. Claude Code, Codex, etc. fire events from short-lived CLI processes that exit when the task ends, so CodeIsland knows the session is done.

Hermes breaks that assumption in two ways:

  1. Long-lived daemon processes. The desktop app runs a persistent serve backend; gateway chats run in a daemon. The process never exits, so cleanupIdleSessions (dead-PID detection) never removes the session. (Related: CodeIsland repeatedly sends SIGTERM to launchd-managed daemon (Hermes gateway), causing restart loop #243 — the SIGTERM side of this mismatch was fixed, but the "stuck running" display remains.)
  2. No idle/done event in the hook set. Hermes fires on_session_start, pre_tool_call, post_tool_call, on_session_end (only on /reset or explicit close), subagent_stop. There is no "response complete" or "idle" event, and on_session_end rarely fires in normal use.

So a card created by the first tool call stays in "running" state forever.

Proposed fixes (any would help; ideally a combination)

  1. Map post_llm_call → internal idle/done. Hermes already has a post_llm_call hook event that fires after every LLM response completes. Mapping it to a "done" state (like TaskRoundComplete for Cline) would return the card to idle after each turn. Users would need to add a post_llm_call hook entry to their config — document it in the Hermes setup.
  2. Idle timeout per source. For sources whose tracked PID is a persistent daemon (Hermes serve/gateway), transition the session to idle after N seconds without events instead of treating it as perpetually active — without SIGTERM-ing the process (see CodeIsland repeatedly sends SIGTERM to launchd-managed daemon (Hermes gateway), causing restart loop #243).
  3. on_session_reset already maps to SessionEnd — good; but also treat a Hermes session as ended when the user closes the conversation in the desktop app (if the app-side can detect it).

Expected behavior

A Hermes session card should show activity only while Hermes is actually processing (tool calls, LLM calls), and settle to an idle state when the turn completes — mirroring how Claude Code sessions behave. The notch should not accumulate permanent "running" cards.

Happy to provide bridge payloads / diagnostics if useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions