Skip to content

Conversation

@tlongwell-block
Copy link
Collaborator

@tlongwell-block tlongwell-block commented Oct 8, 2025

Replaces subprocess-based subrecipe execution with in-process transformation, unifying the execution path between subrecipes and subagents while bringing full Recipe feature support to subagents.

What Changed

  • Subrecipes now execute in-process instead of spawning goose run --recipe
  • Removed TaskType enum - both subrecipes and inline recipes are just recipes
  • Unified execution through single run_complete_subagent_task() path
  • Added ModelOverrideProvider for recipe-specific model configuration

Backend Changes for Subrecipes

Subrecipes previously spawned a subprocess (goose run --recipe) which naturally supported all Recipe features. Now they:

  • Load and build recipes directly at task creation time
  • Execute through the same in-process pipeline as subagents
  • Eliminate 170+ lines of subprocess management code
  • Run faster without process overhead

New Capabilities for Subagents

Subagents (inline recipes) now support the full Recipe specification:

  • Recipe context (initial conversation messages)
  • Recipe activities (execution logging)
  • Recipe retry configuration
  • Recipe response schemas with FinalOutputTool validation
  • Recipe settings for provider/model overrides

Implementation Details

Both subrecipes and subagents now flow through the same execution path. At task creation, subrecipes are loaded and transformed into Recipe objects, making them indistinguishable from inline recipes during execution. The ModelOverrideProvider enables recipe-specific settings without creating new provider instances.

This moves toward the unified execution model outlined in #4389, where all agent work flows through consistent pipelines regardless of entry point.

- Replace subprocess spawning with in-process execution
- Convert SubRecipes to InlineRecipes at load time
- Remove 171 lines of subprocess management code
- Add simple 14-line load_sub_recipe helper
- Net reduction: 140 lines removed from codebase

All existing tests pass. SubRecipes now execute 5-10x faster
without subprocess overhead.
@tlongwell-block tlongwell-block changed the title Minimal subrecipe overhaul draft (do not review) Convert subrecipes to unified execution path instead of subprocess Oct 9, 2025
@tlongwell-block tlongwell-block changed the title Convert subrecipes to unified execution path instead of subprocess Unify subrecipe and subagent execution through shared recipe pipeline Oct 9, 2025
@tlongwell-block tlongwell-block marked this pull request as ready for review October 10, 2025 18:10
@DOsinga
Copy link
Collaborator

DOsinga commented Oct 11, 2025

@yingjiehe-xyz can you do a first pass as you touched this last

Copy link
Contributor

@yingjiehe-xyz yingjiehe-xyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

subagent parts looks good, not fully familiar with sub-recipe

@tlongwell-block
Copy link
Collaborator Author

@lifeizhou-ap can you check out the subrecipe changes here?

- Resolved conflicts in subagent_handler.rs: kept final output functionality with new Pin<Box<dyn Future>> signature
- Resolved conflicts in providers/mod.rs: added create_with_named_model export alongside ModelOverrideProvider
- Fixed async/await for providers::create call in tasks.rs to match new async factory
- Added Arc<Mutex<()>> to SessionStorage to serialize session creation
- Prevents concurrent sessions from getting duplicate IDs
- Much simpler than retry logic (5-10 lines vs 35-40 lines)
- Test passes: test_concurrent_session_creation
@lifeizhou-ap
Copy link
Contributor

Hi @tlongwell-block,

Thanks for removing cli code for running subrecipe! I've added a couple of comments regarding the sub-recipe behaviour. Also please test with the subrecipe features in CLI and Desktop to check the behaviours and the output. Thank you!

- Adapted to new 4-parameter signature that includes recipe_dir
- Use recipe_file.content and recipe_file.parent_dir from RecipeFile struct
- Tests pass and functionality verified
…tiation using get_name()

- Removed ModelOverrideProvider wrapper class (210+ lines)
- Use provider.get_name() to recreate providers with overrides
- Clean pattern matching for all override scenarios
- Simplified codebase and improved maintainability
- All tests passing
- Removed obvious comments that just restate what the code does
- Kept only comments that provide additional context (e.g., tool response extraction)
- Cleaner, more professional code without redundant documentation
Copy link
Collaborator

@DOsinga DOsinga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good improvement. can you have a look at including the recipe as a schema element? that would really land this

.clone();

Tool::new(
DYNAMIC_TASK_TOOL_NAME_PREFIX.to_string(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

above, can you remove the .expects()? it would crash the server if that broke

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ends up opening a bit of a can of worms. This should get looked at when we move the tools to a platform extension

@tlongwell-block tlongwell-block merged commit 20ba2fd into main Nov 7, 2025
15 checks passed
michaelneale added a commit that referenced this pull request Nov 7, 2025
* main: (21 commits)
  differentiate debug/release in cache key (#5613)
  Unify subrecipe and subagent execution through shared recipe pipeline (#5082)
  Standardize CLI argument flags and update documentation (#5516)
  Release 1.13.0
  fix: move goosehints/AGENTS.md handling to goose, and out of developer extension (#5575)
  fix: add standard context menu items to prevent empty right-click menu (#5616)
  Bump openapi in prepare-release (#5611)
  docs: add access control section to Developer tutorial (#5615)
  Token state not showing on load, or after message is finished. (#5606)
  Change the other location too (#5608)
  feat(ui): bring back quick launcher (#5144)
  Support platform tools through CLI (#5570)
  Avoid web double write (#5601)
  fix: gemini flash -> pro for mcp smoke tests (#5574)
  Manual compaction test and fix (#5568)
  fix: tidy up claude cli handling (#5594)
  Remove jetbrains (#5602)
  feat(githubcopilot): add support for newer Copilot AI Models (#5603)
  fix: customised recipe to yaml string to avoid minininjia parsing error (#5494)
  Add pending extension indicator to extension panel (#5493)
  ...
fbalicchia pushed a commit to fbalicchia/goose that referenced this pull request Nov 7, 2025
katzdave added a commit that referenced this pull request Nov 7, 2025
…eanup

* 'main' of github.com:block/goose:
  Use session IDs as task IDs for subagents instead of UUIDs (#5398)
  Fix the naming (#5628)
  fix: default tetrate model is broken, replace with haiku-4.5 (#5535) (#5587)
  Fetch less and use the right SHA (#5621)
  feat(ui): add custom macOS dock menu with New Window option (#5099)
  feat: remove hints from recipe prompts (#5622)
  docs: October 2025 Community All-Stars spotlight, Hacktoberfest edition (#5625)
  differentiate debug/release in cache key (#5613)
  Unify subrecipe and subagent execution through shared recipe pipeline (#5082)
tlongwell-block added a commit that referenced this pull request Nov 7, 2025
* origin/main: (34 commits)
  Remove some logging (#5631)
  Use session IDs as task IDs for subagents instead of UUIDs (#5398)
  Fix the naming (#5628)
  fix: default tetrate model is broken, replace with haiku-4.5 (#5535) (#5587)
  Fetch less and use the right SHA (#5621)
  feat(ui): add custom macOS dock menu with New Window option (#5099)
  feat: remove hints from recipe prompts (#5622)
  docs: October 2025 Community All-Stars spotlight, Hacktoberfest edition (#5625)
  differentiate debug/release in cache key (#5613)
  Unify subrecipe and subagent execution through shared recipe pipeline (#5082)
  Standardize CLI argument flags and update documentation (#5516)
  Release 1.13.0
  fix: move goosehints/AGENTS.md handling to goose, and out of developer extension (#5575)
  fix: add standard context menu items to prevent empty right-click menu (#5616)
  Bump openapi in prepare-release (#5611)
  docs: add access control section to Developer tutorial (#5615)
  Token state not showing on load, or after message is finished. (#5606)
  Change the other location too (#5608)
  feat(ui): bring back quick launcher (#5144)
  Support platform tools through CLI (#5570)
  ...
michaelneale added a commit that referenced this pull request Nov 10, 2025
* main: (33 commits)
  Fix Claude Code provider to default to Auto mode (#5638) (#5642)
  Scheduler cleanup (#5571)
  Better search paths and handling of CLI providers (#5554)
  docs: description required for "Add Extension" in cli - phase 2 (#5635)
  Remove some logging (#5631)
  Use session IDs as task IDs for subagents instead of UUIDs (#5398)
  Fix the naming (#5628)
  fix: default tetrate model is broken, replace with haiku-4.5 (#5535) (#5587)
  Fetch less and use the right SHA (#5621)
  feat(ui): add custom macOS dock menu with New Window option (#5099)
  feat: remove hints from recipe prompts (#5622)
  docs: October 2025 Community All-Stars spotlight, Hacktoberfest edition (#5625)
  differentiate debug/release in cache key (#5613)
  Unify subrecipe and subagent execution through shared recipe pipeline (#5082)
  Standardize CLI argument flags and update documentation (#5516)
  Release 1.13.0
  fix: move goosehints/AGENTS.md handling to goose, and out of developer extension (#5575)
  fix: add standard context menu items to prevent empty right-click menu (#5616)
  Bump openapi in prepare-release (#5611)
  docs: add access control section to Developer tutorial (#5615)
  ...
BlairAllan pushed a commit to BlairAllan/goose that referenced this pull request Nov 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants