Skip to content

fix(tracing): use agentId as span reference_id#1634

Closed
ionmincu wants to merge 1 commit into
mainfrom
fix/traces-reference-id-from-agent-id_2
Closed

fix(tracing): use agentId as span reference_id#1634
ionmincu wants to merge 1 commit into
mainfrom
fix/traces-reference-id-from-agent-id_2

Conversation

@ionmincu
Copy link
Copy Markdown
Contributor

Summary

Tracing

  • Set UiPathSpan.reference_id from the agentId attribute (sourced from the PROJECT_KEY env var) instead of the unset referenceId attribute, so coded-agent spans carry a meaningful reference back to their agent.

Integration tests workflow

Make Dependabot PRs actually able to run integration tests, without exposing the full secret blast radius to arbitrary fork PRs:

  • Add pull_request_target trigger alongside the existing pull_request, gated by actor so it fires only for dependabot[bot]. Regular PRs continue to use pull_request exactly as before. No double-runs.
  • Set actions/checkout to ref: ${{ github.event.pull_request.head.sha }} so the PR's code is tested in both event contexts (default for pull_request_target is base).
  • Restrict the Dependabot matrix to the alpha environment only (skip cloud and staging) to minimize credential exposure for dependency-bump PRs.
  • Omit App Insights / telemetry secrets for Dependabot runs.
  • Add a Check secrets availability step that emits a ::warning:: annotation when any of CLIENT_ID/CLIENT_SECRET/BASE_URL is empty, so the previously-misleading downstream UIPATH_ACCESS_TOKEN is not set failure now has clear context (useful for non-Dependabot fork PRs).

Supersedes #1628 — rebased onto current main (the original branch could not be force-pushed past the latest main due to the repo ruleset blocking direct pushes).

Test plan

  • CI green on this PR (non-Dependabot path)
  • Verify emitted spans include ReferenceId matching the project/agent id
  • Confirm next Dependabot PR runs integration tests against alpha only and passes

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 18, 2026 08:36
@github-actions github-actions Bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-integrations labels May 18, 2026
@sonarqubecloud
Copy link
Copy Markdown

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

Updates tracing span conversion so coded-agent spans carry a meaningful ReferenceId, and adjusts the integration test workflow so Dependabot PRs can run integration tests with tightly-scoped secret exposure.

Changes:

  • Map UiPathSpan.reference_id from the agentId span attribute (populated from PROJECT_KEY) instead of referenceId.
  • Add a pull_request_target workflow path gated for Dependabot, check out PR head SHA, restrict Dependabot runs to alpha, and omit App Insights secrets.
  • Add a “Check secrets availability” step to emit clearer warnings when required integration-test secrets are missing.

Reviewed changes

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

File Description
packages/uipath-platform/src/uipath/platform/common/_span_utils.py Adjusts span conversion to set reference_id from agentId.
.github/workflows/integration_tests.yml Adds a Dependabot-only pull_request_target path and safety checks to enable integration tests with constrained secrets.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +22 to 25
if: |
(github.event_name == 'pull_request' && github.actor != 'dependabot[bot]') ||
(github.event_name == 'pull_request_target' && github.actor == 'dependabot[bot]')
runs-on: ubuntu-latest
Comment on lines +165 to +166
(github.event_name == 'pull_request' && github.actor != 'dependabot[bot]') ||
(github.event_name == 'pull_request_target' && github.actor == 'dependabot[bot]')
Comment on lines +121 to +124
CLIENT_SECRET: ${{ matrix.environment == 'alpha' && secrets.ALPHA_TEST_CLIENT_SECRET || matrix.environment == 'staging' && secrets.STAGING_TEST_CLIENT_SECRET || matrix.environment == 'cloud' && secrets.CLOUD_TEST_CLIENT_SECRET }}
BASE_URL: ${{ matrix.environment == 'alpha' && secrets.ALPHA_BASE_URL || matrix.environment == 'staging' && secrets.STAGING_BASE_URL || matrix.environment == 'cloud' && secrets.CLOUD_BASE_URL }}
PR_ACTOR: ${{ github.event.pull_request.user.login }}
run: |
[ -z "$BASE_URL" ] && missing+=("BASE_URL")

if [ ${#missing[@]} -gt 0 ]; then
echo "::warning::Missing or empty secrets for ${{ matrix.environment }}: ${missing[*]}. PRs from forks or Dependabot do not receive repository secrets — workflows triggered by '$PR_ACTOR' must have the corresponding values configured in Settings → Secrets and variables → Dependabot (or be re-run by a maintainer from a branch in this repo). The testcase will fail with a misleading auth error downstream."
Comment on lines 283 to 287
# Top-level fields for internal tracing schema
execution_type = attributes_dict.get("executionType")
agent_version = attributes_dict.get("agentVersion")
reference_id = attributes_dict.get("referenceId")
reference_id = attributes_dict.get("agentId")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:uipath-integrations test:uipath-langchain Triggers tests in the uipath-langchain-python repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants