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

jason810496 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new a96c3273868 Warn agents against loading the serialized Dag on hot 
paths (#75932)
a96c3273868 is described below

commit a96c327386812589643b544a861f2fec79ee237f
Author: Jason(Zhe-You) Liu <[email protected]>
AuthorDate: Sun Nov 1 17:29:15 2026 +0800

    Warn agents against loading the serialized Dag on hot paths (#75932)
    
    * Warn agents against loading the serialized Dag on hot paths
    
    A performance regression reached 3.4.0 because ti_run deserialized the whole
    serialized Dag on every task start to read two fields only a stub task 
needs.
    #75795 gated that load on ti.is_stub, but nothing recorded the rule, so the
    next route to want a task attribute can reintroduce it just as easily.
    
    * Clarify when to gate the serialized Dag load vs add a column
    
    ---------
---
 airflow-core/src/airflow/api_fastapi/execution_api/AGENTS.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/airflow-core/src/airflow/api_fastapi/execution_api/AGENTS.md 
b/airflow-core/src/airflow/api_fastapi/execution_api/AGENTS.md
index 7e0cfecc7e3..146f8171022 100644
--- a/airflow-core/src/airflow/api_fastapi/execution_api/AGENTS.md
+++ b/airflow-core/src/airflow/api_fastapi/execution_api/AGENTS.md
@@ -32,6 +32,7 @@ uv run --active --group codegen --project 
apache-airflow-task-sdk --directory ta
 - Don't use keyword arguments with `endpoint()` — use positional: 
`endpoint("/path", ["GET"])`.
 - Don't add changes to already-released version files.
 - Don't forget response converters for new fields in nested objects.
+- Don't load the serialized Dag unconditionally on a per-task hot path such as 
`ti_run`. Gate the load so only the tasks that need it pay the cost (as 
`ti.is_stub` does), and add a `task_instance` column only when every task needs 
the value.
 - Don't branch business logic by comparing the negotiated API version to a 
date/version string. For this case, subclass `VersionChangeWithSideEffects` for 
the version change and check its `is_applied` flag instead:
 
   ```python

Reply via email to