Skip to content
Closed
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
d23307d
feat(ui): add GPT-5.6 reasoning mode control
495696116 Jul 16, 2026
56bb5fb
fix(ui): gate reasoning mode by provider
495696116 Jul 16, 2026
30c667d
fix(ui): support prefixed GPT-5.6 model IDs
495696116 Jul 16, 2026
ac0ec9e
fix(ui): recognize goose GPT-5.6 aliases
495696116 Jul 16, 2026
a3e0fc5
fix(ui): gate reasoning mode by request route
495696116 Jul 16, 2026
2d698d5
fix(ui): support Databricks reasoning aliases
495696116 Jul 16, 2026
eef0717
fix(ui): honor OpenAI route capability
495696116 Jul 16, 2026
241ba25
fix(ui): reset reasoning mode on model changes
495696116 Jul 16, 2026
80ce406
Merge remote-tracking branch 'origin/main' into feature/gpt-5-6-reaso…
495696116 Jul 17, 2026
afbf4b5
fix(ui): preserve reasoning mode capabilities
495696116 Jul 17, 2026
1f2255f
fix(bedrock): register GPT-5.6 models
495696116 Jul 17, 2026
987fc38
fix(ui): preserve selected reasoning mode
495696116 Jul 17, 2026
aa48e68
fix(providers): honor explicit reasoning mode
495696116 Jul 17, 2026
9a94c30
fix(ui): preserve fallback model capability
495696116 Jul 17, 2026
56698de
fix(ui): sync delayed session reasoning mode
495696116 Jul 17, 2026
1739184
fix(ui): prefer resolved reasoning capability
495696116 Jul 17, 2026
8d02449
fix(ui): support custom OpenAI reasoning models
495696116 Jul 17, 2026
dcc676a
fix(models): normalize slash-prefixed GPT-5.6 IDs
495696116 Jul 17, 2026
5fd9bfe
fix(ui): resolve reasoning capability by route
495696116 Jul 17, 2026
199bf28
fix(models): preserve resolved reasoning capability
495696116 Jul 17, 2026
f62da5b
fix(openai): key inventory by base URL
495696116 Jul 17, 2026
2da2752
fix(ui): reset mode for custom models
495696116 Jul 17, 2026
f7f2b49
Merge remote-tracking branch 'origin/main' into feature/gpt-5-6-reaso…
495696116 Jul 21, 2026
23ef63b
Merge remote-tracking branch 'origin/main' into feature/gpt-5-6-reaso…
495696116 Jul 23, 2026
5fb91bb
chore: merge latest main into reasoning mode branch
495696116 Jul 29, 2026
8adb442
fix: preserve declarative reasoning capability on refresh
495696116 Jul 29, 2026
4b0a854
fix: invalidate stale reasoning capabilities
495696116 Jul 29, 2026
4b6c076
fix: revalidate Databricks reasoning capability
495696116 Jul 29, 2026
481e06f
fix: prefer live reasoning capability in model picker
495696116 Jul 29, 2026
c97820a
fix(ui): revalidate databricks reasoning capability
495696116 Jul 29, 2026
e680701
fix(ui): preserve pending reasoning mode
495696116 Jul 29, 2026
573cef3
fix(providers): gate serialized reasoning mode
495696116 Jul 29, 2026
4a542ed
fix(acp): confirm positive reasoning capability
495696116 Jul 29, 2026
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
15 changes: 15 additions & 0 deletions crates/goose-provider-types/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ pub struct ModelInfo {
pub currency: Option<String>,
/// Whether this model supports cache control
pub supports_cache_control: Option<bool>,
/// Whether the active provider route supports the GPT-5.6 reasoning mode control.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub supports_reasoning_mode: Option<bool>,
/// Whether this model supports reasoning/thinking controls
#[serde(default)]
pub reasoning: bool,
Expand All @@ -250,6 +253,7 @@ impl ModelInfo {
output_token_cost: None,
currency: None,
supports_cache_control: None,
supports_reasoning_mode: None,
reasoning: false,
}
}
Expand All @@ -269,6 +273,7 @@ impl ModelInfo {
output_token_cost: Some(output_cost),
currency: Some("$".to_string()),
supports_cache_control: None,
supports_reasoning_mode: None,
reasoning: false,
}
}
Expand Down Expand Up @@ -314,6 +319,7 @@ pub fn model_info_for_provider_model(provider_name: &str, model_name: &str) -> M
output_token_cost: None,
currency: None,
supports_cache_control: None,
supports_reasoning_mode: None,
reasoning,
}
}
Expand Down Expand Up @@ -381,6 +387,12 @@ pub trait Provider: Send + Sync {
/// Get the name of this provider instance
fn get_name(&self) -> &str;

/// Whether this provider instance will route the model through a request
/// format that consumes `reasoning_mode`.
async fn supports_reasoning_mode(&self, _model_config: &ModelConfig) -> bool {
false
}

/// Primary streaming method that all providers must implement.
async fn stream(
&self,
Expand Down Expand Up @@ -673,6 +685,7 @@ mod tests {
output_token_cost: None,
currency: None,
supports_cache_control: None,
supports_reasoning_mode: None,
reasoning: false,
};
assert_eq!(info.context_limit, 1000);
Expand All @@ -686,6 +699,7 @@ mod tests {
output_token_cost: None,
currency: None,
supports_cache_control: None,
supports_reasoning_mode: None,
reasoning: false,
};
assert_eq!(info, info2);
Expand All @@ -699,6 +713,7 @@ mod tests {
output_token_cost: None,
currency: None,
supports_cache_control: None,
supports_reasoning_mode: None,
reasoning: false,
};
assert_ne!(info, info3);
Expand Down
17 changes: 16 additions & 1 deletion crates/goose-provider-types/src/formats/databricks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ pub fn create_request_for_provider(
if let Some(params) = &model_config.request_params {
if let Some(obj) = payload.as_object_mut() {
for (key, value) in params {
if key == "thinking_effort" {
if key == "thinking_effort" || key == "reasoning_mode" {
continue;
}
obj.insert(key.clone(), value.clone());
Expand Down Expand Up @@ -1270,6 +1270,21 @@ mod tests {
Ok(())
}

#[test]
fn test_create_request_omits_responses_only_reasoning_mode() -> anyhow::Result<()> {
let mut model_config = ModelConfig::new("goose-gpt-5-6-sol");
model_config.request_params = Some(std::collections::HashMap::from([
("reasoning_mode".to_string(), serde_json::json!("pro")),
("provider_custom".to_string(), serde_json::json!("allowed")),
]));

let request = create_request(&model_config, "system", &[], &[], &ImageFormat::OpenAi)?;

assert!(request.get("reasoning_mode").is_none());
assert_eq!(request["provider_custom"], "allowed");
Ok(())
}

#[test]
fn test_create_request_adaptive_thinking_for_new_anthropic_models() -> anyhow::Result<()> {
let _guard = env_lock::lock_env([("GOOSE_THINKING_EFFORT", None::<&str>)]);
Expand Down
7 changes: 6 additions & 1 deletion crates/goose-provider-types/src/formats/openai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1457,7 +1457,10 @@ pub fn create_request_with_options(
if let Some(params) = &model_config.request_params {
if let Some(obj) = payload.as_object_mut() {
for (key, value) in params {
if key != "thinking_effort" && !is_reserved_request_param_key(key) {
if key != "thinking_effort"
&& key != "reasoning_mode"
&& !is_reserved_request_param_key(key)
{
obj.insert(key.clone(), value.clone());
}
}
Expand Down Expand Up @@ -2411,6 +2414,7 @@ mod tests {
("messages".to_string(), json!([])),
("max_tokens".to_string(), json!(1)),
("temperature".to_string(), json!(2.0)),
("reasoning_mode".to_string(), json!("pro")),
("provider_custom".to_string(), json!("allowed")),
]);
let model_config = test_model_config("glm-4.7")
Expand Down Expand Up @@ -2439,6 +2443,7 @@ mod tests {
assert_eq!(request["messages"][0]["role"], "system");
assert_eq!(request["max_tokens"], 1);
assert_eq!(request["temperature"], 2.0);
assert!(request.get("reasoning_mode").is_none());
assert_eq!(request["provider_custom"], "allowed");

Ok(())
Expand Down
49 changes: 11 additions & 38 deletions crates/goose-provider-types/src/formats/openai_responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -563,14 +563,6 @@ fn add_message_items(input_items: &mut Vec<Value>, messages: &[Message]) {
}
}

fn is_gpt_5_6_model(model_name: &str) -> bool {
let normalized = model_name.to_ascii_lowercase();
normalized == "gpt-5.6"
|| normalized.starts_with("gpt-5.6-")
|| normalized == "gpt-5-6"
|| normalized.starts_with("gpt-5-6-")
}

pub fn create_responses_request(
model_config: &ModelConfig,
system: &str,
Expand Down Expand Up @@ -617,24 +609,7 @@ pub fn create_responses_request(
};

let store = model_config.request_param::<bool>("store").unwrap_or(false);
let reasoning_mode = model_config
.request_param::<String>("reasoning_mode")
.map(|mode| {
let normalized = mode.to_ascii_lowercase();
match normalized.as_str() {
"standard" | "pro" => Ok(normalized),
_ => Err(anyhow!(
"Invalid reasoning_mode '{}'. Supported values are: standard, pro",
mode
)),
}
})
.transpose()?;
if reasoning_mode.is_some() && !is_gpt_5_6_model(&model_name) {
return Err(anyhow!(
"reasoning_mode is only supported for GPT-5.6 models"
));
}
let reasoning_mode = model_config.reasoning_mode().map_err(anyhow::Error::msg)?;
Comment thread
495696116 marked this conversation as resolved.
Resolved
let mut payload = json!({
"model": model_name,
"input": input_items,
Expand All @@ -648,7 +623,7 @@ pub fn create_responses_request(
reasoning.insert("summary".to_string(), json!("auto"));
}
if let Some(mode) = reasoning_mode {
reasoning.insert("mode".to_string(), json!(mode));
reasoning.insert("mode".to_string(), json!(mode.to_string()));
}
payload
.as_object_mut()
Expand Down Expand Up @@ -1517,19 +1492,17 @@ mod tests {
}

#[test]
fn test_responses_request_rejects_reasoning_mode_for_non_gpt_5_6_model() {
for model_name in ["gpt-5.5", "gpt-5.60"] {
let model_config = ModelConfig::new(model_name).with_merged_request_params(
std::collections::HashMap::from([("reasoning_mode".to_string(), json!("pro"))]),
);
fn test_responses_request_honors_reasoning_mode_for_configured_alias() {
let model_config = ModelConfig::new("team-prod").with_merged_request_params(
std::collections::HashMap::from([("reasoning_mode".to_string(), json!("pro"))]),
);

let error = create_responses_request(&model_config, "You are helpful.", &[], &[])
.expect_err("reasoning mode should be gated to GPT-5.6 models");
let result = create_responses_request(&model_config, "You are helpful.", &[], &[]).unwrap();

assert!(error
.to_string()
.contains("reasoning_mode is only supported for GPT-5.6 models"));
}
assert_eq!(result["model"], "team-prod");
assert_eq!(result["reasoning"]["mode"], "pro");
assert!(result["reasoning"].get("effort").is_none());
assert!(result["reasoning"].get("summary").is_none());
}

#[test]
Expand Down
88 changes: 87 additions & 1 deletion crates/goose-provider-types/src/model.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::formats::openai::{extract_reasoning_effort, is_openai_responses_model};
use crate::thinking::ThinkingEffort;
use crate::thinking::{ReasoningMode, ThinkingEffort};
use serde::de::Deserializer;
use serde::{Deserialize, Serialize};
use serde_json::Value;
Expand Down Expand Up @@ -185,6 +185,14 @@ impl ModelConfig {
self
}

pub fn with_reasoning_mode(mut self, mode: ReasoningMode) -> Self {
self.request_params.get_or_insert_with(HashMap::new).insert(
"reasoning_mode".to_string(),
serde_json::json!(mode.to_string()),
);
self
}

pub fn with_default_thinking_effort(mut self, effort: Option<ThinkingEffort>) -> Self {
if self.thinking_effort().is_none() {
if let Some(effort) = effort {
Expand Down Expand Up @@ -235,6 +243,20 @@ impl ModelConfig {
|| Self::is_gemini3_reasoning_model_name(&self.model_name)
}

pub fn supports_reasoning_mode(&self) -> bool {
let normalized = self.model_name.to_ascii_lowercase();
let normalized = normalized.rsplit('/').next().unwrap_or(&normalized);
let normalized = normalized
.strip_prefix("openai.")
.or_else(|| normalized.strip_prefix("databricks-"))
.or_else(|| normalized.strip_prefix("goose-"))
.unwrap_or(normalized);
normalized == "gpt-5.6"
|| normalized.starts_with("gpt-5.6-")
|| normalized == "gpt-5-6"
|| normalized.starts_with("gpt-5-6-")
Comment thread
495696116 marked this conversation as resolved.
Resolved
}

fn is_gemini3_reasoning_model_name(model_name: &str) -> bool {
let lower = model_name.to_lowercase();
lower.starts_with("gemini-3") || lower.contains("/gemini-3") || lower.contains("-gemini-3")
Expand Down Expand Up @@ -285,6 +307,12 @@ impl ModelConfig {
.and_then(|s| s.parse::<ThinkingEffort>().ok())
}

pub fn reasoning_mode(&self) -> Result<Option<ReasoningMode>, String> {
self.request_param::<String>("reasoning_mode")
.map(|mode| mode.parse::<ReasoningMode>())
.transpose()
}

pub fn request_param<T: for<'de> serde::Deserialize<'de>>(
&self,
request_key: &str,
Expand Down Expand Up @@ -415,6 +443,18 @@ mod tests {
);
}

#[test]
fn does_not_inherit_model_specific_reasoning_mode() {
let previous = config_with_params(
"gpt-5.6",
HashMap::from([("reasoning_mode".to_string(), serde_json::json!("pro"))]),
);
let config = ModelConfig::new("gpt-5.5")
.with_inherited_session_settings_from(Some(&previous), None);

assert_eq!(config.reasoning_mode().unwrap(), None);
}

#[test]
fn effort_suffix_stripped_from_model_name() {
let _guard = env_lock::lock_env([
Expand Down Expand Up @@ -525,6 +565,52 @@ mod tests {
}
}

mod reasoning_mode_tests {
use super::*;

#[test]
fn supports_only_gpt_5_6_model_names() {
for model in [
"gpt-5.6",
"gpt-5.6-sol",
"gpt-5-6",
"gpt-5-6-sol-xhigh",
"openai.gpt-5.6-terra",
"openai/gpt-5.6-terra",
"databricks-gpt-5.6-luna",
"goose-gpt-5-6-sol",
] {
assert!(ModelConfig::new(model).supports_reasoning_mode(), "{model}");
}
for model in ["gpt-5.5", "gpt-5.60", "gpt-4o", "my-openai.gpt-5.6"] {
assert!(
!ModelConfig::new(model).supports_reasoning_mode(),
"{model}"
);
}
}

#[test]
fn reads_and_writes_reasoning_mode() {
let config = ModelConfig::new("gpt-5.6").with_reasoning_mode(ReasoningMode::Pro);

assert_eq!(config.reasoning_mode().unwrap(), Some(ReasoningMode::Pro));
}

#[test]
fn rejects_unknown_reasoning_mode() {
let config = ModelConfig::new("gpt-5.6").with_merged_request_params(HashMap::from([(
"reasoning_mode".to_string(),
serde_json::json!("turbo"),
)]));

assert_eq!(
config.reasoning_mode().unwrap_err(),
"unknown reasoning mode: 'turbo'"
);
}
}

mod with_canonical_limits {
use super::*;

Expand Down
29 changes: 29 additions & 0 deletions crates/goose-provider-types/src/thinking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,35 @@ pub enum ThinkingEffort {
Max,
}

#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum ReasoningMode {
#[default]
Standard,
Pro,
}

impl FromStr for ReasoningMode {
type Err = String;

fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.to_lowercase().as_str() {
"standard" => Ok(Self::Standard),
"pro" => Ok(Self::Pro),
other => Err(format!("unknown reasoning mode: '{other}'")),
}
}
}

impl fmt::Display for ReasoningMode {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Standard => write!(f, "standard"),
Self::Pro => write!(f, "pro"),
}
}
}

impl FromStr for ThinkingEffort {
type Err = String;
fn from_str(s: &str) -> Result<Self, Self::Err> {
Expand Down
Loading