From 88c2095fed13934e604392e35269f7d8d1c23676 Mon Sep 17 00:00:00 2001 From: Charles Cunningham Date: Wed, 25 Mar 2026 00:11:56 -0700 Subject: [PATCH] Rename explicit plugin instruction tag Co-authored-by: Codex --- codex-rs/core/src/context_manager/history_tests.rs | 2 +- codex-rs/core/src/event_mapping.rs | 4 ++-- codex-rs/core/src/plugins/render.rs | 6 +++--- codex-rs/core/src/plugins/render_tests.rs | 2 +- codex-rs/core/tests/common/context_snapshot.rs | 6 +++--- codex-rs/core/tests/suite/plugins.rs | 6 +++--- ...ns__explicit_plugin_mentions_inject_plugin_guidance.snap | 2 +- codex-rs/protocol/src/protocol.rs | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/codex-rs/core/src/context_manager/history_tests.rs b/codex-rs/core/src/context_manager/history_tests.rs index 2aef5806cd..d617fc9c6b 100644 --- a/codex-rs/core/src/context_manager/history_tests.rs +++ b/codex-rs/core/src/context_manager/history_tests.rs @@ -961,7 +961,7 @@ fn drop_last_n_user_turns_trims_explicit_plugin_guidance_above_rolled_back_turn( user_input_text_msg("turn 1 user"), assistant_msg("turn 1 assistant"), developer_msg( - "\nCapabilities from the `sample` plugin:\n- Apps from this plugin available in this session: `Google Calendar`.\nUse these plugin-associated capabilities to help solve the task.\n", + "\nCapabilities from the `sample` plugin:\n- Apps from this plugin available in this session: `Google Calendar`.\nUse these plugin-associated capabilities to help solve the task.\n", ), user_input_text_msg( "PRETURN_CONTEXT_DIFF_CWD", diff --git a/codex-rs/core/src/event_mapping.rs b/codex-rs/core/src/event_mapping.rs index e181df1452..ea937931ec 100644 --- a/codex-rs/core/src/event_mapping.rs +++ b/codex-rs/core/src/event_mapping.rs @@ -15,7 +15,7 @@ use codex_protocol::models::is_image_open_tag_text; use codex_protocol::models::is_local_image_close_tag_text; use codex_protocol::models::is_local_image_open_tag_text; use codex_protocol::protocol::COLLABORATION_MODE_OPEN_TAG; -use codex_protocol::protocol::EXPLICIT_PLUGIN_INSTRUCTIONS_OPEN_TAG; +use codex_protocol::protocol::PLUGIN_MENTION_INSTRUCTIONS_OPEN_TAG; use codex_protocol::protocol::REALTIME_CONVERSATION_OPEN_TAG; use codex_protocol::user_input::UserInput; use tracing::warn; @@ -29,7 +29,7 @@ const CONTEXTUAL_DEVELOPER_PREFIXES: &[&str] = &[ "", "", COLLABORATION_MODE_OPEN_TAG, - EXPLICIT_PLUGIN_INSTRUCTIONS_OPEN_TAG, + PLUGIN_MENTION_INSTRUCTIONS_OPEN_TAG, REALTIME_CONVERSATION_OPEN_TAG, "", ]; diff --git a/codex-rs/core/src/plugins/render.rs b/codex-rs/core/src/plugins/render.rs index 6715e4b1cb..815e15a7c6 100644 --- a/codex-rs/core/src/plugins/render.rs +++ b/codex-rs/core/src/plugins/render.rs @@ -1,6 +1,6 @@ use crate::plugins::PluginCapabilitySummary; -use codex_protocol::protocol::EXPLICIT_PLUGIN_INSTRUCTIONS_CLOSE_TAG; -use codex_protocol::protocol::EXPLICIT_PLUGIN_INSTRUCTIONS_OPEN_TAG; +use codex_protocol::protocol::PLUGIN_MENTION_INSTRUCTIONS_CLOSE_TAG; +use codex_protocol::protocol::PLUGIN_MENTION_INSTRUCTIONS_OPEN_TAG; use codex_protocol::protocol::PLUGINS_INSTRUCTIONS_CLOSE_TAG; use codex_protocol::protocol::PLUGINS_INSTRUCTIONS_OPEN_TAG; @@ -88,7 +88,7 @@ pub(crate) fn render_explicit_plugin_instructions( let body = lines.join("\n"); Some(format!( - "{EXPLICIT_PLUGIN_INSTRUCTIONS_OPEN_TAG}\n{body}\n{EXPLICIT_PLUGIN_INSTRUCTIONS_CLOSE_TAG}" + "{PLUGIN_MENTION_INSTRUCTIONS_OPEN_TAG}\n{body}\n{PLUGIN_MENTION_INSTRUCTIONS_CLOSE_TAG}" )) } diff --git a/codex-rs/core/src/plugins/render_tests.rs b/codex-rs/core/src/plugins/render_tests.rs index dd785a0a69..3744e2aa6c 100644 --- a/codex-rs/core/src/plugins/render_tests.rs +++ b/codex-rs/core/src/plugins/render_tests.rs @@ -36,7 +36,7 @@ fn render_explicit_plugin_instructions_wraps_turn_local_guidance_in_stable_tag() ) .expect("explicit plugin instructions should render"); - let expected = "\nCapabilities from the `sample` plugin:\n- Skills from this plugin are prefixed with `sample:`.\n- Apps from this plugin available in this session: `Google Calendar`.\nUse these plugin-associated capabilities to help solve the task.\n"; + let expected = "\nCapabilities from the `sample` plugin:\n- Skills from this plugin are prefixed with `sample:`.\n- Apps from this plugin available in this session: `Google Calendar`.\nUse these plugin-associated capabilities to help solve the task.\n"; assert_eq!(rendered, expected); } diff --git a/codex-rs/core/tests/common/context_snapshot.rs b/codex-rs/core/tests/common/context_snapshot.rs index 8feb8453a2..3a194e41cd 100644 --- a/codex-rs/core/tests/common/context_snapshot.rs +++ b/codex-rs/core/tests/common/context_snapshot.rs @@ -4,7 +4,7 @@ use std::sync::OnceLock; use crate::responses::ResponsesRequest; use codex_protocol::protocol::APPS_INSTRUCTIONS_OPEN_TAG; -use codex_protocol::protocol::EXPLICIT_PLUGIN_INSTRUCTIONS_OPEN_TAG; +use codex_protocol::protocol::PLUGIN_MENTION_INSTRUCTIONS_OPEN_TAG; use codex_protocol::protocol::PLUGINS_INSTRUCTIONS_OPEN_TAG; use codex_protocol::protocol::SKILLS_INSTRUCTIONS_OPEN_TAG; @@ -282,8 +282,8 @@ fn canonicalize_snapshot_text(text: &str) -> String { if text.starts_with(PLUGINS_INSTRUCTIONS_OPEN_TAG) { return "".to_string(); } - if text.starts_with(EXPLICIT_PLUGIN_INSTRUCTIONS_OPEN_TAG) { - return "".to_string(); + if text.starts_with(PLUGIN_MENTION_INSTRUCTIONS_OPEN_TAG) { + return "".to_string(); } if text.starts_with("# AGENTS.md instructions for ") { return "".to_string(); diff --git a/codex-rs/core/tests/suite/plugins.rs b/codex-rs/core/tests/suite/plugins.rs index 131479ac5f..89a4857d36 100644 --- a/codex-rs/core/tests/suite/plugins.rs +++ b/codex-rs/core/tests/suite/plugins.rs @@ -8,9 +8,9 @@ use std::time::Instant; use anyhow::Result; use codex_core::CodexAuth; use codex_features::Feature; -use codex_protocol::protocol::EXPLICIT_PLUGIN_INSTRUCTIONS_OPEN_TAG; use codex_protocol::protocol::EventMsg; use codex_protocol::protocol::Op; +use codex_protocol::protocol::PLUGIN_MENTION_INSTRUCTIONS_OPEN_TAG; use codex_protocol::user_input::UserInput; use core_test_support::apps_test_server::AppsTestServer; use core_test_support::context_snapshot; @@ -326,14 +326,14 @@ async fn explicit_plugin_mentions_inject_plugin_guidance() -> Result<()> { assert!( developer_messages .iter() - .any(|text| text.contains(EXPLICIT_PLUGIN_INSTRUCTIONS_OPEN_TAG)), + .any(|text| text.contains(PLUGIN_MENTION_INSTRUCTIONS_OPEN_TAG)), "expected plugin mention guidance in developer messages: {developer_messages:?}" ); let user_messages = request.message_input_texts("user"); assert!( user_messages .iter() - .all(|text| !text.contains(EXPLICIT_PLUGIN_INSTRUCTIONS_OPEN_TAG)), + .all(|text| !text.contains(PLUGIN_MENTION_INSTRUCTIONS_OPEN_TAG)), "expected plugin mention guidance to stay out of user messages: {user_messages:?}" ); assert!( diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__plugins__explicit_plugin_mentions_inject_plugin_guidance.snap b/codex-rs/core/tests/suite/snapshots/all__suite__plugins__explicit_plugin_mentions_inject_plugin_guidance.snap index 3407959772..dec6b58f57 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__plugins__explicit_plugin_mentions_inject_plugin_guidance.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__plugins__explicit_plugin_mentions_inject_plugin_guidance.snap @@ -7,6 +7,6 @@ Scenario: Explicit plugin mention request layout ## Plugin Mention Request 00:message/developer[2]: [01] - [02] + [02] 01:message/user:> 02:message/user:help me inspect the sample plugin diff --git a/codex-rs/protocol/src/protocol.rs b/codex-rs/protocol/src/protocol.rs index 377a798da5..9b58ccec7c 100644 --- a/codex-rs/protocol/src/protocol.rs +++ b/codex-rs/protocol/src/protocol.rs @@ -95,8 +95,8 @@ pub const SKILLS_INSTRUCTIONS_OPEN_TAG: &str = ""; pub const SKILLS_INSTRUCTIONS_CLOSE_TAG: &str = ""; pub const PLUGINS_INSTRUCTIONS_OPEN_TAG: &str = ""; pub const PLUGINS_INSTRUCTIONS_CLOSE_TAG: &str = ""; -pub const EXPLICIT_PLUGIN_INSTRUCTIONS_OPEN_TAG: &str = ""; -pub const EXPLICIT_PLUGIN_INSTRUCTIONS_CLOSE_TAG: &str = ""; +pub const PLUGIN_MENTION_INSTRUCTIONS_OPEN_TAG: &str = ""; +pub const PLUGIN_MENTION_INSTRUCTIONS_CLOSE_TAG: &str = ""; pub const COLLABORATION_MODE_OPEN_TAG: &str = ""; pub const COLLABORATION_MODE_CLOSE_TAG: &str = ""; pub const REALTIME_CONVERSATION_OPEN_TAG: &str = "";