Add run summary output to create command#90
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Append runtime and cost summary lines after the
done.message whendraft createcompletes 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 babysitare 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 existstest_print_run_summary_zero_cost: Verifies $0.00 is printed (not-) for zero costtest_command_create_success_prints_summary: End-to-end successful run contains both linestest_command_create_failed_run_no_summary: Failed run suppresses summary outputtest_command_create_skip_pr_summary_follows_done_line: Summary appears after--skip-prvariant of done messagetest_command_create_aggregates_raises_done_still_prints: Command returns 0 and printsdone.even if aggregates() raisesAll tests pass; verified no other tests assert on the exact tail of
draft createoutput.