Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions MaxKernel/hitl_agent/subagents/testing/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
from hitl_agent.tools.search_api_tool import search_api_tool
from hitl_agent.tools.tools import filesystem_tool_rw, vertex_ai_rag_tool

# Timeout specifications (in seconds)
COMPILE_VALIDATION_TIMEOUT = 60 * 1
MOCK_EXECUTION_TIMEOUT = 60 * 3
TEST_EXECUTION_TIMEOUT = 60 * 5


class TestRunner(BaseAgent):
"""Executes pytest on a generated test file and captures results with full tracebacks.
Expand Down Expand Up @@ -222,7 +227,7 @@ async def _run_async_impl(
capture_output=True,
text=True,
cwd=os.path.dirname(test_file_path),
timeout=300,
timeout=TEST_EXECUTION_TIMEOUT,
)

full_output = f"STDOUT:\n{result.stdout}\n\nSTDERR:\n{result.stderr}"
Expand Down Expand Up @@ -402,7 +407,7 @@ async def _run_async_impl(
capture_output=True,
text=True,
cwd=os.path.dirname(test_file_path),
timeout=30,
timeout=COMPILE_VALIDATION_TIMEOUT,
)

if result.returncode == 0:
Expand Down Expand Up @@ -700,7 +705,7 @@ async def _run_async_impl(
capture_output=True,
text=True,
cwd=os.path.dirname(test_file_path),
timeout=60,
timeout=MOCK_EXECUTION_TIMEOUT,
)

if result.returncode == 0:
Expand Down Expand Up @@ -750,7 +755,9 @@ async def _run_async_impl(
logging.warning(f"Failed to clean up temporary test file: {e}")

except subprocess.TimeoutExpired:
error_msg = "Mock test execution timed out after 60 seconds"
error_msg = (
f"Mock test execution timed out after {MOCK_EXECUTION_TIMEOUT} seconds"
)
logging.error(f"[{self.name}] {error_msg}")
yield Event(
author=self.name,
Expand Down