mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
[codex] Treat max as a first-class reasoning effort (#30467)
## Why The Bedrock GPT-5.6 catalog advertises `max`, but Codex treated it as an opaque custom effort. That made the reasoning picker render it as lowercase `max` while known efforts use productized labels. Making `max` a known effort aligns catalog data, parsing, and UI presentation without changing the `max` wire value or persisted representation. ## What changed - Add first-class `ReasoningEffort::Max` parsing and serialization. - Use the typed effort in the Bedrock catalog and render it as `Max` in the TUI. - Preserve forward-compatible custom-effort coverage with a genuinely unknown `future` value. ### Before <img width="559" height="124" alt="Screenshot 2026-06-28 at 12 08 47 PM" src="https://github.com/user-attachments/assets/7c43cf4f-020b-4605-9239-0a9c97eb7364" /> ### After <img width="558" height="107" alt="Screenshot 2026-06-28 at 12 09 10 PM" src="https://github.com/user-attachments/assets/b9cc5ded-c940-43b4-b024-bba25abe0a17" />
This commit is contained in:
@@ -45,6 +45,7 @@ pub enum ReasoningEffort {
|
||||
Medium,
|
||||
High,
|
||||
XHigh,
|
||||
Max,
|
||||
Ultra,
|
||||
/// A model-defined effort value that this client does not know yet.
|
||||
Custom(String),
|
||||
@@ -60,6 +61,7 @@ impl ReasoningEffort {
|
||||
Self::Medium => "medium",
|
||||
Self::High => "high",
|
||||
Self::XHigh => "xhigh",
|
||||
Self::Max => "max",
|
||||
Self::Ultra => "ultra",
|
||||
Self::Custom(effort) => effort,
|
||||
}
|
||||
@@ -125,6 +127,7 @@ impl FromStr for ReasoningEffort {
|
||||
"medium" => Ok(Self::Medium),
|
||||
"high" => Ok(Self::High),
|
||||
"xhigh" => Ok(Self::XHigh),
|
||||
"max" => Ok(Self::Max),
|
||||
"ultra" => Ok(Self::Ultra),
|
||||
"" => Err("reasoning_effort must not be empty".to_string()),
|
||||
effort => Ok(Self::Custom(effort.to_string())),
|
||||
@@ -703,30 +706,35 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn reasoning_effort_accepts_known_and_custom_values() {
|
||||
let custom = ReasoningEffort::Custom("max".to_string());
|
||||
let deserialized = from_str::<ReasoningEffort>(r#""max""#)
|
||||
let custom = ReasoningEffort::Custom("future".to_string());
|
||||
let deserialized = from_str::<ReasoningEffort>(r#""future""#)
|
||||
.expect("custom reasoning effort should deserialize");
|
||||
let serialized = to_string(&custom).expect("custom reasoning effort should serialize");
|
||||
let serialized_max = to_string(&ReasoningEffort::Max).expect("Max should serialize");
|
||||
let serialized_ultra = to_string(&ReasoningEffort::Ultra).expect("Ultra should serialize");
|
||||
|
||||
assert_eq!(
|
||||
(
|
||||
"high".parse(),
|
||||
"ultra".parse(),
|
||||
"max".parse(),
|
||||
"ultra".parse(),
|
||||
"future".parse(),
|
||||
deserialized,
|
||||
serialized,
|
||||
serialized_max,
|
||||
serialized_ultra,
|
||||
custom.to_string(),
|
||||
),
|
||||
(
|
||||
Ok(ReasoningEffort::High),
|
||||
Ok(ReasoningEffort::Max),
|
||||
Ok(ReasoningEffort::Ultra),
|
||||
Ok(custom.clone()),
|
||||
custom,
|
||||
r#""future""#.to_string(),
|
||||
r#""max""#.to_string(),
|
||||
r#""ultra""#.to_string(),
|
||||
"max".to_string(),
|
||||
"future".to_string(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user