From e97112a88d8e853ca8e21479387ba8a2bb5eeceb Mon Sep 17 00:00:00 2001 From: dajiaohuang Date: Wed, 7 Oct 2026 14:47:50 +0800 Subject: [PATCH] Fix coverage completeness: include 'failed' agent status and use word-boundary matching - Add 'failed' to _INCOMPLETE_AGENT_STATUSES so agents that exited failed correctly mark the coverage record as incomplete (fixes #1458) - Fix _entry_is_about substring matching bug: use word-boundary set membership instead of substring 'in' so terms like 'rce' don't match inside 'force' (fixes #1447: 'brute force' was falsely counted as RCE coverage) --- strix/report/coverage.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/strix/report/coverage.py b/strix/report/coverage.py index c519853a..76387e61 100644 --- a/strix/report/coverage.py +++ b/strix/report/coverage.py @@ -55,7 +55,7 @@ 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"}) +_INCOMPLETE_AGENT_STATUSES = frozenset({"crashed", "failed", "stopped", "running", "waiting"}) #: Run statuses that mean the scan itself did not run to completion. _INCOMPLETE_RUN_STATUSES = frozenset({"failed", "interrupted", "stopped", "running"}) @@ -224,7 +224,8 @@ def _skill_phrasings(skill: str) -> list[list[str]]: def _entry_is_about(entry: dict[str, Any], phrasings: list[list[str]]) -> bool: """True when a ledger row plausibly concerns any phrasing of a risk class.""" haystack = _normalized(f"{entry.get('risk_area', '')} {entry.get('surface', '')}") - return any(all(term in haystack for term in terms) for terms in phrasings) + haystack_words = set(haystack.split()) + return any(all(term in haystack_words for term in terms) for terms in phrasings) def skill_coverage_gaps(