log placeholder substitution in finish_scan partial reports

Greptile review noted the placeholder substitution was silent — adding
a warning log when fields are missing makes the substitution visible
to operators while keeping the partial-report save behavior intact.

The placeholder approach (vs returning a validation error) is
intentional — losing the entire scan because the model omitted one
section was the original bug from #294, so the trade-off favors
saving the report.

Co-Authored-By: Octopus <liyuan851277048@icloud.com>
This commit is contained in:
octo-patch 2026-04-28 13:13:35 +08:00
parent da472ca0d5
commit 7259ffebec

View file

@ -100,11 +100,30 @@ def finish_scan(
return active_agents_error
_NOT_PROVIDED = "[Not provided by model]"
placeholder_fields = []
if not (executive_summary or "").strip():
placeholder_fields.append("executive_summary")
if not (methodology or "").strip():
placeholder_fields.append("methodology")
if not (technical_analysis or "").strip():
placeholder_fields.append("technical_analysis")
if not (recommendations or "").strip():
placeholder_fields.append("recommendations")
executive_summary = (executive_summary or "").strip() or _NOT_PROVIDED
methodology = (methodology or "").strip() or _NOT_PROVIDED
technical_analysis = (technical_analysis or "").strip() or _NOT_PROVIDED
recommendations = (recommendations or "").strip() or _NOT_PROVIDED
if placeholder_fields:
import logging
logging.warning(
"finish_scan: model omitted required field(s) %s; "
"saving partial report with placeholder text",
placeholder_fields,
)
try:
from strix.telemetry.tracer import get_global_tracer