Fix task_defer method with non-JSON next_kwargs in TaskInstance#64714
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Fixes TaskInstance.defer_task() so next_kwargs containing non-JSON-serializable objects (e.g., datetime, timedelta) are converted into a JSON-safe form before being persisted.
Changes:
- Serialize
start_trigger_args.next_kwargsvia Airflow SDK serde before assigning toTaskInstance.next_kwargs. - Add a unit test covering
defer_task()with non-JSON-nativenext_kwargsvalues.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| airflow-core/src/airflow/models/taskinstance.py | Serializes next_kwargs during deferral to avoid non-JSON values being stored. |
| airflow-core/tests/unit/models/test_taskinstance.py | Adds regression test verifying serde roundtrip for non-JSON next_kwargs. |
…s from TaskInstance
…ext_kwargs for start_trigger_args with defer_task method of TaskInstance
jscheffl
left a comment
There was a problem hiding this comment.
This is a test only PR meanwhile? Other changes went on main with another PR?
Backport failed to create: v3-2-test. View the failure log Run detailsNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
You can attempt to backport this manually by running: cherry_picker 4d3f52b v3-2-testThis should apply the commit to the v3-2-test branch and leave the commit in conflict state marking After you have resolved the conflicts, you can continue the backport process by running: cherry_picker --continueIf you don't have cherry-picker installed, see the installation guide. |
Fix serialization in task_defer method with non-JSON next_kwargs of TaskInstance as mentioned by @kaxil in PR #55068.
Was generative AI tooling used to co-author this PR?
{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.