fix: show tool names in assistant message detail timeline (#849)#856
Merged
fix: show tool names in assistant message detail timeline (#849)#856
Conversation
Surface toolRequest names in _build_event_details for ASSISTANT_MESSAGE events. Tool-calling turns that previously rendered blank now show the invoked tool names (e.g. 'tools: bash, view'). Mixed turns show both token info and tool names. Long tool lists are truncated at 60 chars. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes blank rows in the session detail timeline by surfacing tool-call names for assistant.message events, so tool-only turns render meaningful detail text instead of appearing empty.
Changes:
- Append a compact
tool:/tools:summary (truncated to 60 chars) to assistant message timeline details whentoolRequestsare present. - Add unit tests covering tool-only turns, mixed content+tool turns, regression behavior with no tools, and truncation behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/copilot_usage/render_detail.py |
Updates _build_event_details() to include tool request names in assistant message timeline detail strings. |
tests/copilot_usage/test_render_detail.py |
Adds test coverage for tool request rendering and truncation in _build_event_details(). |
- Filter empty tool names and base singular/plural label on displayed names count instead of total toolRequests length - Fall back to 'tools: (unknown)' when all names are empty - Add tests for empty-name and singular-label edge cases Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
Commit pushed:
|
Contributor
There was a problem hiding this comment.
Quality Gate: APPROVED ✅
Changes reviewed:
src/copilot_usage/render_detail.py(+8 lines): SurfacestoolRequeststool names in_build_event_detailsfor theASSISTANT_MESSAGEbranch, using the existing_truncatehelper with singular/plural labels and an "(unknown)" fallback.tests/copilot_usage/test_render_detail.py(+123 lines): 6 meaningful tests covering tool-only turns, mixed turns, regression (no tools), truncation, empty names, and singular label logic.
Assessment:
- Code quality: Good — follows existing patterns, uses existing helpers, clean list comprehension with proper edge-case handling.
- Guidelines compliance: Type annotations ✓ | No duck typing ✓ | pytest style ✓ | Docstrings ✓ | Double quotes ✓
- Impact: LOW — display-only change in a rendering helper, non-breaking, no API/model/dependency changes.
- CI: All 8 checks passing.
Low-impact display fix with thorough test coverage. Auto-approving for merge.
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.
Closes #849
Problem
In
render_detail.py:_build_event_details, theASSISTANT_MESSAGEbranch parsedtoolRequestsviaas_assistant_message()but silently discarded them. Tool-calling turns (which havecontent=""by design) rendered as blank rows in the session detail timeline.Fix
After building
partsfromoutputTokensandcontent, checkdata.toolRequests. If non-empty, append a compact"tool: name"/"tools: a, b, c"summary (truncated at 60 chars) to the detail string.Before:
Tests added
content="",outputTokens=0, twotoolRequests→ detail contains both tool namescontent="ok",outputTokens=100, onetoolRequest→ detail contains tokens, content, and tool name…