Skip to content

Surface runtime model + token usage in published review summaries - #6

Merged
whhe merged 10 commits into
mainfrom
copilot/show-model-and-token-usage
Jul 21, 2026
Merged

Surface runtime model + token usage in published review summaries#6
whhe merged 10 commits into
mainfrom
copilot/show-model-and-token-usage

Conversation

Copilot AI commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review outputs currently dropped runtime metadata collected by ACP, so maintainers could not see which model produced a review or the token cost of the run. This change propagates structured runtime metadata end-to-end and renders it in the final summary body (including consolidated GitHub review bodies) with explicit unavailable states.

  • Runtime metadata propagation

    • Added runtime fields to agent/review result flow so model + usage survive parsing and publishing boundaries.
    • AgentRunResult now carries model; ACP runtime captures response-reported model when present.
    • SkillResult now carries attached runtime metadata (model, input_tokens, output_tokens, total_tokens).
  • Usage aggregation at runner boundary

    • CodingAgentReviewRunner aggregates runtime data across all agent calls in a review run, including retry paths.
    • Token totals are computed per metric only when that metric is available for all calls; otherwise rendered as unavailable (avoids misleading partial totals).
    • Multiple runtime models are labeled explicitly when retries/reporting differ.
  • Summary rendering updates

    • format_review_note(...) now renders a compact runtime footer line near bot attribution.
    • Applied in both platform and debug publishers, so standalone summary comments and consolidated review bodies share the same runtime line.
    • Existing bot attribution, skill fingerprint, and hidden metadata comment remain intact.
# rendered footer example
"Model: provider/model · Tokens: input 12,345 / output 678 / total 13,023"

# when data is incomplete/missing
"Model: unavailable · Tokens: input unavailable / output unavailable / total unavailable"

Copilot AI linked an issue Jul 21, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Show model and token usage in final review comments Surface runtime model + token usage in published review summaries Jul 21, 2026
Copilot finished work on behalf of whhe July 21, 2026 03:05
Copilot AI requested a review from whhe July 21, 2026 03:05
@whhe
whhe marked this pull request as ready for review July 21, 2026 03:07
Comment thread src/code_review_bot/review/runner.py Outdated

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

Clean runtime metadata propagation end-to-end with solid test coverage. Low overall risk; one minor type-check defensiveness improvement suggested.

Severity: Critical 0 / High 0 / Medium 0 / Low 1
Inline comments posted: 1

Generated by whhe/code-review-bot · Skill fingerprint: 43b5df0c

@whhe

whhe commented Jul 21, 2026

Copy link
Copy Markdown
Owner

@copilot fix the comment #6 (comment)

Copilot AI commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix the comment #6 (comment)

Fixed in commit 7f83bde. CodingAgentReviewRunner now excludes booleans when aggregating token counts (isinstance(value, int) and not isinstance(value, bool)), and I added a regression test covering bool usage values.

Copilot finished work on behalf of whhe July 21, 2026 03:23

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

Clean implementation that propagates ACP runtime model and token usage end-to-end with well-designed aggregation semantics and good test coverage. No new issues found; the previously flagged bool/int edge case is fixed.

Severity: Critical 0 / High 0 / Medium 0 / Low 0
Inline comments posted: 0

Generated by whhe/code-review-bot · Skill fingerprint: 43b5df0c

@whhe
whhe merged commit 79692e0 into main Jul 21, 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.

Show model and token usage in final review comments

2 participants