You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Lee-W (via GitHub)" <gi...@apache.org> on 2026/10/08 08:14:08 UTC
[PR] Make common.ai hooks report misconfiguration instead of failing silently [airflow]
Lee-W opened a new pull request, #74451:
URL: https://github.com/apache/airflow/pull/74451
## Why
`apache-airflow-providers-common-ai` is heading to 1.0. After that, changing a public hook's behaviour needs a deprecation cycle. This PR fixes the silent failures and signature inconsistencies in the hooks now, before that constraint applies.
## What
- `PydanticAIHook.test_connection` now names the provider and the ignored connection fields when the provider class rejects the connection's credentials and the hook retries with environment-variable auth. This also covers connections in `fallback_conn_ids` (reported as `<conn_id>: <provider> (ignored: <fields>)`). Before, it returned a plain "Model resolved successfully." in that case. `docs/provider_fallback.rst` is updated to match.
- `MCPHook` validates the stdio `args` extra (must be a string or a list of strings) and the `timeout` extra (must be a non-negative finite number; `0` and `null` still mean no init timeout). Invalid values raise `ValueError` naming the connection. `docs/connections/mcp.rst` is updated.
- `MCPHook.get_conn` raises `AirflowOptionalProviderFeatureException` instead of a bare `ImportError` when the `mcp` dependency is missing. Importing the `LLMRetryPolicy` module on Airflow < 3.3 now raises the same exception.
- `LlamaIndexHook.test_connection` now reads the LLM's `.metadata`, so a model name that LlamaIndex's OpenAI class rejects (for example an Ollama or vLLM model) is reported as a failure. Before, it passed and failed only on the first `.chat()` call. It still does not call the LLM, so a revoked key or unreachable host still passes (docstring updated).
- **Breaking:** `LangChainHook` and `LlamaIndexHookd_model` as keyword-only arguments. The two hooks had these two parameters in opposite positional order, so positional calls were easy to get wrong. Callers passing them positionally
must switch to keywords.
- The `vertexai` connection field is labelled "Deprecated and ignored" in `provider.yaml` and `get_provider_info.py`. Behaviour is
unchanged, since the field was already ignored.
<!-- SPDX-License-Identifier: Apache-2.0
https://www.apache.org/licenses/LICENSE-2.0 -->
<!--
Thank you for contributing!
Please provide above a brief description of the changes made in this pull request.
Write a good git commit message following this guide: https://chris.beams.io/posts/git-commit/
Please make sure that your code changes are covered with tests.
And in case of new features or big changes remember to adjust the documentation.
For user-facing UI changes, please attach before/after screenshots (or a short
screen recording) so reviewers can assess the visual impact.
Feel free to ping (in general) for the review if you do not see reaction for a few days
(72 Hours is the minimum reaction time you can expect from volunteers) - we sometimes miss notifications.
In case of an existing issue, reference it using one of the following:
* closes: #ISSUE
* related: #ISSUE
-->
---
##### Was generative AI tooling used to co-author this PR?
<!--
If generative AI tooling has been used in the process of authoring this PR, please
change below checkbox to `[X]` followed by the name of the tool, uncomment the "Generated-by".
-->
- [x] Yes (please specify the tool below)
<!--
Generated-by: [Claude] following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
-->
---
* Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
* For fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
* When adding dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
* For significant user-facing changes create newsfragment: `{pr_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments). You can add this file in a follow-up commit after the PR is created so you know the PR number.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make common.ai hooks report misconfiguration instead of failing silently [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #74451:
URL: https://github.com/apache/airflow/pull/74451#discussion_r4227752372
##########
providers/common/ai/tests/unit/common/ai/hooks/test_langchain.py:
##########
@@ -72,6 +72,11 @@ def test_embed_conn_falls_back_to_llm_conn(self):
assert hook.llm_conn_id == "my_conn"
assert hook.embed_conn_id == "my_conn"
+ def test_model_arguments_are_keyword_only(self):
+ """``llm_model`` / ``embed_model`` sit in opposite order across the two hooks."""
Review Comment:
Change the docstrings to say what the tests pin.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make common.ai hooks report misconfiguration instead of failing silently [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #74451:
URL: https://github.com/apache/airflow/pull/74451#discussion_r4273393633
##########
providers/common/ai/src/airflow/providers/common/ai/hooks/pydantic_ai.py:
##########
@@ -406,13 +406,12 @@ def _resolve_own_model(
def _provider_factory(pname: str) -> Any:
try:
return infer_provider_class(pname)(**_kwargs)
- except TypeError:
- self.log.warning(
- "Provider '%s' rejected kwargs %s; falling back to env-var auth",
- pname,
- list(_kwargs),
- )
- return infer_provider(pname)
+ except TypeError as e:
+ raise ValueError(
+ f"Provider '{pname}' rejected the credentials from connection "
Review Comment:
Reworded to "Could not build provider 'X' from the fields on connection 'Y'", keeping the fields passed and the `TypeError` text. Updated the hook docstring, `provider_fallback.rst` and the two test names that still said "credentials".
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make common.ai hooks report misconfiguration instead of failing silently [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #74451:
URL: https://github.com/apache/airflow/pull/74451#discussion_r4227738034
##########
providers/common/ai/src/airflow/providers/common/ai/policies/retry.py:
##########
@@ -66,7 +67,7 @@
RetryPolicy,
)
except ImportError:
- raise ImportError(
+ raise AirflowOptionalProviderFeatureException(
Review Comment:
Sure, changed it ot ctach `(ImportError, AirflowOptionalProviderFeatureException)`.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make common.ai hooks report misconfiguration instead of failing silently [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on code in PR #74451:
URL: https://github.com/apache/airflow/pull/74451#discussion_r4237632760
##########
providers/common/ai/src/airflow/providers/common/ai/hooks/pydantic_ai.py:
##########
@@ -406,13 +406,12 @@ def _resolve_own_model(
def _provider_factory(pname: str) -> Any:
try:
return infer_provider_class(pname)(**_kwargs)
- except TypeError:
- self.log.warning(
- "Provider '%s' rejected kwargs %s; falling back to env-var auth",
- pname,
- list(_kwargs),
- )
- return infer_provider(pname)
+ except TypeError as e:
+ raise ValueError(
+ f"Provider '{pname}' rejected the credentials from connection "
+ f"'{self.llm_conn_id}' (ignored: {', '.join(_kwargs)}). Not falling back to "
Review Comment:
This always lists every kwarg as ignored and drops the `TypeError` text, and `test_connection` returns only `str(e)`, so the connection test never says which field broke. A `litellm:` connection with Host set reports `(ignored: api_key, base_url)` when only `base_url` is wrong (`LiteLLMProvider` takes `api_base`), and `PydanticAIVertexHook` with a `google:` model reports `project, location` as rejected credentials because `GoogleProvider` doesn't take them. Could the message include `{e}` and say "fields passed" rather than "ignored", now that the whole connection is refused?
##########
providers/common/ai/docs/provider_fallback.rst:
##########
@@ -195,15 +195,11 @@ Two checks, neither of which requires waiting for a real outage:
*Test the connection.* ``test_connection`` on the primary resolves every connection in the
chain, so a fallback with a missing ``model`` or an unknown connection ID is reported by name
there rather than discovered mid-incident. Credential fields a provider class rejects with a
-``TypeError`` are caught by the hook, which retries with the env-var-based provider
-constructor and logs a warning either way; if the required env var is also missing, that
-retry raises ``pydantic_ai.exceptions.UserError``, which ``test_connection`` does surface
-since it wraps the whole resolution in a broad exception handler. What it cannot show is the
-opposite case: the env var *is* set on the worker, the retry quietly succeeds, and
-``test_connection`` reports success even though the credentials you configured on the
-connection were silently ignored -- check the logs for that warning rather than relying on
-``test_connection`` alone. It also does not call the provider, so a well-formed but revoked
-key still passes -- that is what the drill below is for.
+``TypeError`` fail the resolution with a ``ValueError`` naming the connection, the provider and
+the ignored fields -- the hook never falls back to environment-variable auth, which would
Review Comment:
The `LiteLLMProvider` note in `self_hosted_models.rst` (around line 318) still says the hook catches this `TypeError`, logs a warning and falls back to environment-variable auth, and the `test_ignores_connection_password_and_omits_api_key` docstring in `test_cortex_model.py` (lines 66-69) says the same. Both should now describe the `ValueError`. If the message wording above changes, "the ignored fields" here would follow it.
##########
providers/common/ai/src/airflow/providers/common/ai/hooks/mcp.py:
##########
@@ -213,10 +214,10 @@ def get_conn(self) -> Any:
try:
from fastmcp.client.transports import SSETransport, StdioTransport, StreamableHttpTransport
from pydantic_ai.mcp import MCPToolset
- except ImportError:
- raise ImportError(
+ except ImportError as e:
+ raise AirflowOptionalProviderFeatureException(
Review Comment:
`docs/toolsets/index.rst` (lines 115-116) still says a missing `mcp` extra raises `ImportError` when `MCPToolset` first connects, which goes through this `get_conn()`. It now matches the sentence just before it about `SQLToolset` and `DataFusionToolset`, so the two could merge.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make common.ai hooks report misconfiguration instead of failing silently [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on code in PR #74451:
URL: https://github.com/apache/airflow/pull/74451#discussion_r4289938421
##########
providers/common/ai/src/airflow/providers/common/ai/hooks/mcp.py:
##########
@@ -236,13 +237,41 @@ def get_conn(self) -> Any:
raise ValueError(
f"Connection {self.mcp_conn_id!r} requires 'command' in extra for stdio transport."
)
- args = extra.get("args", [])
- if isinstance(args, str):
- args = [args]
+ args = extra.get("args")
+ if args is None:
+ args = []
+ elif isinstance(args, str):
+ if args.strip().startswith("["):
+ try:
+ args = json.loads(args)
+ except ValueError as e:
+ raise ValueError(
+ f"'args' in extra for connection {self.mcp_conn_id!r} looks like a JSON array "
+ f"but is not valid JSON: {args!r}."
+ ) from e
+ else:
+ args = [args]
+ if not isinstance(args, list) or not all(isinstance(arg, str) for arg in args):
+ raise ValueError(
+ f"'args' in extra for connection {self.mcp_conn_id!r} must be a string, a JSON "
+ f"array of strings or a list of strings, got {args!r}."
Review Comment:
This message and the invalid-JSON one above print the whole `args` value, and nothing masks it: the secrets masker only registers extra values under sensitive key names, and `args` isn't one. So a stdio connection like `mcp-remote https://... --header "Authorization: Bearer <tok>"` with one item typed as a number puts the token in the task log. `_validate_env_dict` already reports only the type and key; could these report the type and index of the bad item instead, and drop `{args!r}` from the JSON error?
##########
providers/common/ai/src/airflow/providers/common/ai/hooks/pydantic_ai.py:
##########
@@ -875,8 +873,11 @@ class PydanticAIVertexHook(PydanticAIHook):
above), so its presence alone cannot tell the two platforms apart; guessing
would risk silently authenticating against the wrong endpoint. To use the
Generative Language API, set an explicit ``google:``-prefixed model id (on
- the hook or the connection's ``model`` extra) -- that spelling already
- works today.
+ the hook or the connection's ``model`` extra). ``GoogleProvider`` accepts only
Review Comment:
This now contradicts item 1 of the credential order at the top of the docstring, which says `service_account_info` is passed as `credentials` to `GoogleProvider`. It goes to `GoogleCloudProvider`, which is the class that takes `credentials`, `project` and `location`. The `# Direct GoogleProvider scalar kwargs.` comment above the `project`/`location` loop in `_get_provider_kwargs` has the same mix-up.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make common.ai hooks report misconfiguration instead of failing silently [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #74451:
URL: https://github.com/apache/airflow/pull/74451#discussion_r4310928530
##########
providers/common/ai/src/airflow/providers/common/ai/hooks/mcp.py:
##########
@@ -236,13 +237,41 @@ def get_conn(self) -> Any:
raise ValueError(
f"Connection {self.mcp_conn_id!r} requires 'command' in extra for stdio transport."
)
- args = extra.get("args", [])
- if isinstance(args, str):
- args = [args]
+ args = extra.get("args")
+ if args is None:
+ args = []
+ elif isinstance(args, str):
+ if args.strip().startswith("["):
+ try:
+ args = json.loads(args)
+ except ValueError as e:
+ raise ValueError(
+ f"'args' in extra for connection {self.mcp_conn_id!r} looks like a JSON array "
+ f"but is not valid JSON: {args!r}."
+ ) from e
+ else:
+ args = [args]
+ if not isinstance(args, list) or not all(isinstance(arg, str) for arg in args):
+ raise ValueError(
+ f"'args' in extra for connection {self.mcp_conn_id!r} must be a string, a JSON "
+ f"array of strings or a list of strings, got {args!r}."
Review Comment:
Both the invalid-JSON error and the type-check error no longer include the `args` value. The type-check error now reports the type, plus the index of the first non-string item, in the same style as `_validate_env_dict`.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make common.ai hooks report misconfiguration instead of failing silently [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #74451:
URL: https://github.com/apache/airflow/pull/74451#discussion_r4227757145
##########
providers/common/ai/src/airflow/providers/common/ai/hooks/mcp.py:
##########
@@ -239,7 +239,23 @@ def get_conn(self) -> Any:
args = extra.get("args", [])
if isinstance(args, str):
args = [args]
+ if not isinstance(args, list) or not all(isinstance(arg, str) for arg in args):
+ raise ValueError(
+ f"'args' in extra for connection {self.mcp_conn_id!r} must be a string or a "
+ f"list of strings, got {args!r}."
+ )
timeout = extra.get("timeout", 10)
+ # ``None`` and ``0`` are kept valid: fastmcp's ``normalize_timeout_to_seconds``
+ # treats both as "no init timeout".
Review Comment:
`init_timeout=None` is replaced by `settings.client_init_timeout` before normalizing. A `null` timeout is now mapped to `0` before building the toolset, and the comment is updated to say why.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make common.ai hooks report misconfiguration instead of failing silently [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on code in PR #74451:
URL: https://github.com/apache/airflow/pull/74451#discussion_r4243797550
##########
providers/common/ai/src/airflow/providers/common/ai/hooks/pydantic_ai.py:
##########
@@ -873,11 +871,10 @@ def _get_provider_kwargs(
# "vertexai" predates pydantic-ai splitting GoogleProvider (Generative Language API)
# from GoogleCloudProvider (Vertex AI, which hardcodes vertexai=True internally and
# accepts no such constructor kwarg) in pydantic/pydantic-ai#5336. Forwarding it would
- # raise TypeError, which the base hook's `except TypeError` in get_conn() would then
- # catch: it logs a warning and falls back to env-var auth rather than raising --
- # authenticating as the wrong identity (with *all* other kwargs discarded). Accept
- # the field for backward compatibility but never forward it: which API is used is
- # now controlled by the model prefix.
+ # raise TypeError, which the base hook's `except TypeError` in get_conn() would turn
+ # into a ValueError rejecting the whole connection. Accept the field for backward
Review Comment:
With the fail-closed change, a Vertex connection set up like its form placeholder (`project` and `location` filled in) plus a `google:` model now errors, because this method forwards `project`/`location` whatever the prefix and `GoogleProvider` only takes `api_key`/`base_url` (`unexpected keyword argument 'project'` on pydantic-ai 2.54). The class docstring ("that spelling already works today") and the Model field in `docs/connections/pydantic_ai_vertex.rst` ("routes to a different provider regardless of which fields this connection sets") only held because of the env-var fallback that's now gone. Could both say that `google:` on this connection type needs `api_key` and no Vertex-only fields?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make common.ai hooks report misconfiguration instead of failing silently [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #74451:
URL: https://github.com/apache/airflow/pull/74451#discussion_r4310808773
##########
providers/common/ai/src/airflow/providers/common/ai/hooks/pydantic_ai.py:
##########
@@ -875,8 +873,11 @@ class PydanticAIVertexHook(PydanticAIHook):
above), so its presence alone cannot tell the two platforms apart; guessing
would risk silently authenticating against the wrong endpoint. To use the
Generative Language API, set an explicit ``google:``-prefixed model id (on
- the hook or the connection's ``model`` extra) -- that spelling already
- works today.
+ the hook or the connection's ``model`` extra). ``GoogleProvider`` accepts only
Review Comment:
The docstring now says `service_account_info` goes to `GoogleCloudProvider` as `credentials`. The comment in `_get_provider_kwargs` now says `GoogleCloudProvider` takes `api_key`/`project`/`location`/`base_url`, while `GoogleProvider` only takes `api_key`/`base_url`.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make common.ai hooks report misconfiguration instead of failing silently [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on code in PR #74451:
URL: https://github.com/apache/airflow/pull/74451#discussion_r4352755181
##########
providers/common/ai/src/airflow/providers/common/ai/hooks/llamaindex.py:
##########
@@ -115,9 +116,9 @@ def __init__(
self,
llm_conn_id: str | None = None,
embed_conn_id: str | None = None,
- embed_model: str | None = None,
- llm_model: str | None = None,
*,
Review Comment:
1.0.0 shipped on 2026-10-19 with `llm_model` and `embed_model` positional here. `LlamaIndexHook("c", None, "text-embedding-3-small")` worked on 1.0.0 and raises `TypeError` with this change. Both hooks are experimental in `stability.rst`, and that page asks for breaking changes to experimental features to be announced in the changelog. Could you add a note under the Changelog header in `docs/changelog.rst`? I'd put the fail-closed `ValueError` from `PydanticAIHook` in it too, and the retry module's switch to `AirflowOptionalProviderFeatureException`: the 1.0.0 example used `except ImportError:`, so Dags that copied it need a wider guard on 2.11 to 3.2. The PR body also still says "heading to 1.0", and the Breaking bullet reads "`LlamaIndexHookd_model`".
##########
providers/common/ai/src/airflow/providers/common/ai/hooks/pydantic_ai.py:
##########
@@ -451,13 +451,12 @@ def _resolve_own_model(
def _provider_factory(pname: str) -> Any:
try:
return infer_provider_class(pname)(**_kwargs)
- except TypeError:
- self.log.warning(
- "Provider '%s' rejected kwargs %s; falling back to env-var auth",
- pname,
- list(_kwargs),
- )
- return infer_provider(pname)
+ except TypeError as e:
+ raise ValueError(
+ f"Could not build provider '{pname}' from the fields on connection "
Review Comment:
The rationale comment in `tests/unit/common/ai/test_provider_metadata.py` (lines 136-143) still says `_provider_factory` catches this `TypeError` and retries via `infer_provider(pname)`, and that the Codex CLI login works "via that fallback". With this change an `openai-codex:` model on a connection with a password or host raises here, and the ambient login only applies when neither is set. The conclusion still holds; just the mechanism it describes is gone.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make common.ai hooks report misconfiguration instead of failing silently [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #74451:
URL: https://github.com/apache/airflow/pull/74451#discussion_r4255540892
##########
providers/common/ai/src/airflow/providers/common/ai/hooks/pydantic_ai.py:
##########
@@ -406,13 +406,12 @@ def _resolve_own_model(
def _provider_factory(pname: str) -> Any:
try:
return infer_provider_class(pname)(**_kwargs)
- except TypeError:
- self.log.warning(
- "Provider '%s' rejected kwargs %s; falling back to env-var auth",
- pname,
- list(_kwargs),
- )
- return infer_provider(pname)
+ except TypeError as e:
+ raise ValueError(
+ f"Provider '{pname}' rejected the credentials from connection "
+ f"'{self.llm_conn_id}' (ignored: {', '.join(_kwargs)}). Not falling back to "
Review Comment:
Changed it to "fields passed" and included the provider's `TypeError` text.
##########
providers/common/ai/docs/provider_fallback.rst:
##########
@@ -195,15 +195,11 @@ Two checks, neither of which requires waiting for a real outage:
*Test the connection.* ``test_connection`` on the primary resolves every connection in the
chain, so a fallback with a missing ``model`` or an unknown connection ID is reported by name
there rather than discovered mid-incident. Credential fields a provider class rejects with a
-``TypeError`` are caught by the hook, which retries with the env-var-based provider
-constructor and logs a warning either way; if the required env var is also missing, that
-retry raises ``pydantic_ai.exceptions.UserError``, which ``test_connection`` does surface
-since it wraps the whole resolution in a broad exception handler. What it cannot show is the
-opposite case: the env var *is* set on the worker, the retry quietly succeeds, and
-``test_connection`` reports success even though the credentials you configured on the
-connection were silently ignored -- check the logs for that warning rather than relying on
-``test_connection`` alone. It also does not call the provider, so a well-formed but revoked
-key still passes -- that is what the drill below is for.
+``TypeError`` fail the resolution with a ``ValueError`` naming the connection, the provider and
+the ignored fields -- the hook never falls back to environment-variable auth, which would
Review Comment:
Updated both `self_hosted_models.rst` and `test_cortex_model.py` docstring to describe the `ValueError` instead of the env-var fallback.
##########
providers/common/ai/src/airflow/providers/common/ai/hooks/mcp.py:
##########
@@ -213,10 +214,10 @@ def get_conn(self) -> Any:
try:
from fastmcp.client.transports import SSETransport, StdioTransport, StreamableHttpTransport
from pydantic_ai.mcp import MCPToolset
- except ImportError:
- raise ImportError(
+ except ImportError as e:
+ raise AirflowOptionalProviderFeatureException(
Review Comment:
Updated `docs/toolsets/index.rst` to say a missing `mcp` extra raises `AirflowOptionalProviderFeatureException`, merged with the sentence about the other toolsets.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make common.ai hooks report misconfiguration instead of failing silently [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on code in PR #74451:
URL: https://github.com/apache/airflow/pull/74451#discussion_r4218124576
##########
providers/common/ai/src/airflow/providers/common/ai/hooks/mcp.py:
##########
@@ -239,7 +239,23 @@ def get_conn(self) -> Any:
args = extra.get("args", [])
if isinstance(args, str):
args = [args]
+ if not isinstance(args, list) or not all(isinstance(arg, str) for arg in args):
+ raise ValueError(
+ f"'args' in extra for connection {self.mcp_conn_id!r} must be a string or a "
+ f"list of strings, got {args!r}."
+ )
timeout = extra.get("timeout", 10)
+ # ``None`` and ``0`` are kept valid: fastmcp's ``normalize_timeout_to_seconds``
+ # treats both as "no init timeout".
Review Comment:
This holds for `0` but not quite for `None`. `MCPToolset` passes `init_timeout=None` through unchanged, and fastmcp's `Client.__init__` replaces `None` with `fastmcp.settings.client_init_timeout` before normalizing. So on a worker with `FASTMCP_CLIENT_INIT_TIMEOUT` set, a `null` timeout still times out. Mapping `None` to `0` before building the toolset would make this comment and the `mcp.rst` line true in every case.
##########
providers/common/ai/tests/unit/common/ai/hooks/test_mcp.py:
##########
@@ -207,6 +209,54 @@ def test_stdio_without_command_raises(self):
with pytest.raises(ValueError, match="requires 'command'"):
hook.get_conn()
+ def test_missing_mcp_dependency_raises_optional_feature_exception(self):
+ hook = MCPHook(mcp_conn_id="test_conn")
+ with patch.dict(sys.modules, {"fastmcp.client.transports": None}):
+ with pytest.raises(AirflowOptionalProviderFeatureException, match="pydantic-ai-slim"):
+ hook.get_conn()
+
+ @pytest.mark.parametrize("bad_args", [{"a": 1}, ["-m", 1], 5], ids=["dict", "non_string_item", "int"])
+ def test_stdio_invalid_args_raises(self, bad_args):
+ hook = MCPHook(mcp_conn_id="test_conn")
+ conn = Connection(
+ conn_id="test_conn",
+ conn_type="mcp",
+ extra=json.dumps({"transport": "stdio", "command": "uvx", "args": bad_args}),
+ )
+ with patch.object(hook, "get_connection", return_value=conn):
+ with pytest.raises(ValueError, match="'args' in extra"):
+ hook.get_conn()
+
+ @pytest.mark.parametrize(
+ "bad_timeout",
+ ["30", -5, -0.5, float("nan"), float("inf"), True, [10]],
+ ids=["str", "neg", "neg_float", "nan", "inf", "bool", "list"],
+ )
+ def test_stdio_invalid_timeout_raises(self, bad_timeout):
+ hook = MCPHook(mcp_conn_id="test_conn")
+ conn = Connection(
+ conn_id="test_conn",
+ conn_type="mcp",
+ extra=json.dumps({"transport": "stdio", "command": "uvx", "args": [], "timeout": bad_timeout}),
+ )
+ with patch.object(hook, "get_connection", return_value=conn):
+ with pytest.raises(ValueError, match="'timeout' in extra"):
+ hook.get_conn()
+
+ @patch(_MCP_TOOLSET, autospec=True)
+ @patch(_STDIO_TRANSPORT, autospec=True)
+ def test_stdio_float_zero_and_null_timeout_accepted(self, mock_transport_cls, mock_toolset_cls):
Review Comment:
Could this be parametrized like the two tests above it? With the loop a failure doesn't say which timeout value broke, and the mocks are shared across iterations.
##########
providers/common/ai/src/airflow/providers/common/ai/hooks/pydantic_ai.py:
##########
@@ -412,6 +415,7 @@ def _provider_factory(pname: str) -> Any:
pname,
list(_kwargs),
)
+ self._env_auth_fallbacks.append(f"{pname} (ignored: {', '.join(_kwargs)})")
Review Comment:
This makes `test_connection` honest, but at task runtime the swap is still only a log warning, and the Vertex comment further down calls this path authenticating as the wrong identity. Since this PR is about settling hook behaviour while it can still change freely, would it be worth failing closed here (a `ValueError` built from this same string), or making the env-var fallback opt-in? Fine as a follow-up if you'd rather keep this PR scoped.
##########
providers/common/ai/tests/unit/common/ai/hooks/test_langchain.py:
##########
@@ -72,6 +72,11 @@ def test_embed_conn_falls_back_to_llm_conn(self):
assert hook.llm_conn_id == "my_conn"
assert hook.embed_conn_id == "my_conn"
+ def test_model_arguments_are_keyword_only(self):
+ """``llm_model`` / ``embed_model`` sit in opposite order across the two hooks."""
Review Comment:
After this PR both hooks declare `llm_model` before `embed_model`, so this docstring describes the old signature. Maybe say what the test pins instead (the model arguments can't be passed positionally). Same docstring in `test_llamaindex.py`.
##########
providers/common/ai/src/airflow/providers/common/ai/policies/retry.py:
##########
@@ -66,7 +67,7 @@
RetryPolicy,
)
except ImportError:
- raise ImportError(
+ raise AirflowOptionalProviderFeatureException(
Review Comment:
`AirflowOptionalProviderFeatureException` isn't an `ImportError` subclass, so the `except ImportError:` guard in `example_dags/example_llm_retry_policy.py` (line 173, "example DAG is skipped on older versions") no longer catches this on Airflow 2.11 to 3.2. Any user Dag that copied that guard breaks the same way. Could the example catch `(ImportError, AirflowOptionalProviderFeatureException)`, or import `airflow.sdk.definitions.retry_policy` first inside the `try` so older cores still fail with `ImportError`?
##########
providers/common/ai/src/airflow/providers/common/ai/hooks/mcp.py:
##########
@@ -239,7 +239,23 @@ def get_conn(self) -> Any:
args = extra.get("args", [])
if isinstance(args, str):
args = [args]
+ if not isinstance(args, list) or not all(isinstance(arg, str) for arg in args):
Review Comment:
Since this is now where `args` gets validated, could it also handle the two shapes the connection form produces? `provider.yaml` declares `args` as a nullable string and the form writes blank fields as `null`, so a stdio connection with Arguments left empty ends up with `"args": null` and is rejected here (it already failed before, just later in `StdioServerParameters`). And the field description asks for a JSON array, but typing `["mcp-run-python"]` gets wrapped as one literal argument by the `isinstance(args, str)` branch above and passes this check. Treating `None` as `[]` and `json.loads`-ing a string that starts with `[` would cover both. I traced the form path in code, didn't run the UI.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make common.ai hooks report misconfiguration instead of failing silently [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #74451:
URL: https://github.com/apache/airflow/pull/74451#discussion_r4273390753
##########
providers/common/ai/src/airflow/providers/common/ai/hooks/pydantic_ai.py:
##########
@@ -406,13 +406,12 @@ def _resolve_own_model(
def _provider_factory(pname: str) -> Any:
try:
return infer_provider_class(pname)(**_kwargs)
- except TypeError:
- self.log.warning(
- "Provider '%s' rejected kwargs %s; falling back to env-var auth",
- pname,
- list(_kwargs),
- )
- return infer_provider(pname)
+ except TypeError as e:
+ raise ValueError(
Review Comment:
`_hook()` now goes through `PydanticAIHook.get_hook()`, so a `pydanticai_azure` connection resolves to `PydanticAIAzureHook`. Added a test that checks this.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make common.ai hooks report misconfiguration instead of failing silently [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W merged PR #74451:
URL: https://github.com/apache/airflow/pull/74451
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make common.ai hooks report misconfiguration instead of failing silently [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #74451:
URL: https://github.com/apache/airflow/pull/74451#discussion_r4227743962
##########
providers/common/ai/tests/unit/common/ai/hooks/test_mcp.py:
##########
@@ -207,6 +209,54 @@ def test_stdio_without_command_raises(self):
with pytest.raises(ValueError, match="requires 'command'"):
hook.get_conn()
+ def test_missing_mcp_dependency_raises_optional_feature_exception(self):
+ hook = MCPHook(mcp_conn_id="test_conn")
+ with patch.dict(sys.modules, {"fastmcp.client.transports": None}):
+ with pytest.raises(AirflowOptionalProviderFeatureException, match="pydantic-ai-slim"):
+ hook.get_conn()
+
+ @pytest.mark.parametrize("bad_args", [{"a": 1}, ["-m", 1], 5], ids=["dict", "non_string_item", "int"])
+ def test_stdio_invalid_args_raises(self, bad_args):
+ hook = MCPHook(mcp_conn_id="test_conn")
+ conn = Connection(
+ conn_id="test_conn",
+ conn_type="mcp",
+ extra=json.dumps({"transport": "stdio", "command": "uvx", "args": bad_args}),
+ )
+ with patch.object(hook, "get_connection", return_value=conn):
+ with pytest.raises(ValueError, match="'args' in extra"):
+ hook.get_conn()
+
+ @pytest.mark.parametrize(
+ "bad_timeout",
+ ["30", -5, -0.5, float("nan"), float("inf"), True, [10]],
+ ids=["str", "neg", "neg_float", "nan", "inf", "bool", "list"],
+ )
+ def test_stdio_invalid_timeout_raises(self, bad_timeout):
+ hook = MCPHook(mcp_conn_id="test_conn")
+ conn = Connection(
+ conn_id="test_conn",
+ conn_type="mcp",
+ extra=json.dumps({"transport": "stdio", "command": "uvx", "args": [], "timeout": bad_timeout}),
+ )
+ with patch.object(hook, "get_connection", return_value=conn):
+ with pytest.raises(ValueError, match="'timeout' in extra"):
+ hook.get_conn()
+
+ @patch(_MCP_TOOLSET, autospec=True)
+ @patch(_STDIO_TRANSPORT, autospec=True)
+ def test_stdio_float_zero_and_null_timeout_accepted(self, mock_transport_cls, mock_toolset_cls):
Review Comment:
Sure, parametrized. Thanks!
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make common.ai hooks report misconfiguration instead of failing silently [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #74451:
URL: https://github.com/apache/airflow/pull/74451#discussion_r4227774231
##########
providers/common/ai/src/airflow/providers/common/ai/hooks/pydantic_ai.py:
##########
@@ -412,6 +415,7 @@ def _provider_factory(pname: str) -> Any:
pname,
list(_kwargs),
)
+ self._env_auth_fallbacks.append(f"{pname} (ignored: {', '.join(_kwargs)})")
Review Comment:
Done in this PR.
When a provider class rejects the connection's credentials, `get_conn()` raises a `ValueError` naming the connection, the provider and the ignored fields, and never rebuilds from env vars. `test_connection` thus reports it as a failure.
Since nothing records env-var fallbacks any more, I removed `_env_auth_fallbacks` and updated the `provider_fallback.rst` sentence and the Vertex comment that described the old behaviour.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make common.ai hooks report misconfiguration instead of failing silently [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #74451:
URL: https://github.com/apache/airflow/pull/74451#discussion_r4227761631
##########
providers/common/ai/src/airflow/providers/common/ai/hooks/mcp.py:
##########
@@ -239,7 +239,23 @@ def get_conn(self) -> Any:
args = extra.get("args", [])
if isinstance(args, str):
args = [args]
+ if not isinstance(args, list) or not all(isinstance(arg, str) for arg in args):
Review Comment:
Handles both shape now.
* `args: null` is treated as `[]`.
* A string starting with `[` is parsed as JSON; malformed JSON, or an array with a non-string item, raises a `ValueError` naming the connection.
* A plain string without a leading `[` is still one argument.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make common.ai hooks report misconfiguration instead of failing silently [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #74451:
URL: https://github.com/apache/airflow/pull/74451#discussion_r4255549848
##########
providers/common/ai/src/airflow/providers/common/ai/hooks/pydantic_ai.py:
##########
@@ -873,11 +871,10 @@ def _get_provider_kwargs(
# "vertexai" predates pydantic-ai splitting GoogleProvider (Generative Language API)
# from GoogleCloudProvider (Vertex AI, which hardcodes vertexai=True internally and
# accepts no such constructor kwarg) in pydantic/pydantic-ai#5336. Forwarding it would
- # raise TypeError, which the base hook's `except TypeError` in get_conn() would then
- # catch: it logs a warning and falls back to env-var auth rather than raising --
- # authenticating as the wrong identity (with *all* other kwargs discarded). Accept
- # the field for backward compatibility but never forward it: which API is used is
- # now controlled by the model prefix.
+ # raise TypeError, which the base hook's `except TypeError` in get_conn() would turn
+ # into a ValueError rejecting the whole connection. Accept the field for backward
Review Comment:
The `PydanticAIVertexHook` docstring and the Model field in `pydantic_ai_vertex.rst` now say that `google:` on this connection type needs `api_key` and no Vertex-only fields (`project`, `location`, `service_account_info`). Left the forwarding logic as is.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make common.ai hooks report misconfiguration instead of failing silently [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #74451:
URL: https://github.com/apache/airflow/pull/74451#discussion_r4273397813
##########
providers/common/ai/docs/connections/pydantic_ai_vertex.rst:
##########
@@ -57,8 +57,10 @@ Model
mean Vertex AI Express Mode credentials (see "Credentials" below), so its
presence alone cannot tell the two platforms apart. To reach the
Generative Language API instead, prefix the model explicitly with
- ``google:`` -- that spelling routes to a different provider regardless of
- which fields this connection sets.
+ ``google:``. On this connection type that spelling requires ``API Key``
Review Comment:
Fixed both. The Azure page now says a model prefixed with another platform works only if that provider class accepts the forwarded fields, otherwise `get_conn()` raises. The Vertex page and `PydanticAIVertexHook` docstring now say `google:` takes the API key and Custom Endpoint URL (and reads `GOOGLE_API_KEY` without a key), and rejects the Vertex-only fields.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make common.ai hooks report misconfiguration instead of failing silently [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #74451:
URL: https://github.com/apache/airflow/pull/74451#discussion_r4374434332
##########
providers/common/ai/src/airflow/providers/common/ai/hooks/llamaindex.py:
##########
@@ -115,9 +116,9 @@ def __init__(
self,
llm_conn_id: str | None = None,
embed_conn_id: str | None = None,
- embed_model: str | None = None,
- llm_model: str | None = None,
*,
Review Comment:
Update `docs/changelog.rst` with
1. the fail-closed `ValueError` from `PydanticAIHook`, the retry module's `AirflowOptionalProviderFeatureException` (with an `except (ImportError, AirflowOptionalProviderFeatureException)` example for 2.11 to 3.2)
2. the `llm_model`/`embed_model` change
3. Positional use is now deprecated instead of raising `TypeError`: it still works and emits an `AirflowProviderDeprecationWarning`, so 1.0.0 callers like `LlamaIndexHook("c", None, "text-embedding-3-small")` keep working.
PR description was also updated
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make common.ai hooks report misconfiguration instead of failing silently [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #74451:
URL: https://github.com/apache/airflow/pull/74451#discussion_r4374437147
##########
providers/common/ai/src/airflow/providers/common/ai/hooks/pydantic_ai.py:
##########
@@ -451,13 +451,12 @@ def _resolve_own_model(
def _provider_factory(pname: str) -> Any:
try:
return infer_provider_class(pname)(**_kwargs)
- except TypeError:
- self.log.warning(
- "Provider '%s' rejected kwargs %s; falling back to env-var auth",
- pname,
- list(_kwargs),
- )
- return infer_provider(pname)
+ except TypeError as e:
+ raise ValueError(
+ f"Could not build provider '{pname}' from the fields on connection "
Review Comment:
Rewrote it as `get_conn()` re-raises the `TypeError` as a `ValueError` when the connection has a password or host, and that only a connection with neither falls through to the ambient Codex CLI login.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make common.ai hooks report misconfiguration instead of failing silently [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on code in PR #74451:
URL: https://github.com/apache/airflow/pull/74451#discussion_r4268048823
##########
providers/common/ai/src/airflow/providers/common/ai/hooks/pydantic_ai.py:
##########
@@ -406,13 +406,12 @@ def _resolve_own_model(
def _provider_factory(pname: str) -> Any:
try:
return infer_provider_class(pname)(**_kwargs)
- except TypeError:
- self.log.warning(
- "Provider '%s' rejected kwargs %s; falling back to env-var auth",
- pname,
- list(_kwargs),
- )
- return infer_provider(pname)
+ except TypeError as e:
+ raise ValueError(
Review Comment:
One caller outside the diff now hits this on a valid connection. `_ModelRetryPolicy._hook()` (`policies/retry.py:323-326`, shared by `LLMRetryPolicy` and `ClassifierRetryPolicy`) builds a bare `PydanticAIHook` instead of `PydanticAIHook.get_hook()` like the operators, so a `pydanticai_azure` connection gets the base `{api_key, base_url}` kwargs and `AzureProvider` rejects `base_url`. That used to fall back quietly to the `AZURE_OPENAI_*` env vars; now every classification raises this `ValueError`, `evaluate()` logs "classification failed" and uses `fallback_rules`. Could `_hook()` return `PydanticAIHook.get_hook(self.llm_conn_id, hook_params={"model_id": self.model_id})`, with a test that an Azure-typed connection resolves through `PydanticAIAzureHook`?
##########
providers/common/ai/docs/connections/pydantic_ai_vertex.rst:
##########
@@ -57,8 +57,10 @@ Model
mean Vertex AI Express Mode credentials (see "Credentials" below), so its
presence alone cannot tell the two platforms apart. To reach the
Generative Language API instead, prefix the model explicitly with
- ``google:`` -- that spelling routes to a different provider regardless of
- which fields this connection sets.
+ ``google:``. On this connection type that spelling requires ``API Key``
Review Comment:
The Azure page has the same sentence this one used to have: `pydantic_ai_azure.rst` (lines 53-57) says an `openai:` model on an Azure connection bypasses Azure entirely, but `PydanticAIAzureHook._get_provider_kwargs` always forwards Host as `azure_endpoint`, which `OpenAIProvider` doesn't take, so that connection now fails `get_conn()`. It probably wants the same wording as here. On this line, "requires API Key" and "accepts only an API key" are a little stricter than the code, since `GoogleProvider` also takes `base_url` and reads `GOOGLE_API_KEY` when no key is set.
##########
providers/common/ai/src/airflow/providers/common/ai/hooks/pydantic_ai.py:
##########
@@ -406,13 +406,12 @@ def _resolve_own_model(
def _provider_factory(pname: str) -> Any:
try:
return infer_provider_class(pname)(**_kwargs)
- except TypeError:
- self.log.warning(
- "Provider '%s' rejected kwargs %s; falling back to env-var auth",
- pname,
- list(_kwargs),
- )
- return infer_provider(pname)
+ except TypeError as e:
+ raise ValueError(
+ f"Provider '{pname}' rejected the credentials from connection "
Review Comment:
Not every rejected field is a credential. `PydanticAIBedrockHook` always forwards `aws_read_timeout` / `aws_connect_timeout` when set, and `BedrockMantleProvider` takes neither, so a Bedrock connection with a timeout and a `bedrock-mantle:` model is told its credentials were rejected. Something like "could not build provider 'X' from the fields on connection 'Y'" would fit both cases.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org