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 8a6606bd28028..85d8e008990da 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 e2055344bc3ec..7f0069688c1ab 100644 --- a/airflow-core/src/airflow/models/hitl.py +++ b/airflow-core/src/airflow/models/hitl.py @@ -167,8 +167,3 @@ def responded_by_user(self) -> HITLUser | None: 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 764d5a48ccdc6..33a1b3e79bcab 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 a9299ae240756..bdaa84b01f6dd 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 @@ async def run(self) -> AsyncIterator[TriggerEvent]: 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 ef82f9e09d9b0..118bcb77dc1d6 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 @@ async def test_run_fallback_to_default_due_to_timeout(self, mock_update, mock_lo 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, ) )