Repository navigation
Show common.ai retry policies why each fallback connection failed - #76999
Merged
Lee-W merged 11 commits intoNov 18, 2026
Merged
Conversation
Lee-W
force-pushed
the
common-ai-fallback-retry-classification
branch
from
November 13, 2026 06:08
2afe541 to
5f387f2
Compare
kaxil
reviewed
Nov 15, 2026
Lee-W
force-pushed
the
common-ai-fallback-retry-classification
branch
from
November 16, 2026 03:19
4a6a184 to
ae6caf1
Compare
kaxil
reviewed
Nov 17, 2026
kaxil
approved these changes
Nov 17, 2026
… member error in retry prompts
…ports stay free of pydantic-ai
FallbackChainExhaustedError.replayed_steps and recorded_steps stay None unless a journal was already recording. Add find_active_journal(), which reads the journal without creating one.
… rate-limit classes FallbackChainExhaustedError is only raised by the operators, their subclasses and the @task.llm and @task.agent decorators. A plain @task that runs an agent built with PydanticAIHook gets pydantic-ai's own FallbackExceptionGroup, without member_errors or journal progress, so provider_fallback, recovery and retry_policies now say which path raises which error. Telling a rate limit from a bad request in a rule needs ModelRateLimitError (pydantic-ai-slim 2.59.0) and ModelRequestRejectedError (2.62.0). On the provider's 2.46.0 floor both are a plain ModelHTTPError, so the docs now state the version needs.
The rule order test listed the group catch-all first, so it passed whether the policy tried rule by rule or target by target. It now lists the member rule first and the group catch-all after it, and expects the member rule to win. Looping over targets in the outer loop reaches the group catch-all first and fails the test.
recovery.rst said every durable task raises FallbackChainExhaustedError once the chain fails. Only the operators, their subclasses and the @task.llm and @task.agent decorators do; a plain @task that runs an agent with AirflowDurability gets pydantic-ai's FallbackExceptionGroup. Airflow retries both, so the sentence now says so. retry_policies.rst also claimed that before 2.59.0 no rule can tell a 429 from a 400. From 2.59.0 a 429 is ModelRateLimitError, so a rule can single out a rate limit but not a rejected request until 2.62.0. The paragraphs touched by the previous documentation commit are rewrapped to the surrounding line width.
Lee-W
force-pushed
the
common-ai-fallback-retry-classification
branch
from
November 18, 2026 02:04
ae6caf1 to
0635735
Compare
1 task done
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
When every connection of a
fallback_conn_idschain fails,LLMOperatorandAgentOperatorraise pydantic-ai'sFallbackExceptionGroup.RetryRulecompares one exception type withisinstance, so a rule written for a provider-specific exception such asModelHTTPErrorstops matching once a chain is configured. A rule set that retries rate limits but fails bad requests collapses into one rule. The classifier prompt ofLLMRetryPolicyandClassifierRetryPolicysees only the group's message, not what each connection raised. (This is the gap the previous docs inretry_policies.rstandrecovery.rstdescribed.)What
providers/common/ai/src/airflow/providers/common/ai/fallback_exceptions.py(new): addsFallbackChainExhaustedError, a subclass ofFallbackExceptionGroup. It exposesmember_errors(each connection's error, in chain order) andreplayed_steps/recorded_steps(durable journal progress of the failed attempt,Nonewhen the run was not durable). It lives outsidecommon.ai.exceptionsso that module stays importable without pydantic-ai..../mixins/cancellable_run.py:run_agent_syncre-raises aFallbackExceptionGroupasFallbackChainExhaustedError,fromthe original group (kept as__cause__), filling the journal counts from the current journal. An error that is already aFallbackChainExhaustedErroris not wrapped again..../policies/retry.py:fallback_rulesofLLMRetryPolicyandClassifierRetryPolicyare tried, rule by rule in the listed order, against the chain's own error and then against the last connection's error. The last connection decides when members disagree. A decision taken on it ends its reason with(last chain member).chain member N of M: <Type>: <message>, redacted and limited tomax_exception_lengthper member, so one long message cannot push the last member out. Withdurable=Trueit also states how many steps the attempt replayed and recorded. The prompt-building code was split into a_limithelper to share the redact-then-truncate step.include_traceback=Truepath adds no member lines (it already formats the group).Was generative AI tooling used to co-author this PR?
Generated-by: [Claude] following the guidelines
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.