hermes - ✅(Solved) Fix Dashboard active_sessions count excludes child sessions (always shows 0) [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#15722Fetched 2026-04-26 05:25:32
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×3cross-referenced ×1

Root Cause

In hermes_cli/web_server.py the /api/status endpoint counts active sessions using SessionDB.list_sessions_rich(), which by default excludes all sessions that have a parent_session_id set (i.e. child / sub-sessions).

Relevant code in hermes_state.py:

if not include_children:
    where_clauses.append("s.parent_session_id IS NULL")

The counting logic in web_server.py:

active_sessions = sum(
    1 for s in sessions
    if s.get("ended_at") is None
    and (now - s.get("last_active", s.get("started_at", 0))) < 300
)

The current session is an active CLI session with:

  • ended_at IS NULL
  • Last message 142 seconds ago (< 300s) ✓
  • But parent_session_id is set (it is a child session)

Because of the parent_session_id IS NOT NULL filter, this active session is excluded from the count, causing active_sessions to always be 0 for child sessions.

Fix Action

Fixed

PR fix notes

PR #15773: fix(dashboard): active_sessions count excludes child sessions (#15722)

Description (problem / solution / changelog)

Summary

  • /api/status was calling list_sessions_rich() without include_children=True, silently dropping all child sessions from the active count
  • Any CLI, WeChat, or Feishu session running as a child (delegation, subagent, or compression continuation) was invisible to the counter
  • One-line fix: pass include_children=True to the counting query

The bug

list_sessions_rich() excludes rows where parent_session_id IS NOT NULL by default — by design, so the session browser shows a clean top-level view. The /api/status handler reused this listing call for counting active sessions without opting out of the filter. Users whose active session was a child (common in delegation and gateway flows) always saw active_sessions: 0.

The fix

Pass include_children=True to list_sessions_rich() only for the active-session counting query. The sessions listing endpoint at /api/sessions is unaffected — it continues to filter children out of the UI list.

Test plan

  • Before: test_active_sessions_count_without_include_children_misses_child documents the bug — count is 1 (child missing) without the flag
  • After: test_active_sessions_count_includes_child passes — both parent and child are counted
  • Regression guard: the new tests make the fix explicit in the SessionDB layer; test_active_sessions_count_without_include_children_misses_child documents what the old code produced
  • Full tests/test_hermes_state.py suite: 178 passed

Related

  • Fixes #15722

🤖 Generated with Claude Code

Changed files

  • hermes_cli/web_server.py (modified, +1/-1)
  • tests/test_hermes_state.py (modified, +48/-0)

Code Example

if not include_children:
    where_clauses.append("s.parent_session_id IS NULL")

---

active_sessions = sum(
    1 for s in sessions
    if s.get("ended_at") is None
    and (now - s.get("last_active", s.get("started_at", 0))) < 300
)
RAW_BUFFERClick to expand / collapse

Bug Description

Dashboard shows active_sessions: 0 even when there are active CLI/WeChat/Feishu sessions.

Root Cause

In hermes_cli/web_server.py the /api/status endpoint counts active sessions using SessionDB.list_sessions_rich(), which by default excludes all sessions that have a parent_session_id set (i.e. child / sub-sessions).

Relevant code in hermes_state.py:

if not include_children:
    where_clauses.append("s.parent_session_id IS NULL")

The counting logic in web_server.py:

active_sessions = sum(
    1 for s in sessions
    if s.get("ended_at") is None
    and (now - s.get("last_active", s.get("started_at", 0))) < 300
)

The current session is an active CLI session with:

  • ended_at IS NULL
  • Last message 142 seconds ago (< 300s) ✓
  • But parent_session_id is set (it is a child session)

Because of the parent_session_id IS NOT NULL filter, this active session is excluded from the count, causing active_sessions to always be 0 for child sessions.

Expected Behavior

Child sessions that are actively processing messages should also be counted toward active_sessions. The filtering logic for counting active sessions should be separate from the logic used to list sessions for display.

Environment

  • hermes-agent v0.10.0 (2026.4.16)
  • macOS

extent analysis

TL;DR

Modify the session counting logic in hermes_cli/web_server.py to include child sessions by adjusting the include_children parameter or the filtering logic.

Guidance

  • Review the SessionDB.list_sessions_rich() function to understand how the include_children parameter affects the session list.
  • Adjust the counting logic in web_server.py to include child sessions, potentially by setting include_children to True or modifying the where_clauses in hermes_state.py.
  • Verify that the modified counting logic correctly includes active child sessions by testing with a child session that is actively processing messages.
  • Consider adding a separate filtering logic for counting active sessions to distinguish it from the logic used to list sessions for display.

Example

# Example of modified counting logic
active_sessions = sum(
    1 for s in SessionDB.list_sessions_rich(include_children=True)
    if s.get("ended_at") is None
    and (now - s.get("last_active", s.get("started_at", 0))) < 300
)

Notes

The provided code snippet assumes that setting include_children to True will correctly include child sessions in the count. However, this may require additional modifications to the SessionDB.list_sessions_rich() function or the hermes_state.py file.

Recommendation

Apply workaround: Modify the counting logic to include child sessions, as the current implementation excludes them due to the parent_session_id filter. This will ensure that active child sessions are correctly counted toward active_sessions.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix Dashboard active_sessions count excludes child sessions (always shows 0) [1 pull requests, 1 participants]