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
- Configure Hermes with a Telegram bot (e.g.
TELEGRAM_BOT_TOKEN set in environment)
- Start the gateway:
hermes gateway
- Have a conversation with the bot over Telegram
- Run
session_search (via CLI or gateway) searching for a topic from that Telegram conversation
- 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:
- The
session_search task in config.yaml (line ~73) has api_key: '' and provider: auto
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
- 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")
- This
RuntimeError is caught at line 174 of session_search_tool.py and returns None
- 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)
Bug Description
Telegram sessions'
session_searchresults 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
TELEGRAM_BOT_TOKENset in environment)hermes gatewaysession_search(via CLI or gateway) searching for a topic from that Telegram conversationExpected Behavior
session_searchshould 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:
Root Cause Analysis
The bug is in
tools/session_search_tool.pylines 125–181 (_summarize_sessionfunction).When
async_call_llm()is called withtask="session_search", it delegates to the auxiliary model (configured asgoogle/gemini-3-flash-previewviacompression.summary_modelinconfig.yaml). However:session_searchtask inconfig.yaml(line ~73) hasapi_key: ''andprovider: autoasync_call_llm()inagent/auxiliary_client.pyattempts to resolve the provider — sinceprovider=autoand no explicit Google API key is set, it falls through to auto-detectionGOOGLE_API_KEYor compatible key available), andasync_call_llm()raises aRuntimeError(line ~2407: "No LLM provider configured for task=session_search")RuntimeErroris caught at line 174 ofsession_search_tool.pyand returnsNoneCLI 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
RuntimeErrorbeing 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, whensession_searchtask auto-detection fails, fall back to the primary model client instead of raisingRuntimeError. This would require modifying the provider resolution logic inasync_call_llm()around line 2407.Option B (more robust): Add a
session_searchconfiguration option to use the primary model as a fallback when the auxiliary model is unavailable, rather than silently falling back to raw text. Alternatively, ensureconfig.yamldocuments that a valid API key must be set forauxiliary.session_search.api_keywhen using a non-auto provider.Component
Agent Core (conversation loop, context compression, memory)