Summary
In openagent_eval/reports/terminal.py, the generate_to_file() method does no extension handling or default filename appending — unlike every other report generator (HTMLReport, MarkdownReport, JSONReport, ComparisonReport), which all check the output path and either append a default filename or replace the extension.
Steps to Reproduce
- Call
TerminalReport().generate_to_file(report, "./output") (a path without extension).
- Observe that a file named
output (no extension) is created.
- Compare with
MarkdownReport().generate_to_file(report, "./output") which correctly creates ./output/report.md.
Expected Behavior
TerminalReport.generate_to_file() should be consistent with the other report generators — if the path has no extension, it should be treated as a directory and a default filename (e.g., report.txt) should be appended.
Actual Behavior
The path is used as-is, producing an extensionless file.
Relevant Code
# Lines 88-94 in terminal.py
def generate_to_file(self, report: Any, output_path: Path | str) -> Path:
path = self._ensure_output_dir(output_path)
content = self.generate(report)
path.write_text(content, encoding="utf-8")
return path
Compare with html.py which correctly distinguishes directory paths from file paths:
path = Path(output_path)
if path.suffix == "":
path = path / "report.html" # treat as directory
elif path.suffix.lower() != ".html":
path = path.with_suffix(".html") # replace extension
Impact
Low severity, but a clear API inconsistency. Users who follow the same pattern across report generators will get extensionless files from TerminalReport.
Suggested Fix
Adopt the same pattern as HTMLReport.generate_to_file():
path = Path(output_path)
if path.suffix == "":
path = path / "report.txt"
elif path.suffix.lower() != ".txt":
path = path.with_suffix(".txt")
path = self._ensure_output_dir(path)
Summary
In
openagent_eval/reports/terminal.py, thegenerate_to_file()method does no extension handling or default filename appending — unlike every other report generator (HTMLReport,MarkdownReport,JSONReport,ComparisonReport), which all check the output path and either append a default filename or replace the extension.Steps to Reproduce
TerminalReport().generate_to_file(report, "./output")(a path without extension).output(no extension) is created.MarkdownReport().generate_to_file(report, "./output")which correctly creates./output/report.md.Expected Behavior
TerminalReport.generate_to_file()should be consistent with the other report generators — if the path has no extension, it should be treated as a directory and a default filename (e.g.,report.txt) should be appended.Actual Behavior
The path is used as-is, producing an extensionless file.
Relevant Code
Compare with
html.pywhich correctly distinguishes directory paths from file paths:Impact
Low severity, but a clear API inconsistency. Users who follow the same pattern across report generators will get extensionless files from
TerminalReport.Suggested Fix
Adopt the same pattern as
HTMLReport.generate_to_file():