Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/patched-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Modified by Jonathan Mohrbacher, 2026: test-patches runs subdirectory hints tests; test-patches runs message id / truncate_from_message tests; the release also carries the aarch64-apple-darwin CLI.
# Modified by Jonathan Mohrbacher, 2026: test-patches runs subdirectory hints tests; test-patches runs message id / truncate_from_message tests; the release also carries the aarch64-apple-darwin CLI; test-patches runs role recipe thinking_effort tests.
# Builds this branch (an upstream release tag plus a few local patches) with upstream's own
# Linux CLI build workflow and patched-build-macos.yml (upstream's macOS CLI build, unsigned), so the result
# differs from the upstream release only by the patches, and publishes the gnu tarballs and the
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
- name: Test patched modules
run: |
F=code-mode,tree-sitter,aws-providers,telemetry,otel,rustls-tls,live-voice,system-keyring,platform-apps,chat-recall,scheduler,acp-http,online-model-meta
cargo test --release -p goose --features "$F" --lib -- gcpvertexai session_context test_parent_link_is_visible_to_providers gcpauth process_group cache_ttl max_turns_from_meta test_add_final_output_tool rolling self_compact compact_kind global_skill mcp_client_startup_timeout turn_error subagent_policy subdirectory_hints deliver_subdirectory_hints requeue_after_history_replacement message_id_from_meta agent_capabilities_advertise_truncate_from_message truncate_conversation_from_message requeue_hints_missing_from cache_miss_breaker
cargo test --release -p goose --features "$F" --lib -- gcpvertexai session_context test_parent_link_is_visible_to_providers gcpauth process_group cache_ttl max_turns_from_meta test_add_final_output_tool rolling self_compact compact_kind global_skill mcp_client_startup_timeout turn_error subagent_policy subdirectory_hints deliver_subdirectory_hints requeue_after_history_replacement message_id_from_meta agent_capabilities_advertise_truncate_from_message truncate_conversation_from_message requeue_hints_missing_from cache_miss_breaker recipe_thinking_effort recipe_without_thinking_effort thinking_effort_parsing invalid_thinking_effort
cargo test --release -p goose --features "$F" --test acp_server_test -- test_session_settings test_prompt_max_turns_bounds_run test_prompt_self_compact test_recipe_session_after_reload_never_lists_self_compact_and_resume test_prompt_turn_error test_prompt_message_id_and_truncate_from_message
cargo test --release -p goose --features "$F" --test rolling_memory
cargo test --release -p goose --features "$F" --test self_compact
Expand Down
1 change: 1 addition & 0 deletions crates/goose/src/acp/server/recipe/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ impl From<RecipeSettingsDto> for Settings {
goose_model: dto.goose_model,
temperature: dto.temperature,
max_turns: dto.max_turns,
thinking_effort: None,
}
}
}
Expand Down
151 changes: 150 additions & 1 deletion crates/goose/src/agents/platform_extensions/summon.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Modified by Jonathan Mohrbacher, 2026: subagent policy: GOOSE_SUBAGENT_ROLES_DIR (~ expanded) is scanned first; recipe declared extensions replace parent; GOOSE_SUBAGENT_DEFAULT_RECIPE scopes delegates declaring no extensions.
// Modified by Jonathan Mohrbacher, 2026: subagent policy: GOOSE_SUBAGENT_ROLES_DIR (~ expanded) is scanned first; recipe declared extensions replace parent; GOOSE_SUBAGENT_DEFAULT_RECIPE scopes delegates declaring no extensions; recipe settings.thinking_effort overrides the inherited delegate effort.
use crate::agents::extension::PlatformExtensionContext;
use crate::agents::final_output_tool::FinalOutputTool;
use crate::agents::mcp_client::{Error, McpClientTrait};
Expand Down Expand Up @@ -1548,6 +1548,7 @@ impl SummonClient {
goose_model: None,
temperature: None,
max_turns: None,
thinking_effort: None,
})
.max_turns = Some(max_turns);
if recipe
Expand Down Expand Up @@ -1795,6 +1796,7 @@ impl SummonClient {
goose_provider: params.provider.clone(),
temperature: params.temperature,
max_turns: None,
thinking_effort: None,
});

let mut builder = Recipe::builder()
Expand Down Expand Up @@ -1994,6 +1996,10 @@ impl SummonClient {
model_config = model_config.with_temperature(Some(temp));
}

if let Some(effort) = recipe.settings.as_ref().and_then(|s| s.thinking_effort) {
model_config = model_config.with_thinking_effort(effort);
}

Ok(model_config)
}

Expand Down Expand Up @@ -3339,6 +3345,7 @@ You review code."#;
goose_model: None,
temperature: None,
max_turns: Some(10),
thinking_effort: None,
}),
activities: None,
author: None,
Expand Down Expand Up @@ -3612,6 +3619,145 @@ You review code."#;
);
}

#[tokio::test]
#[serial]
async fn test_resolve_model_config_recipe_thinking_effort_overrides_parent_on_override() {
use goose_providers::thinking::ThinkingEffort;

let _env = env_lock::lock_env([
("GOOSE_CONTEXT_LIMIT", None::<&str>),
("GOOSE_MAX_TOKENS", None::<&str>),
("GOOSE_SUBAGENT_MODEL", None::<&str>),
]);

let parent = parent_config().with_thinking_effort(ThinkingEffort::Medium);
let client = SummonClient::new(create_test_context()).unwrap();
let params = DelegateParams {
model: Some(OVERRIDE_MODEL.to_string()),
..Default::default()
};
let recipe = Recipe::from_content(
r#"
version: "1.0.0"
title: "Test"
description: "Test"
instructions: "Test"
settings:
thinking_effort: high
"#,
)
.expect("recipe with thinking_effort should parse");

let resolved = client
.resolve_model_config(&params, &recipe, &session_with(parent), PROVIDER, None)
.expect("resolve_model_config");

assert_eq!(
resolved.thinking_effort(),
Some(ThinkingEffort::High),
"recipe settings.thinking_effort must override inherited effort on model override"
);
}

#[tokio::test]
#[serial]
async fn test_resolve_model_config_recipe_thinking_effort_overrides_parent_on_clone() {
use goose_providers::thinking::ThinkingEffort;

let _env = env_lock::lock_env([
("GOOSE_CONTEXT_LIMIT", None::<&str>),
("GOOSE_MAX_TOKENS", None::<&str>),
("GOOSE_SUBAGENT_MODEL", None::<&str>),
]);

let parent = parent_config().with_thinking_effort(ThinkingEffort::Medium);
let client = SummonClient::new(create_test_context()).unwrap();
let params = DelegateParams::default();
let recipe = Recipe::from_content(
r#"
version: "1.0.0"
title: "Test"
description: "Test"
instructions: "Test"
settings:
thinking_effort: high
"#,
)
.expect("recipe with thinking_effort should parse");

let resolved = client
.resolve_model_config(&params, &recipe, &session_with(parent), PROVIDER, None)
.expect("resolve_model_config");

assert_eq!(
resolved.thinking_effort(),
Some(ThinkingEffort::High),
"recipe settings.thinking_effort must override inherited effort on same-model clone"
);
}

#[tokio::test]
#[serial]
async fn test_resolve_model_config_recipe_without_thinking_effort_inherits_parent() {
use goose_providers::thinking::ThinkingEffort;

let _env = env_lock::lock_env([
("GOOSE_CONTEXT_LIMIT", None::<&str>),
("GOOSE_MAX_TOKENS", None::<&str>),
("GOOSE_SUBAGENT_MODEL", None::<&str>),
]);

let parent = parent_config().with_thinking_effort(ThinkingEffort::Medium);
let client = SummonClient::new(create_test_context()).unwrap();
let params = DelegateParams {
model: Some(OVERRIDE_MODEL.to_string()),
..Default::default()
};
let recipe = empty_recipe();

let resolved = client
.resolve_model_config(&params, &recipe, &session_with(parent), PROVIDER, None)
.expect("resolve_model_config");

assert_eq!(
resolved.thinking_effort(),
Some(ThinkingEffort::Medium),
"recipe without thinking_effort must inherit parent's medium effort"
);
}

#[test]
fn test_recipe_yaml_thinking_effort_parsing() {
use goose_providers::thinking::ThinkingEffort;

let valid_yaml = r#"
version: "1.0.0"
title: "Test"
description: "Test"
instructions: "Test"
settings:
thinking_effort: high
"#;
let recipe =
Recipe::from_content(valid_yaml).expect("recipe with thinking_effort should parse");
assert_eq!(
recipe.settings.as_ref().and_then(|s| s.thinking_effort),
Some(ThinkingEffort::High),
"recipe yaml with thinking_effort: high must parse to Some(High)"
);

let bogus_yaml = r#"
version: "1.0.0"
title: "Test"
description: "Test"
instructions: "Test"
settings:
thinking_effort: bogus
"#;
let result = Recipe::from_content(bogus_yaml);
assert!(result.is_err(), "thinking_effort: bogus must fail to parse");
}

fn extract_text(content: &ContentBlock) -> &str {
use rmcp::model::ContentBlock;
match content {
Expand Down Expand Up @@ -3665,6 +3811,7 @@ You review code."#;
goose_model: Some("recipe-model".to_string()),
temperature: None,
max_turns: None,
thinking_effort: None,
});
let result = client
.resolve_model_config(
Expand Down Expand Up @@ -3699,6 +3846,7 @@ You review code."#;
goose_model: None,
temperature: None,
max_turns: None,
thinking_effort: None,
});
let (resolved_provider, _) = client
.resolve_provider(
Expand Down Expand Up @@ -3734,6 +3882,7 @@ You review code."#;
goose_model: None,
temperature: None,
max_turns: None,
thinking_effort: None,
});
let session = crate::session::Session::default();
let (_, result) = client
Expand Down
36 changes: 36 additions & 0 deletions crates/goose/src/recipe/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Modified by Jonathan Mohrbacher, 2026: recipe settings.thinking_effort overrides the inherited delegate effort.
use anyhow::Result;
use serde_json::Value;
use std::collections::HashMap;
Expand Down Expand Up @@ -108,6 +109,9 @@ pub struct Settings {

#[serde(skip_serializing_if = "Option::is_none")]
pub max_turns: Option<usize>,

#[serde(default, skip_serializing_if = "Option::is_none")]
pub thinking_effort: Option<goose_providers::thinking::ThinkingEffort>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
Expand Down Expand Up @@ -827,4 +831,36 @@ isGlobal: true"#;
"settings.temperature: invalid type: string \"not_a_number\", expected f32"
);
}

#[test]
fn test_format_serde_error_invalid_thinking_effort() {
let valid_content = r#"{
"version": "1.0.0",
"title": "Test",
"description": "Test",
"instructions": "Test",
"settings": {
"thinking_effort": "high"
}
}"#;
let recipe =
Recipe::from_content(valid_content).expect("valid thinking_effort should parse");
assert_eq!(
recipe.settings.as_ref().and_then(|s| s.thinking_effort),
Some(goose_providers::thinking::ThinkingEffort::High)
);

let content = r#"{
"version": "1.0.0",
"title": "Test",
"description": "Test",
"instructions": "Test",
"settings": {
"thinking_effort": "bogus"
}
}"#;

let result = Recipe::from_content(content);
assert!(result.is_err(), "bogus thinking_effort must fail to parse");
}
}
2 changes: 1 addition & 1 deletion crates/goose/src/recipe/validate_recipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ fn schema_field(node: SchemaNode, field: &str) -> Option<SchemaNode> {
_ => None,
},
SchemaNode::Settings => match field {
"goose_provider" | "goose_model" | "temperature" | "max_turns" => {
"goose_provider" | "goose_model" | "temperature" | "max_turns" | "thinking_effort" => {
Some(SchemaNode::Scalar)
}
_ => None,
Expand Down
1 change: 1 addition & 0 deletions crates/goose/tests/acp_server_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,7 @@ fn test_new_session_honors_recipe_model_without_recipe_provider() {
goose_model: Some(recipe_model.to_string()),
temperature: None,
max_turns: None,
thinking_effort: None,
})
.build()
.unwrap();
Expand Down