fix: subrecipe relative path with summon#7295
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes an issue where sub-recipe paths remain relative when recipes are loaded through the goose-server routes, making them unusable by the summon extension. The fix exposes resolve_sub_recipe_path as a public function and adds path resolution logic to both recipe loading functions in the server routes.
Changes:
- Made
resolve_sub_recipe_pathpublic in the recipe build module - Added sub-recipe path resolution in
get_all_recipes_manifestsfor recipe manifests - Added sub-recipe path resolution in
load_recipe_by_idfor individual recipe loading
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| crates/goose/src/recipe/build_recipe/mod.rs | Changed resolve_sub_recipe_path function visibility from private to public to allow use in server routes |
| crates/goose-server/src/routes/recipe_utils.rs | Added sub-recipe path resolution logic in two functions (get_all_recipes_manifests and load_recipe_by_id) to convert relative paths to absolute paths |
| if let Some(recipe_dir) = file_path.parent() { | ||
| if let Some(ref mut sub_recipes) = recipe.sub_recipes { | ||
| for sr in sub_recipes.iter_mut() { | ||
| if let Ok(resolved) = resolve_sub_recipe_path(&sr.path, recipe_dir) { | ||
| sr.path = resolved; | ||
| } | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
This path resolution logic is duplicated in load_recipe_by_id (lines 144-152). Consider extracting it into a helper function to avoid duplication and ensure consistent behavior across both functions.
| if let Ok(resolved) = resolve_sub_recipe_path(&sr.path, recipe_dir) { | ||
| sr.path = resolved; | ||
| } |
There was a problem hiding this comment.
Silent error handling: when resolve_sub_recipe_path fails, the error is silently ignored. This could hide issues like missing sub-recipe files. Consider logging a warning when path resolution fails so issues are visible during debugging.
There was a problem hiding this comment.
probably ok in this case
| if let Ok(resolved) = resolve_sub_recipe_path(&sr.path, recipe_dir) { | ||
| sr.path = resolved; |
There was a problem hiding this comment.
Silent error handling: when resolve_sub_recipe_path fails, the error is silently ignored. This could hide issues like missing sub-recipe files. Consider logging a warning when path resolution fails so issues are visible during debugging.
| if let Ok(resolved) = resolve_sub_recipe_path(&sr.path, recipe_dir) { | |
| sr.path = resolved; | |
| match resolve_sub_recipe_path(&sr.path, recipe_dir) { | |
| Ok(resolved) => { | |
| sr.path = resolved; | |
| } | |
| Err(err) => { | |
| eprintln!( | |
| "Warning: failed to resolve sub-recipe path '{}' relative to '{}': {err}", | |
| sr.path.display(), | |
| recipe_dir.display() | |
| ); | |
| } |
michaelneale
left a comment
There was a problem hiding this comment.
yeah seems reasonable to unblock - will need to fmt it (and a bit of deep nesting going on which may cause clippy grief)
* origin/main: (49 commits) chore: show important keys for provider configuration (#7265) fix: subrecipe relative path with summon (#7295) fix extension selector not displaying the correct enabled extensions (#7290) Use the working dir from the session (#7285) Fix: Minor logging uplift for debugging of prompt injection mitigation (#7195) feat(otel): make otel logging level configurable (#7271) docs: add documentation for Top Of Mind extension (#7283) Document gemini 3 thinking levels (#7282) docs: stream subagent tool calls (#7280) Docs: delete custom provider in desktop (#7279) Everything is streaming (#7247) openai: responses models and hardens event streaming handling (#6831) docs: disable ai session naming (#7194) Added cmd to validate bundled extensions json (#7217) working_dir usage more clear in add_extension (#6958) Use Canonical Models to set context window sizes (#6723) Set up direnv and update flake inputs (#6526) fix: restore subagent tool call notifications after summon refactor (#7243) fix(ui): preserve server config values on partial provider config save (#7248) fix(claude-code): allow goose to run inside a Claude Code session (#7232) ...
* origin/main: feat: add GOOSE_SUBAGENT_MODEL and GOOSE_SUBAGENT_PROVIDER config options (#7277) fix(openai): support "reasoning" field alias in streaming deltas (#7294) fix(ui): revert app-driven iframe width and send containerDimensions per ext-apps spec (#7300) New OpenAI event (#7301) ci: add fork guards to scheduled workflows (#7292) fix: allow ollama input limit override (#7281) chore: show important keys for provider configuration (#7265) fix: subrecipe relative path with summon (#7295) fix extension selector not displaying the correct enabled extensions (#7290) Use the working dir from the session (#7285) Fix: Minor logging uplift for debugging of prompt injection mitigation (#7195) feat(otel): make otel logging level configurable (#7271) docs: add documentation for Top Of Mind extension (#7283) Document gemini 3 thinking levels (#7282) docs: stream subagent tool calls (#7280) Docs: delete custom provider in desktop (#7279) # Conflicts: # ui/desktop/src/components/McpApps/McpAppRenderer.tsx
Summary
This is only fix patch to get the release out quickly.
Bug: for subrecipe path
./sub_recipe_file.yam, it should use the path relative to parent recipe, but actually it tries the path relative to current working dir.Root Cause:
For Desktop, we store original path for session recipe and resolved to the absolution path in agent. However, with summon it uses the recipe data in session without the main recipe path.
Fix:
Resolve the subrecipe path earlier. You can see it has applied at 2 places. Ideally it should resolve when
load_file_path_by_id. However, recently in this PR #7096 it passes the recipe to the server end and theload_file_path_by_idis no longer used. So have to also apply the same logic inget_all_recipes_manifestsnow. When we switch back to userecipe_id, we can only apply the logic toload_file_path_by_idType of Change
AI Assistance
Testing
Related Issues
Relates to #ISSUE_ID
Discussion: LINK (if any)
Screenshots/Demos (for UX changes)
Before:
After: