Skip to content

fix(dify-agent): handle non-recording application tracing parents - #44803

Merged
zyssyz123 merged 1 commit into
mainfrom
codex/fix-agent-tracing-nonrecording-attributes
Oct 26, 2026
Merged

zyssyz123 merged 1 commit into
mainfrom
codex/fix-agent-tracing-nonrecording-attributes

Conversation

@zyssyz123

Copy link
Copy Markdown
Contributor

Workflow Agent execution fails before its first model call when the ambient platform span is a Logfire ReadableSpan wrapper around an OpenTelemetry NonRecordingSpan. _ApplicationRunTracer assumes every ReadableSpan exposes attributes, causing an AttributeError while selecting the invocation parent. This also prevents the collector's initialization-failure fallback from creating a span.

Treat a wrapper without attributes as unable to prove invocation ownership and use the existing API-issued trace ID and parent span. Attributed descendants belonging to the current invocation keep their hierarchy. No API contract, dependency lock, or sampling/content policy changes.

Validation:

  • Real Pydantic AI Agent/tool execution with Logfire/OpenTelemetry and a local HTTP collector: unsampled Logfire parents reproduce 2 failures before the fix; all 6 parent/content combinations pass after it. Checks retain one canonical root, descendant parent links, invocation attributes, content redaction, and the acknowledged final batch.
  • Frozen Agent package environment: all 80 related tests pass; Ruff, format, targeted Pyrefly, and whitespace checks pass.
  • Additional OTel 1.44 compatibility probe: the 6 targeted cases pass. The broader probe has 75 passes and 5 existing isolated-provider failures, reproduced unchanged on the original HEAD. OTel 1.44's process-wide service.instance.id exposes a separate isolation assumption; this patch does not change that provider logic.

Found during staging regression after #44701 reached the environment via saas-deploy #1172. Successful Workflow inline/reference execution and native provider receipt still require deployment and end-to-end revalidation; local tests are not claimed as a staging acceptance pass.

@github-actions github-actions Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Oct 26, 2026
@zyssyz123
zyssyz123 added this pull request to the merge queue Oct 26, 2026
Merged via the queue into main with commit d3e897c Oct 26, 2026
45 checks passed
@zyssyz123
zyssyz123 deleted the codex/fix-agent-tracing-nonrecording-attributes branch October 26, 2026 08:46
zyssyz123 added a commit that referenced this pull request Oct 26, 2026
zyssyz123 added a commit that referenced this pull request Oct 27, 2026
zyssyz123 added a commit that referenced this pull request Oct 27, 2026
@laipz8200 laipz8200 mentioned this pull request Nov 3, 2026
1 task done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants