You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Lee-W (via GitHub)" <gi...@apache.org> on 2025/10/17 10:23:05 UTC

[PR] feat(hitl): hitl history ui [airflow]

Lee-W opened a new pull request, #56760:
URL: https://github.com/apache/airflow/pull/56760

   <!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
   
      http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
    -->
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   
   
   <!-- Please keep an empty line above the dashes. -->
   ---
   **^ Add meaningful description above**
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add HITLDetailHistory UI [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #56760:
URL: https://github.com/apache/airflow/pull/56760#discussion_r2479245057


##########
airflow-core/src/airflow/ui/src/utils/hitl.ts:
##########
@@ -18,22 +18,22 @@
  */
 import type { TFunction } from "i18next";
 
-import type { HITLDetail } from "openapi/requests/types.gen";
+import type { HITLDetail, HITLDetailHisotry } from "openapi/requests/types.gen";

Review Comment:
   How was this not caught by pre-commit? yikes



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add HITLDetailHistory UI [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #56760:
URL: https://github.com/apache/airflow/pull/56760#discussion_r2589979836


##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/HITLResponse.tsx:
##########
@@ -47,6 +86,13 @@ export const HITLResponse = () => {
 
   return (
     <Box px={4}>
+      {taskInstance.try_number <= 1 ? undefined : (
+        <TaskTrySelect
+          onSelectTryNumber={onSelectTryNumber}
+          selectedTryNumber={tryNumber}
+          taskInstance={taskInstance}
+        />
+      )}
       <HITLResponseForm hitlDetail={hitlDetail} />

Review Comment:
   The form doesn't accurately reflect the user's HITL response. Perhaps we should add a check for `response_received`, if false, show the form, if true show `chosen_options`, `params_input` and `responded_by_user`



##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/HITLResponse.tsx:
##########
@@ -18,26 +18,65 @@
  */
 import { Box } from "@chakra-ui/react";
 import { useParams } from "react-router-dom";
+import { useSearchParams } from "react-router-dom";
 
-import { useTaskInstanceServiceGetHitlDetail } from "openapi/queries";
+import {
+  useTaskInstanceServiceGetHitlDetailTryDetail,
+  useTaskInstanceServiceGetMappedTaskInstance,
+} from "openapi/queries";
+import { TaskTrySelect } from "src/components/TaskTrySelect";
 import { ProgressBar } from "src/components/ui";
+import { SearchParamsKeys } from "src/constants/searchParams";
+import { isStatePending, useAutoRefresh } from "src/utils";
 
 import { HITLResponseForm } from "../HITLTaskInstances/HITLResponseForm";
 
 export const HITLResponse = () => {
   const { dagId, mapIndex, runId, taskId } = useParams();
 
-  const { data: hitlDetail } = useTaskInstanceServiceGetHitlDetail(
+  const refetchInterval = useAutoRefresh({ dagId });
+  const [searchParams, setSearchParams] = useSearchParams();
+  const tryNumberParam = searchParams.get(SearchParamsKeys.TRY_NUMBER);
+
+  const parsedMapIndex = Number(mapIndex ?? -1);
+
+  const { data: taskInstance } = useTaskInstanceServiceGetMappedTaskInstance(
+    {
+      dagId: dagId ?? "",
+      dagRunId: runId ?? "",
+      mapIndex: parsedMapIndex,
+      taskId: taskId ?? "",
+    },
+    undefined,
+    {
+      enabled: !isNaN(parsedMapIndex),
+      refetchInterval: (query) => (isStatePending(query.state.data?.state) ? refetchInterval : false),
+    },
+  );
+
+  const onSelectTryNumber = (newTryNumber: number) => {
+    if (newTryNumber === taskInstance?.try_number) {
+      searchParams.delete(SearchParamsKeys.TRY_NUMBER);
+    } else {
+      searchParams.set(SearchParamsKeys.TRY_NUMBER, newTryNumber.toString());
+    }
+    setSearchParams(searchParams);
+  };
+
+  const tryNumber = tryNumberParam === null ? undefined : parseInt(tryNumberParam, 10);

Review Comment:
   ```suggestion
     const tryNumber = tryNumberParam === null ? taskInstance?.try_number : parseInt(tryNumberParam, 10);
   ```
   
   We're never actually checking the task instance so the select doesn't work



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add HITLDetailHistory UI [airflow]

Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on PR #56760:
URL: https://github.com/apache/airflow/pull/56760#issuecomment-3615193608

   Mark it as a draft. I'll get back to it if bandwidth allow


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add HITLDetailHistory UI [airflow]

Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on PR #56760:
URL: https://github.com/apache/airflow/pull/56760#issuecomment-3752484495

   Got it. Thanks @bbovenzi !


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add HITLDetailHistory UI [airflow]

Posted by "guan404ming (via GitHub)" <gi...@apache.org>.
guan404ming commented on code in PR #56760:
URL: https://github.com/apache/airflow/pull/56760#discussion_r2470236854


##########
airflow-core/src/airflow/ui/src/utils/hitl.ts:
##########
@@ -18,22 +18,22 @@
  */
 import type { TFunction } from "i18next";
 
-import type { HITLDetail } from "openapi/requests/types.gen";
+import type { HITLDetail, HITLDetailHisotry } from "openapi/requests/types.gen";

Review Comment:
   ```suggestion
   import type { HITLDetail, HITLDetailHistory } from "openapi/requests/types.gen";
   ```
   
   typo



##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/HITLResponse.tsx:
##########
@@ -18,26 +18,73 @@
  */
 import { Box } from "@chakra-ui/react";
 import { useParams } from "react-router-dom";
+import { useSearchParams } from "react-router-dom";
 
-import { useTaskInstanceServiceGetHitlDetail } from "openapi/queries";
+import {
+  useTaskInstanceServiceGetHitlDetailTry,
+  useTaskInstanceServiceGetMappedTaskInstance,
+} from "openapi/queries";
+import { TaskTrySelect } from "src/components/TaskTrySelect";
 import { ProgressBar } from "src/components/ui";
+import { SearchParamsKeys } from "src/constants/searchParams";
+import { isStatePending, useAutoRefresh } from "src/utils";
 
 import { HITLResponseForm } from "../HITLTaskInstances/HITLResponseForm";
 
 export const HITLResponse = () => {
   const { dagId, mapIndex, runId, taskId } = useParams();
 
-  const { data: hitlDetail } = useTaskInstanceServiceGetHitlDetail(
+  const refetchInterval = useAutoRefresh({ dagId });
+  const [searchParams, setSearchParams] = useSearchParams();
+  const tryNumberParam = searchParams.get(SearchParamsKeys.TRY_NUMBER);
+
+  const parsedMapIndex = Number(mapIndex ?? -1);
+
+  const { data: taskInstance } = useTaskInstanceServiceGetMappedTaskInstance(
     {
       dagId: dagId ?? "",
       dagRunId: runId ?? "",
-      mapIndex: Number(mapIndex ?? -1),
+      mapIndex: parsedMapIndex,
       taskId: taskId ?? "",
     },
     undefined,
+    {
+      enabled: !isNaN(parsedMapIndex),
+      refetchInterval: (query) => (isStatePending(query.state.data?.state) ? refetchInterval : false),
+    },
   );
 
-  if (!hitlDetail?.task_instance) {
+  const onSelectTryNumber = (newTryNumber: number) => {
+    if (newTryNumber === taskInstance?.try_number) {
+      searchParams.delete(SearchParamsKeys.TRY_NUMBER);
+    } else {
+      searchParams.set(SearchParamsKeys.TRY_NUMBER, newTryNumber.toString());
+    }
+    setSearchParams(searchParams);
+  };
+
+  const tryNumber = tryNumberParam === null ? -1 : parseInt(tryNumberParam, 10);
+
+  const { data: hitlDetail } = useTaskInstanceServiceGetHitlDetailTry(
+    {
+      dagId: dagId ?? "",
+      dagRunId: runId ?? "",
+      mapIndex: parsedMapIndex,
+      taskId: taskId ?? "",
+      tryNumber,
+    },
+    undefined,
+  );
+
+  if (!taskInstance) {

Review Comment:
   ```suggestion
     if (!taskInstance || !hitlDetail) {
   ```
   
   nit one, then we could remove the below one.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add HITLDetailHistory UI [airflow]

Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #56760:
URL: https://github.com/apache/airflow/pull/56760#discussion_r2490763073


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/hitl.py:
##########
@@ -190,10 +203,37 @@ def get_hitl_detail(
         task_id=task_id,
         session=session,
         map_index=map_index,
+        try_number=None,
     )
     return task_instance.hitl_detail
 
 
+@task_instances_hitl_router.get(
+    task_instance_hitl_path + "/tries/{try_number}",
+    status_code=status.HTTP_200_OK,
+    responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]),
+    dependencies=[Depends(requires_access_dag(method="GET", access_entity=DagAccessEntity.HITL_DETAIL))],
+)
+def get_hitl_detail_try(

Review Comment:
   Nit:
   ```suggestion
   def get_hitl_try_details(
   ```
   
   To be consistant with `get_task_instance_try_details`
   



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add HITLDetailHistory UI [airflow]

Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #56760:
URL: https://github.com/apache/airflow/pull/56760#discussion_r2579364502


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/hitl.py:
##########
@@ -72,21 +75,31 @@ def _get_task_instance_with_hitl_detail(
     task_id: str,
     session: SessionDep,
     map_index: int,
-) -> TI:
-    query = (
-        select(TI)
-        .where(
-            TI.dag_id == dag_id,
-            TI.run_id == dag_run_id,
-            TI.task_id == task_id,
+    try_number: int | None = None,
+) -> TI | TIH:
+    def _query(orm_object: Base) -> TI | TIH | None:
+        query = (
+            select(orm_object)
+            .where(
+                orm_object.dag_id == dag_id,
+                orm_object.run_id == dag_run_id,
+                orm_object.task_id == task_id,
+                orm_object.map_index == map_index,
+            )
+            .options(joinedload(orm_object.hitl_detail))
         )
-        .options(joinedload(TI.hitl_detail))
-    )
 
-    if map_index is not None:
-        query = query.where(TI.map_index == map_index)
+        if try_number is not None:
+            query = query.where(orm_object.try_number == try_number)
+
+        task_instance = session.scalar(query)

Review Comment:
   Yep, I think we should rename it on both sides. I'll make the update 



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add HITLDetailHistory UI [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi merged PR #56760:
URL: https://github.com/apache/airflow/pull/56760


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add HITLDetailHistory UI [airflow]

Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #56760:
URL: https://github.com/apache/airflow/pull/56760#discussion_r2490729647


##########
airflow-core/src/airflow/ui/src/utils/hitl.ts:
##########
@@ -18,22 +18,22 @@
  */
 import type { TFunction } from "i18next";
 
-import type { HITLDetail } from "openapi/requests/types.gen";
+import type { HITLDetail, HITLDetailHisotry } from "openapi/requests/types.gen";

Review Comment:
    I fixed it in another PR, you mean by spellchecker? No idea, but the class really is named 'HTLDetailHisotry` 😂.
   



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add HITLDetailHistory UI [airflow]

Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #56760:
URL: https://github.com/apache/airflow/pull/56760#discussion_r2577683278


##########
airflow-core/src/airflow/api_fastapi/core_api/datamodels/hitl.py:
##########
@@ -101,3 +102,9 @@ class HITLDetailCollection(BaseModel):
 
     hitl_details: Iterable[HITLDetail]
     total_entries: int
+
+
+class HITLDetailHisotry(BaseHITLDetail):

Review Comment:
   Needs to be deleted, this doesn't exist anymore, it's `HITLDetailHistory`



##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/HITLResponse.tsx:
##########
@@ -18,26 +18,65 @@
  */
 import { Box } from "@chakra-ui/react";
 import { useParams } from "react-router-dom";
+import { useSearchParams } from "react-router-dom";
 
-import { useTaskInstanceServiceGetHitlDetail } from "openapi/queries";
+import {
+  useTaskInstanceServiceGetHitlDetailTryDetail,
+  useTaskInstanceServiceGetMappedTaskInstance,
+} from "openapi/queries";
+import { TaskTrySelect } from "src/components/TaskTrySelect";
 import { ProgressBar } from "src/components/ui";
+import { SearchParamsKeys } from "src/constants/searchParams";
+import { isStatePending, useAutoRefresh } from "src/utils";
 
 import { HITLResponseForm } from "../HITLTaskInstances/HITLResponseForm";
 
 export const HITLResponse = () => {
   const { dagId, mapIndex, runId, taskId } = useParams();
 
-  const { data: hitlDetail } = useTaskInstanceServiceGetHitlDetail(
+  const refetchInterval = useAutoRefresh({ dagId });
+  const [searchParams, setSearchParams] = useSearchParams();
+  const tryNumberParam = searchParams.get(SearchParamsKeys.TRY_NUMBER);
+
+  const parsedMapIndex = Number(mapIndex ?? -1);
+
+  const { data: taskInstance } = useTaskInstanceServiceGetMappedTaskInstance(
+    {
+      dagId: dagId ?? "",
+      dagRunId: runId ?? "",
+      mapIndex: parsedMapIndex,
+      taskId: taskId ?? "",
+    },
+    undefined,
+    {
+      enabled: !isNaN(parsedMapIndex),
+      refetchInterval: (query) => (isStatePending(query.state.data?.state) ? refetchInterval : false),
+    },
+  );
+
+  const onSelectTryNumber = (newTryNumber: number) => {
+    if (newTryNumber === taskInstance?.try_number) {
+      searchParams.delete(SearchParamsKeys.TRY_NUMBER);
+    } else {
+      searchParams.set(SearchParamsKeys.TRY_NUMBER, newTryNumber.toString());
+    }
+    setSearchParams(searchParams);
+  };
+
+  const tryNumber = tryNumberParam === null ? -1 : parseInt(tryNumberParam, 10);

Review Comment:
   This `-1` for try number seems odd. It should either be a valid try number >=1 or `null/undefined`. -1 feels like a placeholder value



##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/hitl.py:
##########
@@ -72,21 +75,31 @@ def _get_task_instance_with_hitl_detail(
     task_id: str,
     session: SessionDep,
     map_index: int,
-) -> TI:
-    query = (
-        select(TI)
-        .where(
-            TI.dag_id == dag_id,
-            TI.run_id == dag_run_id,
-            TI.task_id == task_id,
+    try_number: int | None = None,
+) -> TI | TIH:
+    def _query(orm_object: Base) -> TI | TIH | None:
+        query = (
+            select(orm_object)
+            .where(
+                orm_object.dag_id == dag_id,
+                orm_object.run_id == dag_run_id,
+                orm_object.task_id == task_id,
+                orm_object.map_index == map_index,
+            )
+            .options(joinedload(orm_object.hitl_detail))
         )
-        .options(joinedload(TI.hitl_detail))
-    )
 
-    if map_index is not None:
-        query = query.where(TI.map_index == map_index)
+        if try_number is not None:
+            query = query.where(orm_object.try_number == try_number)
+
+        task_instance = session.scalar(query)

Review Comment:
   We can name this `rows`, `entities`, `models` anything not confusing us about having TI while they can be TIH too.
   
   > both of them are technically task instance
   
   I don't understand this statement. Those are not the same model and don't expose the same interface. If I expect a TI and do `get_task_instance` on this I'll have a problem when it's a TIH.
   
   Ideally we could fix both places. That's not a big deal though. (so we can do that latter too, i'm fine)
   



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add HITLDetailHistory UI [airflow]

Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #56760:
URL: https://github.com/apache/airflow/pull/56760#discussion_r2579368307


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/hitl.py:
##########
@@ -72,21 +75,31 @@ def _get_task_instance_with_hitl_detail(
     task_id: str,
     session: SessionDep,
     map_index: int,
-) -> TI:
-    query = (
-        select(TI)
-        .where(
-            TI.dag_id == dag_id,
-            TI.run_id == dag_run_id,
-            TI.task_id == task_id,
+    try_number: int | None = None,
+) -> TI | TIH:
+    def _query(orm_object: Base) -> TI | TIH | None:
+        query = (
+            select(orm_object)
+            .where(
+                orm_object.dag_id == dag_id,
+                orm_object.run_id == dag_run_id,
+                orm_object.task_id == task_id,
+                orm_object.map_index == map_index,
+            )
+            .options(joinedload(orm_object.hitl_detail))
         )
-        .options(joinedload(TI.hitl_detail))
-    )
 
-    if map_index is not None:
-        query = query.where(TI.map_index == map_index)
+        if try_number is not None:
+            query = query.where(orm_object.try_number == try_number)
+
+        task_instance = session.scalar(query)

Review Comment:
   renamed both places



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add HITLDetailHistory UI [airflow]

Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #56760:
URL: https://github.com/apache/airflow/pull/56760#discussion_r2490750289


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/hitl.py:
##########
@@ -72,21 +75,31 @@ def _get_task_instance_with_hitl_detail(
     task_id: str,
     session: SessionDep,
     map_index: int,
-) -> TI:
-    query = (
-        select(TI)
-        .where(
-            TI.dag_id == dag_id,
-            TI.run_id == dag_run_id,
-            TI.task_id == task_id,
+    try_number: int | None = None,
+) -> TI | TIH:
+    def _query(orm_object: Base) -> TI | TIH | None:
+        query = (
+            select(orm_object)
+            .where(
+                orm_object.dag_id == dag_id,
+                orm_object.run_id == dag_run_id,
+                orm_object.task_id == task_id,
+                orm_object.map_index == map_index,
+            )
+            .options(joinedload(orm_object.hitl_detail))
         )
-        .options(joinedload(TI.hitl_detail))
-    )
 
-    if map_index is not None:
-        query = query.where(TI.map_index == map_index)
+        if try_number is not None:
+            query = query.where(orm_object.try_number == try_number)
+
+        task_instance = session.scalar(query)

Review Comment:
   This an be TIH, we shouldn't name it `task_instance` I believe 
   ```suggestion
           something_else = session.scalar(query)
   ```



##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/hitl.py:
##########
@@ -72,21 +75,31 @@ def _get_task_instance_with_hitl_detail(
     task_id: str,
     session: SessionDep,
     map_index: int,
-) -> TI:
-    query = (
-        select(TI)
-        .where(
-            TI.dag_id == dag_id,
-            TI.run_id == dag_run_id,
-            TI.task_id == task_id,
+    try_number: int | None = None,
+) -> TI | TIH:
+    def _query(orm_object: Base) -> TI | TIH | None:
+        query = (
+            select(orm_object)
+            .where(
+                orm_object.dag_id == dag_id,
+                orm_object.run_id == dag_run_id,
+                orm_object.task_id == task_id,
+                orm_object.map_index == map_index,
+            )
+            .options(joinedload(orm_object.hitl_detail))
         )
-        .options(joinedload(TI.hitl_detail))
-    )
 
-    if map_index is not None:
-        query = query.where(TI.map_index == map_index)
+        if try_number is not None:
+            query = query.where(orm_object.try_number == try_number)
+
+        task_instance = session.scalar(query)

Review Comment:
   This an be TIH, we shouldn't name it `task_instance` I believe 
   ```suggestion
           <other_name> = session.scalar(query)
   ```



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add HITLDetailHistory UI [airflow]

Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #56760:
URL: https://github.com/apache/airflow/pull/56760#discussion_r2654990336


##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/HITLResponse.tsx:
##########
@@ -18,26 +18,65 @@
  */
 import { Box } from "@chakra-ui/react";
 import { useParams } from "react-router-dom";
+import { useSearchParams } from "react-router-dom";
 
-import { useTaskInstanceServiceGetHitlDetail } from "openapi/queries";
+import {
+  useTaskInstanceServiceGetHitlDetailTryDetail,
+  useTaskInstanceServiceGetMappedTaskInstance,
+} from "openapi/queries";
+import { TaskTrySelect } from "src/components/TaskTrySelect";
 import { ProgressBar } from "src/components/ui";
+import { SearchParamsKeys } from "src/constants/searchParams";
+import { isStatePending, useAutoRefresh } from "src/utils";
 
 import { HITLResponseForm } from "../HITLTaskInstances/HITLResponseForm";
 
 export const HITLResponse = () => {
   const { dagId, mapIndex, runId, taskId } = useParams();
 
-  const { data: hitlDetail } = useTaskInstanceServiceGetHitlDetail(
+  const refetchInterval = useAutoRefresh({ dagId });
+  const [searchParams, setSearchParams] = useSearchParams();
+  const tryNumberParam = searchParams.get(SearchParamsKeys.TRY_NUMBER);
+
+  const parsedMapIndex = Number(mapIndex ?? -1);
+
+  const { data: taskInstance } = useTaskInstanceServiceGetMappedTaskInstance(
+    {
+      dagId: dagId ?? "",
+      dagRunId: runId ?? "",
+      mapIndex: parsedMapIndex,
+      taskId: taskId ?? "",
+    },
+    undefined,
+    {
+      enabled: !isNaN(parsedMapIndex),
+      refetchInterval: (query) => (isStatePending(query.state.data?.state) ? refetchInterval : false),
+    },
+  );
+
+  const onSelectTryNumber = (newTryNumber: number) => {
+    if (newTryNumber === taskInstance?.try_number) {
+      searchParams.delete(SearchParamsKeys.TRY_NUMBER);
+    } else {
+      searchParams.set(SearchParamsKeys.TRY_NUMBER, newTryNumber.toString());
+    }
+    setSearchParams(searchParams);
+  };
+
+  const tryNumber = tryNumberParam === null ? undefined : parseInt(tryNumberParam, 10);

Review Comment:
   just updated thanks!



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add HITLDetailHistory UI [airflow]

Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #56760:
URL: https://github.com/apache/airflow/pull/56760#discussion_r2580421409


##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/HITLResponse.tsx:
##########
@@ -18,26 +18,65 @@
  */
 import { Box } from "@chakra-ui/react";
 import { useParams } from "react-router-dom";
+import { useSearchParams } from "react-router-dom";
 
-import { useTaskInstanceServiceGetHitlDetail } from "openapi/queries";
+import {
+  useTaskInstanceServiceGetHitlDetailTryDetail,
+  useTaskInstanceServiceGetMappedTaskInstance,
+} from "openapi/queries";
+import { TaskTrySelect } from "src/components/TaskTrySelect";
 import { ProgressBar } from "src/components/ui";
+import { SearchParamsKeys } from "src/constants/searchParams";
+import { isStatePending, useAutoRefresh } from "src/utils";
 
 import { HITLResponseForm } from "../HITLTaskInstances/HITLResponseForm";
 
 export const HITLResponse = () => {
   const { dagId, mapIndex, runId, taskId } = useParams();
 
-  const { data: hitlDetail } = useTaskInstanceServiceGetHitlDetail(
+  const refetchInterval = useAutoRefresh({ dagId });
+  const [searchParams, setSearchParams] = useSearchParams();
+  const tryNumberParam = searchParams.get(SearchParamsKeys.TRY_NUMBER);
+
+  const parsedMapIndex = Number(mapIndex ?? -1);
+
+  const { data: taskInstance } = useTaskInstanceServiceGetMappedTaskInstance(
+    {
+      dagId: dagId ?? "",
+      dagRunId: runId ?? "",
+      mapIndex: parsedMapIndex,
+      taskId: taskId ?? "",
+    },
+    undefined,
+    {
+      enabled: !isNaN(parsedMapIndex),
+      refetchInterval: (query) => (isStatePending(query.state.data?.state) ? refetchInterval : false),
+    },
+  );
+
+  const onSelectTryNumber = (newTryNumber: number) => {
+    if (newTryNumber === taskInstance?.try_number) {
+      searchParams.delete(SearchParamsKeys.TRY_NUMBER);
+    } else {
+      searchParams.set(SearchParamsKeys.TRY_NUMBER, newTryNumber.toString());
+    }
+    setSearchParams(searchParams);
+  };
+
+  const tryNumber = tryNumberParam === null ? -1 : parseInt(tryNumberParam, 10);

Review Comment:
   updated



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add HITLDetailHistory UI [airflow]

Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #56760:
URL: https://github.com/apache/airflow/pull/56760#discussion_r2490750289


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/hitl.py:
##########
@@ -72,21 +75,31 @@ def _get_task_instance_with_hitl_detail(
     task_id: str,
     session: SessionDep,
     map_index: int,
-) -> TI:
-    query = (
-        select(TI)
-        .where(
-            TI.dag_id == dag_id,
-            TI.run_id == dag_run_id,
-            TI.task_id == task_id,
+    try_number: int | None = None,
+) -> TI | TIH:
+    def _query(orm_object: Base) -> TI | TIH | None:
+        query = (
+            select(orm_object)
+            .where(
+                orm_object.dag_id == dag_id,
+                orm_object.run_id == dag_run_id,
+                orm_object.task_id == task_id,
+                orm_object.map_index == map_index,
+            )
+            .options(joinedload(orm_object.hitl_detail))
         )
-        .options(joinedload(TI.hitl_detail))
-    )
 
-    if map_index is not None:
-        query = query.where(TI.map_index == map_index)
+        if try_number is not None:
+            query = query.where(orm_object.try_number == try_number)
+
+        task_instance = session.scalar(query)

Review Comment:
   This an be TIH, we shouldn't name it `task_instance I believe 



##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/hitl.py:
##########
@@ -72,21 +75,31 @@ def _get_task_instance_with_hitl_detail(
     task_id: str,
     session: SessionDep,
     map_index: int,
-) -> TI:
-    query = (
-        select(TI)
-        .where(
-            TI.dag_id == dag_id,
-            TI.run_id == dag_run_id,
-            TI.task_id == task_id,
+    try_number: int | None = None,
+) -> TI | TIH:
+    def _query(orm_object: Base) -> TI | TIH | None:
+        query = (
+            select(orm_object)
+            .where(
+                orm_object.dag_id == dag_id,
+                orm_object.run_id == dag_run_id,
+                orm_object.task_id == task_id,
+                orm_object.map_index == map_index,
+            )
+            .options(joinedload(orm_object.hitl_detail))
         )
-        .options(joinedload(TI.hitl_detail))
-    )
 
-    if map_index is not None:
-        query = query.where(TI.map_index == map_index)
+        if try_number is not None:
+            query = query.where(orm_object.try_number == try_number)
+
+        task_instance = session.scalar(query)

Review Comment:
   This an be TIH, we shouldn't name it `task_instance` I believe 



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add HITLDetailHistory UI [airflow]

Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #56760:
URL: https://github.com/apache/airflow/pull/56760#discussion_r2490736073


##########
airflow-core/src/airflow/ui/src/utils/hitl.ts:
##########
@@ -18,22 +18,22 @@
  */
 import type { TFunction } from "i18next";
 
-import type { HITLDetail } from "openapi/requests/types.gen";
+import type { HITLDetail, HITLDetailHisotry } from "openapi/requests/types.gen";

Review Comment:
   I don't think spellcheker is smart enought to catch these kind of words 🤔 I'm still working on another PR. will get back to this afterward. Mark it as draft



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add HITLDetailHistory UI [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #56760:
URL: https://github.com/apache/airflow/pull/56760#discussion_r2479252099


##########
airflow-core/src/airflow/api_fastapi/core_api/datamodels/hitl.py:
##########
@@ -88,3 +89,9 @@ class HITLDetailCollection(BaseModel):
 
     hitl_details: list[HITLDetail]
     total_entries: int
+
+
+class HITLDetailHisotry(BaseHITLDetail):

Review Comment:
   Oh this typo goes into the backend.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add HITLDetailHistory UI [airflow]

Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #56760:
URL: https://github.com/apache/airflow/pull/56760#discussion_r2577679017


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/hitl.py:
##########
@@ -190,10 +203,37 @@ def get_hitl_detail(
         task_id=task_id,
         session=session,
         map_index=map_index,
+        try_number=None,
     )
     return task_instance.hitl_detail
 
 
+@task_instances_hitl_router.get(
+    task_instance_hitl_path + "/tries/{try_number}",
+    status_code=status.HTTP_200_OK,
+    responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]),
+    dependencies=[Depends(requires_access_dag(method="GET", access_entity=DagAccessEntity.HITL_DETAIL))],
+)
+def get_hitl_detail_try(

Review Comment:
   Double `detail` in the name is confusing. I get why it's there though. 
   
   Also I think in the current impl, you missed the trailing `s` `get_hitl_detail_try_detail`



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add HITLDetailHistory UI [airflow]

Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #56760:
URL: https://github.com/apache/airflow/pull/56760#discussion_r2579364744


##########
airflow-core/src/airflow/api_fastapi/core_api/datamodels/hitl.py:
##########
@@ -101,3 +102,9 @@ class HITLDetailCollection(BaseModel):
 
     hitl_details: Iterable[HITLDetail]
     total_entries: int
+
+
+class HITLDetailHisotry(BaseHITLDetail):

Review Comment:
   updated



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add HITLDetailHistory UI [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #56760:
URL: https://github.com/apache/airflow/pull/56760#discussion_r2479250274


##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/HITLResponse.tsx:
##########
@@ -18,26 +18,73 @@
  */
 import { Box } from "@chakra-ui/react";
 import { useParams } from "react-router-dom";
+import { useSearchParams } from "react-router-dom";
 
-import { useTaskInstanceServiceGetHitlDetail } from "openapi/queries";
+import {
+  useTaskInstanceServiceGetHitlDetailTry,
+  useTaskInstanceServiceGetMappedTaskInstance,
+} from "openapi/queries";
+import { TaskTrySelect } from "src/components/TaskTrySelect";
 import { ProgressBar } from "src/components/ui";
+import { SearchParamsKeys } from "src/constants/searchParams";
+import { isStatePending, useAutoRefresh } from "src/utils";
 
 import { HITLResponseForm } from "../HITLTaskInstances/HITLResponseForm";
 
 export const HITLResponse = () => {
   const { dagId, mapIndex, runId, taskId } = useParams();
 
-  const { data: hitlDetail } = useTaskInstanceServiceGetHitlDetail(
+  const refetchInterval = useAutoRefresh({ dagId });
+  const [searchParams, setSearchParams] = useSearchParams();
+  const tryNumberParam = searchParams.get(SearchParamsKeys.TRY_NUMBER);
+
+  const parsedMapIndex = Number(mapIndex ?? -1);
+
+  const { data: taskInstance } = useTaskInstanceServiceGetMappedTaskInstance(
     {
       dagId: dagId ?? "",
       dagRunId: runId ?? "",
-      mapIndex: Number(mapIndex ?? -1),
+      mapIndex: parsedMapIndex,
       taskId: taskId ?? "",
     },
     undefined,
+    {
+      enabled: !isNaN(parsedMapIndex),
+      refetchInterval: (query) => (isStatePending(query.state.data?.state) ? refetchInterval : false),
+    },
   );
 
-  if (!hitlDetail?.task_instance) {
+  const onSelectTryNumber = (newTryNumber: number) => {
+    if (newTryNumber === taskInstance?.try_number) {
+      searchParams.delete(SearchParamsKeys.TRY_NUMBER);
+    } else {
+      searchParams.set(SearchParamsKeys.TRY_NUMBER, newTryNumber.toString());
+    }
+    setSearchParams(searchParams);
+  };
+
+  const tryNumber = tryNumberParam === null ? -1 : parseInt(tryNumberParam, 10);
+
+  const { data: hitlDetail } = useTaskInstanceServiceGetHitlDetailTry(
+    {
+      dagId: dagId ?? "",
+      dagRunId: runId ?? "",
+      mapIndex: parsedMapIndex,
+      taskId: taskId ?? "",
+      tryNumber,
+    },
+    undefined,
+  );
+
+  if (!taskInstance) {

Review Comment:
   Also a loading bar should be matched with `isLoading`, which we can get from the object spread from both of the queries, otherwise it should be an empty state like "No Human in the Loop details found"



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add HITLDetailHistory UI [airflow]

Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #56760:
URL: https://github.com/apache/airflow/pull/56760#discussion_r2579375787


##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/HITLResponse.tsx:
##########
@@ -18,26 +18,65 @@
  */
 import { Box } from "@chakra-ui/react";
 import { useParams } from "react-router-dom";
+import { useSearchParams } from "react-router-dom";
 
-import { useTaskInstanceServiceGetHitlDetail } from "openapi/queries";
+import {
+  useTaskInstanceServiceGetHitlDetailTryDetail,
+  useTaskInstanceServiceGetMappedTaskInstance,
+} from "openapi/queries";
+import { TaskTrySelect } from "src/components/TaskTrySelect";
 import { ProgressBar } from "src/components/ui";
+import { SearchParamsKeys } from "src/constants/searchParams";
+import { isStatePending, useAutoRefresh } from "src/utils";
 
 import { HITLResponseForm } from "../HITLTaskInstances/HITLResponseForm";
 
 export const HITLResponse = () => {
   const { dagId, mapIndex, runId, taskId } = useParams();
 
-  const { data: hitlDetail } = useTaskInstanceServiceGetHitlDetail(
+  const refetchInterval = useAutoRefresh({ dagId });
+  const [searchParams, setSearchParams] = useSearchParams();
+  const tryNumberParam = searchParams.get(SearchParamsKeys.TRY_NUMBER);
+
+  const parsedMapIndex = Number(mapIndex ?? -1);
+
+  const { data: taskInstance } = useTaskInstanceServiceGetMappedTaskInstance(
+    {
+      dagId: dagId ?? "",
+      dagRunId: runId ?? "",
+      mapIndex: parsedMapIndex,
+      taskId: taskId ?? "",
+    },
+    undefined,
+    {
+      enabled: !isNaN(parsedMapIndex),
+      refetchInterval: (query) => (isStatePending(query.state.data?.state) ? refetchInterval : false),
+    },
+  );
+
+  const onSelectTryNumber = (newTryNumber: number) => {
+    if (newTryNumber === taskInstance?.try_number) {
+      searchParams.delete(SearchParamsKeys.TRY_NUMBER);
+    } else {
+      searchParams.set(SearchParamsKeys.TRY_NUMBER, newTryNumber.toString());
+    }
+    setSearchParams(searchParams);
+  };
+
+  const tryNumber = tryNumberParam === null ? -1 : parseInt(tryNumberParam, 10);

Review Comment:
   sounds good. I'll change both frontend and backend side



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add HITLDetailHistory UI [airflow]

Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #56760:
URL: https://github.com/apache/airflow/pull/56760#discussion_r2577679017


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/hitl.py:
##########
@@ -190,10 +203,37 @@ def get_hitl_detail(
         task_id=task_id,
         session=session,
         map_index=map_index,
+        try_number=None,
     )
     return task_instance.hitl_detail
 
 
+@task_instances_hitl_router.get(
+    task_instance_hitl_path + "/tries/{try_number}",
+    status_code=status.HTTP_200_OK,
+    responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]),
+    dependencies=[Depends(requires_access_dag(method="GET", access_entity=DagAccessEntity.HITL_DETAIL))],
+)
+def get_hitl_detail_try(

Review Comment:
   Double `detail` in the name is confusing.
   
   Also I think in the current impl, you missed the trailing `s` `get_hitl_detail_try_detail`



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(hitl): hitl history ui [airflow]

Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on PR #56760:
URL: https://github.com/apache/airflow/pull/56760#issuecomment-3414849606

   after some tesitng, I feel we might need to revert part of the https://github.com/apache/airflow/pull/55952 implementation 🤔 (related to ti history)


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add HITLDetailHistory UI [airflow]

Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #56760:
URL: https://github.com/apache/airflow/pull/56760#discussion_r2563774431


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/hitl.py:
##########
@@ -72,21 +75,31 @@ def _get_task_instance_with_hitl_detail(
     task_id: str,
     session: SessionDep,
     map_index: int,
-) -> TI:
-    query = (
-        select(TI)
-        .where(
-            TI.dag_id == dag_id,
-            TI.run_id == dag_run_id,
-            TI.task_id == task_id,
+    try_number: int | None = None,
+) -> TI | TIH:
+    def _query(orm_object: Base) -> TI | TIH | None:
+        query = (
+            select(orm_object)
+            .where(
+                orm_object.dag_id == dag_id,
+                orm_object.run_id == dag_run_id,
+                orm_object.task_id == task_id,
+                orm_object.map_index == map_index,
+            )
+            .options(joinedload(orm_object.hitl_detail))
         )
-        .options(joinedload(TI.hitl_detail))
-    )
 
-    if map_index is not None:
-        query = query.where(TI.map_index == map_index)
+        if try_number is not None:
+            query = query.where(orm_object.try_number == try_number)
+
+        task_instance = session.scalar(query)

Review Comment:
   This pattern is also used here 
   
   https://github.com/apache/airflow/blob/1aa9b7af38b52afa79d5108a04ceb5fd181682ba/airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_instances.py#L666-L680
   
   This is TI or TIH. both of them are technically task instance. We could renamed it as `ti_or_tih` but I don't think that's better 🤔 



##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/hitl.py:
##########
@@ -190,10 +203,37 @@ def get_hitl_detail(
         task_id=task_id,
         session=session,
         map_index=map_index,
+        try_number=None,
     )
     return task_instance.hitl_detail
 
 
+@task_instances_hitl_router.get(
+    task_instance_hitl_path + "/tries/{try_number}",
+    status_code=status.HTTP_200_OK,
+    responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]),
+    dependencies=[Depends(requires_access_dag(method="GET", access_entity=DagAccessEntity.HITL_DETAIL))],
+)
+def get_hitl_detail_try(

Review Comment:
   then it probably should be `get_hitl_detail_try_details` instead



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add HITLDetailHistory UI [airflow]

Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #56760:
URL: https://github.com/apache/airflow/pull/56760#discussion_r2664422045


##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/HITLResponse.tsx:
##########
@@ -47,6 +86,13 @@ export const HITLResponse = () => {
 
   return (
     <Box px={4}>
+      {taskInstance.try_number <= 1 ? undefined : (
+        <TaskTrySelect
+          onSelectTryNumber={onSelectTryNumber}
+          selectedTryNumber={tryNumber}
+          taskInstance={taskInstance}
+        />
+      )}
       <HITLResponseForm hitlDetail={hitlDetail} />

Review Comment:
   This is expected. The user will see the form with the data they previously provided, but the button will be disabled so that they know it's a past try. this is consistent with our current behavior



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org