Tcc0403 commented on code in PR #58753:
URL: https://github.com/apache/airflow/pull/58753#discussion_r2567687932


##########
airflow-core/src/airflow/models/trigger.py:
##########
@@ -413,7 +413,7 @@ def handle_event_submit(event: TriggerEvent, *, 
task_instance: TaskInstance, ses
     from airflow.utils.state import TaskInstanceState
 
     # Get the next kwargs of the task instance, or an empty dictionary if it 
doesn't exist
-    next_kwargs = task_instance.next_kwargs or {}
+    next_kwargs = cast("dict[str, Any]", task_instance.next_kwargs or {})

Review Comment:
   
   There is a similar case where `next_kwargs` is deserialized first if it's a 
str. 
   
   
https://github.com/apache/airflow/blob/3928c9dfddde134d9894da72c67d8ca25fe35a29/airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances.py#L513-L519
   
   Perhaps the solution would be something like this?
   ```suggestion
       next_kwargs = task_instance.next_kwargs or {}
       if isinstance(next_kwargs, str):
           from airflow.serialization.serialized_objects import 
BaseSerialization 
       
           next_kwargs = BaseSerialization.deserialize(next_kwargs)
   ```



-- 
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