Lee-W commented on code in PR #76999:
URL: https://github.com/apache/airflow/pull/76999#discussion_r4615239906


##########
providers/common/ai/docs/retry_policies.rst:
##########
@@ -379,15 +379,31 @@ retry behaviour with no change to the Dag. Two things 
follow:
 Separately, and regardless of this policy: if the connection **the task 
itself** uses to call
 the LLM (for example ``llm_conn_id`` on ``LLMOperator`` or ``AgentOperator``) 
carries a fallback
 chain, the exception the task raises once that chain is exhausted is
-``pydantic_ai.exceptions.FallbackExceptionGroup``, not the last provider's own 
exception.
-``RetryRule`` matches with ``isinstance``, so a rule written as
-``RetryRule(exception=ModelHTTPError, ...)`` -- in ``fallback_rules`` here or 
in a plain
-``ExceptionRetryPolicy`` -- stops matching. Match 
``pydantic_ai.exceptions.FallbackExceptionGroup``
-explicitly as well; its only common ancestor with ``ModelAPIError`` is 
``Exception``, too
-broad to write a rule against. The original per-model exceptions are still 
available on
-``FallbackExceptionGroup.exceptions``, but ``RetryRule`` only compares the 
top-level
-exception type, so a rule set that told 429s apart from 400s collapses into 
one rule once
-the chain is in play.
+:class:`~airflow.providers.common.ai.fallback_exceptions.FallbackChainExhaustedError`.
 It subclasses
+``pydantic_ai.exceptions.FallbackExceptionGroup``, so a rule or ``except`` 
clause written for the
+group keeps matching, and it is raised ``from`` the group the chain raised. 
The error each
+connection raised is in ``member_errors``, in chain order.
+
+``RetryRule`` still compares one exception type, so the policies here read the 
members for it:
+in ``fallback_rules``, each rule is tried against the chain's own error and 
then against the
+error of the **last** connection, rule by rule in the order listed. A rule 
written as
+``RetryRule(exception=ModelHTTPError, ...)`` therefore matches again, and a 
rule set that tells
+failures apart by exception type, such as retrying a rate-limit error but 
failing a bad-request

Review Comment:
   Named both classes with their versions, and said that before 2.59.0 a rule 
can't tell a 429 from a 400. The bad-request line in `recovery.rst` points 
there.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to