Commit 31ca370
fix(platform): emit W3C-compliant traceparent so the gateway accepts it
build_trace_context_headers emitted x-uipath-traceparent-id as
"00-{trace}-{span}" with a 32-hex span id and no trace-flags segment. The
LLM Gateway parses this header strictly (UiPath.Tracing.TraceParent.TryParse):
it requires exactly four segments {version}-{32-hex trace}-{16-hex span}-{flags}
and a 16-hex span id. The malformed header was rejected, so the gateway
synthesized a fresh root trace for every LLM call and dropped the inbound
baggage — the gateway's completion (audit) span ended up under a different
traceId with a null parent, orphaned from the agent run, and the jobKey/source
baggage this PR adds never reached the gateway.
Fix: format the span id as 16 hex (`016x`, a span id is 64-bit) and append the
`-01` trace-flags segment. Verified safe for the other consumer (the Agents
backend parser is lenient: >=3 parts, no span-length check). Updated the test
to assert the correct 4-segment / 16-hex shape.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent bfe2c1a commit 31ca370
2 files changed
Lines changed: 15 additions & 6 deletions
File tree
- packages/uipath-platform
- src/uipath/platform/chat
- tests/services
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
39 | 45 | | |
40 | 46 | | |
41 | 47 | | |
| |||
Lines changed: 7 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| |||
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
61 | | - | |
| 63 | + | |
62 | 64 | | |
63 | | - | |
| 65 | + | |
64 | 66 | | |
65 | 67 | | |
66 | | - | |
| 68 | + | |
| 69 | + | |
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
| |||
0 commit comments