Compare commits

...

7 Commits

Author SHA1 Message Date
jimmyfraiture
7d65c68fd1 Merge remote-tracking branch 'origin/jif/parallel-tool-call-prompt' into jif/parallel-tool-call-prompt 2025-10-07 15:33:08 +01:00
jimmyfraiture
701e958d5f Improve prompt 2025-10-07 15:21:32 +01:00
jif-oai
9de51507e6 Merge branch 'main' into jif/parallel-tool-call-prompt 2025-10-07 11:17:28 +01:00
jimmyfraiture
fea8f62a0c No parallel for compaction 2025-10-06 11:46:04 +01:00
jimmyfraiture
5984394f9f Enable it for gpt-5-codex and fix tests 2025-10-06 11:35:36 +01:00
jimmyfraiture
b23a3e632b NITs 2025-10-06 11:26:17 +01:00
jimmyfraiture
695a421502 Improve prompt for parallel tool calls 2025-10-06 11:24:49 +01:00
7 changed files with 49 additions and 11 deletions

View File

@@ -6,6 +6,14 @@ You are Codex, based on GPT-5. You are running as a coding agent in the Codex CL
- Always set the `workdir` param when using the shell function. Do not use `cd` unless absolutely necessary.
- When searching for text or files, prefer using `rg` or `rg --files` respectively because `rg` is much faster than alternatives like `grep`. (If the `rg` command is not found, then use alternatives.)
## Exploration and reading files
- Use `read_file` to get file contents. You are only allowed to use this to read in a file. You can't use `rg`, `cat`, `head`, `python` or any other tools.
- You may output multiple tool calls at the same time. Do it everytime you plan to call multiple tools in a row to save time and improve efficiency. Time is very important.
- Do not try to design your own parallelization strategy. Codex harness will automatically run multiple tool calls in parallel when you output them together.
- Efficiency is a high priority, to make the exploration more efficient:
- Prefer using dedicated tools that are provided such as `read_file` instead of running shell commands
- If you need, do not hesitate to return multiple tool calls at once
## Editing constraints
- Default to ASCII when editing or creating files. Only introduce non-ASCII or other Unicode characters when there is a clear justification and the file already uses them.

View File

@@ -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!(

View File

@@ -76,6 +76,16 @@ impl ToolCallRuntime {
&mut self,
output: &mut [ProcessedResponseItem],
) -> Result<(), CodexErr> {
if !self.pending_calls.is_empty() {
tracing::info!(
"Resolving {} tool calls: {:?}",
self.pending_calls.len(),
self.pending_calls
.iter()
.map(|call| call.index)
.collect::<Vec<_>>()
);
}
while let Some(PendingToolCall { index, handle }) = self.pending_calls.pop() {
match handle.await {
Ok(Ok(response)) => {

View File

@@ -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 {

View File

@@ -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"
},
@@ -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"
},

View File

@@ -107,7 +107,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",
);
}

View File

@@ -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