Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates BC-Bench’s agent metrics collection to stop relying on Copilot/Claude debug logs for tool usage (which no longer include it) and instead records tool usage via PreToolUse hooks, then parses a dedicated tool_usage.jsonl output.
Changes:
- Add hook setup + a PowerShell hook script to log tool usage to
tool_usage.jsonl. - Add a shared parser for the hooks output and wire it into Copilot/Claude agents.
- Remove tool-usage-from-log parsing, keep Copilot turn counting from session logs, and update tests accordingly.
Reviewed changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/bcbench/operations/hooks_operations.py |
New operation to write Copilot/Claude hook configuration and define tool usage log destination. |
src/bcbench/agent/shared/hooks_parser.py |
New JSONL parser that aggregates tool usage counts from hook output. |
src/bcbench/agent/shared/hooks/log-tool-usage.ps1 |
New hook script that appends tool usage entries to a JSONL file. |
src/bcbench/agent/copilot/metrics.py |
Removes tool usage parsing from Copilot logs; keeps turn counting. |
src/bcbench/agent/copilot/agent.py |
Configures hooks and attaches parsed tool usage to collected metrics. |
src/bcbench/agent/claude/metrics.py |
Removes debug-log-based tool usage parsing from Claude metrics. |
src/bcbench/agent/claude/agent.py |
Configures hooks and attaches parsed tool usage to collected metrics. |
src/bcbench/commands/run.py |
Updates “copilot-inspector” to use hook-based tool usage parsing + log-based turn counting. |
src/bcbench/config.py |
Adds hook script path and new file-pattern config entries. |
src/bcbench/operations/__init__.py |
Exposes setup_hooks via operations package exports. |
src/bcbench/agent/shared/__init__.py |
Re-exports parse_tool_usage_from_hooks. |
tests/test_hooks_parser.py |
New unit tests for hook JSONL parsing behavior. |
tests/test_hooks_operations.py |
New unit tests for hook config generation for Copilot/Claude. |
tests/test_tool_usage_parser.py |
Replaces tool-usage-from-log tests with turn-count-from-log tests. |
tests/test_copilot_metrics_parsing.py |
Removes tool usage assertions from session logs; keeps turn count assertions. |
tests/test_claude_code_metrics.py |
Removes debug-log tool usage tests; asserts tool usage remains None without hooks. |
pyproject.toml / uv.lock |
Version bump to 0.5.2. |
Co-authored-by: Copilot <copilot@github.com>
Jiawen-CS
approved these changes
Apr 24, 2026
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.
Previous metrics parsing relies on the debug logs, which no longer contains the tool usage.
Instead of relying on logs parsing, we leverage
PreToolUsehook to record all tool usage