amoghrajesh commented on code in PR #58900:
URL: https://github.com/apache/airflow/pull/58900#discussion_r2580019745


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/xcom.py:
##########
@@ -335,6 +336,6 @@ def update_xcom_entry(
         )
 
     # Update XCom entry
-    xcom_entry.value = XComModel.serialize_value(xcom_new_value)
+    xcom_entry.value = json.dumps(xcom_new_value)

Review Comment:
   In a way yes. 
   
   If I have a dag like so:
   ```python
   from datetime import datetime
   
   from airflow.decorators import task
   from airflow.models.dag import DAG
   
   with DAG(dag_id="add_dag", schedule=None, start_date=datetime(2022, 3, 4)) 
as dag:
   
       @task
       def add_one(x: int):
           return x + 1
   
       @task
       def add_two(y: int):
           # y is result of add_one
           return y + 1
   
       @task
       def add_all_past_values(**context):
           xcoms = context['ti'].xcom_pull(task_ids=["add_one", "add_two"], 
include_prior_dates=True)
           print(xcoms)
   
   
       res1 = add_one(1)
       add_two(res1)
   
       add_all_past_values()
   
   ```
   
   
   And I patch one of the runs as:
   ```python
   curl -X 'PATCH' \
     
'http://localhost:28080/api/v2/dags/add_dag/dagRuns/manual__2025-12-02T07%3A34%3A26%2B00%3A00/taskInstances/add_one/xcomEntries/return_value'
 \
     -H 'accept: application/json' \
     -H 'Content-Type: application/json' \
     -d '{
     "value": 7,
     "map_index": -1
   }'
   ```
   
   The next run would show output as:
   <img width="1125" height="305" alt="image" 
src="https://github.com/user-attachments/assets/d53edff8-625d-4a1c-b2e5-6f781a85f3c9";
 />
   
   
   Which is wrong.



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