Deduplicate plugin skills in unified mentions (#40501)

## Why

Unified `@` search could show a plugin alongside the skills it owns, creating duplicate entry points for the same capability.

## What changed

- Add a nullable `pluginId` to `SkillMetadata` returned by `skills/list` so clients can associate skills with their owning plugin without inspecting names or paths.
- Hide a plugin's owned skills from unified `@` results when that plugin is present, while retaining standalone skills and skills with unknown ownership.
- Keep `$` focused on individual skills and apps, and use it consistently as the skills-list shortcut. Preserve the legacy mention behavior when `mentions_v2` is disabled.

## Testing

- Cover plugin ownership in `skills/list` and the updated `@` and `$` composer results.

GitOrigin-RevId: e168cdff8d0c58f74ce4c228a683880a3167775b
This commit is contained in:
victor-openai authored and copyberry committed 2026-08-25 00:15:49 +00:00
1 parent 465eafacbc
commit 5918c743f3
18 files changed
+121 -25

No files matched your search

@@ -19095,6 +19095,13 @@
"path": { "path": {
"$ref": "#/definitions/v2/AbsolutePathBuf" "$ref": "#/definitions/v2/AbsolutePathBuf"
}, },
"pluginId": {
"description": "Owning plugin ID, matching `PluginSummary.id`, when known.",
"type": [
"string",
"null"
]
},
"scope": { "scope": {
"$ref": "#/definitions/v2/SkillScope" "$ref": "#/definitions/v2/SkillScope"
}, },
@@ -16847,6 +16847,13 @@
"path": { "path": {
"$ref": "#/definitions/AbsolutePathBuf" "$ref": "#/definitions/AbsolutePathBuf"
}, },
"pluginId": {
"description": "Owning plugin ID, matching `PluginSummary.id`, when known.",
"type": [
"string",
"null"
]
},
"scope": { "scope": {
"$ref": "#/definitions/SkillScope" "$ref": "#/definitions/SkillScope"
}, },
@@ -131,6 +131,13 @@
"path": { "path": {
"$ref": "#/definitions/AbsolutePathBuf" "$ref": "#/definitions/AbsolutePathBuf"
}, },
"pluginId": {
"description": "Owning plugin ID, matching `PluginSummary.id`, when known.",
"type": [
"string",
"null"
]
},
"scope": { "scope": {
"$ref": "#/definitions/SkillScope" "$ref": "#/definitions/SkillScope"
}, },
@@ -10,4 +10,8 @@ export type SkillMetadata = { name: string, description: string,
/** /**
* Legacy short_description from SKILL.md. Prefer SKILL.json interface.short_description. * Legacy short_description from SKILL.md. Prefer SKILL.json interface.short_description.
*/ */
shortDescription?: string, interface?: SkillInterface, dependencies?: SkillDependencies, path: AbsolutePathBuf, scope: SkillScope, enabled: boolean, }; shortDescription?: string, interface?: SkillInterface, dependencies?: SkillDependencies, path: AbsolutePathBuf, scope: SkillScope, enabled: boolean,
/**
* Owning plugin ID, matching `PluginSummary.id`, when known.
*/
pluginId: string | null, };
@@ -436,6 +436,8 @@ pub struct SkillMetadata {
pub path: AbsolutePathBuf, pub path: AbsolutePathBuf,
pub scope: SkillScope, pub scope: SkillScope,
pub enabled: bool, pub enabled: bool,
/// Owning plugin ID, matching `PluginSummary.id`, when known.
pub plugin_id: Option<String>,
} }
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
@@ -943,6 +945,7 @@ impl From<CoreSkillMetadata> for SkillMetadata {
path: value.path, path: value.path,
scope: value.scope.into(), scope: value.scope.into(),
enabled: true, enabled: true,
plugin_id: None,
} }
} }
} }
+2
View File
@@ -1915,6 +1915,7 @@ $skill-creator Add a new skill for triaging flaky CI and include step-by-step us
``` ```
Use `skills/list` to fetch the available skills (optionally scoped by `cwds`, with `forceReload`). Use `skills/list` to fetch the available skills (optionally scoped by `cwds`, with `forceReload`).
Each skill includes a nullable `pluginId` matching its owning plugin's `id` in `plugin/list`, when known. Clients can use it to group plugin-owned skills without inferring ownership from names or paths. Older servers may omit this field.
`skills/list` might reuse a cached skills result per `cwd`; setting `forceReload` to `true` refreshes the result from disk. `skills/list` might reuse a cached skills result per `cwd`; setting `forceReload` to `true` refreshes the result from disk.
The server also emits `skills/changed` notifications when watched local skill files change. Treat this as an invalidation signal and re-run `skills/list` with your current params when needed. The server also emits `skills/changed` notifications when watched local skill files change. Treat this as an invalidation signal and re-run `skills/list` with your current params when needed.
Use `skills/extraRoots/set` to replace additional standalone skill roots for the current app-server process. These roots use the same layout as other standalone skill roots: each root contains skill directories, and each skill directory contains `SKILL.md`. Missing roots are accepted and load no skills until they exist. This setting is lost when app-server exits. Use `skills/extraRoots/set` to replace additional standalone skill roots for the current app-server process. These roots use the same layout as other standalone skill roots: each root contains skill directories, and each skill directory contains `SKILL.md`. Missing roots are accepted and load no skills until they exist. This setting is lost when app-server exits.
@@ -1932,6 +1933,7 @@ Use `skills/extraRoots/set` to replace additional standalone skill roots for the
"name": "skill-creator", "name": "skill-creator",
"description": "Create or update a Codex skill", "description": "Create or update a Codex skill",
"enabled": true, "enabled": true,
"pluginId": null,
"interface": { "interface": {
"displayName": "Skill Creator", "displayName": "Skill Creator",
"shortDescription": "Create or update a Codex skill", "shortDescription": "Create or update a Codex skill",
@@ -57,6 +57,7 @@ fn skills_to_info(
path: skill.path_to_skills_md.clone(), path: skill.path_to_skills_md.clone(),
scope: skill.scope.into(), scope: skill.scope.into(),
enabled, enabled,
plugin_id: skill.plugin_id.clone(),
} }
}) })
.collect() .collect()
@@ -659,7 +659,10 @@ async fn skills_list_loads_remote_installed_plugin_skills_from_cache() -> Result
std::fs::canonicalize(skill.path.as_path())?, std::fs::canonicalize(skill.path.as_path())?,
expected_skill_path expected_skill_path
); );
assert_eq!(skill.enabled, true); assert_eq!(
(skill.enabled, skill.plugin_id.as_deref()),
(true, Some("linear@openai-curated-remote")),
);
Ok(()) Ok(())
} }
+56 -3
View File
@@ -9,6 +9,12 @@
//! - Turning raw key streams into explicit paste operations on platforms where terminals //! - Turning raw key streams into explicit paste operations on platforms where terminals
//! don't provide reliable bracketed paste (notably Windows). //! don't provide reliable bracketed paste (notably Windows).
//! //!
//! # Mention Menus
//!
//! By default, `@` lists plugins, filesystem entries, and skills. Skills are hidden when their
//! owning plugin is listed. `$` lists individual skills and apps, but not plugins.
//! Disabling `mentions_v2` restores file-only `@` search and adds plugins back to `$`.
//!
//! # Key Event Routing //! # Key Event Routing
//! //!
//! Most key handling goes through [`ChatComposer::handle_key_event`], which dispatches to a //! Most key handling goes through [`ChatComposer::handle_key_event`], which dispatches to a
@@ -4207,7 +4213,9 @@ impl ChatComposer {
} }
} }
if let Some(plugins) = self.plugins.as_ref() { if !self.mentions_v2_enabled
&& let Some(plugins) = self.plugins.as_ref()
{
for plugin in plugins { for plugin in plugins {
let (plugin_name, marketplace_name) = plugin let (plugin_name, marketplace_name) = plugin
.config_name .config_name
@@ -6855,6 +6863,7 @@ mod tests {
path: test_path_buf(&format!("/tmp/{name}/SKILL.md")).abs(), path: test_path_buf(&format!("/tmp/{name}/SKILL.md")).abs(),
scope: crate::test_support::skill_scope_user(), scope: crate::test_support::skill_scope_user(),
enabled: true, enabled: true,
plugin_id: None,
} }
} }
@@ -7506,6 +7515,7 @@ mod tests {
path: skill_path.clone(), path: skill_path.clone(),
scope: crate::test_support::skill_scope_user(), scope: crate::test_support::skill_scope_user(),
enabled: true, enabled: true,
plugin_id: None,
}])); }]));
let ActivePopup::Skill(popup) = &composer.popups.active else { let ActivePopup::Skill(popup) = &composer.popups.active else {
@@ -7519,7 +7529,7 @@ mod tests {
} }
#[test] #[test]
fn mention_items_show_plugin_owned_skill_and_app_duplicates() { fn mention_items_keep_direct_skills_and_apps_with_unified_mentions() {
let skill_path = test_path_buf("/tmp/repo/google-calendar/SKILL.md").abs(); let skill_path = test_path_buf("/tmp/repo/google-calendar/SKILL.md").abs();
let (tx, _rx) = unbounded_channel::<AppEvent>(); let (tx, _rx) = unbounded_channel::<AppEvent>();
let sender = AppEventSender::new(tx); let sender = AppEventSender::new(tx);
@@ -7550,6 +7560,7 @@ mod tests {
path: skill_path.clone(), path: skill_path.clone(),
scope: crate::test_support::skill_scope_repo(), scope: crate::test_support::skill_scope_repo(),
enabled: true, enabled: true,
plugin_id: Some("google-calendar@debug".to_string()),
}])); }]));
composer.set_plugin_mentions(Some(vec![PluginCapabilitySummary { composer.set_plugin_mentions(Some(vec![PluginCapabilitySummary {
config_name: "google-calendar@debug".to_string(), config_name: "google-calendar@debug".to_string(),
@@ -7595,6 +7606,25 @@ mod tests {
); );
assert_eq!(mentions[2].category_tag, Some("[App]".to_string())); assert_eq!(mentions[2].category_tag, Some("[App]".to_string()));
assert_eq!(mentions[2].path, Some("app://google_calendar".to_string())); assert_eq!(mentions[2].path, Some("app://google_calendar".to_string()));
composer.set_mentions_v2_enabled(/*enabled*/ true);
assert_eq!(
composer
.mention_items()
.into_iter()
.map(|mention| (mention.insert_text, mention.path))
.collect::<Vec<_>>(),
vec![
(
"$google-calendar:availability".to_string(),
Some(skill_path.display().to_string()),
),
(
"$google-calendar".to_string(),
Some("app://google_calendar".to_string()),
),
],
);
} }
#[test] #[test]
@@ -7629,11 +7659,32 @@ mod tests {
let features = codex_features::Features::with_defaults(); let features = codex_features::Features::with_defaults();
composer composer
.set_mentions_v2_enabled(features.enabled(codex_features::Feature::MentionsV2)); .set_mentions_v2_enabled(features.enabled(codex_features::Feature::MentionsV2));
composer.set_skill_mentions(Some(vec![
SkillMetadata {
name: "sample-tools:search".to_string(),
plugin_id: Some("sample@test".to_string()),
..test_skill_metadata("sample-search")
},
SkillMetadata {
name: "sample:summarize".to_string(),
plugin_id: Some("sample@test".to_string()),
..test_skill_metadata("sample-summarize")
},
SkillMetadata {
name: "sample:notes".to_string(),
..test_skill_metadata("sample-notes")
},
SkillMetadata {
name: "sample:other".to_string(),
plugin_id: Some("sample@other-marketplace".to_string()),
..test_skill_metadata("sample-other")
},
]));
composer.set_text_content("@sa".to_string(), Vec::new(), Vec::new()); composer.set_text_content("@sa".to_string(), Vec::new(), Vec::new());
composer.set_plugin_mentions(Some(vec![PluginCapabilitySummary { composer.set_plugin_mentions(Some(vec![PluginCapabilitySummary {
config_name: "sample@test".to_string(), config_name: "sample@test".to_string(),
display_name: "Sample Plugin".to_string(), display_name: "Sample Plugin".to_string(),
plugin_namespace: None, plugin_namespace: Some("sample".to_string()),
description: Some("Plugin with skills and an MCP server".to_string()), description: Some("Plugin with skills and an MCP server".to_string()),
has_skills: true, has_skills: true,
mcp_server_names: vec!["sample".to_string()], mcp_server_names: vec!["sample".to_string()],
@@ -7823,6 +7874,7 @@ mod tests {
/*width*/ 72, /*width*/ 72,
/*enhanced_keys_supported*/ false, /*enhanced_keys_supported*/ false,
|composer| { |composer| {
composer.set_mentions_v2_enabled(/*enabled*/ true);
composer.set_connectors_enabled(/*enabled*/ true); composer.set_connectors_enabled(/*enabled*/ true);
composer.set_text_content("$goog".to_string(), Vec::new(), Vec::new()); composer.set_text_content("$goog".to_string(), Vec::new(), Vec::new());
composer.set_skill_mentions(Some(vec![SkillMetadata { composer.set_skill_mentions(Some(vec![SkillMetadata {
@@ -7843,6 +7895,7 @@ mod tests {
path: test_path_buf("/tmp/repo/google-calendar/SKILL.md").abs(), path: test_path_buf("/tmp/repo/google-calendar/SKILL.md").abs(),
scope: crate::test_support::skill_scope_repo(), scope: crate::test_support::skill_scope_repo(),
enabled: true, enabled: true,
plugin_id: None,
}])); }]));
composer.set_plugin_mentions(Some(vec![PluginCapabilitySummary { composer.set_plugin_mentions(Some(vec![PluginCapabilitySummary {
config_name: "google-calendar@debug".to_string(), config_name: "google-calendar@debug".to_string(),
@@ -1,3 +1,5 @@
use std::collections::HashSet;
use codex_app_server_protocol::SkillMetadata; use codex_app_server_protocol::SkillMetadata;
use codex_plugin::PluginCapabilitySummary; use codex_plugin::PluginCapabilitySummary;
@@ -15,9 +17,25 @@ pub(crate) fn build_search_catalog(
plugins: Option<&[PluginCapabilitySummary]>, plugins: Option<&[PluginCapabilitySummary]>,
tasks: &[TaskMention], tasks: &[TaskMention],
) -> Vec<Candidate> { ) -> Vec<Candidate> {
let plugin_ids: HashSet<_> = plugins
.into_iter()
.flatten()
.map(|plugin| plugin.config_name.as_str())
.collect();
let mut candidates = Vec::new(); let mut candidates = Vec::new();
if let Some(skills) = skills { if let Some(skills) = skills {
candidates.extend(skills.iter().map(skill_candidate)); // Keep skills visible when older servers omit plugin ownership.
candidates.extend(
skills
.iter()
.filter(|skill| {
!skill
.plugin_id
.as_deref()
.is_some_and(|plugin_id| plugin_ids.contains(plugin_id))
})
.map(skill_candidate),
);
} }
if let Some(plugins) = plugins { if let Some(plugins) = plugins {
+1
View File
@@ -2782,6 +2782,7 @@ mod tests {
path: test_path_buf("/tmp/test-skill/SKILL.md").abs(), path: test_path_buf("/tmp/test-skill/SKILL.md").abs(),
scope: crate::test_support::skill_scope_user(), scope: crate::test_support::skill_scope_user(),
enabled: true, enabled: true,
plugin_id: None,
}]), }]),
}); });
@@ -6,8 +6,8 @@ expression: terminal.backend()
"› @sa " "› @sa "
" " " "
" " " "
" " "> Sample Plugin Plugin with skills and an MCP server Plugin"
" " " other (sample) Example skill used in tests. Skill "
"> Sample Plugin Plugin with skills and an MCP server Plugin" " notes (sample) Example skill used in tests. Skill "
" " " "
" enter insert · esc close · ←/→ switch search modes [All Results] Filesystem Only Plugins " " enter insert · esc close · ←/→ switch search modes [All Results] Filesystem Only Plugins "
@@ -6,7 +6,7 @@ expression: terminal.backend()
"› $goog " "› $goog "
" " " "
" " " "
" Google Calendar [Plugin] Connect Google Calendar for scheduling, ava…" " "
" Google Calendar [Skill] Find availability and plan event changes " " Google Calendar [Skill] Find availability and plan event changes "
" Google Calendar [App] Look up events and availability " " Google Calendar [App] Look up events and availability "
" " " "
+2 -14
View File
@@ -14,32 +14,20 @@ use codex_app_server_protocol::SkillMetadata;
use codex_app_server_protocol::SkillsListEntry; use codex_app_server_protocol::SkillsListEntry;
use codex_app_server_protocol::SkillsListResponse; use codex_app_server_protocol::SkillsListResponse;
use codex_connectors::AppInfo; use codex_connectors::AppInfo;
use codex_features::Feature;
use codex_protocol::parse_command::ParsedCommand; use codex_protocol::parse_command::ParsedCommand;
use codex_utils_absolute_path::AbsolutePathBuf; use codex_utils_absolute_path::AbsolutePathBuf;
use codex_utils_plugins::mention_syntax::TOOL_MENTION_SIGIL; use codex_utils_plugins::mention_syntax::TOOL_MENTION_SIGIL;
impl ChatWidget { impl ChatWidget {
pub(crate) fn open_skills_list(&mut self) { pub(crate) fn open_skills_list(&mut self) {
if self.config.features.enabled(Feature::MentionsV2) { self.insert_str("$");
self.insert_str("@");
} else {
self.insert_str("$");
}
} }
pub(crate) fn open_skills_menu(&mut self) { pub(crate) fn open_skills_menu(&mut self) {
let list_shortcut = if self.config.features.enabled(Feature::MentionsV2) {
'@'
} else {
'$'
};
let items = vec![ let items = vec![
SelectionItem { SelectionItem {
name: "List skills".to_string(), name: "List skills".to_string(),
description: Some(format!( description: Some("Tip: press $ to open this list directly.".to_string()),
"Tip: press {list_shortcut} to open this list directly."
)),
actions: vec![Box::new(|tx| { actions: vec![Box::new(|tx| {
tx.send(AppEvent::OpenSkillsList); tx.send(AppEvent::OpenSkillsList);
})], })],
@@ -5,7 +5,7 @@ expression: popup
Skills Skills
Choose an action Choose an action
› 1. List skills Tip: press @ to open this list directly. › 1. List skills Tip: press $ to open this list directly.
2. Enable/Disable Skills Enable or disable skills. 2. Enable/Disable Skills Enable or disable skills.
Press enter to confirm or esc to go back Press enter to confirm or esc to go back
@@ -886,6 +886,7 @@ async fn submission_prefers_selected_duplicate_skill_path() {
path: repo_skill_path, path: repo_skill_path,
scope: crate::test_support::skill_scope_repo(), scope: crate::test_support::skill_scope_repo(),
enabled: true, enabled: true,
plugin_id: None,
}, },
SkillMetadata { SkillMetadata {
name: "figma".to_string(), name: "figma".to_string(),
@@ -896,6 +897,7 @@ async fn submission_prefers_selected_duplicate_skill_path() {
path: user_skill_path.clone(), path: user_skill_path.clone(),
scope: crate::test_support::skill_scope_user(), scope: crate::test_support::skill_scope_user(),
enabled: true, enabled: true,
plugin_id: None,
}, },
])); ]));