Skip to content

Conversation

@juanmichelini
Copy link
Collaborator

Summary

This PR fixes issue #332 by changing the report_costs.py summary to return total_duration instead of average_duration.

Changes

  • Modified calculate_time_statistics to include total_duration (sum of all durations) in addition to existing statistics
  • Updated calculate_costs to track total_duration across all JSONL files (main output and critic files)
  • Changed the summary dictionary to use total_duration instead of average_duration
  • Added comprehensive tests for report_costs.py functionality

Details

The total_duration is calculated as the sum of all instance durations across all JSONL files, similar to how total_cost is calculated. When critic files exist, the total duration is the sum of durations from all critic files; otherwise, it falls back to the main output file's total duration.

Testing

Added 11 new tests in tests/test_report_costs.py covering:

  • calculate_time_statistics returning total_duration
  • Empty data handling
  • No valid durations handling
  • Backward compatibility (average_duration still calculated in time_statistics)
  • calculate_line_duration functionality
  • extract_accumulated_cost functionality
  • Integration tests for summary total_duration with and without critic files

All tests pass.

Fixes #332

@juanmichelini can click here to continue refining the PR

…s summary

- Modified calculate_time_statistics to include total_duration (sum of all durations)
- Updated calculate_costs to track total_duration across all JSONL files
- Changed summary to use total_duration instead of average_duration
- Added comprehensive tests for report_costs.py

Fixes #332

Co-authored-by: openhands <openhands@all-hands.dev>
@juanmichelini
Copy link
Collaborator Author

@OpenHands good but let's also drop "max_duration", "min_duration", and "mean_duration"

@openhands-ai
Copy link

openhands-ai bot commented Jan 16, 2026

I'm on it! juanmichelini can track my progress at all-hands.dev

…e statistics

Remove redundant duration statistics from calculate_time_statistics:
- max_duration
- min_duration
- mean_duration (was duplicate of average_duration)

Also remove corresponding print statements from console output.
@openhands-ai
Copy link

openhands-ai bot commented Jan 16, 2026

I've updated PR #333 to drop max_duration, min_duration, and mean_duration from the time statistics as requested.

Changes Made

✅ Removed from calculate_time_statistics return dictionaries:

  • max_duration
  • min_duration
  • mean_duration (was redundant - same as average_duration)

✅ Removed corresponding print statements from console output (both for main output and critic files)

The calculate_time_statistics function now returns only:

  • average_duration - average duration per instance
  • total_duration - sum of all durations
  • total_lines - total number of lines
  • lines_with_duration - number of lines with valid duration data

The changes have been pushed to the openhands/fix-report-costs-total-duration branch.

View full conversation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Report costs should return total_duration instead of average_duration.

3 participants