diff --git a/agents/runner.py b/agents/runner.py index d8c4abe..a57b9de 100644 --- a/agents/runner.py +++ b/agents/runner.py @@ -870,11 +870,13 @@ def _detect_test_command(project_path: str) -> str | None: return None -def _run_project_tests(project_path: str, test_command: str = 'make test', timeout: int = 120) -> dict: +def _run_project_tests(project_path: str, test_command: str = 'make test', timeout: int | None = None) -> dict: """Run test_command in project_path. Returns {success, output, returncode}. Never raises — all errors are captured and returned in output. """ + if timeout is None: + timeout = int(os.environ.get("KIN_AUTO_TEST_TIMEOUT") or 600) env = _build_claude_env() parts = shlex.split(test_command) if not parts: @@ -1894,7 +1896,8 @@ def run_pipeline( }) else: max_auto_test_attempts = int(os.environ.get("KIN_AUTO_TEST_MAX_ATTEMPTS") or 3) - test_run = _run_project_tests(p_path_str, p_test_cmd) + auto_test_timeout = int(os.environ.get("KIN_AUTO_TEST_TIMEOUT") or 600) + test_run = _run_project_tests(p_path_str, p_test_cmd, timeout=auto_test_timeout) results.append({"role": "_auto_test", "success": test_run["success"], "output": test_run["output"], "_project_test": True}) auto_test_attempt = 0 @@ -1917,7 +1920,7 @@ def run_pipeline( total_tokens += fix_result.get("tokens_used") or 0 total_duration += fix_result.get("duration_seconds") or 0 results.append({**fix_result, "_auto_test_fix_attempt": auto_test_attempt}) - test_run = _run_project_tests(p_path_str, p_test_cmd) + test_run = _run_project_tests(p_path_str, p_test_cmd, timeout=auto_test_timeout) results.append({"role": "_auto_test", "success": test_run["success"], "output": test_run["output"], "_project_test": True, "_attempt": auto_test_attempt})