From 3fea72fda69616efc6cc2e398a506edb73292686 Mon Sep 17 00:00:00 2001 From: jif-oai Date: Wed, 17 Jun 2026 19:38:22 +0200 Subject: [PATCH] Preserve capability prompt ordering --- codex-rs/core/src/session/mod.rs | 48 ++++++++++++++++---------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/codex-rs/core/src/session/mod.rs b/codex-rs/core/src/session/mod.rs index dfb88c89a0..00757d5210 100644 --- a/codex-rs/core/src/session/mod.rs +++ b/codex-rs/core/src/session/mod.rs @@ -2966,6 +2966,30 @@ impl Session { developer_sections.push(apps_instructions.render()); } } + let context_contributors = self.services.extensions.context_contributors().to_vec(); + for contributor in context_contributors { + for fragment in contributor + .contribute(ContextContributionContext { + session_store: &self.services.session_extension_data, + thread_store: &self.services.thread_extension_data, + turn_store: turn_context.extension_data.as_ref(), + model_context_window: turn_context.model_info.context_window, + }) + .await + { + match fragment.slot() { + PromptSlot::DeveloperPolicy | PromptSlot::DeveloperCapabilities => { + developer_sections.push(fragment.text().to_string()); + } + PromptSlot::ContextualUser => { + contextual_user_sections.push(fragment.text().to_string()); + } + PromptSlot::SeparateDeveloper => { + separate_developer_sections.push(fragment.text().to_string()); + } + } + } + } let loaded_plugins = self .services .plugins_manager @@ -2999,30 +3023,6 @@ impl Session { { developer_sections.push(plugin_instructions.render()); } - let context_contributors = self.services.extensions.context_contributors().to_vec(); - for contributor in context_contributors { - for fragment in contributor - .contribute(ContextContributionContext { - session_store: &self.services.session_extension_data, - thread_store: &self.services.thread_extension_data, - turn_store: turn_context.extension_data.as_ref(), - model_context_window: turn_context.model_info.context_window, - }) - .await - { - match fragment.slot() { - PromptSlot::DeveloperPolicy | PromptSlot::DeveloperCapabilities => { - developer_sections.push(fragment.text().to_string()); - } - PromptSlot::ContextualUser => { - contextual_user_sections.push(fragment.text().to_string()); - } - PromptSlot::SeparateDeveloper => { - separate_developer_sections.push(fragment.text().to_string()); - } - } - } - } if let Some(user_instructions) = turn_context.user_instructions.as_deref() { contextual_user_sections.push(user_instructions.to_string()); }