Skip to content

[Bug]: Telegram session summarization always falls back to summarization unavailable even when jsonl is complete #8045

@hertzhzzz

Description

@hertzhzzz

Bug Description

Telegram sessions' session_search results always display "[Raw preview — summarization unavailable]" even when the JSONL transcript files are complete and contain full conversation data. CLI sessions generate summaries normally, but Telegram-sourced sessions consistently fail the summarization step.

Steps to Reproduce

  1. Configure Hermes with a Telegram bot (e.g. TELEGRAM_BOT_TOKEN set in environment)
  2. Start the gateway: hermes gateway
  3. Have a conversation with the bot over Telegram
  4. Run session_search (via CLI or gateway) searching for a topic from that Telegram conversation
  5. Observe that results show "[Raw preview — summarization unavailable]" instead of a generated summary

Expected Behavior

session_search should generate a summary for Telegram sessions using the auxiliary LLM, just as it does for CLI sessions.

Actual Behavior

The summary field always falls back to:

[Raw preview — summarization unavailable]
{first 500 chars of transcript}…[truncated]

Root Cause Analysis

The bug is in tools/session_search_tool.py lines 125–181 (_summarize_session function).

When async_call_llm() is called with task="session_search", it delegates to the auxiliary model (configured as google/gemini-3-flash-preview via compression.summary_model in config.yaml). However:

  1. The session_search task in config.yaml (line ~73) has api_key: '' and provider: auto
  2. async_call_llm() in agent/auxiliary_client.py attempts to resolve the provider — since provider=auto and no explicit Google API key is set, it falls through to auto-detection
  3. Auto-detection fails (no GOOGLE_API_KEY or compatible key available), and async_call_llm() raises a RuntimeError (line ~2407: "No LLM provider configured for task=session_search")
  4. This RuntimeError is caught at line 174 of session_search_tool.py and returns None
  5. The fallback at line 414–416 then uses the raw preview text instead of a summary

CLI sessions work because they use the primary model (which has a valid API key), not the auxiliary model path. Telegram sessions go through the gateway which relies on the auxiliary model for session_search.

Proposed Fix

The fix should address the RuntimeError being raised when no auxiliary model is available, rather than letting it propagate and trigger the fallback. Two options:

Option A (minimal): In agent/auxiliary_client.py, when session_search task auto-detection fails, fall back to the primary model client instead of raising RuntimeError. This would require modifying the provider resolution logic in async_call_llm() around line 2407.

Option B (more robust): Add a session_search configuration option to use the primary model as a fallback when the auxiliary model is unavailable, rather than silently falling back to raw text. Alternatively, ensure config.yaml documents that a valid API key must be set for auxiliary.session_search.api_key when using a non-auto provider.

Component

Agent Core (conversation loop, context compression, memory)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/toolsTool registry, model_tools, toolsetsplatform/telegramTelegram bot adaptertype/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions