hermes - ✅(Solved) Fix /branch creates SQLite entry but not JSON file [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#14854Fetched 2026-04-24 10:44:41
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×4cross-referenced ×1

Root Cause

Not totally sure this is a bug, but it does create a subtle problem because hermes sessions browse (or list)

Fix Action

Fixed

PR fix notes

PR #14896: fix(/branch): redirect session_log_file and expose branch sessions in sessions list

Description (problem / solution / changelog)

Fixes #14854

Problem

Two bugs when using /branch:

  1. JSON session log not created for the branch_handle_branch_command updates self.agent.session_id to the new session ID but never updates self.agent.session_log_file. All messages written after branching still go to the original session's session_<id>.json, and the branch session never gets its own JSON log on disk.

  2. Branch session invisible in sessions list / sessions browselist_sessions_rich filters out every session with parent_session_id IS NOT NULL to hide sub-agent runs and compression continuations. Branch sessions set parent_session_id too, so they are silently excluded from hermes sessions list and hermes sessions browse, making it easy to lose the branch.

Solution

Fix 1 (cli.py): Mirror the compression-split path in run_agent.py (line 7579) — immediately after updating agent.session_id, also update agent.session_log_file to logs_dir / f"session_{new_session_id}.json".

Fix 2 (hermes_state.py): Expand the list_sessions_rich filter to also include branch sessions — those whose parent ended with end_reason='branched' and whose started_at >= parent.ended_at (the same timing condition get_compression_tip uses to distinguish compression continuations from live-spawned sub-agents). Sub-agent runs (spawned while the parent is still live) and compression continuations (parent end_reason='compression') remain hidden.

Testing

Added two new test cases:

  • tests/cli/test_branch_command.py::test_branch_updates_agent_session_log_file — verifies agent.session_log_file is redirected to the new branch path
  • tests/test_hermes_state.py::TestListSessionsRich::test_branch_session_visible_in_list — verifies branch sessions appear in the list
  • tests/test_hermes_state.py::TestListSessionsRich::test_subagent_session_still_hidden — verifies sub-agent children are still excluded
  • tests/test_hermes_state.py::TestListSessionsRich::test_compression_child_still_hidden — verifies compression continuations are still excluded

All three scenarios verified manually:

branch visible: True       # was False before fix
subagent hidden: True      # unchanged
compression continuation hidden: True  # unchanged

Changed files

  • cli.py (modified, +6/-0)
  • hermes_state.py (modified, +12/-1)
  • tests/cli/test_branch_command.py (modified, +24/-0)
  • tests/test_hermes_state.py (modified, +42/-0)
RAW_BUFFERClick to expand / collapse

Not totally sure this is a bug, but it does create a subtle problem because hermes sessions browse (or list)

... only finds sessions with JSON files. So it's very easy to lose your branch.

Thankfully Hermes helped me find it and diagnosed the problem!

extent analysis

TL;DR

The issue can be mitigated by ensuring that all sessions have corresponding JSON files for hermes sessions browse or list to function as expected.

Guidance

  • Verify that all sessions have associated JSON files to ensure they are discoverable by hermes sessions browse or list.
  • Consider modifying the workflow to always create a JSON file for each session to prevent them from being lost.
  • If a session is missing its JSON file, try to recreate it or manually add a JSON file to make it visible to hermes sessions browse or list.
  • Review the documentation or help output of hermes sessions to see if there are any options or flags that can help find sessions without JSON files.

Notes

The exact behavior of hermes sessions browse or list when sessions lack JSON files is not fully specified, so the above guidance is based on the information provided.

Recommendation

Apply workaround: Ensure all sessions have JSON files to maintain visibility in hermes sessions browse or list, as there is no clear indication of a version upgrade that would fix this behavior.

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 /branch creates SQLite entry but not JSON file [1 pull requests, 1 participants]