Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions strix/core/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,14 +293,23 @@ async def spawn_child_agent(**kwargs: Any) -> dict[str, Any]:
elif isinstance(final, dict):
scan_completed = bool(final.get("scan_completed"))
if not scan_completed:
logger.error(
"Scan %s ended without calling finish_scan. The agent "
"emitted a text-only turn instead of a lifecycle tool call, "
"so no executive report was written. Final output (first "
"300 chars): %r",
logger.warning(
"Scan %s ended without a formal lifecycle tool call. "
"Compiling a fallback report from final output text.",
scan_id,
str(final)[:300],
)
# Automatically save the data into a fallback markdown report using Path
reports_dir = run_dir / "reports"
reports_dir.mkdir(parents=True, exist_ok=True)

report_file = reports_dir / f"report_{scan_id}_fallback.md"
with report_file.open("w", encoding="utf-8") as f:
f.write("# Strix Scan Report (Text Turn Fallback)\n\n")
f.write(f"**Scan ID:** {scan_id}\n\n")
f.write("## Final Agent Output\n")
f.write(str(final))

logger.info("Fallback report written successfully to %s", report_file)
return result # noqa: TRY300
except BudgetExceededError as exc:
logger.info("Scan %s stopped: %s", scan_id, exc)
Expand Down