diff --git a/hermes_state.py b/hermes_state.py index 77d1a1ab4..54cec8437 100644 --- a/hermes_state.py +++ b/hermes_state.py @@ -349,13 +349,6 @@ class SessionDB: self._conn.commit() - def close(self): - """Close the database connection.""" - with self._lock: - if self._conn: - self._conn.close() - self._conn = None - # ========================================================================= # Session lifecycle # ========================================================================= diff --git a/tools/browser_tool.py b/tools/browser_tool.py index 56870c041..8339fdd9c 100644 --- a/tools/browser_tool.py +++ b/tools/browser_tool.py @@ -65,6 +65,7 @@ import requests from typing import Dict, Any, Optional, List from pathlib import Path from agent.auxiliary_client import call_llm +from hermes_constants import get_hermes_home try: from tools.website_policy import check_website_access @@ -144,7 +145,7 @@ def _get_command_timeout() -> int: ``DEFAULT_COMMAND_TIMEOUT`` (30s) if unset or unreadable. """ try: - hermes_home = Path(os.environ.get("HERMES_HOME", Path.home() / ".hermes")) + hermes_home = get_hermes_home() config_path = hermes_home / "config.yaml" if config_path.exists(): import yaml @@ -256,7 +257,7 @@ def _get_cloud_provider() -> Optional[CloudBrowserProvider]: _cloud_provider_resolved = True try: - hermes_home = Path(os.environ.get("HERMES_HOME", Path.home() / ".hermes")) + hermes_home = get_hermes_home() config_path = hermes_home / "config.yaml" if config_path.exists(): import yaml @@ -327,7 +328,7 @@ def _allow_private_urls() -> bool: _allow_private_urls_resolved = True _cached_allow_private_urls = False # safe default try: - hermes_home = Path(os.environ.get("HERMES_HOME", Path.home() / ".hermes")) + hermes_home = get_hermes_home() config_path = hermes_home / "config.yaml" if config_path.exists(): import yaml @@ -777,7 +778,7 @@ def _find_agent_browser() -> str: extra_dirs.append(d) extra_dirs.extend(_discover_homebrew_node_dirs()) - hermes_home = Path(os.environ.get("HERMES_HOME", Path.home() / ".hermes")) + hermes_home = get_hermes_home() hermes_node_bin = str(hermes_home / "node" / "bin") if os.path.isdir(hermes_node_bin): extra_dirs.append(hermes_node_bin) diff --git a/tools/delegate_tool.py b/tools/delegate_tool.py index cef91cf75..7b7583800 100644 --- a/tools/delegate_tool.py +++ b/tools/delegate_tool.py @@ -563,7 +563,7 @@ def delegate_task( if parent_agent and hasattr(parent_agent, '_memory_manager') and parent_agent._memory_manager: for entry in results: try: - _task_goal = tasks[entry["task_index"]]["goal"] if entry["task_index"] < len(tasks) else "" + _task_goal = task_list[entry["task_index"]]["goal"] if entry["task_index"] < len(task_list) else "" parent_agent._memory_manager.on_delegation( task=_task_goal, result=entry.get("summary", "") or "", diff --git a/tools/web_tools.py b/tools/web_tools.py index ba6bdb077..69ab16e86 100644 --- a/tools/web_tools.py +++ b/tools/web_tools.py @@ -788,6 +788,15 @@ Create a single, unified markdown summary.""" logger.warning("Synthesis LLM returned empty content, retrying once") response = await async_call_llm(**call_kwargs) final_summary = extract_content_or_reasoning(response) + + # If still None after retry, fall back to concatenated summaries + if not final_summary: + logger.warning("Synthesis failed after retry — concatenating chunk summaries") + fallback = "\n\n".join(summaries) + if len(fallback) > max_output_size: + fallback = fallback[:max_output_size] + "\n\n[... truncated ...]" + return fallback + # Enforce hard cap if len(final_summary) > max_output_size: final_summary = final_summary[:max_output_size] + "\n\n[... summary truncated for context management ...]"