From 3165a49fecc033128f2bb881aba4c069f21af020 Mon Sep 17 00:00:00 2001 From: jif-oai Date: Fri, 19 Jun 2026 15:54:45 +0200 Subject: [PATCH] Use thread config for inventory lists --- .../schema/json/ClientRequest.json | 8 +- .../codex_app_server_protocol.schemas.json | 8 +- .../codex_app_server_protocol.v2.schemas.json | 8 +- .../schema/json/v2/PluginListParams.json | 4 +- .../schema/json/v2/SkillsListParams.json | 4 +- .../schema/typescript/v2/PluginListParams.ts | 6 +- .../schema/typescript/v2/SkillsListParams.ts | 6 +- .../src/protocol/v2/plugin.rs | 12 ++- codex-rs/app-server/README.md | 8 +- .../request_processors/catalog_processor.rs | 51 +++++++----- .../src/request_processors/plugins.rs | 3 + .../app-server/tests/suite/v2/skills_list.rs | 80 +++++++++++++++++++ codex-rs/tui/src/app/background_requests.rs | 2 + codex-rs/tui/src/app/thread_routing.rs | 1 + 14 files changed, 155 insertions(+), 46 deletions(-) diff --git a/codex-rs/app-server-protocol/schema/json/ClientRequest.json b/codex-rs/app-server-protocol/schema/json/ClientRequest.json index 69b43b7f76..ee89eee826 100644 --- a/codex-rs/app-server-protocol/schema/json/ClientRequest.json +++ b/codex-rs/app-server-protocol/schema/json/ClientRequest.json @@ -1876,7 +1876,7 @@ "PluginListParams": { "properties": { "cwds": { - "description": "Optional working directories used to discover repo marketplaces. When omitted, only home-scoped marketplaces and the official curated marketplace are considered.", + "description": "Optional working directories used to discover repo marketplaces. When omitted, only home-scoped marketplaces and the official curated marketplace are considered. Cannot be combined with `threadId`.", "items": { "$ref": "#/definitions/AbsolutePathBuf" }, @@ -1896,7 +1896,7 @@ ] }, "threadId": { - "description": "Optional loaded thread id used to evaluate plugins from that thread's config.", + "description": "Optional loaded thread id used to evaluate plugins from that thread's cwd and config. Cannot be combined with `cwds`.", "type": [ "string", "null" @@ -3474,7 +3474,7 @@ "SkillsListParams": { "properties": { "cwds": { - "description": "When empty, defaults to the current session working directory.", + "description": "Working directories used to list skills. Must be empty when `threadId` is provided. When empty, defaults to the loaded thread's cwd or the app-server default cwd.", "items": { "type": "string" }, @@ -3485,7 +3485,7 @@ "type": "boolean" }, "threadId": { - "description": "Optional loaded thread id used to evaluate skills from that thread's config.", + "description": "Optional loaded thread id used to evaluate skills from that thread's cwd and config. Cannot be combined with `cwds`.", "type": [ "string", "null" 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.json index 3334d83768..97e9a6ac74 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 @@ -13359,7 +13359,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "properties": { "cwds": { - "description": "Optional working directories used to discover repo marketplaces. When omitted, only home-scoped marketplaces and the official curated marketplace are considered.", + "description": "Optional working directories used to discover repo marketplaces. When omitted, only home-scoped marketplaces and the official curated marketplace are considered. Cannot be combined with `threadId`.", "items": { "$ref": "#/definitions/v2/AbsolutePathBuf" }, @@ -13379,7 +13379,7 @@ ] }, "threadId": { - "description": "Optional loaded thread id used to evaluate plugins from that thread's config.", + "description": "Optional loaded thread id used to evaluate plugins from that thread's cwd and config. Cannot be combined with `cwds`.", "type": [ "string", "null" @@ -16415,7 +16415,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "properties": { "cwds": { - "description": "When empty, defaults to the current session working directory.", + "description": "Working directories used to list skills. Must be empty when `threadId` is provided. When empty, defaults to the loaded thread's cwd or the app-server default cwd.", "items": { "type": "string" }, @@ -16426,7 +16426,7 @@ "type": "boolean" }, "threadId": { - "description": "Optional loaded thread id used to evaluate skills from that thread's config.", + "description": "Optional loaded thread id used to evaluate skills from that thread's cwd and config. Cannot be combined with `cwds`.", "type": [ "string", "null" 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.json index 795a5e517d..02e3501acc 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 @@ -9783,7 +9783,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "properties": { "cwds": { - "description": "Optional working directories used to discover repo marketplaces. When omitted, only home-scoped marketplaces and the official curated marketplace are considered.", + "description": "Optional working directories used to discover repo marketplaces. When omitted, only home-scoped marketplaces and the official curated marketplace are considered. Cannot be combined with `threadId`.", "items": { "$ref": "#/definitions/AbsolutePathBuf" }, @@ -9803,7 +9803,7 @@ ] }, "threadId": { - "description": "Optional loaded thread id used to evaluate plugins from that thread's config.", + "description": "Optional loaded thread id used to evaluate plugins from that thread's cwd and config. Cannot be combined with `cwds`.", "type": [ "string", "null" @@ -14194,7 +14194,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "properties": { "cwds": { - "description": "When empty, defaults to the current session working directory.", + "description": "Working directories used to list skills. Must be empty when `threadId` is provided. When empty, defaults to the loaded thread's cwd or the app-server default cwd.", "items": { "type": "string" }, @@ -14205,7 +14205,7 @@ "type": "boolean" }, "threadId": { - "description": "Optional loaded thread id used to evaluate skills from that thread's config.", + "description": "Optional loaded thread id used to evaluate skills from that thread's cwd and config. Cannot be combined with `cwds`.", "type": [ "string", "null" diff --git a/codex-rs/app-server-protocol/schema/json/v2/PluginListParams.json b/codex-rs/app-server-protocol/schema/json/v2/PluginListParams.json index f9b0280213..ff74d8f4d3 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/PluginListParams.json +++ b/codex-rs/app-server-protocol/schema/json/v2/PluginListParams.json @@ -18,7 +18,7 @@ }, "properties": { "cwds": { - "description": "Optional working directories used to discover repo marketplaces. When omitted, only home-scoped marketplaces and the official curated marketplace are considered.", + "description": "Optional working directories used to discover repo marketplaces. When omitted, only home-scoped marketplaces and the official curated marketplace are considered. Cannot be combined with `threadId`.", "items": { "$ref": "#/definitions/AbsolutePathBuf" }, @@ -38,7 +38,7 @@ ] }, "threadId": { - "description": "Optional loaded thread id used to evaluate plugins from that thread's config.", + "description": "Optional loaded thread id used to evaluate plugins from that thread's cwd and config. Cannot be combined with `cwds`.", "type": [ "string", "null" diff --git a/codex-rs/app-server-protocol/schema/json/v2/SkillsListParams.json b/codex-rs/app-server-protocol/schema/json/v2/SkillsListParams.json index 0729662636..72399284b3 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/SkillsListParams.json +++ b/codex-rs/app-server-protocol/schema/json/v2/SkillsListParams.json @@ -2,7 +2,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "properties": { "cwds": { - "description": "When empty, defaults to the current session working directory.", + "description": "Working directories used to list skills. Must be empty when `threadId` is provided. When empty, defaults to the loaded thread's cwd or the app-server default cwd.", "items": { "type": "string" }, @@ -13,7 +13,7 @@ "type": "boolean" }, "threadId": { - "description": "Optional loaded thread id used to evaluate skills from that thread's config.", + "description": "Optional loaded thread id used to evaluate skills from that thread's cwd and config. Cannot be combined with `cwds`.", "type": [ "string", "null" diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/PluginListParams.ts b/codex-rs/app-server-protocol/schema/typescript/v2/PluginListParams.ts index 9fe184122a..0d228f2fc8 100644 --- a/codex-rs/app-server-protocol/schema/typescript/v2/PluginListParams.ts +++ b/codex-rs/app-server-protocol/schema/typescript/v2/PluginListParams.ts @@ -7,11 +7,13 @@ import type { PluginListMarketplaceKind } from "./PluginListMarketplaceKind"; export type PluginListParams = { /** * Optional working directories used to discover repo marketplaces. When omitted, - * only home-scoped marketplaces and the official curated marketplace are considered. + * only home-scoped marketplaces and the official curated marketplace are considered. Cannot + * be combined with `threadId`. */ cwds?: Array | null, /** - * Optional loaded thread id used to evaluate plugins from that thread's config. + * Optional loaded thread id used to evaluate plugins from that thread's cwd and config. Cannot + * be combined with `cwds`. */ threadId?: string | null, /** diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/SkillsListParams.ts b/codex-rs/app-server-protocol/schema/typescript/v2/SkillsListParams.ts index 46b3e1f280..3fdade8ac8 100644 --- a/codex-rs/app-server-protocol/schema/typescript/v2/SkillsListParams.ts +++ b/codex-rs/app-server-protocol/schema/typescript/v2/SkillsListParams.ts @@ -4,11 +4,13 @@ export type SkillsListParams = { /** - * When empty, defaults to the current session working directory. + * Working directories used to list skills. Must be empty when `threadId` is provided. When + * empty, defaults to the loaded thread's cwd or the app-server default cwd. */ cwds?: Array, /** - * Optional loaded thread id used to evaluate skills from that thread's config. + * Optional loaded thread id used to evaluate skills from that thread's cwd and config. Cannot + * be combined with `cwds`. */ threadId?: 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.rs index 31fbfc1877..b9d07e8941 100644 --- a/codex-rs/app-server-protocol/src/protocol/v2/plugin.rs +++ b/codex-rs/app-server-protocol/src/protocol/v2/plugin.rs @@ -19,11 +19,13 @@ use ts_rs::TS; #[serde(rename_all = "camelCase")] #[ts(export_to = "v2/")] pub struct SkillsListParams { - /// When empty, defaults to the current session working directory. + /// Working directories used to list skills. Must be empty when `threadId` is provided. When + /// empty, defaults to the loaded thread's cwd or the app-server default cwd. #[serde(default, skip_serializing_if = "Vec::is_empty")] pub cwds: Vec, - /// Optional loaded thread id used to evaluate skills from that thread's config. + /// Optional loaded thread id used to evaluate skills from that thread's cwd and config. Cannot + /// be combined with `cwds`. #[ts(optional = nullable)] pub thread_id: Option, @@ -132,10 +134,12 @@ pub struct MarketplaceUpgradeErrorInfo { #[ts(export_to = "v2/")] pub struct PluginListParams { /// Optional working directories used to discover repo marketplaces. When omitted, - /// only home-scoped marketplaces and the official curated marketplace are considered. + /// only home-scoped marketplaces and the official curated marketplace are considered. Cannot + /// be combined with `threadId`. #[ts(optional = nullable)] pub cwds: Option>, - /// Optional loaded thread id used to evaluate plugins from that thread's config. + /// Optional loaded thread id used to evaluate plugins from that thread's cwd and config. Cannot + /// be combined with `cwds`. #[ts(optional = nullable)] pub thread_id: Option, /// Optional marketplace kind filter. When omitted, only local marketplaces are queried, plus diff --git a/codex-rs/app-server/README.md b/codex-rs/app-server/README.md index 99a9ee823b..ee7ca855db 100644 --- a/codex-rs/app-server/README.md +++ b/codex-rs/app-server/README.md @@ -206,13 +206,13 @@ Example with notification opt-out: - `experimentalFeature/enablement/set` — patch the in-memory process-wide runtime feature enablement for currently supported feature keys. For each feature, precedence is: cloud requirements > --enable > config.toml > experimentalFeature/enablement/set (new) > code default. Invalid keys will be ignored. - `environment/add` — experimental; add or replace a named remote environment by `environmentId` and `execServerUrl` for later selection by `thread/start` or `turn/start`; optional `connectTimeoutMs` overrides the WebSocket connection timeout; returns `{}` and does not change the default environment. - `collaborationMode/list` — list available collaboration mode presets (experimental, no pagination). Built-in presets do not select a model; the Plan preset selects medium reasoning effort. This response omits built-in developer instructions; clients should either pass `settings.developer_instructions: null` when setting a mode to use Codex's built-in instructions, or provide their own instructions explicitly. -- `skills/list` — list skills for one or more `cwd` values (optional `forceReload`). Pass `threadId` to evaluate skills from a loaded thread's refreshed config; when `cwds` is omitted, the server uses that thread's cwd. +- `skills/list` — list skills for one or more `cwd` values (optional `forceReload`). Pass `threadId` to evaluate skills from a loaded thread's refreshed config and cwd. `threadId` cannot be combined with `cwds`. - `skills/extraRoots/set` — replace the app-server process runtime extra standalone skill roots. The roots are not persisted; missing directories are accepted and simply load no skills. - `hooks/list` — list discovered hooks for one or more `cwd` values. - `marketplace/add` — add a remote plugin marketplace from an HTTP(S) Git URL, SSH Git URL, or GitHub `owner/repo` shorthand, then persist it into the user marketplace config. Returns the installed root path plus whether the marketplace was already present. - `marketplace/remove` — remove a configured marketplace by name from the user marketplace config, and delete its installed marketplace root when one exists. - `marketplace/upgrade` — upgrade all configured Git plugin marketplaces, or one named marketplace when `marketplaceName` is provided. Returns selected marketplace names, upgraded roots, and per-marketplace errors. -- `plugin/list` — list discovered plugin marketplaces and plugin state, including effective marketplace install/auth policy metadata, plugin `availability` (`AVAILABLE` by default or `DISABLED_BY_ADMIN` for remote plugins blocked upstream), fail-open `marketplaceLoadErrors` entries for marketplace files that could not be parsed or loaded, and best-effort `featuredPluginIds` for the official curated marketplace. Clients can explicitly request the remote `workspace-directory`, `shared-with-me`, or `created-by-me-remote` marketplace kinds. Pass `threadId` to evaluate plugins from a loaded thread's refreshed config; when `cwds` is omitted, the server uses that thread's cwd for repo marketplace discovery. `interface.category` uses the marketplace category when present; otherwise it falls back to the plugin manifest category (**under development; do not call from production clients yet**). +- `plugin/list` — list discovered plugin marketplaces and plugin state, including effective marketplace install/auth policy metadata, plugin `availability` (`AVAILABLE` by default or `DISABLED_BY_ADMIN` for remote plugins blocked upstream), fail-open `marketplaceLoadErrors` entries for marketplace files that could not be parsed or loaded, and best-effort `featuredPluginIds` for the official curated marketplace. Clients can explicitly request the remote `workspace-directory`, `shared-with-me`, or `created-by-me-remote` marketplace kinds. Pass `threadId` to evaluate plugins from a loaded thread's refreshed config and cwd for repo marketplace discovery. `threadId` cannot be combined with `cwds`. `interface.category` uses the marketplace category when present; otherwise it falls back to the plugin manifest category (**under development; do not call from production clients yet**). - `plugin/installed` — list installed plugin rows plus any explicitly requested local install-suggestion plugin names, without fetching the broader remote catalog. Mention surfaces can use this narrower view when they need plugin mention payloads rather than plugin-page discovery data (**under development; do not call from production clients yet**). - `plugin/read` — read one plugin by `marketplacePath` plus `pluginName`, returning marketplace info, a list-style `summary`, manifest descriptions/interface metadata, and bundled skills/hooks/apps/MCP server names. Remote plugin details expose the canonical `shareUrl` supplied by the remote catalog when available; it is `null` for local plugins or when the catalog omits it. This field is separate from `summary.shareContext`, which continues to describe user and workspace sharing state. Returned plugin skills include their current `enabled` state after local config filtering; bundled hooks are returned as lightweight declaration summaries keyed for correlation with `hooks/list`. Use `plugin/install`'s `appsNeedingAuth` to drive post-install authentication and `app/list`'s `isAccessible` to determine current connector accessibility (**under development; do not call from production clients yet**). - `plugin/skill/read` — read remote plugin skill markdown on demand by `remoteMarketplaceName`, `remotePluginId`, and `skillName`. This lets clients preview uninstalled remote plugin skills without downloading the plugin bundle. @@ -1632,9 +1632,9 @@ Example: $skill-creator Add a new skill for triaging flaky CI and include step-by-step usage. ``` -Use `skills/list` to fetch the available skills (optionally scoped by `cwds` or `threadId`, with `forceReload`). +Use `skills/list` to fetch the available skills (optionally scoped by either `cwds` or `threadId`, with `forceReload`). `skills/list` might reuse a cached skills result per `cwd`; setting `forceReload` to `true` refreshes the result from disk. -When `threadId` is provided and `cwds` is omitted, the server lists skills for that loaded thread's cwd and refreshed config. +When `threadId` is provided, the server lists skills for that loaded thread's cwd and refreshed config. Do not combine `threadId` with `cwds`. 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. diff --git a/codex-rs/app-server/src/request_processors/catalog_processor.rs b/codex-rs/app-server/src/request_processors/catalog_processor.rs index 5d155fb321..b6b6566973 100644 --- a/codex-rs/app-server/src/request_processors/catalog_processor.rs +++ b/codex-rs/app-server/src/request_processors/catalog_processor.rs @@ -504,6 +504,10 @@ impl CatalogRequestProcessor { thread_id, force_reload, } = params; + let thread_scoped = thread_id.is_some(); + if thread_scoped && !cwds.is_empty() { + return Err(invalid_request("`threadId` cannot be combined with `cwds`")); + } let config = match thread_id.as_deref() { Some(thread_id) => { let thread_id = ThreadId::from_string(thread_id) @@ -532,6 +536,9 @@ impl CatalogRequestProcessor { .workspace_codex_plugins_enabled(&config, auth.as_ref()) .await; let skills_service = self.thread_manager.skills_service(); + if thread_scoped && force_reload { + skills_service.clear_cache(); + } let plugins_manager = self.thread_manager.plugins_manager(); let fs = self .thread_manager @@ -545,21 +552,25 @@ impl CatalogRequestProcessor { let plugins_manager = &plugins_manager; let skills_service = &skills_service; async move { - let (cwd_abs, config_layer_stack) = match self.resolve_cwd_config(&cwd).await { - Ok(resolved) => resolved, - Err(message) => { - let error_path = cwd.clone(); - return ( - index, - codex_app_server_protocol::SkillsListEntry { - cwd, - skills: Vec::new(), - errors: vec![codex_app_server_protocol::SkillErrorInfo { - path: error_path, - message, - }], - }, - ); + let (cwd_abs, config_layer_stack) = if thread_scoped { + (config.cwd.clone(), config.config_layer_stack.clone()) + } else { + match self.resolve_cwd_config(&cwd).await { + Ok(resolved) => resolved, + Err(message) => { + let error_path = cwd.clone(); + return ( + index, + codex_app_server_protocol::SkillsListEntry { + cwd, + skills: Vec::new(), + errors: vec![codex_app_server_protocol::SkillErrorInfo { + path: error_path, + message, + }], + }, + ); + } } }; let effective_skill_roots = if workspace_codex_plugins_enabled { @@ -579,9 +590,13 @@ impl CatalogRequestProcessor { config_layer_stack, config.bundled_skills_enabled(), ); - let snapshot = skills_service - .snapshot_for_cwd(&skills_input, force_reload, fs) - .await; + let snapshot = if thread_scoped { + skills_service.snapshot_for_config(&skills_input, fs).await + } else { + skills_service + .snapshot_for_cwd(&skills_input, force_reload, fs) + .await + }; let outcome = snapshot.outcome(); let errors = errors_to_info(&outcome.errors); let skills = skills_to_info(&outcome.skills, &outcome.disabled_paths); diff --git a/codex-rs/app-server/src/request_processors/plugins.rs b/codex-rs/app-server/src/request_processors/plugins.rs index 117c2f0607..ebd5966f84 100644 --- a/codex-rs/app-server/src/request_processors/plugins.rs +++ b/codex-rs/app-server/src/request_processors/plugins.rs @@ -532,6 +532,9 @@ impl PluginRequestProcessor { thread_id, marketplace_kinds, } = params; + if thread_id.is_some() && cwds.is_some() { + return Err(invalid_request("`threadId` cannot be combined with `cwds`")); + } let explicit_marketplace_kinds = marketplace_kinds.is_some(); let marketplace_kinds = marketplace_kinds.unwrap_or_else(|| vec![PluginListMarketplaceKind::Local]); diff --git a/codex-rs/app-server/tests/suite/v2/skills_list.rs b/codex-rs/app-server/tests/suite/v2/skills_list.rs index 66f651d7fd..65e082840d 100644 --- a/codex-rs/app-server/tests/suite/v2/skills_list.rs +++ b/codex-rs/app-server/tests/suite/v2/skills_list.rs @@ -1,3 +1,4 @@ +use std::collections::HashMap; use std::time::Duration; use anyhow::Context; @@ -18,10 +19,12 @@ use codex_app_server_protocol::SkillsExtraRootsSetResponse; use codex_app_server_protocol::SkillsListParams; use codex_app_server_protocol::SkillsListResponse; use codex_app_server_protocol::ThreadStartParams; +use codex_app_server_protocol::ThreadStartResponse; use codex_config::types::AuthCredentialsStoreMode; use codex_exec_server::CODEX_EXEC_SERVER_URL_ENV_VAR; use codex_utils_absolute_path::AbsolutePathBuf; use pretty_assertions::assert_eq; +use serde_json::json; use tempfile::TempDir; use tokio::time::timeout; use wiremock::Mock; @@ -154,6 +157,83 @@ fn write_cached_remote_plugin_with_skill( Ok(skill_path) } +#[tokio::test] +async fn skills_list_with_thread_id_uses_thread_config() -> Result<()> { + let server = create_mock_responses_server_repeating_assistant("Done").await; + let codex_home = TempDir::new()?; + let cwd = TempDir::new()?; + write_mock_responses_config_toml_with_chatgpt_base_url( + codex_home.path(), + &server.uri(), + &server.uri(), + )?; + write_skill(&codex_home, "demo")?; + + let mut mcp = + TestAppServer::new_with_env(codex_home.path(), &[(CODEX_EXEC_SERVER_URL_ENV_VAR, None)]) + .await?; + timeout(DEFAULT_TIMEOUT, mcp.initialize()).await??; + + let warm_request_id = mcp + .send_skills_list_request(SkillsListParams { + cwds: vec![cwd.path().to_path_buf()], + thread_id: None, + force_reload: true, + }) + .await?; + let warm_response: JSONRPCResponse = timeout( + DEFAULT_TIMEOUT, + mcp.read_stream_until_response_message(RequestId::Integer(warm_request_id)), + ) + .await??; + let SkillsListResponse { data } = to_response(warm_response)?; + let demo = data[0] + .skills + .iter() + .find(|skill| skill.name == "demo") + .context("demo skill should be present")?; + assert!(demo.enabled); + + let thread_start_request_id = mcp + .send_thread_start_request(ThreadStartParams { + cwd: Some(cwd.path().display().to_string()), + config: Some(HashMap::from([( + "skills.config".to_string(), + json!([{"name": "demo", "enabled": false}]), + )])), + ..Default::default() + }) + .await?; + let thread_start_response: JSONRPCResponse = timeout( + DEFAULT_TIMEOUT, + mcp.read_stream_until_response_message(RequestId::Integer(thread_start_request_id)), + ) + .await??; + let ThreadStartResponse { thread, .. } = to_response(thread_start_response)?; + + let request_id = mcp + .send_skills_list_request(SkillsListParams { + cwds: Vec::new(), + thread_id: Some(thread.id), + force_reload: false, + }) + .await?; + let response: JSONRPCResponse = timeout( + DEFAULT_TIMEOUT, + mcp.read_stream_until_response_message(RequestId::Integer(request_id)), + ) + .await??; + let SkillsListResponse { data } = to_response(response)?; + let demo = data[0] + .skills + .iter() + .find(|skill| skill.name == "demo") + .context("demo skill should be present")?; + assert!(!demo.enabled); + + Ok(()) +} + #[tokio::test] async fn skills_list_loads_remote_installed_plugin_skills_from_cache() -> Result<()> { let codex_home = TempDir::new()?; diff --git a/codex-rs/tui/src/app/background_requests.rs b/codex-rs/tui/src/app/background_requests.rs index bb05e1a3f4..322113fdbc 100644 --- a/codex-rs/tui/src/app/background_requests.rs +++ b/codex-rs/tui/src/app/background_requests.rs @@ -824,6 +824,7 @@ pub(super) async fn fetch_skills_list( request_id, params: SkillsListParams { cwds: vec![cwd], + thread_id: None, force_reload: true, }, }) @@ -1009,6 +1010,7 @@ async fn request_plugin_list_with_marketplace_kinds( request_id, params: PluginListParams { cwds: Some(vec![cwd]), + thread_id: None, marketplace_kinds, }, }) diff --git a/codex-rs/tui/src/app/thread_routing.rs b/codex-rs/tui/src/app/thread_routing.rs index 76cf56ef06..40771162ee 100644 --- a/codex-rs/tui/src/app/thread_routing.rs +++ b/codex-rs/tui/src/app/thread_routing.rs @@ -669,6 +669,7 @@ impl App { app_server .skills_list(codex_app_server_protocol::SkillsListParams { cwds: cwds.clone(), + thread_id: None, force_reload: *force_reload, }) .await,