fix(recipe): auto-inject summon when instructions use delegate()#7360
Open
clouatre wants to merge 1 commit intoblock:mainfrom
Open
fix(recipe): auto-inject summon when instructions use delegate()#7360clouatre wants to merge 1 commit intoblock:mainfrom
clouatre wants to merge 1 commit intoblock:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a regression from #6964 where recipes with explicit extensions: blocks that omit summon lose access to the delegate() tool. The fix extends the ensure_summon_for_subrecipes function to detect delegate( usage in recipe instructions and auto-inject the summon extension when needed.
Changes:
- Extended
ensure_summon_for_subrecipesto detectdelegate(in instructions and auto-inject summon platform extension - Added warning when auto-injection occurs due to delegate usage
- Added three unit tests for delegate detection and summon injection scenarios
4ea343f to
ecd4c76
Compare
Recipes with an explicit extensions block that omits summon lose access
to the delegate tool. ensure_summon_for_subrecipes only checked for
sub_recipes presence; it now also scans recipe.instructions for the
string 'delegate(' and injects the summon platform extension when found
but absent. A tracing warning is emitted when auto-injection occurs.
Three unit tests cover: injection when delegate is used without summon,
no duplication when summon is already listed, and no injection when
delegate is not used.
Fixes block#7355
Signed-off-by: Hugues Clouâtre <hugues@linux.com>
ecd4c76 to
2ebd70e
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
crates/goose/src/recipe/mod.rs:267
ensure_summon_for_subrecipescurrently injectsextensions = Some(vec![summon])whenuses_delegateandextensionsisNone, which turns an implicit "use globally-enabled extensions" recipe into an explicit/exclusive extensions list (seeresolve_extensions_for_new_session), potentially dropping other enabled extensions and changing runtime behavior; consider only auto-injecting when the recipe had an explicitextensions:block (i.e.,self.extensions.is_some()), or mergingsummoninto the resolved enabled extensions instead of replacing them.
let summon_present = self
.extensions
.as_ref()
.map(|exts| exts.iter().any(|e| e.name() == "summon"))
.unwrap_or(false);
if uses_delegate && !summon_present {
warn!("recipe instructions use 'delegate' but 'summon' extension is not listed; auto-injecting summon");
}
let summon = ExtensionConfig::Platform {
name: "summon".to_string(),
description: String::new(),
display_name: None,
bundled: None,
available_tools: vec![],
};
match &mut self.extensions {
Some(exts) if !exts.iter().any(|e| e.name() == "summon") => exts.push(summon),
None => self.extensions = Some(vec![summon]),
_ => {}
This was referenced Feb 19, 2026
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.
Summary
Recipes with an explicit
extensions:block that omitssummonlose access to thedelegatetool. This was a regression introduced in #6964, which moveddelegatefrom an unconditional builtin into thesummonplatform extension.ensure_summon_for_subrecipesonly checked forsub_recipespresence. It now also scansrecipe.instructionsfor the stringdelegate(and injects thesummonplatform extension when found but absent. Atracing::warnis emitted when auto-injection occurs.Changes
crates/goose/src/recipe/mod.rs: extendensure_summon_for_subrecipesto detectdelegate(in instructions and auto-inject summonTests
Three unit tests added:
test_ensure_summon_injected_when_delegate_in_instructions: recipe with explicit empty extensions anddelegate(in instructions gets summon injectedtest_ensure_summon_not_duplicated_when_already_present: summon already listed + delegate in instructions stays at exactly one summon entrytest_ensure_summon_not_injected_without_delegate: recipe without delegate and empty extensions stays emptyReproduction
Before this fix, a recipe like:
would fail with
delegatetool not found at runtime.After this fix,
summonis auto-injected and the recipe works as expected.Fixes #7355