Lightweight coding agent that runs in your terminal
Rust
fix: parallel tool call instruction injection (#6893)
jif-oai4985a7a4448e
diff --git a/codex-rs/core/src/codex.rs b/codex-rs/core/src/codex.rsindex c2f2fbf5d2..b32650e289 100644--- a/codex-rs/core/src/codex.rs+++ b/codex-rs/core/src/codex.rs@@ -1982,12 +1982,14 @@ async fn run_turn(let mut base_instructions = turn_context.base_instructions.clone();if parallel_tool_calls {static INSTRUCTIONS: &str = include_str!("../templates/parallel/instructions.md");- static INSERTION_SPOT: &str = "## Editing constraints";- base_instructions- .as_mut()- .map(|base| base.replace(INSERTION_SPOT, INSTRUCTIONS));+ if let Some(family) =+ find_family_for_model(&sess.state.lock().await.session_configuration.model)+ {+ let mut new_instructions = base_instructions.unwrap_or(family.base_instructions);+ new_instructions.push_str(INSTRUCTIONS);+ base_instructions = Some(new_instructions);+ }}-let prompt = Prompt {input,tools: router.specs(),diff --git a/codex-rs/core/templates/parallel/instructions.md b/codex-rs/core/templates/parallel/instructions.mdindex d690501af7..292d585e45 100644--- a/codex-rs/core/templates/parallel/instructions.md+++ b/codex-rs/core/templates/parallel/instructions.md@@ -1,3 +1,4 @@+## Exploration and reading files- **Think first.** Before any tool call, decide ALL files/resources you will need.@@ -10,5 +11,3 @@* Always maximize parallelism. Never read files one-by-one unless logically unavoidable.* This concern every read/list/search operations including, but not only, `cat`, `rg`, `sed`, `ls`, `git show`, `nl`, `wc`, ...* Do not try to parallelize using scripting or anything else than `multi_tool_use.parallel`.--## Editing constraints\ No newline at end of file