Skip to content

feat(tasks): send the current span as ParentSpanId in taskSourceMetadata [ACTN-11909] - #1948

Open
Sahil-Wakode wants to merge 6 commits into
mainfrom
feat/quickform-task-source-metadata
Open

Sahil-Wakode wants to merge 6 commits into
mainfrom
feat/quickform-task-source-metadata

Conversation

@Sahil-Wakode

@Sahil-Wakode Sahil-Wakode commented Oct 19, 2026 •

Copy link
Copy Markdown

What

_apply_task_source now adds ParentSpanId to taskSourceMetadata. It is the span the task is created under, the same one the SDK already sends in the x-uipath-traceparent-id header (LLMOps current span, falling back to the OTel current span). If there is no current span the key is left out and the task looks the same as today.

Why

Action Center places a task's trace spans under ParentSpanId. Every create path (create, create_async, create_quickform, create_quickform_async, and CreateTask / CreateEscalation interrupts) goes through _apply_task_source, so all of them get it without callers having to pass anything.

Changes

  • _tasks_service.py: add ParentSpanId from the current span in _apply_task_source.
  • test_actions_service.py: test that the current span is sent as ParentSpanId.
  • uipath-platform bumped to 0.2.42.

Testing

  • uipath-platform tests: 1892 passed, 11 skipped. The new test fails without this change.
  • ruff format, ruff check and mypy pass.

@github-actions github-actions Bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-integrations labels Oct 19, 2026
@Sahil-Wakode Sahil-Wakode changed the title feat(tasks): accept task_source_metadata when creating quick form tasks [ACTN-11909] feat(tasks): [1/2] accept task_source_metadata when creating quick form tasks [ACTN-11909] Oct 19, 2026
@Sahil-Wakode Sahil-Wakode changed the title feat(tasks): [1/2] accept task_source_metadata when creating quick form tasks [ACTN-11909] feat(tasks): [1/2] accept task_source_metadata on every task create method [ACTN-11909] Oct 19, 2026
@Sahil-Wakode Sahil-Wakode changed the title feat(tasks): [1/2] accept task_source_metadata on every task create method [ACTN-11909] feat(tasks): [1/2] accept task_source_metadata in create_quickform_async [ACTN-11909] Oct 22, 2026
@Sahil-Wakode
Sahil-Wakode force-pushed the feat/quickform-task-source-metadata branch from 6b8b66c to ff73d76 Compare October 22, 2026 09:41
@Sahil-Wakode
Sahil-Wakode marked this pull request as ready for review October 23, 2026 09:17
Copilot AI balanced review requested due to automatic review settings October 23, 2026 09:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The backward-compatible change reuses existing merge behavior, includes a focused regression test, and has no identified blocking issues.

No open issues 🎉

What changed in this PR

Adds optional task_source_metadata support to asynchronous QuickForm creation, enabling Action Center task events to link to the correct trace span.

Changes:

  • Passes custom metadata through the existing task-source merge helper; synchronous creation remains unchanged.
  • Adds a regression test verifying ParentSpanId is included and InstanceId is preserved.
  • Bumps uipath-platform to 0.2.42 and updates both lockfiles.
File Description
packages/​uipath/​uv.lock Updates the platform package version.
packages/​uipath-platform/​uv.lock Updates the platform package version.
packages/​uipath-platform/​tests/​services/​test_actions_service.py Tests custom metadata merging for async QuickForms.
packages/​uipath-platform/​src/​uipath/​platform/​action_center/​_tasks_service.py Adds and forwards the optional metadata parameter.
packages/​uipath-platform/​pyproject.toml Bumps the package version to 0.2.42.

Review effort: Balanced

@Sahil-Wakode Sahil-Wakode changed the title feat(tasks): [1/2] accept task_source_metadata in create_quickform_async [ACTN-11909] feat(tasks): [1/2] let quick form tasks send extra task source metadata [ACTN-11909] Oct 23, 2026
@Sahil-Wakode Sahil-Wakode changed the title feat(tasks): [1/2] let quick form tasks send extra task source metadata [ACTN-11909] feat(tasks): send the current span as ParentSpanId in taskSourceMetadata [ACTN-11909] Oct 26, 2026
"FolderKey": UiPathConfig.folder_key,
"JobKey": UiPathConfig.job_key,
"ProcessKey": UiPathConfig.process_uuid,
**({"ParentSpanId": format_span_id(span_id)} if span_id else {}),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What happens when format_span_id is passed a null span_id

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

we have if condition here right?
The if span_id check is false for 0, so format_span_id isn't called and ParentSpanId is just left out.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I meant "" spanId. Empty**. Does format_span_id have adequate null handling? Else, it'll crash the agent runtime entirely

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes looked over the truthy-falsy case here
It will be false in cases span_id=None or "" or 0

@dushyant-uipath

Copy link
Copy Markdown
Contributor

@Sahil-Wakode - once the environments are sstable, let's make sure the CIs are green

…ata [ACTN-11909]

_apply_task_source adds ParentSpanId from the current span, so every task
the SDK creates carries it. The task_source_metadata parameter on
create_quickform_async is no longer needed and is removed.
@Sahil-Wakode
Sahil-Wakode force-pushed the feat/quickform-task-source-metadata branch from f4e8a78 to 0ef02b5 Compare October 26, 2026 15:20
@Sahil-Wakode

Copy link
Copy Markdown
Author

@Sahil-Wakode - once the environments are sstable, let's make sure the CIs are green

yes I have rebased and working on the CIs thankyou

"FolderKey": UiPathConfig.folder_key,
"JobKey": UiPathConfig.job_key,
"ProcessKey": UiPathConfig.process_uuid,
**({"ParentSpanId": format_span_id(span_id)} if span_id else {}),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please confirm if this is the right spanId

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes it shall be the right one as I can see used up in x-uipath-traceparent-id.
We have implemented similar to

llmops_span = UiPathSpanUtils.get_external_current_span()
span = llmops_span or trace.get_current_span()
ctx = span.get_span_context()
if not (ctx.trace_id and ctx.span_id):
return
config_trace_id = UiPathConfig.trace_id
trace_id = (
_SpanUtils.normalize_trace_id(config_trace_id)
if config_trace_id
else format_trace_id(ctx.trace_id)
)
span_id = format_span_id(ctx.span_id)
headers[HEADER_TRACEPARENT_ID] = f"00-{trace_id}-{span_id}-01"

ParentSpanId is added only for a valid, non-zero span id. Any error while reading the span
is logged at debug level and the task is created without ParentSpanId.
@github-actions

Copy link
Copy Markdown

🚨 Heads up: uipath-integrations cross-tests are FAILING 🚨

Your changes may break one or more integrations in uipath-integrations-python:

  • uipath-openai-agents
  • uipath-google-adk
  • uipath-agent-framework
  • uipath-llamaindex
  • uipath-pydantic-ai

⚠️ These checks are NOT enforced by branch protection rules. Please review the failures before merging.

🔍 Inspect the failed run →

@sonarqubecloud

Copy link
Copy Markdown


def _current_span_id() -> Optional[str]:
try:
span = UiPathSpanUtils.get_external_current_span() or trace.get_current_span()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What's get_external?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

get_external_current_span() returns the span the agents runtime registers with UiPathSpanUtils, which is the Escalation span during an escalation.

As said followed the way span_id is taken here: #1948 (comment)

@github-actions

Copy link
Copy Markdown

🚨 Heads up: uipath-langchain cross-tests are FAILING 🚨

Your changes may break the uipath-langchain-python integration.

⚠️ These checks are NOT enforced by branch protection rules. Please review the failures before merging.

🔍 Inspect the failed run →

This branch has not been deployed

No deployments
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.

3 participants