Scheduled runs have no regression test for recipe-before-inference ordering
- 主要语言
- Rust
- 星标
- 54.2k
- 派生
- 6.2k
- 平均合并
- 3 天 2 小时
- 30 天内合并 PR
- 262
描述
## Summary
Bit convoluted, so my apologies.
If `Scheduler::run_job` does not attach a recipe to the session before starting inference, anything that reads session.recipe during the run sees None. The run itself proceeds normally, which is what makes it hard to spot. Sub-recipe delegation silently returns nothing.
Currently, `Scheduler::run_job` attaches the recipe to the session before starting inference. However, only since #9574 which fixed the issue incidentally while refactoring. There is currently no test, so this bug may be silently reintroduced, and the failure mode was difficult for me to diagnose, so I'd like to guard against this.
## Background
In `crates/goose/src/scheduler.rs`, a scheduled run attaches the recipe to its session via `session_manager.update(...).recipe(...)`. Until 2026-08-06 that call happened **after** the reply stream had been consumed, so for the entire duration of a scheduled run the session's `recipe` was `None`. #9574 is a large restructuring of that function. As far as I can tell the reordering was a side effect rather than the point of the change, and no test was added alongside it.
Anything that reads `session.recipe` during a run sees `None`. The case I hit was sub-recipe resolution: `summon` resolves delegate/load sources from the session's recipe, so for a recipe with a `sub_recipes:` block, the subagent sources did not exist while the run was in progress.
The symptom is:
```
Error: Source 'check_calendar' not found
```
on a recipe whose `sub_recipes` block is present in the file, followed by the agent listing only unrelated library recipes when asked what sources are available.
## Blast Radius
Anyone running recipes on the built-in scheduler, particularly recipes that delegate to sub-recipes. Unattended runs make it worse. The failure surfaces inside the agent's own transcript rather than as a job error, so a scheduled job can fail this way repeatedly without anything obviously going wrong.
## Proposed direction
Add a regression test asserting that, on the scheduled path, the session has its recipe attached before inference begins.
`crates/goose/src/agents/state_machine/tests/recipe_scheduling_lifecycle.rs` looks like the natural home, but its existing tests drive the pipeline directly via `pipeline.set_recipe(...)` and so would not have caught this. Happy to follow whatever placement maintainers prefer.
贡献指南
评估
这个 Issue 还没有评估数据。