feat: improve worker diagnostics
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
from unittest.mock import Mock, call, patch
|
||||
|
||||
from lai_automation.models import (
|
||||
@@ -158,6 +159,22 @@ def test_run_once_returns_false_without_work(settings) -> None:
|
||||
assert Worker(settings, gitea, Mock()).run_once() is False
|
||||
|
||||
|
||||
def test_agent_failure_details_identify_step_limit(settings) -> None:
|
||||
worker = Worker(settings, Mock(), Mock())
|
||||
result = AgentResult("LimitsExceeded", "", settings.agent_step_limit, 0.2)
|
||||
|
||||
details = worker._agent_failure_details(
|
||||
result,
|
||||
elapsed=180.0,
|
||||
trajectory=Path("/workspaces/trajectories/issue-43.traj.json"),
|
||||
)
|
||||
|
||||
assert f"step limit reached ({settings.agent_step_limit})" in details
|
||||
assert "model_calls=40" in details
|
||||
assert "cost=0.2000" in details
|
||||
assert "issue-43.traj.json" in details
|
||||
|
||||
|
||||
@patch("lai_automation.worker.GitWorkspace")
|
||||
def test_preflight_runs_setup_and_tests_without_model(
|
||||
GitWorkspace,
|
||||
|
||||
Reference in New Issue
Block a user