mirror of
https://github.com/openai/codex.git
synced 2026-11-03 19:53:25 +00:00
Enable it for gpt-5-codex and fix tests
This commit is contained in:
@@ -127,6 +127,7 @@ pub fn find_family_for_model(mut slug: &str) -> Option<ModelFamily> {
|
||||
|
||||
// Internal models.
|
||||
} else if slug.starts_with("codex-") {
|
||||
tracing::info!("Internal model selected. Used for experimental features");
|
||||
model_family!(
|
||||
slug, slug,
|
||||
supports_reasoning_summaries: true,
|
||||
@@ -145,6 +146,8 @@ pub fn find_family_for_model(mut slug: &str) -> Option<ModelFamily> {
|
||||
reasoning_summary_format: ReasoningSummaryFormat::Experimental,
|
||||
base_instructions: GPT_5_CODEX_INSTRUCTIONS.to_string(),
|
||||
apply_patch_tool_type: Some(ApplyPatchToolType::Freeform),
|
||||
experimental_supported_tools: vec!["read_file".to_string()],
|
||||
supports_parallel_tool_calls: true,
|
||||
)
|
||||
} else if slug.starts_with("gpt-5") {
|
||||
model_family!(
|
||||
|
||||
@@ -76,7 +76,7 @@ impl ToolCallRuntime {
|
||||
&mut self,
|
||||
output: &mut [ProcessedResponseItem],
|
||||
) -> Result<(), CodexErr> {
|
||||
if self.pending_calls.len() > 0 {
|
||||
if !self.pending_calls.is_empty() {
|
||||
tracing::info!(
|
||||
"Resolving {} tool calls: {:?}",
|
||||
self.pending_calls.len(),
|
||||
|
||||
@@ -1039,6 +1039,7 @@ mod tests {
|
||||
&[
|
||||
"unified_exec",
|
||||
"apply_patch",
|
||||
"read_file",
|
||||
"web_search",
|
||||
"view_image",
|
||||
"dash/search",
|
||||
@@ -1046,7 +1047,7 @@ mod tests {
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
tools[4].spec,
|
||||
tools[5].spec,
|
||||
ToolSpec::Function(ResponsesApiTool {
|
||||
name: "dash/search".to_string(),
|
||||
parameters: JsonSchema::Object {
|
||||
@@ -1106,13 +1107,14 @@ mod tests {
|
||||
&[
|
||||
"unified_exec",
|
||||
"apply_patch",
|
||||
"read_file",
|
||||
"web_search",
|
||||
"view_image",
|
||||
"dash/paginate",
|
||||
],
|
||||
);
|
||||
assert_eq!(
|
||||
tools[4].spec,
|
||||
tools[5].spec,
|
||||
ToolSpec::Function(ResponsesApiTool {
|
||||
name: "dash/paginate".to_string(),
|
||||
parameters: JsonSchema::Object {
|
||||
@@ -1170,13 +1172,14 @@ mod tests {
|
||||
&[
|
||||
"unified_exec",
|
||||
"apply_patch",
|
||||
"read_file",
|
||||
"web_search",
|
||||
"view_image",
|
||||
"dash/tags",
|
||||
],
|
||||
);
|
||||
assert_eq!(
|
||||
tools[4].spec,
|
||||
tools[5].spec,
|
||||
ToolSpec::Function(ResponsesApiTool {
|
||||
name: "dash/tags".to_string(),
|
||||
parameters: JsonSchema::Object {
|
||||
@@ -1237,13 +1240,14 @@ mod tests {
|
||||
&[
|
||||
"unified_exec",
|
||||
"apply_patch",
|
||||
"read_file",
|
||||
"web_search",
|
||||
"view_image",
|
||||
"dash/value",
|
||||
],
|
||||
);
|
||||
assert_eq!(
|
||||
tools[4].spec,
|
||||
tools[5].spec,
|
||||
ToolSpec::Function(ResponsesApiTool {
|
||||
name: "dash/value".to_string(),
|
||||
parameters: JsonSchema::Object {
|
||||
@@ -1341,6 +1345,7 @@ mod tests {
|
||||
&[
|
||||
"unified_exec",
|
||||
"apply_patch",
|
||||
"read_file",
|
||||
"web_search",
|
||||
"view_image",
|
||||
"test_server/do_something_cool",
|
||||
@@ -1348,7 +1353,7 @@ mod tests {
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
tools[4].spec,
|
||||
tools[5].spec,
|
||||
ToolSpec::Function(ResponsesApiTool {
|
||||
name: "test_server/do_something_cool".to_string(),
|
||||
parameters: JsonSchema::Object {
|
||||
|
||||
@@ -51,6 +51,8 @@ async fn compact_resume_and_fork_preserve_model_history_view() {
|
||||
return;
|
||||
}
|
||||
|
||||
let is_windows = cfg!(target_os = "windows");
|
||||
|
||||
// 1. Arrange mocked SSE responses for the initial compact/resume/fork flow.
|
||||
let server = MockServer::start().await;
|
||||
mount_initial_flow(&server).await;
|
||||
@@ -171,7 +173,7 @@ async fn compact_resume_and_fork_preserve_model_history_view() {
|
||||
],
|
||||
"tools": tool_calls,
|
||||
"tool_choice": "auto",
|
||||
"parallel_tool_calls": false,
|
||||
"parallel_tool_calls": !is_windows,
|
||||
"reasoning": {
|
||||
"summary": "auto"
|
||||
},
|
||||
@@ -240,7 +242,7 @@ async fn compact_resume_and_fork_preserve_model_history_view() {
|
||||
],
|
||||
"tools": [],
|
||||
"tool_choice": "auto",
|
||||
"parallel_tool_calls": false,
|
||||
"parallel_tool_calls": !is_windows,
|
||||
"reasoning": {
|
||||
"summary": "auto"
|
||||
},
|
||||
@@ -305,7 +307,7 @@ SUMMARY_ONLY_CONTEXT"
|
||||
],
|
||||
"tools": tool_calls,
|
||||
"tool_choice": "auto",
|
||||
"parallel_tool_calls": false,
|
||||
"parallel_tool_calls": !is_windows,
|
||||
"reasoning": {
|
||||
"summary": "auto"
|
||||
},
|
||||
@@ -390,7 +392,7 @@ SUMMARY_ONLY_CONTEXT"
|
||||
],
|
||||
"tools": tool_calls,
|
||||
"tool_choice": "auto",
|
||||
"parallel_tool_calls": false,
|
||||
"parallel_tool_calls": !is_windows,
|
||||
"reasoning": {
|
||||
"summary": "auto"
|
||||
},
|
||||
@@ -475,7 +477,7 @@ SUMMARY_ONLY_CONTEXT"
|
||||
],
|
||||
"tools": tool_calls,
|
||||
"tool_choice": "auto",
|
||||
"parallel_tool_calls": false,
|
||||
"parallel_tool_calls": !is_windows,
|
||||
"reasoning": {
|
||||
"summary": "auto"
|
||||
},
|
||||
|
||||
@@ -125,7 +125,11 @@ async fn model_selects_expected_tools() {
|
||||
let gpt5_codex_tools = collect_tool_identifiers_for_model("gpt-5-codex").await;
|
||||
assert_eq!(
|
||||
gpt5_codex_tools,
|
||||
vec!["shell".to_string(), "apply_patch".to_string(),],
|
||||
vec![
|
||||
"shell".to_string(),
|
||||
"apply_patch".to_string(),
|
||||
"read_file".to_string()
|
||||
],
|
||||
"gpt-5-codex should expose the apply_patch tool",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -225,7 +225,13 @@ async fn prompt_tools_are_consistent_across_requests() {
|
||||
("gpt-5", vec!["shell", "update_plan", "view_image"]),
|
||||
(
|
||||
"gpt-5-codex",
|
||||
vec!["shell", "update_plan", "apply_patch", "view_image"],
|
||||
vec![
|
||||
"shell",
|
||||
"update_plan",
|
||||
"apply_patch",
|
||||
"read_file",
|
||||
"view_image",
|
||||
],
|
||||
),
|
||||
]);
|
||||
let expected_tools_names = tools_by_model
|
||||
|
||||
Reference in New Issue
Block a user