mirror of
https://github.com/usestrix/strix.git
synced 2026-10-16 04:28:23 +00:00
fix(report): count failed and budget_paused agents as incomplete coverage
An agent whose status is 'failed' or 'budget_paused' never finished the surfaces it held, but _INCOMPLETE_AGENT_STATUSES only listed crashed, stopped, running, and waiting — so coverage.json could claim complete: true while an agent had died mid-scan. Add both statuses and tests covering each.
This commit is contained in:
parent
62b496430d
commit
5afc96f998
2 changed files with 27 additions and 1 deletions
|
|
@ -55,7 +55,12 @@ OUTCOME_LABELS: dict[str, str] = {
|
|||
}
|
||||
|
||||
#: Statuses that mean the agent stopped early rather than finishing its task.
|
||||
_INCOMPLETE_AGENT_STATUSES = frozenset({"crashed", "stopped", "running", "waiting"})
|
||||
#: ``failed`` and ``budget_paused`` are in ``core.agents.Status`` too, and an
|
||||
#: agent wearing either never finished the surfaces it held, so they count as
|
||||
#: incomplete here just like ``crashed`` does.
|
||||
_INCOMPLETE_AGENT_STATUSES = frozenset(
|
||||
{"crashed", "stopped", "running", "waiting", "failed", "budget_paused"}
|
||||
)
|
||||
|
||||
#: Run statuses that mean the scan itself did not run to completion.
|
||||
_INCOMPLETE_RUN_STATUSES = frozenset({"failed", "interrupted", "stopped", "running"})
|
||||
|
|
|
|||
|
|
@ -154,6 +154,27 @@ def test_unfinished_agent_makes_the_record_partial() -> None:
|
|||
assert "authz-tester" in doc["completeness"]["caveats"][0]
|
||||
|
||||
|
||||
def test_failed_agent_makes_the_record_partial() -> None:
|
||||
"""A failed agent must not let the record read as complete (#1458)."""
|
||||
doc = _document(
|
||||
agent_graph=_graph(statuses={"agent-1": "failed"}),
|
||||
exit_reason="finished_by_tool",
|
||||
)
|
||||
|
||||
assert doc["completeness"]["complete"] is False
|
||||
assert "authz-tester" in doc["completeness"]["caveats"][0]
|
||||
|
||||
|
||||
def test_budget_paused_agent_makes_the_record_partial() -> None:
|
||||
doc = _document(
|
||||
agent_graph=_graph(statuses={"agent-1": "budget_paused"}),
|
||||
exit_reason="finished_by_tool",
|
||||
)
|
||||
|
||||
assert doc["completeness"]["complete"] is False
|
||||
assert "authz-tester" in doc["completeness"]["caveats"][0]
|
||||
|
||||
|
||||
def test_failed_run_status_makes_the_record_partial() -> None:
|
||||
doc = _document(
|
||||
run_record={"run_id": "r1", "status": "failed"},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue