kin: KIN-124-backend_dev

This commit is contained in:
Gros Frumos 2026-03-18 13:33:29 +02:00
parent ce0b11ca3f
commit 6fa2d8b3a6

View file

@ -870,11 +870,13 @@ def _detect_test_command(project_path: str) -> str | None:
return 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}. """Run test_command in project_path. Returns {success, output, returncode}.
Never raises all errors are captured and returned in output. 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() env = _build_claude_env()
parts = shlex.split(test_command) parts = shlex.split(test_command)
if not parts: if not parts:
@ -1894,7 +1896,8 @@ def run_pipeline(
}) })
else: else:
max_auto_test_attempts = int(os.environ.get("KIN_AUTO_TEST_MAX_ATTEMPTS") or 3) 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"], results.append({"role": "_auto_test", "success": test_run["success"],
"output": test_run["output"], "_project_test": True}) "output": test_run["output"], "_project_test": True})
auto_test_attempt = 0 auto_test_attempt = 0
@ -1917,7 +1920,7 @@ def run_pipeline(
total_tokens += fix_result.get("tokens_used") or 0 total_tokens += fix_result.get("tokens_used") or 0
total_duration += fix_result.get("duration_seconds") or 0 total_duration += fix_result.get("duration_seconds") or 0
results.append({**fix_result, "_auto_test_fix_attempt": auto_test_attempt}) 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"], results.append({"role": "_auto_test", "success": test_run["success"],
"output": test_run["output"], "_project_test": True, "output": test_run["output"], "_project_test": True,
"_attempt": auto_test_attempt}) "_attempt": auto_test_attempt})