mirror of
https://github.com/openai/codex.git
synced 2026-10-26 18:38:47 +00:00
Move host skill prompt injection into the skills extension (#37503)
## What changed - Add `HostSkillsSnapshot::load_skill_prompts` so the skills extension owns reading and rendering selected host skills. - Keep explicit invocation telemetry, unreadable-skill warnings, plugin prompt ordering, and suppression of host prompts superseded by provider prompts. - Remove the legacy prompt injection and fragment implementation from `codex-core-skills`. ## Testing - Cover prompt truncation without an installed skills extension, skill/plugin ordering, selective provider supersession, unreadable skills, and contextual fragment detection. GitOrigin-RevId: 9c8b84ad54b90d174abc287ab49cc5a231e9e1aa
This commit is contained in:
@@ -9,7 +9,6 @@ use super::LegacyApplyPatchExecCommandWarning;
|
||||
use super::LegacyModelMismatchWarning;
|
||||
use super::LegacyUnifiedExecProcessLimitWarning;
|
||||
use super::RecommendedPluginsInstructions;
|
||||
use super::SkillInstructions;
|
||||
use super::SubagentNotification;
|
||||
use super::TurnAborted;
|
||||
use super::UserInstructions;
|
||||
@@ -20,7 +19,7 @@ const CONTEXTUAL_USER_FRAGMENT_MATCHERS: &[fn(&str) -> bool] = &[
|
||||
UserInstructions::matches_text,
|
||||
EnvironmentsState::matches_text,
|
||||
AdditionalContextUserFragment::matches_text,
|
||||
SkillInstructions::matches_text,
|
||||
codex_skills_extension::is_skill_prompt_fragment,
|
||||
UserShellCommand::matches_text,
|
||||
TurnAborted::matches_text,
|
||||
SubagentNotification::matches_text,
|
||||
|
||||
@@ -15,6 +15,18 @@ fn detects_environment_context_fragment() {
|
||||
}));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn detects_skill_instructions_fragment_case_insensitively() {
|
||||
for text in [
|
||||
"<skill>\n<name>demo</name>\n</skill>",
|
||||
" <SKILL>\n<name>demo</name>\n</SKILL> ",
|
||||
] {
|
||||
assert!(is_contextual_user_fragment(&ContentItem::InputText {
|
||||
text: text.to_string(),
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn detects_agents_instructions_fragment() {
|
||||
for text in [
|
||||
|
||||
@@ -43,7 +43,6 @@ pub(crate) use available_plugins_instructions::AvailablePluginsInstructions;
|
||||
pub(crate) use codex_context_fragments::AdditionalContextDeveloperFragment;
|
||||
pub(crate) use codex_context_fragments::AdditionalContextUserFragment;
|
||||
pub use codex_context_fragments::ContextualUserFragment;
|
||||
pub(crate) use codex_core_skills::SkillInstructions;
|
||||
pub(crate) use contextual_user_message::is_contextual_user_fragment;
|
||||
pub(crate) use contextual_user_message::parse_visible_hook_prompt_message;
|
||||
pub(crate) use current_time_reminder::CurrentTimeReminder;
|
||||
|
||||
Reference in New Issue
Block a user