mirror of
https://github.com/hanzoai/python-sdk.git
synced 2026-10-23 20:23:00 +00:00
fix(hanzo-mcp): v0.10.4 - fix search hanging and null process_manager
- Add 30s timeout to each search engine (grep, ast, lsp, git) - Fix NoneType error when process_manager unavailable in auto_timeout - Prevents LSP engine from hanging indefinitely on large codebases
This commit is contained in:
@@ -172,7 +172,12 @@ def with_auto_timeout(tool_name: str, timeout_manager: Optional[MCPToolTimeoutMa
|
||||
return result
|
||||
|
||||
except asyncio.TimeoutError:
|
||||
# Tool timed out - background it
|
||||
# Tool timed out - background it if process manager is available
|
||||
if timeout_manager.process_manager is None:
|
||||
# No process manager - just report timeout
|
||||
timeout_formatted = format_timeout(tool_timeout)
|
||||
return f"Operation timed out after {timeout_formatted}. Backgrounding unavailable."
|
||||
|
||||
process_id = f"{tool_name}_{uuid.uuid4().hex[:8]}"
|
||||
log_file = await timeout_manager.process_manager.create_log_file(process_id)
|
||||
|
||||
|
||||
@@ -131,10 +131,13 @@ class SearchTool(BaseTool):
|
||||
stats = {"query": pattern, "path": path, "engines": [], "time_ms": {}}
|
||||
all_results = []
|
||||
|
||||
async def timed(name: str, coro):
|
||||
async def timed(name: str, coro, timeout: float = 30.0):
|
||||
"""Run coroutine with timeout and timing."""
|
||||
start = time.time()
|
||||
try:
|
||||
results = await coro
|
||||
results = await asyncio.wait_for(coro, timeout=timeout)
|
||||
except asyncio.TimeoutError:
|
||||
results = [] # Engine timed out
|
||||
except Exception:
|
||||
results = []
|
||||
elapsed = int((time.time() - start) * 1000)
|
||||
|
||||
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "hanzo-mcp"
|
||||
version = "0.10.3"
|
||||
version = "0.10.4"
|
||||
description = "The Zen of Hanzo MCP: One server to rule them all. The ultimate MCP that orchestrates all others."
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.12"
|
||||
|
||||
Reference in New Issue
Block a user