hermes - 💡(How to fix) Fix fix(session_search): use original session ID for content retrieval

Official PRs (…)
ON THIS PAGE

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…

Root Cause

In tools/session_search_tool.py, the _resolve_to_parent helper overwrites result['session_id'] with the parent sid. Then get_messages_as_conversation(resolved_sid) fetches from the parent, not the child where the actual content lives.

# Before (buggy)
result['session_id'] = resolved_sid  # ← overwrites original child sid
messages = get_messages_as_conversation(resolved_sid)

Fix Action

Fix

Preserve the original session ID for content retrieval, add a separate resolved_session_id field for dedup logic:

# After (fixed)
seen_sessions.add(resolved_sid)
if resolved_sid != sid:
    result['resolved_session_id'] = resolved_sid
# session_id stays as original for content retrieval
messages = get_messages_as_conversation(sid)

Code Example

# Before (buggy)
result['session_id'] = resolved_sid  # ← overwrites original child sid
messages = get_messages_as_conversation(resolved_sid)

---

# After (fixed)
seen_sessions.add(resolved_sid)
if resolved_sid != sid:
    result['resolved_session_id'] = resolved_sid
# session_id stays as original for content retrieval
messages = get_messages_as_conversation(sid)
RAW_BUFFERClick to expand / collapse

Bug

FTS5 search was returning wrong session content. When searching 'headless-chatgpt', the search correctly matched a child session (20260509_013938_e105c7, 156 msgs) via FTS5, but then the code fetched content from the resolved parent session (20260508_133608_740f82d1, 42 msgs) — which doesn't contain the matched text.

Root Cause

In tools/session_search_tool.py, the _resolve_to_parent helper overwrites result['session_id'] with the parent sid. Then get_messages_as_conversation(resolved_sid) fetches from the parent, not the child where the actual content lives.

# Before (buggy)
result['session_id'] = resolved_sid  # ← overwrites original child sid
messages = get_messages_as_conversation(resolved_sid)

Fix

Preserve the original session ID for content retrieval, add a separate resolved_session_id field for dedup logic:

# After (fixed)
seen_sessions.add(resolved_sid)
if resolved_sid != sid:
    result['resolved_session_id'] = resolved_sid
# session_id stays as original for content retrieval
messages = get_messages_as_conversation(sid)

Verification

  • Child session 20260509_013938_e105c7: 156 msgs, contains 'headless-chatgpt' (13 occurrences)
  • Parent session 20260508_133608_740f82d1: 42 msgs, no 'headless-chatgpt'
  • After fix: content_sid correctly points to 20260509_013938_e105c7

Commit

69c55d61d — fix(session_search): use original session ID for content retrieval

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