Jie211 opened a new issue, #68217:
URL: https://github.com/apache/airflow/issues/68217

   ### Under which category would you file this issue?
   
   Providers
   
   ### Apache Airflow version
   
   3.1.7
   
   ### What happened and how to reproduce it?
   
   When I set this `enable_hitl_review=True` in an agent task in my DAG, The 
`common.ai` HITL Review tab show **404** instead of the review UI. 
   
   The plugin's React bundle crashes on load:
   
   ```
   Component Failed Loading: TypeError: Cannot read properties of undefined 
(reading 'createToaster')
       at <webserver>/hitl-review/static/main.umd.cjs
   ```
   
   **Reproduce**
   
   ```python
   from datetime import timedelta
   
   from airflow.providers.common.compat.sdk import dag, task
   from pydantic import BaseModel
   
   
   @dag
   def hitl_repro():
       class Report(BaseModel):
           summary: str
   
       @task.agent(
           llm_conn_id="my_llm_conn",
           system_prompt="Produce a short structured report.",
           output_type=Report,
           enable_hitl_review=True,
           max_hitl_iterations=5,
           hitl_timeout=timedelta(minutes=30),
       )
       def analyze(question: str) -> str:
           return f"Answer: {question}"
   
       analyze("one-line health summary")
   
   
   hitl_repro()
   ```
   
   1. Trigger it; the task reaches `pending_review`.
   2. Open the task instance → **HITL Review** tab → 404, with the console 
error above.
   
   Plugin registration, the bundle file, and the backend 
(`/hitl-review/openapi.json`, `/hitl-review/sessions/find`) all return 200 — 
only the React mount fails.
   
   ### What you think should happen instead?
   
   The HITL Review tab should render the review UI (current output + approve / 
request-changes / reject) so a human can drive the loop.
   
   It fails because the bundle externalizes `@chakra-ui/react`, but the plugin 
contract only shares React/React-DOM — so Chakra is `undefined` at runtime and 
`createToaster` (a Chakra v3 API) throws.
   The error is "reading 'createToaster' of **undefined**", i.e. the whole 
module is missing from the shared scope, not a version diff.
   
   **Fix:** bundle Chakra UI inside the plugin instead of externalizing it; 
only React/React-DOM should be external.
   
   Backend works, so reviews can still be driven via REST in the meantime: 
`POST /hitl-review/sessions/{approve,reject,feedback}` (query 
`dag_id`/`run_id`/`task_id`/`map_index`; `feedback` body `{"feedback": "..."}`).
   
   (This part was created by GPT)
   
   ### Operating System
   
   _No response_
   
   ### Deployment
   
   Other 3rd-party Helm chart
   
   ### Apache Airflow Provider(s)
   
   common-ai
   
   ### Versions of Apache Airflow Providers
   
   ```
   apache-airflow                            3.1.7
   apache-airflow-core                       3.1.7
   apache-airflow-providers-amazon           9.21.0
   apache-airflow-providers-apache-cassandra 3.9.1
   apache-airflow-providers-apache-hdfs      4.11.3
   apache-airflow-providers-apache-hive      9.2.4
   apache-airflow-providers-apache-livy      4.5.3
   apache-airflow-providers-apache-spark     5.5.0
   apache-airflow-providers-celery           3.15.2
   apache-airflow-providers-cncf-kubernetes  10.12.3
   apache-airflow-providers-common-ai        0.4.0
   apache-airflow-providers-common-compat    1.15.0
   apache-airflow-providers-common-io        1.7.1
   apache-airflow-providers-common-sql       1.36.0
   apache-airflow-providers-fab              3.2.0
   apache-airflow-providers-git              0.2.2
   apache-airflow-providers-github           2.10.2
   apache-airflow-providers-http             5.6.4
   apache-airflow-providers-mysql            6.4.2
   apache-airflow-providers-openai           1.7.2
   apache-airflow-providers-opensearch       1.8.4
   apache-airflow-providers-oracle           4.3.1
   apache-airflow-providers-pagerduty        5.2.3
   apache-airflow-providers-papermill        3.12.1
   apache-airflow-providers-postgres         6.5.3
   apache-airflow-providers-redis            4.4.2
   apache-airflow-providers-slack            9.6.2
   apache-airflow-providers-smtp             2.4.2
   apache-airflow-providers-ssh              4.3.1
   apache-airflow-providers-standard         1.14.0
   apache-airflow-providers-tableau          5.3.2
   apache-airflow-providers-trino            6.4.2
   apache-airflow-task-sdk                   1.1.7
   ```
   
   ### Official Helm Chart version
   
   Not Applicable
   
   ### Kubernetes Version
   
   Not Applicable
   
   ### Helm Chart configuration
   
   _No response_
   
   ### Docker Image customizations
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


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