aaif-goose / aaif-goose/goose

GOOSE_SUBAGENT_MODEL/PROVIDER override recipe settings.goose_model/goose_provider

未关闭
#11,862 1 条评论 0 个 reaction 已指派 1 人 已被 @jamadeo 认领 在 GitHub 查看
主要语言
Rust
星标
54.2k
派生
6.2k
平均合并
3 天 4 小时
30 天内合并 PR
240

描述

**Describe the bug**

`resolve_provider`/`resolve_model_config` in `crates/goose/src/agents/platform_extensions/summon.rs` resolve `GOOSE_SUBAGENT_PROVIDER`/`GOOSE_SUBAGENT_MODEL` above everything else, including `recipe.settings.goose_provider`/`goose_model` (`summon.rs:1726`, `summon.rs:1822`). #9650 introduced this to stop the orchestrator LLM from confabulating provider/model into `delegate()` tool-call params (#9644) and having the env var silently ignored. It also put the env var above `recipe.settings`, not just above LLM-supplied params.

This contradicts goose's own documented precedent for the sibling variable. `GOOSE_SUBAGENT_MAX_TURNS` is documented as "can be overridden by `settings.max_turns` in recipes" (environment-variables.md:156). Recipe settings outrank that env var. It also contradicts the Settings section's own note in recipe-reference.md: "Settings specified in a recipe will override your default goose configuration." Neither `GOOSE_SUBAGENT_MODEL` nor `GOOSE_SUBAGENT_PROVIDER` appears in the docs at all, so there's no documented precedence for the reversal. This looks like an oversight in #9650's scope, not a deliberate design choice.

Net effect: any recipe that pins a distinct `goose_model`/`goose_provider` per delegate role has every role silently collapse to one model the moment `GOOSE_SUBAGENT_MODEL` is set anywhere in the environment. No error or warning is raised.

---

**To Reproduce**

Steps to reproduce the behavior:
1. Two recipes, each with a documented `settings:` block (per recipe-reference.md#settings), same provider, different model:
```yaml
# role-a.yaml
settings:
goose_provider: "openrouter"
goose_model: "openai/gpt-5.6-luna"
```
```yaml
# role-b.yaml
settings:
goose_provider: "openrouter"
goose_model: "google/gemini-3.8-flash"
```
2. `export GOOSE_SUBAGENT_MODEL=anthropic/claude-opus-5`
3. `delegate()` into role-a, then role-b, from an orchestrating recipe.
4. Both delegates run on `claude-opus-5`. Each recipe's own `goose_model` is silently ignored.

---

**Expected behavior**

`recipe.settings.goose_model`/`goose_provider` should not be overridden by `GOOSE_SUBAGENT_MODEL`/`GOOSE_SUBAGENT_PROVIDER`. This should match the precedence already documented for `GOOSE_SUBAGENT_MAX_TURNS`: subagent tool-call param > recipe `settings` > `GOOSE_SUBAGENT_*` env var > persisted config > default. Whatever the final order, it should be added to environment-variables.md and recipe-reference.md. Both vars are currently undocumented.

---

**Screenshots**

N/A

---

**Please provide the following information**
- **OS & Arch:** macOS (Darwin 25.6.0) arm64
- **Interface:** CLI
- **Version:** v1.49.0 (commit dce690095)
- **Extensions enabled:** N/A
- **Provider & Model:** Any. Reproduces with any provider/model pinned via recipe settings.

---

**Additional context**

Related: #9644 (orchestrator LLM confabulation into delegate() params), #9650 (introduced this regression while fixing #9644). Code: `summon.rs:1718` (`resolve_model_config`), `summon.rs:1809` (`resolve_provider`). The regression is currently pinned by an existing test that asserts the overriding behavior as intended: `test_resolve_model_config_env_var_overrides_recipe_model` (`summon.rs:3246`). That test's assertion should be reversed if this is addressed.

Do not begin implementation until the issue reaches **Ready** on the [Goose Issues board](https://github.com/orgs/aaif-goose/projects/1).

贡献指南

打开贡献指南

调研方向

The bug is in `crates/goose/src/agents/platform_extensions/summon.rs` in the `resolve_provider` and `resolve_model_config` functions (lines ~1718 and ~1809). Start by reading the test `test_resolve_model_config_env_var_overrides_recipe_model` at line 3246 to understand the current, incorrect behavior. Then, examine the precedence logic for `GOOSE_SUBAGENT_MAX_TURNS` as documented in `environment-variables.md` to model the correct order. 'Done' is when recipe settings correctly override the environment variables, and the test assertion is reversed.

由索引模型根据 Issue 内容生成。

评估

技术栈
rust
领域
ai-infra-agents
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
描述清楚
新手友好度
55/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。