Skip to content

Add run summary output to create command#90

Merged
vm-mishchenko merged 2 commits into
mainfrom
260514-spec-create-summary
May 15, 2026
Merged

Add run summary output to create command#90
vm-mishchenko merged 2 commits into
mainfrom
260514-spec-create-summary

Conversation

@vm-mishchenko
Copy link
Copy Markdown
Owner

Summary

Append runtime and cost summary lines after the done. message when draft create completes successfully. Users now see two additional lines showing total execution time and estimated LLM cost, providing visibility into run performance and cost.

The summary safely handles missing or invalid aggregates by swallowing exceptions—a broken metric will not turn a successful command into a failed one. Failure paths and draft continue/draft babysit are unchanged.

Test plan

Added six test cases in tests/draft/test_commands.py:

  • test_print_run_summary_with_cost: Verifies output format with rounded cost ($0.46)
  • test_print_run_summary_no_cost: Verifies - is printed when no cost data exists
  • test_print_run_summary_zero_cost: Verifies $0.00 is printed (not -) for zero cost
  • test_command_create_success_prints_summary: End-to-end successful run contains both lines
  • test_command_create_failed_run_no_summary: Failed run suppresses summary output
  • test_command_create_skip_pr_summary_follows_done_line: Summary appears after --skip-pr variant of done message
  • test_command_create_aggregates_raises_done_still_prints: Command returns 0 and prints done. even if aggregates() raises

All tests pass; verified no other tests assert on the exact tail of draft create output.

Print runtime and LLM cost information after the
command completes successfully, giving users
visibility into execution metrics and costs.
The summary is safely skipped if metrics
aggregation fails.
- Replace direct `_print_run_summary` calls with `cc.run` invocations —
  reviewer: tests bypassed `command_create.run` entirely — spec requires
  end-to-end assertions through the full command execution path
- Add `_make_pipeline_run_with_cost` factory to inject synthetic step
  entries via `session_metrics` — reviewer: cost data must flow through
  the real `session_metrics.end(rc)` path in the `finally` block
- Assert `done.` line exists and `runtime:`/`cost:` follow immediately
  after it — reviewer: exact stdout tail sequence was not verified
@vm-mishchenko vm-mishchenko marked this pull request as ready for review May 15, 2026 06:02
@vm-mishchenko vm-mishchenko merged commit b5f9992 into main May 15, 2026
1 check passed
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.

1 participant