feat(relay): report answer fallback in routing marks - #612
Draft
afourniernv wants to merge 2 commits into
Draft
Conversation
Signed-off-by: Alex Fournier <afournier@nvidia.com>
Signed-off-by: Alex Fournier <afournier@nvidia.com>
afourniernv
force-pushed
the
codex/relay-answer-fallback-telemetry
branch
from
September 3, 2026 17:33
2876b35 to
9713c0f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The routing decision currently records the model Switchyard selected, while the Relay LLM span records the model that eventually answered. If the selected model fails and Switchyard falls back, neither record explains the difference, and the failed answer attempt is not visible.
This makes the complete serving path visible without changing routing, retries, fallback, responses, or metrics.
What changed
switchyard.routing.decisionserved_modelandfallback_usedfields.switchyard.routing.llm_callTrace shape
Before, fallback has to be inferred from the selected model and the outer response:
After, both answer attempts and the final serving path are explicit:
With an agent scope, Relay parents the LLM span and Switchyard marks into one trace. The smoke harness used for these screenshots had no agent scope, so Phoenix displays them as separate roots.
Live Phoenix result
Before
The decision records
model/weak, while the successful LLM span reportsmodel/strong. There is no fallback field or failed-attempt mark.After
The decision reports the selected and served models and
fallback_used = true. Two answer-call marks showmodel/weakfailing beforemodel/strongsucceeds.Answer-candidate attempt details
Contract notes
served_modelandfallback_usedarenullwhen serving metadata is unavailable.outcome = okand latency cover creation of the upstream stream. Later stream failures continue throughswitchyard.routing.error.Testing
model/weakreturned HTTP 503,model/strongsucceeded, and the resulting marks were verified in Phoenix.fallback_used = false.