From de5c110bc9f2047cd4b4e16b8c459a8178b45575 Mon Sep 17 00:00:00 2001 From: DB Lee Date: Mon, 23 Mar 2026 17:29:08 -0700 Subject: [PATCH] fix: report command respects --format html parameter The default output path was hardcoded to report.md regardless of the --format flag. When -f html was passed, the file was still named report.md and the returned path did not reflect the actual format. - Default output filename now uses the correct suffix based on report_format (report.html when html, report.md otherwise) - Returned output_report_path now tracks which file was actually written --- src/agentops/services/reporting.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/agentops/services/reporting.py b/src/agentops/services/reporting.py index dc9d7aa..5d31754 100644 --- a/src/agentops/services/reporting.py +++ b/src/agentops/services/reporting.py @@ -26,13 +26,15 @@ def generate_report_from_results( payload = json.loads(resolved_results_path.read_text(encoding="utf-8")) result = RunResult.model_validate(payload) + default_suffix = ".html" if report_format == "html" else ".md" resolved_output_path = ( output_path.resolve() if output_path is not None - else resolved_results_path.with_name("report.md") + else resolved_results_path.with_name(f"report{default_suffix}") ) resolved_output_path.parent.mkdir(parents=True, exist_ok=True) + primary_path = resolved_output_path if report_format in ("md", "all"): md_path = ( resolved_output_path @@ -40,11 +42,15 @@ def generate_report_from_results( else resolved_output_path.with_suffix(".md") ) md_path.write_text(generate_report_markdown(result), encoding="utf-8") + primary_path = md_path if report_format in ("html", "all"): html_path = resolved_output_path.with_suffix(".html") html_path.write_text(generate_report_html(result), encoding="utf-8") + primary_path = html_path + if report_format == "all": + primary_path = resolved_output_path.with_suffix(".md") return ReportResult( input_results_path=resolved_results_path, - output_report_path=resolved_output_path, + output_report_path=primary_path, )