Repository navigation
Conversation
Blueprint adds blueprint_step_config, blueprint_step_code and
blueprint_dag_args to each task's template_fields so the Rendered
Template tab shows them. Airflow renders these fields as Jinja when the
task runs, so a blueprint whose source file contains a template string
such as "{{ task.prompt }}" failed every task it built.
Wrap each value in a Jinja raw block before it goes on the task. Every
"{%" in the text gets split so an "endraw" tag inside the source cannot
close the block early. The rendered value is the original text, and
config values that operators use as templates still render in their
own fields.
schnie
approved these changes
Oct 5, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A blueprint whose source file contains a Jinja string fails every task it builds. For example,
map_index_template="{{ task.prompt.splitlines()[0] }}"givesUndefinedError: '..._PythonDecoratedOperator object' has no attribute 'prompt'on the first task, even one that never uses that template. Blueprint adds the step config, the blueprint source and the DAG args to each task'stemplate_fieldsso the Rendered Template tab shows them, and Airflow renders those fields as Jinja when the task runs. Each value is now wrapped in a Jinjarawblock, so it renders back to the exact text.Call-stack diff
build_all_airflow_dags() └─ Builder.build() └─ Builder._render_step() ├─ blueprint.render(config) # unchanged └─ Builder._inject_step_context() + ├─ _jinja_literal(step_yaml) + ├─ _jinja_literal(source_code) + └─ _jinja_literal(dag_args_yaml)Unchanged: the three fields stay in
template_fieldswith the same renderers. A config value that a blueprint passes into an operator argument, such asbash_command: "echo {{ ds }}", still renders there._jinja_literalsplits every{%in the text, so an{% endraw %}inside a blueprint's source cannot close the raw block early. I checked it against plain, sandboxed (withtrim_blocksandlstrip_blocks) and native Jinja environments. Until Airflow renders them,task.blueprint_step_codeand the other two attributes hold the wrapped text, so anything that reads them directly sees therawmarkup.template_fieldsalso stops the rendering, but drops them from the Rendered Template tab.embed_sourceis not involved. It controls onlydefault_args["blueprint_source"]for the YAML tab, which is not a template field, and it never turned off these per-task fields.tests/test_builder.py, all failing before the fix.pytest tests/ --ignore=tests/integration: 445 passed.ruff check,ruff format --checkandty checkpass. I did not run the integration tests, which need the Astro CLI. Found with 0.5.0 on Airflow 3.3.2; the tests reproduce it on 3.0.3.