Repository navigation
feat(tasks): send the current span as ParentSpanId in taskSourceMetadata [ACTN-11909] - #1948
Sahil-Wakode wants to merge 6 commits into
Conversation
6b8b66c to
ff73d76
Compare
There was a problem hiding this comment.
🟢 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
ParentSpanIdis included andInstanceIdis preserved. - Bumps
uipath-platformto0.2.42and 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
| "FolderKey": UiPathConfig.folder_key, | ||
| "JobKey": UiPathConfig.job_key, | ||
| "ProcessKey": UiPathConfig.process_uuid, | ||
| **({"ParentSpanId": format_span_id(span_id)} if span_id else {}), |
There was a problem hiding this comment.
What happens when format_span_id is passed a null span_id
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I meant "" spanId. Empty**. Does format_span_id have adequate null handling? Else, it'll crash the agent runtime entirely
There was a problem hiding this comment.
yes looked over the truthy-falsy case here
It will be false in cases span_id=None or "" or 0
|
@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.
f4e8a78 to
0ef02b5
Compare
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 {}), |
There was a problem hiding this comment.
Please confirm if this is the right spanId
There was a problem hiding this comment.
Yes it shall be the right one as I can see used up in x-uipath-traceparent-id.
We have implemented similar to
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.
🚨 Heads up:
|
|
|
|
||
| def _current_span_id() -> Optional[str]: | ||
| try: | ||
| span = UiPathSpanUtils.get_external_current_span() or trace.get_current_span() |
There was a problem hiding this comment.
What's get_external?
There was a problem hiding this comment.
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)
🚨 Heads up:
|



What
_apply_task_sourcenow addsParentSpanIdtotaskSourceMetadata. It is the span the task is created under, the same one the SDK already sends in thex-uipath-traceparent-idheader (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, andCreateTask/CreateEscalationinterrupts) goes through_apply_task_source, so all of them get it without callers having to pass anything.Changes
_tasks_service.py: addParentSpanIdfrom the current span in_apply_task_source.test_actions_service.py: test that the current span is sent asParentSpanId.Testing
uipath-platformtests: 1892 passed, 11 skipped. The new test fails without this change.ruff format,ruff checkandmypypass.