codex: address PR review feedback (#28582)

This commit is contained in:
Steven Lee
2026-06-23 07:28:54 +00:00
parent 7db1786573
commit e750db2ccb
16 changed files with 199 additions and 13 deletions
+4
View File
@@ -16,6 +16,7 @@ use anyhow::Context;
use codex_login::CodexAuth;
use codex_protocol::mcp::McpServerInfo;
use codex_utils_plugins::mcp_connector::sanitize_name;
use codex_utils_plugins::plugin_service_routing::plugin_service_preview_enabled;
use serde::Deserialize;
use serde::Serialize;
use sha1::Digest;
@@ -26,6 +27,8 @@ pub struct CodexAppsToolsCacheKey {
pub(crate) account_id: Option<String>,
pub(crate) chatgpt_user_id: Option<String>,
pub(crate) is_workspace_account: bool,
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub(crate) plugin_service_preview: bool,
}
pub fn codex_apps_tools_cache_key(auth: Option<&CodexAuth>) -> CodexAppsToolsCacheKey {
@@ -33,6 +36,7 @@ pub fn codex_apps_tools_cache_key(auth: Option<&CodexAuth>) -> CodexAppsToolsCac
account_id: auth.and_then(CodexAuth::get_account_id),
chatgpt_user_id: auth.and_then(CodexAuth::get_chatgpt_user_id),
is_workspace_account: auth.is_some_and(CodexAuth::is_workspace_account),
plugin_service_preview: plugin_service_preview_enabled(),
}
}
@@ -86,6 +86,7 @@ fn create_codex_apps_tools_cache_context(
account_id: account_id.map(ToOwned::to_owned),
chatgpt_user_id: chatgpt_user_id.map(ToOwned::to_owned),
is_workspace_account: false,
plugin_service_preview: false,
},
}
}
@@ -611,6 +612,24 @@ fn codex_apps_tools_cache_is_scoped_per_user() {
);
}
#[test]
fn codex_apps_tools_cache_is_scoped_by_plugin_service_preview() {
let codex_home = tempdir().expect("tempdir");
let regular = create_codex_apps_tools_cache_context(
codex_home.path().to_path_buf(),
Some("account-one"),
Some("user-one"),
);
let mut preview = regular.clone();
preview.user_key.plugin_service_preview = true;
assert_ne!(regular.tools_cache_path(), preview.tools_cache_path());
assert_ne!(
regular.server_info_cache_path(),
preview.server_info_cache_path()
);
}
#[test]
fn codex_apps_tools_cache_preserves_formerly_disallowed_connectors() {
let codex_home = tempdir().expect("tempdir");
@@ -1263,6 +1282,7 @@ async fn no_local_runtime_fails_local_stdio_but_keeps_local_http_server() {
account_id: None,
chatgpt_user_id: None,
is_workspace_account: false,
plugin_service_preview: false,
},
/*prefix_mcp_tool_names*/ true,
ElicitationCapability::default(),