Lightweight coding agent that runs in your terminal
Rust
Deduplicate plugin skills in unified mentions (#40501)
victor-openai5918c743f3d3
diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.jsonindex 706251c4e4..e20a9351c6 100644--- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json+++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json@@ -19095,6 +19095,13 @@"path": {"$ref": "#/definitions/v2/AbsolutePathBuf"},+ "pluginId": {+ "description": "Owning plugin ID, matching `PluginSummary.id`, when known.",+ "type": [+ "string",+ "null"+ ]+ },"scope": {"$ref": "#/definitions/v2/SkillScope"},diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.jsonindex 86b5b67c32..6afde55a16 100644--- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json+++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json@@ -16847,6 +16847,13 @@"path": {"$ref": "#/definitions/AbsolutePathBuf"},+ "pluginId": {+ "description": "Owning plugin ID, matching `PluginSummary.id`, when known.",+ "type": [+ "string",+ "null"+ ]+ },"scope": {"$ref": "#/definitions/SkillScope"},diff --git a/codex-rs/app-server-protocol/schema/json/v2/SkillsListResponse.json b/codex-rs/app-server-protocol/schema/json/v2/SkillsListResponse.jsonindex 3040d57e40..9344eec0ca 100644--- a/codex-rs/app-server-protocol/schema/json/v2/SkillsListResponse.json+++ b/codex-rs/app-server-protocol/schema/json/v2/SkillsListResponse.json@@ -131,6 +131,13 @@"path": {"$ref": "#/definitions/AbsolutePathBuf"},+ "pluginId": {+ "description": "Owning plugin ID, matching `PluginSummary.id`, when known.",+ "type": [+ "string",+ "null"+ ]+ },"scope": {"$ref": "#/definitions/SkillScope"},diff --git a/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-experimental.json.zst b/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-experimental.json.zstindex 4f686dd0da..65ca7eb274 100644Binary files a/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-experimental.json.zst and b/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-experimental.json.zst differdiff --git a/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-stable.json.zst b/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-stable.json.zstindex 76ac470aa0..a12fda2014 100644Binary files a/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-stable.json.zst and b/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-stable.json.zst differdiff --git a/codex-rs/app-server-protocol/schema/typescript/v2/SkillMetadata.ts b/codex-rs/app-server-protocol/schema/typescript/v2/SkillMetadata.tsindex e43484d1f4..742842187d 100644--- a/codex-rs/app-server-protocol/schema/typescript/v2/SkillMetadata.ts+++ b/codex-rs/app-server-protocol/schema/typescript/v2/SkillMetadata.ts@@ -10,4 +10,8 @@ export type SkillMetadata = { name: string, description: string,/*** 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, };diff --git a/codex-rs/app-server-protocol/src/protocol/v2/plugin.rs b/codex-rs/app-server-protocol/src/protocol/v2/plugin.rsindex de2bdc3a4e..d6d28a6e21 100644--- a/codex-rs/app-server-protocol/src/protocol/v2/plugin.rs+++ b/codex-rs/app-server-protocol/src/protocol/v2/plugin.rs@@ -436,6 +436,8 @@ pub struct SkillMetadata {pub path: AbsolutePathBuf,pub scope: SkillScope,pub enabled: bool,+ /// Owning plugin ID, matching `PluginSummary.id`, when known.+ pub plugin_id: Option<String>,}#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]@@ -943,6 +945,7 @@ impl From<CoreSkillMetadata> for SkillMetadata {path: value.path,scope: value.scope.into(),enabled: true,+ plugin_id: None,}}}diff --git a/codex-rs/app-server/README.md b/codex-rs/app-server/README.mdindex 188106f550..09b40ca94d 100644--- a/codex-rs/app-server/README.md+++ b/codex-rs/app-server/README.md@@ -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`).+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.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.@@ -1932,6 +1933,7 @@ Use `skills/extraRoots/set` to replace additional standalone skill roots for the"name": "skill-creator","description": "Create or update a Codex skill","enabled": true,+ "pluginId": null,"interface": {"displayName": "Skill Creator","shortDescription": "Create or update a Codex skill",diff --git a/codex-rs/app-server/src/request_processors/catalog_processor.rs b/codex-rs/app-server/src/request_processors/catalog_processor.rsindex 1a20b35187..42f36a76dc 100644--- a/codex-rs/app-server/src/request_processors/catalog_processor.rs+++ b/codex-rs/app-server/src/request_processors/catalog_processor.rs@@ -57,6 +57,7 @@ fn skills_to_info(path: skill.path_to_skills_md.clone(),scope: skill.scope.into(),enabled,+ plugin_id: skill.plugin_id.clone(),}}).collect()diff --git a/codex-rs/app-server/tests/suite/v2/skills_list.rs b/codex-rs/app-server/tests/suite/v2/skills_list.rsindex 26d135af21..0dc72dc0c7 100644--- a/codex-rs/app-server/tests/suite/v2/skills_list.rs+++ b/codex-rs/app-server/tests/suite/v2/skills_list.rs@@ -659,7 +659,10 @@ async fn skills_list_loads_remote_installed_plugin_skills_from_cache() -> Resultstd::fs::canonicalize(skill.path.as_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(())}diff --git a/codex-rs/tui/src/bottom_pane/chat_composer.rs b/codex-rs/tui/src/bottom_pane/chat_composer.rsindex 14969d1d17..8b45703925 100644--- a/codex-rs/tui/src/bottom_pane/chat_composer.rs+++ b/codex-rs/tui/src/bottom_pane/chat_composer.rs@@ -9,6 +9,12 @@//! - Turning raw key streams into explicit paste operations on platforms where terminals//! 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//!//! 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 {let (plugin_name, marketplace_name) = plugin.config_name@@ -6855,6 +6863,7 @@ mod tests {path: test_path_buf(&format!("/tmp/{name}/SKILL.md")).abs(),scope: crate::test_support::skill_scope_user(),enabled: true,+ plugin_id: None,}}@@ -7506,6 +7515,7 @@ mod tests {path: skill_path.clone(),scope: crate::test_support::skill_scope_user(),enabled: true,+ plugin_id: None,}]));let ActivePopup::Skill(popup) = &composer.popups.active else {@@ -7519,7 +7529,7 @@ mod tests {}#[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 (tx, _rx) = unbounded_channel::<AppEvent>();let sender = AppEventSender::new(tx);@@ -7550,6 +7560,7 @@ mod tests {path: skill_path.clone(),scope: crate::test_support::skill_scope_repo(),enabled: true,+ plugin_id: Some("google-calendar@debug".to_string()),}]));composer.set_plugin_mentions(Some(vec![PluginCapabilitySummary {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].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]@@ -7629,11 +7659,32 @@ mod tests {let features = codex_features::Features::with_defaults();composer.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_plugin_mentions(Some(vec![PluginCapabilitySummary {config_name: "sample@test".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()),has_skills: true,mcp_server_names: vec!["sample".to_string()],@@ -7823,6 +7874,7 @@ mod tests {/*width*/ 72,/*enhanced_keys_supported*/ false,|composer| {+ composer.set_mentions_v2_enabled(/*enabled*/ true);composer.set_connectors_enabled(/*enabled*/ true);composer.set_text_content("$goog".to_string(), Vec::new(), Vec::new());composer.set_skill_mentions(Some(vec![SkillMetadata {@@ -7843,6 +7895,7 @@ mod tests {path: test_path_buf("/tmp/repo/google-calendar/SKILL.md").abs(),scope: crate::test_support::skill_scope_repo(),enabled: true,+ plugin_id: None,}]));composer.set_plugin_mentions(Some(vec![PluginCapabilitySummary {config_name: "google-calendar@debug".to_string(),diff --git a/codex-rs/tui/src/bottom_pane/mentions_v2/search_catalog.rs b/codex-rs/tui/src/bottom_pane/mentions_v2/search_catalog.rsindex ccf1ad7f7b..fdc6143f35 100644--- a/codex-rs/tui/src/bottom_pane/mentions_v2/search_catalog.rs+++ b/codex-rs/tui/src/bottom_pane/mentions_v2/search_catalog.rs@@ -1,3 +1,5 @@+use std::collections::HashSet;+use codex_app_server_protocol::SkillMetadata;use codex_plugin::PluginCapabilitySummary;@@ -15,9 +17,25 @@ pub(crate) fn build_search_catalog(plugins: Option<&[PluginCapabilitySummary]>,tasks: &[TaskMention],) -> Vec<Candidate> {+ let plugin_ids: HashSet<_> = plugins+ .into_iter()+ .flatten()+ .map(|plugin| plugin.config_name.as_str())+ .collect();let mut candidates = Vec::new();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 {diff --git a/codex-rs/tui/src/bottom_pane/mod.rs b/codex-rs/tui/src/bottom_pane/mod.rsindex 5e62eca887..ded10d319a 100644--- a/codex-rs/tui/src/bottom_pane/mod.rs+++ b/codex-rs/tui/src/bottom_pane/mod.rs@@ -2782,6 +2782,7 @@ mod tests {path: test_path_buf("/tmp/test-skill/SKILL.md").abs(),scope: crate::test_support::skill_scope_user(),enabled: true,+ plugin_id: None,}]),});diff --git a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__chat_composer__tests__default_unified_mention_popup.snap b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__chat_composer__tests__default_unified_mention_popup.snapindex ced677b639..015b3ec340 100644--- a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__chat_composer__tests__default_unified_mention_popup.snap+++ b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__chat_composer__tests__default_unified_mention_popup.snap@@ -6,8 +6,8 @@ expression: terminal.backend()"› @sa "" "" "-" "-" "-"> Sample Plugin Plugin with skills and an MCP server Plugin"+"> Sample Plugin Plugin with skills and an MCP server Plugin"+" other (sample) Example skill used in tests. Skill "+" notes (sample) Example skill used in tests. Skill "" "" enter insert · esc close · ←/→ switch search modes [All Results] Filesystem Only Plugins "diff --git a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__chat_composer__tests__mention_popup_type_prefixes.snap b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__chat_composer__tests__mention_popup_type_prefixes.snapindex a894bffcb2..8bfb4abf3c 100644--- a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__chat_composer__tests__mention_popup_type_prefixes.snap+++ b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__chat_composer__tests__mention_popup_type_prefixes.snap@@ -6,7 +6,7 @@ expression: terminal.backend()"› $goog "" "" "-" Google Calendar [Plugin] Connect Google Calendar for scheduling, ava…"+" "" Google Calendar [Skill] Find availability and plan event changes "" Google Calendar [App] Look up events and availability "" "diff --git a/codex-rs/tui/src/chatwidget/skills.rs b/codex-rs/tui/src/chatwidget/skills.rsindex 3d5f9cc1b6..80209e6538 100644--- a/codex-rs/tui/src/chatwidget/skills.rs+++ b/codex-rs/tui/src/chatwidget/skills.rs@@ -14,32 +14,20 @@ use codex_app_server_protocol::SkillMetadata;use codex_app_server_protocol::SkillsListEntry;use codex_app_server_protocol::SkillsListResponse;use codex_connectors::AppInfo;-use codex_features::Feature;use codex_protocol::parse_command::ParsedCommand;use codex_utils_absolute_path::AbsolutePathBuf;use codex_utils_plugins::mention_syntax::TOOL_MENTION_SIGIL;impl ChatWidget {pub(crate) fn open_skills_list(&mut self) {- if self.config.features.enabled(Feature::MentionsV2) {- self.insert_str("@");- } else {- self.insert_str("$");- }+ self.insert_str("$");}pub(crate) fn open_skills_menu(&mut self) {- let list_shortcut = if self.config.features.enabled(Feature::MentionsV2) {- '@'- } else {- '$'- };let items = vec![SelectionItem {name: "List skills".to_string(),- description: Some(format!(- "Tip: press {list_shortcut} to open this list directly."- )),+ description: Some("Tip: press $ to open this list directly.".to_string()),actions: vec![Box::new(|tx| {tx.send(AppEvent::OpenSkillsList);})],diff --git a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__skills_menu_default_mentions_shortcut.snap b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__skills_menu_default_mentions_shortcut.snapindex f63ef4958c..63d95ffaaa 100644--- a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__skills_menu_default_mentions_shortcut.snap+++ b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__skills_menu_default_mentions_shortcut.snap@@ -5,7 +5,7 @@ expression: popupSkillsChoose 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.Press enter to confirm or esc to go backdiff --git a/codex-rs/tui/src/chatwidget/tests/composer_submission.rs b/codex-rs/tui/src/chatwidget/tests/composer_submission.rsindex c41bd98ea6..1acc1e5a27 100644--- a/codex-rs/tui/src/chatwidget/tests/composer_submission.rs+++ b/codex-rs/tui/src/chatwidget/tests/composer_submission.rs@@ -886,6 +886,7 @@ async fn submission_prefers_selected_duplicate_skill_path() {path: repo_skill_path,scope: crate::test_support::skill_scope_repo(),enabled: true,+ plugin_id: None,},SkillMetadata {name: "figma".to_string(),@@ -896,6 +897,7 @@ async fn submission_prefers_selected_duplicate_skill_path() {path: user_skill_path.clone(),scope: crate::test_support::skill_scope_user(),enabled: true,+ plugin_id: None,},]));