mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Add configurable developer instructions for v2 subagents (#35708)
## What changed - Add `features.multi_agent_v2.subagent_developer_instructions` to override inherited developer instructions for subagents that do not define role-specific instructions. - Preserve role-specific instructions as the higher-precedence setting, and carry the effective instructions through full and bounded forks, compacted histories, and cold resume without duplication. - Treat an unset override as inheritance and a blank override as clearing inherited instructions. ## Testing - Cover configuration parsing and materialization, instruction precedence, fork modes, compaction, role application, and resumed subagents. GitOrigin-RevId: 32321e61abc59b14a1be5f31e6bd6570bb1cd89d
This commit is contained in:
1 parent
3418498f01
commit
49025589b0
14 files changed
+1035
-70
No files matched your search
@@ -1,4 +1,5 @@
|
||||
use crate::agent::role::apply_role_to_config;
|
||||
use crate::agent::role::apply_role_to_config_for_multi_agent_v2;
|
||||
use crate::config::Config;
|
||||
use crate::config::DEFAULT_MULTI_AGENT_V2_MIN_WAIT_TIMEOUT_MS;
|
||||
use crate::config::HARD_MAX_MULTI_AGENT_V2_TIMEOUT_MS;
|
||||
@@ -200,6 +201,15 @@ fn build_agent_shared_config(turn: &TurnContext) -> Result<Config, FunctionCallE
|
||||
.or_else(|| turn.model_info.default_reasoning_level.clone());
|
||||
config.model_reasoning_summary = Some(turn.reasoning_summary);
|
||||
config.developer_instructions = turn.developer_instructions.clone();
|
||||
if turn.multi_agent_version == MultiAgentVersion::V2
|
||||
&& let Some(developer_instructions) = turn
|
||||
.config
|
||||
.multi_agent_v2
|
||||
.subagent_developer_instructions
|
||||
.clone()
|
||||
{
|
||||
config.developer_instructions = Some(developer_instructions);
|
||||
}
|
||||
apply_spawn_agent_runtime_overrides(&mut config, turn)?;
|
||||
|
||||
Ok(config)
|
||||
@@ -364,9 +374,15 @@ pub(crate) async fn apply_spawn_agent_role(
|
||||
) -> Result<(), FunctionCallError> {
|
||||
let previous_model = config.model.clone();
|
||||
let previous_reasoning_effort = config.model_reasoning_effort.clone();
|
||||
apply_role_to_config(config, role_name)
|
||||
.await
|
||||
.map_err(FunctionCallError::RespondToModel)?;
|
||||
if session.multi_agent_version() == Some(MultiAgentVersion::V2) {
|
||||
apply_role_to_config_for_multi_agent_v2(config, role_name)
|
||||
.await
|
||||
.map_err(FunctionCallError::RespondToModel)?;
|
||||
} else {
|
||||
apply_role_to_config(config, role_name)
|
||||
.await
|
||||
.map_err(FunctionCallError::RespondToModel)?;
|
||||
}
|
||||
if config.model == previous_model && config.model_reasoning_effort == previous_reasoning_effort
|
||||
{
|
||||
return Ok(());
|
||||
|
||||
Reference in new issue
Block a user