aaif-goose / aaif-goose/goose

GOOSE_SUBAGENT_MODEL/PROVIDER override recipe settings.goose_model/goose_provider

Đang mở
#11,862 1 bình luận 0 reaction 1 người được giao Được @jamadeo nhận Xem trên GitHub
Ngôn ngữ chính
Rust
Star
54.2k
Fork
6.2k
Merge trung bình
3 ngày 4 giờ
Pull request đã merge (30 ngày)
240

Mô tả

**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).

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bug nằm trong `crates/goose/src/agents/platform_extensions/summon.rs` ở các hàm `resolve_provider` và `resolve_model_config` (dòng ~1718 và ~1809). Bắt đầu bằng cách đọc test `test_resolve_model_config_env_var_overrides_recipe_model` ở dòng 3246 để hiểu hành vi hiện tại, không đúng. Sau đó, xem xét logic độ ưu tiên cho `GOOSE_SUBAGENT_MAX_TURNS` như được ghi trong `environment-variables.md` để mô hình hóa thứ tự đúng. 'Done' là khi các thiết lập recipe ghi đè đúng các biến môi trường, và assertion của test được đảo ngược.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
rust
Lĩnh vực
ai-infra-agents
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
55/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.