mirror of
https://github.com/openai/codex.git
synced 2026-11-03 19:53:25 +00:00
Improve prompt for parallel tool calls
This commit is contained in:
@@ -6,6 +6,12 @@ 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
|
||||
- Use `read_file` to get file contents.
|
||||
- You may output multiple `read_file` calls at the same time. Do it when you can to win in efficiency and time. This 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.
|
||||
- You can only return multiple tool calls for non-mutating tools (i.e. `read-file`). Prefer doing it when possible instead of calling them once at a time to be more efficient.
|
||||
|
||||
## 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.
|
||||
|
||||
@@ -76,6 +76,16 @@ impl ToolCallRuntime {
|
||||
&mut self,
|
||||
output: &mut [ProcessedResponseItem],
|
||||
) -> Result<(), CodexErr> {
|
||||
if self.pending_calls.len() > 0 {
|
||||
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)) => {
|
||||
|
||||
Reference in New Issue
Block a user