Skip to content

Conversation

@AAgnihotry
Copy link
Contributor

@AAgnihotry AAgnihotry commented Jan 23, 2026

Summary

This PR removes duplicate span creation code and fixes trace ID assignment to properly sync with how uipath-python creates spans.

Changes

🗑️ Removed Dead/Duplicate Code (319 lines)

Removed 3 methods from _progress_reporter.py:

  • _send_parent_trace() - Created duplicate evaluation set spans
  • _send_eval_run_trace() - Dead code (defined but never called)
  • _send_evaluator_traces() - Created duplicate evaluator spans AND duplicate agent span exports

🔧 Fixed Trace ID Assignment

  • Removed: Global eval_set_run_id trace ID override that forced ALL evaluations to use the same trace ID
  • Added: Per-evaluation trace_id setting in handle_update_eval_run():
    # Set trace_id to the eval execution_id for this specific evaluation
    # This ensures each eval's spans are grouped under its own trace
    self.spans_exporter.trace_id = payload.execution_id

🧹 Cleanup

  • Removed unused imports: datetime, timezone, SpanContext, SpanKind, TraceFlags

Why These Changes?

Problem 1: Duplicate Span Creation

The deleted methods were creating spans that duplicated what _runtime.py already creates:

  • _runtime.py creates "Evaluation Set Run", "Evaluation", and "Evaluator" spans with proper hierarchy
  • _progress_reporter.py was creating the same spans again via the 3 deleted methods
  • Agent execution spans were being exported twice (once in the deleted method, once in handle_update_eval_run)

Problem 2: Incorrect Trace IDs

  • All evaluation spans were being forced to use eval_set_run_id as their trace ID
  • But _runtime.py creates spans with execution.id = eval_item.id for each evaluation
  • This mismatch prevented the Agents repo from retrieving traces correctly

Impact

✅ What Still Works

  • Agent execution spans are still exported (via line 422 in handle_update_eval_run)
  • Span creation happens in _runtime.py (unchanged)
  • All evaluation metrics and reporting continue to function

🎯 What's Fixed

  • No more duplicate spans in traces
  • Each evaluation now has its own trace ID matching its eval_item.id
  • Syncs with Agents repo trace retrieval (see related PR in Agents repo)

Testing

  • ✅ All linting checks passed
  • ✅ All type checks passed (mypy)
  • ✅ Package builds successfully
  • ✅ No tests needed removal (deleted methods had no test coverage)

Related Changes

This PR complements changes in the Agents repo (AgentHealthScorerUtils.cs) that update trace retrieval to query by individual evaluation IDs instead of eval set run ID.

🤖 Generated with Claude Code

Development Package

  • Use uipath pack --nolock to get the latest dev build from this PR (requires version range).
  • Add this package as a dependency in your pyproject.toml:
[project]
dependencies = [
  # Exact version:
  "uipath==2.5.36.dev1011894202",

  # Any version from PR
  "uipath>=2.5.36.dev1011890000,<2.5.36.dev1011900000"
]

[[tool.uv.index]]
name = "testpypi"
url = "https://test.pypi.org/simple/"
publish-url = "https://test.pypi.org/legacy/"
explicit = true

[tool.uv.sources]
uipath = { index = "testpypi" }

[tool.uv]
override-dependencies = [
    "uipath>=2.5.36.dev1011890000,<2.5.36.dev1011900000",
]

Screenshots

Before
image

After

image

@github-actions github-actions bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-llamaindex Triggers tests in the uipath-llamaindex-python repository labels Jan 23, 2026
@AAgnihotry AAgnihotry added the build:dev Create a dev build from the pr label Jan 23, 2026
@AAgnihotry AAgnihotry force-pushed the feat/removeDeadSpans branch from 9a04ff3 to 584bbca Compare January 23, 2026 19:13
AAgnihotry and others added 2 commits January 23, 2026 11:14
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@AAgnihotry AAgnihotry force-pushed the feat/removeDeadSpans branch from a941db3 to 0059658 Compare January 23, 2026 20:16
@AAgnihotry AAgnihotry merged commit d26cf65 into main Jan 23, 2026
249 of 253 checks passed
@AAgnihotry AAgnihotry deleted the feat/removeDeadSpans branch January 23, 2026 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build:dev Create a dev build from the pr test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-llamaindex Triggers tests in the uipath-llamaindex-python repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants