Skip to content

fix: eval tool_call_response uses correct event field names#2302

Merged
dgageot merged 2 commits intomainfrom
fix/eval-tool-call-response-format
Apr 1, 2026
Merged

fix: eval tool_call_response uses correct event field names#2302
dgageot merged 2 commits intomainfrom
fix/eval-tool-call-response-format

Conversation

@hamza-jeddad
Copy link
Copy Markdown
Contributor

Summary

Fix incorrect parsing of tool_call_response events in the evaluation package.

Problem

The tool_call_response event structure was updated so that tool_call_id and tool_definition are top-level fields, but the parsing code was still reading from the old nested tool_call structure. This caused:

  • save.go: tool response messages were silently dropped from reconstructed sessions
  • eval.go: tool names showed up as empty in evaluation transcripts

Additionally, buildTranscript had no nil guard on tool_definition, which could cause a runtime panic if the field was missing.

Changes

  • save.go: read tool_call_id from the top-level event field instead of tool_call.id
  • eval.go: read tool_definition.name from the top-level event field instead of via getToolCallInfo, with a nil guard to prevent panics
  • eval_test.go, save_test.go: updated test fixtures to match the correct event structure

SessionFromEvents and buildTranscript were looking for a non-existent
"tool_call" nested map in tool_call_response events. The actual
ToolCallResponseEvent serializes with "tool_call_id" (top-level string)
and "tool_definition" (top-level object), so the type assertions always
failed silently — tool call results were never written to sessions and
transcript tool names were empty.

Fix both functions to use the correct field names and update tests to
match the real ToolCallResponseEvent JSON format.

Assisted-By: docker-agent
@hamza-jeddad hamza-jeddad requested a review from a team as a code owner April 1, 2026 10:00
Copy link
Copy Markdown

@docker-agent docker-agent bot left a comment

Choose a reason for hiding this comment

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

Assessment: 🟢 APPROVE

This PR correctly updates the event parsing logic to match the new tool_call_response event structure. The changes are well-documented with inline comments explaining the structural change, and all test fixtures have been updated consistently.

Key improvements:

  • ✅ Proper nil guard added for tool_definition in eval.go to prevent panics
  • ✅ Consistent field access pattern across both eval.go and save.go
  • ✅ Test fixtures updated to match the new structure
  • ✅ Clear explanatory comments added

No bugs found in the changed code.

@dgageot dgageot merged commit ae34273 into main Apr 1, 2026
12 checks 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.

2 participants