fix: preserve fallback provider attribution on llm node spans - #7374
Conversation
Record the node's request identity when its first nested LLM stream is created. The serving-provider update can then survive completion instead of being overwritten by the provider captured before failover.
longcw
left a comment
There was a problem hiding this comment.
from claude code:
What it misses. On the request where the failover happens, FallbackAdapter.model still returns the primary: _next_instance() marks the primary unavailable only after it fails. FallbackLLMStream._run then writes gen_ai.provider.name and gen_ai.response.model to _caller_span, but not gen_ai.request.model. The node span ends with the primary's request model beside the fallback's provider — the same mismatched pair, reversed. The
Yeah, this is expected from this change:
after fallback: previously:
now:
so the fallback (requested A but B responded) is clear. |
After failover,
llm_nodecould report the fallback model with the primary provider. Preserve the serving-provider update from #7137 by recording the node's request identity before nested inference starts.Addresses AGT-3551: issue.
The full local type check reports existing plugin dependency errors also present on
main; the core package passes.Initial prompt and agent context
Model: GPT-6
The requested issue is the
llm_nodeprovider overwrite found during the preceding telemetry review. The fallback stream records the serving provider, then node completion overwrites it with the original provider. This PR preserves the per-request attribution.