Confusing Output When Loading Nested Sub-Recipes
Describe the bug
Say I have a recipe file structure like the following:
recipe_test/
├── oncall-buddy-recipe.yaml # Main recipe
├── analyze-pagerduty-incident.yaml # Sub-recipe (level 1)
└── sub-recipes/
├── pagerduty.yaml # Nested sub-recipe (level 2)
├── presidio.yaml # Nested sub-recipe (level 2)
├── sentry.yaml # Nested sub-recipe (level 2)
└── jira.yaml # Nested sub-recipe (level 2)
Where the main recipe references a sub-recipe with template variable:
# oncall-buddy-recipe.yaml
sub_recipes:
- name: analyze-pagerduty-incident
path: "{{ recipe_dir }}/analyze-pagerduty-incident.yaml"
And that sub-recipe references its own sub-recipes:
# analyze-pagerduty-incident.yaml
sub_recipes:
- name: "pagerduty"
path: "{{ recipe_dir }}/sub-recipes/pagerduty.yaml"
- name: "presidio"
path: "{{ recipe_dir }}/sub-recipes/presidio.yaml"
While the session is starting, secret discovery are loaded without resolving Jinja2 template variables resulting in noisy GitHub lookup failures for the nested sub-recipes:
📦 Looking for recipe "{{ recipe_dir }}/sub-recipes/pagerduty.yaml" in github repo: squareup/goose-recipes
fatal: not a valid object name: origin/main:{{ recipe_dir }}/sub-recipes/pagerduty.yaml
📦 Looking for recipe "{{ recipe_dir }}/sub-recipes/presidio.yaml" in github repo: squareup/goose-recipes
fatal: not a valid object name: origin/main:{{ recipe_dir }}/sub-recipes/presidio.yaml
...
Note this isn't actually a problem and the nested sub-recipes still work when invoked in the session, since recipe execution goes through a different path with build_recipe_from_template() and templates are properly rendered. This problem is just that the GitHub lookup failure messages are confusing and misleading and imply that the nested sub-recipes won't work in the session, which isn't true.
This seems to have been introduced in #4974
To Reproduce
Given the recipe structure above, run goose run --recipe ./recipe_test/oncall-buddy-recipe.yaml and observe the output.
Expected behavior
I would expect template variables like {{ recipe_dir }} to be rendered/resolved before attempting to use them, instead of using the string literal {{ recipe_dir }} in a file operation
Please provide following information:
- OS & Arch: Darwin (Sequoia 15.6.1) arm64
- Interface: CLI
- Version: unreleased, built off latest
main - Extensions enabled:
computercontroller,developer - Provider & Model: Databricks + Claude Sonnet 4
@tlongwell-block checking if this is something you can look into?