fix: select root agent span by earliest start_time in multi-agent traces - #371
fix: select root agent span by earliest start_time in multi-agent traces#371liramon2 wants to merge 1 commit into
Conversation
|
@strandly-the-agent Review this PR. Consolidate any findings into a single comment. |
This comment was marked as resolved.
This comment was marked as resolved.
72efc62 to
89ec94d
Compare
89ec94d to
9fa6675
Compare
|
@strandly-the-agent Review this PR. Consolidate any findings into a single comment.
This is effectively a no-op for the
This is outside the scope of the PR, which is targeting the root agent search. Question 1: a coordinator without content would most likely error on evaluations, so it is out of scope here. |
|
TL;DR — approve. All five findings from my previous review are resolved on Previous findings — status (each verified against the diff, not the commit message):
Verified on
Footnote on ruling 1 (parse_timestamp normalisation)Agreed on the naive-datetime half: normalising naive → UTC in The half that argument doesn't cover is the fabricated |
Description
Fixes root-agent selection in multi-agent traces so
_find_root_agent_spanbreaks ties by earlieststart_time. In a flat multi-agent trace where multiple agent spans are parentless, the previous logic returned the first parentless-with-content span in list order, which may be an arbitrary sub-agent rather than the outer coordinator. Since the coordinator is invoked first and encloses its sub-agents, selecting the earliest-start agent picks the root agent correctly.Related Issues
Fixes #370
Additionally, this is a prerequisite for #365 and #366. These PRs convert OpenAI Agents SDK traces that may contain multiple parentless span. When an OpenAI agent hands off or delegates to another agent, the original agent's span is a sibling rather than parent of the subsequent agent's span; therefore, there are multiple parentless agent spans. That leads the scenario described in this PR's issue.
Documentation PR
N/A
Type of Change
Bug fix
Testing
hatch run prepareChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.