Skip to content

fix: show tool names in assistant message detail timeline (#849)#856

Merged
microsasa merged 2 commits intomainfrom
fix/849-tool-calling-detail-8eae7d3a50de6685
Apr 8, 2026
Merged

fix: show tool names in assistant message detail timeline (#849)#856
microsasa merged 2 commits intomainfrom
fix/849-tool-calling-detail-8eae7d3a50de6685

Conversation

@microsasa
Copy link
Copy Markdown
Owner

Closes #849

Problem

In render_detail.py:_build_event_details, the ASSISTANT_MESSAGE branch parsed toolRequests via as_assistant_message() but silently discarded them. Tool-calling turns (which have content="" by design) rendered as blank rows in the session detail timeline.

Fix

After building parts from outputTokens and content, check data.toolRequests. If non-empty, append a compact "tool: name" / "tools: a, b, c" summary (truncated at 60 chars) to the detail string.

Before:

assistant │ tokens=450  │              ← content reply
assistant │             │              ← tool-calling turn (blank)
```

**After:**
```
assistant │ tokens=450  │              ← content reply
assistant │             │ tools: bash, view

Tests added

  • Tool-only turncontent="", outputTokens=0, two toolRequests → detail contains both tool names
  • Mixed turncontent="ok", outputTokens=100, one toolRequest → detail contains tokens, content, and tool name
  • No tools (regression) — existing content-only behavior unaffected
  • Truncation — long tool name lists are truncated at 60 chars with

Generated by Issue Implementer · ● 6.3M ·

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>
Copilot AI review requested due to automatic review settings April 8, 2026 08:20
@microsasa microsasa added the aw Created by agentic workflow label Apr 8, 2026
@microsasa microsasa enabled auto-merge April 8, 2026 08:20
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 when toolRequests are 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>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Commit pushed: cdc3dda

Generated by Review Responder

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@microsasa microsasa added the aw-quality-gate-approved Quality gate approved the PR label Apr 8, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Quality Gate: APPROVED

Changes reviewed:

  • src/copilot_usage/render_detail.py (+8 lines): Surfaces toolRequests tool names in _build_event_details for the ASSISTANT_MESSAGE branch, using the existing _truncate helper 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.

@microsasa microsasa merged commit 6836a05 into main Apr 8, 2026
8 checks passed
@microsasa microsasa deleted the fix/849-tool-calling-detail-8eae7d3a50de6685 branch April 8, 2026 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aw Created by agentic workflow aw-quality-gate-approved Quality gate approved the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[aw][code health] Session detail timeline shows blank entries for tool-calling assistant messages

2 participants