@@ -577,11 +577,19 @@ async fn run_guardian_subagent(
577577 } ;
578578 ( turn. model_info . slug . clone ( ) , reasoning_effort)
579579 } ;
580+ let guardian_model_info = session
581+ . services
582+ . models_manager
583+ . get_model_info ( & guardian_model, turn. config . as_ref ( ) )
584+ . await ;
580585 let guardian_config = build_guardian_subagent_config (
581586 turn. config . as_ref ( ) ,
582587 live_network_config,
583588 guardian_model. as_str ( ) ,
584589 guardian_reasoning_effort,
590+ guardian_model_info
591+ . guardian_developer_instructions
592+ . as_deref ( ) ,
585593 ) ?;
586594
587595 // Reuse the standard interactive subagent runner so we can seed inherited
@@ -647,11 +655,12 @@ fn build_guardian_subagent_config(
647655 live_network_config : Option < codex_network_proxy:: NetworkProxyConfig > ,
648656 active_model : & str ,
649657 reasoning_effort : Option < codex_protocol:: openai_models:: ReasoningEffort > ,
658+ guardian_prompt_override : Option < & str > ,
650659) -> anyhow:: Result < Config > {
651660 let mut guardian_config = parent_config. clone ( ) ;
652661 guardian_config. model = Some ( active_model. to_string ( ) ) ;
653662 guardian_config. model_reasoning_effort = reasoning_effort;
654- guardian_config. developer_instructions = Some ( guardian_policy_prompt ( ) ) ;
663+ guardian_config. developer_instructions = Some ( guardian_policy_prompt ( guardian_prompt_override ) ) ;
655664 guardian_config. permissions . approval_policy = Constrained :: allow_only ( AskForApproval :: Never ) ;
656665 guardian_config. permissions . sandbox_policy =
657666 Constrained :: allow_only ( SandboxPolicy :: new_read_only_policy ( ) ) ;
@@ -861,8 +870,10 @@ fn guardian_output_contract_prompt() -> &'static str {
861870/// Keep the prompt in a dedicated markdown file so reviewers can audit prompt
862871/// changes directly without diffing through code. The output contract is
863872/// appended from code so it stays near `guardian_output_schema()`.
864- fn guardian_policy_prompt ( ) -> String {
865- let prompt = include_str ! ( "guardian_prompt.md" ) . trim_end ( ) ;
873+ fn guardian_policy_prompt ( prompt_override : Option < & str > ) -> String {
874+ let prompt = prompt_override
875+ . unwrap_or ( include_str ! ( "guardian_prompt.md" ) )
876+ . trim_end ( ) ;
866877 format ! ( "{prompt}\n \n {}\n " , guardian_output_contract_prompt( ) )
867878}
868879
0 commit comments