kaxil opened a new pull request, #75518: URL: https://github.com/apache/airflow/pull/75518
Follow-up to #74334, which added the AI Model tab, and #74351, which taught the HITL review plugin to address one loop pass. For an `@task.agent` or `@task.llm` task inside a task loop, the AI Model tab shows "No AI Model Info" with "Select a region and index for this task instance", even though the task pushed its model name and `usage` XComs. The tab reads them by task id and map index only. For a loop task the XCom route also needs the loop pass, so it rejects the read with a 400. The tab now sends the selected task instance's `region_id` and `region_index` on both reads. **No core change.** The host already passes the resolved `taskInstance`, which carries the region, to every plugin ([`ReactPlugin.tsx`](https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/ui/src/pages/ReactPlugin.tsx)), and the HITL review plugin has used it since #74351. The region helpers move into a side-effect-free `region.ts` that both plugin bundles import, so the two tabs share one rule instead of two copies. **Older hosts keep the old requests.** A host that predates the `taskInstance` prop never passes the key, so the tab reads without a region, as before. On a newer host the tab shows its loading spinner until the task instance resolves, rather than sending a read without the region. **A slow read for the previous loop pass no longer wins.** The host remounts a plugin when the path changes ([`ExternalView.tsx`](https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/ui/src/pages/ExternalView.tsx)), but the loop pass is a search param, so switching passes keeps the panel mounted while the old read may still be in flight. Its result is now dropped. The new tests render the plugin in happy-dom, added as a dev dependency (the core UI tests use the same library). They check the region on both reads, the reread on a pass switch, and the stale-read case. Each of those fails if the region is dropped at any layer between the plugin props and the request. --- * Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information. Note: commit author/co-author name and email in commits become permanently public when merged. * For fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed. * When adding dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x). * For significant user-facing changes create newsfragment: `{pr_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments). You can add this file in a follow-up commit after the PR is created so you know the PR number. -- 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]
