This is an automated email from the ASF dual-hosted git repository.

kaxilnaik pushed a commit to branch v3-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 4b76188ee7d0697375ce6f724c126d7d36dd6416
Author: Wei Lee <[email protected]>
AuthorDate: Fri Sep 12 09:38:42 2025 +0800

    feat(hitl): get rid off "Fallback to defaults" in HITL (#55536)
    
    (cherry picked from commit e41de0880640a98a378764c5e5d52c3ee98578fd)
---
 airflow-core/src/airflow/api_fastapi/execution_api/routes/hitl.py  | 2 +-
 airflow-core/src/airflow/models/hitl.py                            | 5 -----
 .../unit/api_fastapi/execution_api/versions/head/test_hitl.py      | 7 ++-----
 providers/standard/src/airflow/providers/standard/triggers/hitl.py | 7 ++-----
 providers/standard/tests/unit/standard/triggers/test_hitl.py       | 2 +-
 5 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/airflow-core/src/airflow/api_fastapi/execution_api/routes/hitl.py 
b/airflow-core/src/airflow/api_fastapi/execution_api/routes/hitl.py
index 8a6606bd280..85d8e008990 100644
--- a/airflow-core/src/airflow/api_fastapi/execution_api/routes/hitl.py
+++ b/airflow-core/src/airflow/api_fastapi/execution_api/routes/hitl.py
@@ -116,7 +116,7 @@ def update_hitl_detail(
             f"Human-in-the-loop detail for Task Instance with id {ti_id_str} 
already exists.",
         )
 
-    hitl_detail_model.responded_by = HITLDetail.DEFAULT_USER
+    hitl_detail_model.responded_by = None
     hitl_detail_model.response_at = datetime.now(timezone.utc)
     hitl_detail_model.chosen_options = payload.chosen_options
     hitl_detail_model.params_input = payload.params_input
diff --git a/airflow-core/src/airflow/models/hitl.py 
b/airflow-core/src/airflow/models/hitl.py
index e2055344bc3..7f0069688c1 100644
--- a/airflow-core/src/airflow/models/hitl.py
+++ b/airflow-core/src/airflow/models/hitl.py
@@ -167,8 +167,3 @@ class HITLDetail(Base):
             id=self.responded_by["id"],
             name=self.responded_by["name"],
         )
-
-    DEFAULT_USER = HITLUser(
-        id="Fallback to defaults",
-        name="Fallback to defaults",
-    )
diff --git 
a/airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_hitl.py 
b/airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_hitl.py
index 764d5a48ccd..33a1b3e79bc 100644
--- 
a/airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_hitl.py
+++ 
b/airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_hitl.py
@@ -93,7 +93,7 @@ def expected_sample_hitl_detail_dict(sample_ti: TaskInstance) 
-> dict[str, Any]:
                 "params_input": {"input_1": 2},
                 "response_at": convert_to_utc(datetime(2025, 7, 3, 0, 0, 0)),
                 "chosen_options": ["Reject"],
-                "responded_by": {"id": "Fallback to defaults", "name": 
"Fallback to defaults"},
+                "responded_by": None,
             },
         },
     ],
@@ -174,10 +174,7 @@ def test_update_hitl_detail(client: Client, sample_ti: 
TaskInstance) -> None:
         "response_at": "2025-07-03T00:00:00Z",
         "chosen_options": ["Reject"],
         "response_received": True,
-        "responded_by_user": {
-            "id": "Fallback to defaults",
-            "name": "Fallback to defaults",
-        },
+        "responded_by_user": None,
     }
 
 
diff --git a/providers/standard/src/airflow/providers/standard/triggers/hitl.py 
b/providers/standard/src/airflow/providers/standard/triggers/hitl.py
index a9299ae2407..bdaa84b01f6 100644
--- a/providers/standard/src/airflow/providers/standard/triggers/hitl.py
+++ b/providers/standard/src/airflow/providers/standard/triggers/hitl.py
@@ -44,7 +44,7 @@ class HITLTriggerEventSuccessPayload(TypedDict, total=False):
 
     chosen_options: list[str]
     params_input: dict[str, Any]
-    responded_by_user: HITLUser
+    responded_by_user: HITLUser | None
     timedout: bool
 
 
@@ -148,10 +148,7 @@ class HITLTrigger(BaseTrigger):
                     HITLTriggerEventSuccessPayload(
                         chosen_options=self.defaults,
                         params_input=self.params,
-                        responded_by_user=HITLUser(
-                            id="Fallback to defaults",
-                            name="Fallback to defaults",
-                        ),
+                        responded_by_user=None,
                         timedout=True,
                     )
                 )
diff --git a/providers/standard/tests/unit/standard/triggers/test_hitl.py 
b/providers/standard/tests/unit/standard/triggers/test_hitl.py
index ef82f9e09d9..118bcb77dc1 100644
--- a/providers/standard/tests/unit/standard/triggers/test_hitl.py
+++ b/providers/standard/tests/unit/standard/triggers/test_hitl.py
@@ -125,7 +125,7 @@ class TestHITLTrigger:
             HITLTriggerEventSuccessPayload(
                 chosen_options=["1"],
                 params_input={"input": 1},
-                responded_by_user={"id": "Fallback to defaults", "name": 
"Fallback to defaults"},
+                responded_by_user=None,
                 timedout=True,
             )
         )

Reply via email to