kaxil opened a new pull request, #74313: URL: https://github.com/apache/airflow/pull/74313
On pydantic-ai-slim 2.50 or later, an `AgentOperator` retry with `durable=True`, and the resume after a tool approval, fail on Airflow 3.3+ when they load the usage the earlier attempt saved: ``` ValueError: 'run_usage'['audio_seconds'] in the task state store is not an int (got 0.0); delete the key to reset. ``` pydantic-ai 2.50 added `audio_seconds: float` to `RunUsage` (seconds of audio billed, for voice models). `load_run_usage` in `utils/usage_budget.py` walks every `RunUsage` field and, apart from `cost` and `details`, requires an int. The first attempt saves the usage with `audio_seconds=0.0`, so the retry or resume cannot read it back. The provider allows `pydantic-ai-slim>=2.33.0`, so any install that has picked up 2.50+ is affected; CI did not catch it because `uv.lock` pins 2.48.0. Fields declared as `float` now load as floats, still rejecting strings and bools; count fields keep the int check. The loader already carries any new `RunUsage` field through automatically, so this only teaches it the second numeric type. With pydantic-ai-slim 2.52.0 installed, 15 existing tests in `test_agent.py` (durable usage-budget retries) and `test_agent_tool_approval.py` (approve, reject, timeout and cancel on resume) fail on `main` with the error above and pass with this change. The new tests include a round trip through `TypeAdapter(RunUsage)`, the path the resume uses, which runs on every pydantic-ai version, so a future field of another type fails it instead of being skipped. --- * 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
