aKode fase 2b-2: rimosso login ChatGPT e tutti i sottosistemi solo-ChatGPT
- Login: resta solo chiave API (+ header, Bedrock). Rimossi OAuth/browser, device code, refresh/revoke su auth.openai.com, PAT, agent/workload identity, runtime agent instance, backend-client e openapi-models, workspace routing. - Rimossi: generazione immagini (ext + skill imagegen), history notes, plugin remoti (catalogo, sync, share), cyber access program, daybreak, cloud config e requirements (config_server ora fail-closed), attestation, frozen cloud skills, EMA MCP auth, Codex Apps/connettori, ricerca ospitata, header/zstd/ routing/cookie del backend Codex, fallback OPENAI_API_KEY del realtime. - Messaggi d'errore senza link a chatgpt.com. - Chiavi di config legacy accettate e ignorate; feature rimosse = Stage::Removed. - Test: cancellati solo quelli del codice rimosso; test di sicurezza (sandbox estensioni, permessi, redazione, auth storage, requirements) adattati. Restano solo fallimenti d'ambiente (code-mode-host/V8, ~/.agents). - Istruzioni di sistema invariate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -37,22 +37,20 @@ use codex_tools::ToolOutput;
|
||||
use codex_tools::ToolPayload;
|
||||
use codex_tools::ToolSpec;
|
||||
use codex_utils_path_uri::LegacyAppPathString;
|
||||
use core_test_support::apps_test_server::AppsTestServer;
|
||||
use core_test_support::apps_test_server::AppsTestToolLoading;
|
||||
use core_test_support::apps_test_server::CALENDAR_CREATE_EVENT_MCP_APP_RESOURCE_URI;
|
||||
use core_test_support::apps_test_server::CALENDAR_CREATE_EVENT_RESOURCE_URI;
|
||||
use core_test_support::apps_test_server::DIRECT_CALENDAR_CREATE_EVENT_TOOL as CALENDAR_CREATE_TOOL;
|
||||
use core_test_support::apps_test_server::DIRECT_CALENDAR_LIST_EVENTS_TOOL as CALENDAR_LIST_TOOL;
|
||||
use core_test_support::apps_test_server::LINK_ID;
|
||||
use core_test_support::apps_test_server::SEARCH_CALENDAR_APP_ONLY_TOOL;
|
||||
use core_test_support::apps_test_server::SEARCH_CALENDAR_CREATE_TOOL;
|
||||
use core_test_support::apps_test_server::SEARCH_CALENDAR_LIST_TOOL;
|
||||
use core_test_support::apps_test_server::SEARCH_CALENDAR_NAMESPACE;
|
||||
use core_test_support::apps_test_server::configure_search_capable_apps;
|
||||
use core_test_support::apps_test_server::configure_search_capable_model;
|
||||
use core_test_support::apps_test_server::recorded_apps_tool_call_by_call_id;
|
||||
use core_test_support::apps_test_server::recorded_apps_tool_calls;
|
||||
use core_test_support::apps_test_server::search_capable_apps_builder as configured_builder;
|
||||
use core_test_support::mcp_test_server::McpTestServer;
|
||||
use core_test_support::mcp_test_server::McpTestToolLoading;
|
||||
use core_test_support::mcp_test_server::CALENDAR_CREATE_EVENT_MCP_APP_RESOURCE_URI;
|
||||
use core_test_support::mcp_test_server::DIRECT_CALENDAR_CREATE_EVENT_TOOL as CALENDAR_CREATE_TOOL;
|
||||
use core_test_support::mcp_test_server::DIRECT_CALENDAR_LIST_EVENTS_TOOL as CALENDAR_LIST_TOOL;
|
||||
use core_test_support::mcp_test_server::CALENDAR_APP_ONLY_TOOL_NAME;
|
||||
use core_test_support::mcp_test_server::CALENDAR_CREATE_EVENT_TOOL_NAME;
|
||||
use core_test_support::mcp_test_server::CALENDAR_LIST_EVENTS_TOOL_NAME;
|
||||
use core_test_support::mcp_test_server::CALENDAR_NAMESPACE;
|
||||
use core_test_support::mcp_test_server::configure_search_capable_mcp_test_server;
|
||||
use core_test_support::mcp_test_server::configure_search_capable_model;
|
||||
use core_test_support::mcp_test_server::recorded_mcp_tool_call_by_call_id;
|
||||
use core_test_support::mcp_test_server::recorded_mcp_tool_calls;
|
||||
use core_test_support::mcp_test_server::search_capable_mcp_server_builder as configured_builder;
|
||||
use core_test_support::responses::ResponsesRequest;
|
||||
use core_test_support::responses::ev_assistant_message;
|
||||
use core_test_support::responses::ev_completed;
|
||||
@@ -70,6 +68,7 @@ use core_test_support::skip_if_wine_exec;
|
||||
use core_test_support::test_codex::test_codex;
|
||||
use core_test_support::wait_for_event;
|
||||
use core_test_support::wait_for_mcp_server;
|
||||
use core_test_support::mcp_test_server::MCP_TEST_SERVER_NAME;
|
||||
use pretty_assertions::assert_eq;
|
||||
use serde_json::Value;
|
||||
use serde_json::json;
|
||||
@@ -82,7 +81,7 @@ use super::rmcp_client::remote_aware_stdio_server_bin;
|
||||
|
||||
const SEARCH_TOOL_DESCRIPTION_SNIPPETS: [&str; 2] = [
|
||||
"You have access to tools from the following sources",
|
||||
"- Calendar: Plan events and manage your calendar.",
|
||||
"- calendar\n",
|
||||
];
|
||||
const TOOL_SEARCH_TOOL_NAME: &str = "tool_search";
|
||||
|
||||
@@ -148,7 +147,7 @@ async fn search_tool_enabled_by_default_adds_tool_search() -> Result<()> {
|
||||
skip_if_no_network!(Ok(()));
|
||||
|
||||
let server = start_mock_server().await;
|
||||
let apps_server = AppsTestServer::mount_searchable(&server).await?;
|
||||
let apps_server = McpTestServer::mount_searchable(&server).await?;
|
||||
let mock = mount_sse_once(
|
||||
&server,
|
||||
sse(vec![
|
||||
@@ -159,7 +158,7 @@ async fn search_tool_enabled_by_default_adds_tool_search() -> Result<()> {
|
||||
)
|
||||
.await;
|
||||
|
||||
let mut builder = configured_builder(apps_server.chatgpt_base_url.clone());
|
||||
let mut builder = configured_builder(apps_server.base_url.clone());
|
||||
let test = builder.build_with_auto_env(&server).await?;
|
||||
|
||||
test.submit_turn_with_approval_and_permission_profile(
|
||||
@@ -206,7 +205,7 @@ async fn small_app_tool_sets_are_deferred_by_default() -> Result<()> {
|
||||
skip_if_no_network!(Ok(()));
|
||||
|
||||
let server = start_mock_server().await;
|
||||
let apps_server = AppsTestServer::mount(&server).await?;
|
||||
let apps_server = McpTestServer::mount(&server).await?;
|
||||
let mock = mount_sse_once(
|
||||
&server,
|
||||
sse(vec![
|
||||
@@ -217,7 +216,7 @@ async fn small_app_tool_sets_are_deferred_by_default() -> Result<()> {
|
||||
)
|
||||
.await;
|
||||
|
||||
let mut builder = configured_builder(apps_server.chatgpt_base_url.clone());
|
||||
let mut builder = configured_builder(apps_server.base_url.clone());
|
||||
let test = builder.build_with_auto_env(&server).await?;
|
||||
|
||||
test.submit_turn_with_approval_and_permission_profile(
|
||||
@@ -247,7 +246,7 @@ async fn app_only_tools_are_not_visible_or_runnable_by_direct_model_calls() -> R
|
||||
|
||||
let server = start_mock_server().await;
|
||||
let apps_server =
|
||||
AppsTestServer::mount_with_app_only_tool(&server, AppsTestToolLoading::Direct).await?;
|
||||
McpTestServer::mount_with_app_only_tool(&server, McpTestToolLoading::Direct).await?;
|
||||
let search_call_id = "app-only-search";
|
||||
let call_id = "app-only-direct-call";
|
||||
let mock = mount_sse_sequence(
|
||||
@@ -268,8 +267,8 @@ async fn app_only_tools_are_not_visible_or_runnable_by_direct_model_calls() -> R
|
||||
ev_response_created("resp-2"),
|
||||
ev_function_call_with_namespace(
|
||||
call_id,
|
||||
SEARCH_CALENDAR_NAMESPACE,
|
||||
SEARCH_CALENDAR_APP_ONLY_TOOL,
|
||||
CALENDAR_NAMESPACE,
|
||||
CALENDAR_APP_ONLY_TOOL_NAME,
|
||||
"{}",
|
||||
),
|
||||
ev_completed("resp-2"),
|
||||
@@ -283,7 +282,7 @@ async fn app_only_tools_are_not_visible_or_runnable_by_direct_model_calls() -> R
|
||||
)
|
||||
.await;
|
||||
|
||||
let mut builder = configured_builder(apps_server.chatgpt_base_url.clone());
|
||||
let mut builder = configured_builder(apps_server.base_url.clone());
|
||||
let test = builder.build_with_auto_env(&server).await?;
|
||||
test.submit_turn_with_approval_and_permission_profile(
|
||||
"Try to call the app-only calendar tool.",
|
||||
@@ -297,8 +296,8 @@ async fn app_only_tools_are_not_visible_or_runnable_by_direct_model_calls() -> R
|
||||
tool_search_output_has_namespace_child(
|
||||
&requests[1],
|
||||
search_call_id,
|
||||
SEARCH_CALENDAR_NAMESPACE,
|
||||
SEARCH_CALENDAR_CREATE_TOOL
|
||||
CALENDAR_NAMESPACE,
|
||||
CALENDAR_CREATE_EVENT_TOOL_NAME
|
||||
),
|
||||
"visible tool from the app-only tool's connector should be searchable"
|
||||
);
|
||||
@@ -306,8 +305,8 @@ async fn app_only_tools_are_not_visible_or_runnable_by_direct_model_calls() -> R
|
||||
!tool_search_output_has_namespace_child(
|
||||
&requests[1],
|
||||
search_call_id,
|
||||
SEARCH_CALENDAR_NAMESPACE,
|
||||
SEARCH_CALENDAR_APP_ONLY_TOOL
|
||||
CALENDAR_NAMESPACE,
|
||||
CALENDAR_APP_ONLY_TOOL_NAME
|
||||
),
|
||||
"app-only tool should not be returned to the model by tool_search"
|
||||
);
|
||||
@@ -320,7 +319,7 @@ async fn app_only_tools_are_not_visible_or_runnable_by_direct_model_calls() -> R
|
||||
"forced app-only direct call should not dispatch"
|
||||
);
|
||||
assert!(
|
||||
recorded_apps_tool_calls(&server).await.is_empty(),
|
||||
recorded_mcp_tool_calls(&server).await.is_empty(),
|
||||
"forced app-only direct call should not reach the MCP server"
|
||||
);
|
||||
|
||||
@@ -332,7 +331,7 @@ async fn app_search_sources_are_hidden_for_api_key_auth() -> Result<()> {
|
||||
skip_if_no_network!(Ok(()));
|
||||
|
||||
let server = start_mock_server().await;
|
||||
let apps_server = AppsTestServer::mount(&server).await?;
|
||||
let apps_server = McpTestServer::mount(&server).await?;
|
||||
let mock = mount_sse_once(
|
||||
&server,
|
||||
sse(vec![
|
||||
@@ -346,7 +345,7 @@ async fn app_search_sources_are_hidden_for_api_key_auth() -> Result<()> {
|
||||
let mut builder = test_codex()
|
||||
.with_auth(CodexAuth::from_api_key("Test API Key"))
|
||||
.with_config(move |config| {
|
||||
configure_search_capable_apps(config, apps_server.chatgpt_base_url.as_str())
|
||||
configure_search_capable_mcp_test_server(config, apps_server.base_url.as_str())
|
||||
});
|
||||
let test = builder.build_with_auto_env(&server).await?;
|
||||
|
||||
@@ -360,7 +359,7 @@ async fn app_search_sources_are_hidden_for_api_key_auth() -> Result<()> {
|
||||
let body = mock.single_request().body_json();
|
||||
let tools = tool_names(&body);
|
||||
assert!(
|
||||
!tools.iter().any(|name| name == SEARCH_CALENDAR_NAMESPACE),
|
||||
!tools.iter().any(|name| name == CALENDAR_NAMESPACE),
|
||||
"tools list should not include app tools for API key auth: {tools:?}"
|
||||
);
|
||||
let description = tool_search_description(&body).unwrap_or_default();
|
||||
@@ -377,7 +376,7 @@ async fn search_tool_adds_discovery_instructions_when_world_state_is_disabled()
|
||||
skip_if_no_network!(Ok(()));
|
||||
|
||||
let server = start_mock_server().await;
|
||||
let apps_server = AppsTestServer::mount_searchable(&server).await?;
|
||||
let apps_server = McpTestServer::mount_searchable(&server).await?;
|
||||
let mock = mount_sse_once(
|
||||
&server,
|
||||
sse(vec![
|
||||
@@ -389,7 +388,7 @@ async fn search_tool_adds_discovery_instructions_when_world_state_is_disabled()
|
||||
.await;
|
||||
|
||||
let mut builder =
|
||||
configured_builder(apps_server.chatgpt_base_url.clone()).with_config(|config| {
|
||||
configured_builder(apps_server.base_url.clone()).with_config(|config| {
|
||||
config
|
||||
.features
|
||||
.disable(Feature::DeferredToolWorldState)
|
||||
@@ -433,7 +432,7 @@ async fn search_tool_omits_sources_with_deferred_tool_world_state_by_default() -
|
||||
skip_if_no_network!(Ok(()));
|
||||
|
||||
let server = start_mock_server().await;
|
||||
let apps_server = AppsTestServer::mount_searchable(&server).await?;
|
||||
let apps_server = McpTestServer::mount_searchable(&server).await?;
|
||||
let mock = mount_sse_once(
|
||||
&server,
|
||||
sse(vec![
|
||||
@@ -444,7 +443,7 @@ async fn search_tool_omits_sources_with_deferred_tool_world_state_by_default() -
|
||||
)
|
||||
.await;
|
||||
|
||||
let mut builder = configured_builder(apps_server.chatgpt_base_url.clone());
|
||||
let mut builder = configured_builder(apps_server.base_url.clone());
|
||||
let test = builder.build_with_auto_env(&server).await?;
|
||||
test.submit_turn_with_approval_and_permission_profile(
|
||||
"list tools",
|
||||
@@ -466,7 +465,7 @@ async fn search_tool_omits_sources_with_deferred_tool_world_state_by_default() -
|
||||
request
|
||||
.message_input_texts("developer")
|
||||
.into_iter()
|
||||
.any(|text| text.contains(SEARCH_CALENDAR_NAMESPACE)),
|
||||
.any(|text| text.contains(CALENDAR_NAMESPACE)),
|
||||
"world state should advertise the deferred Calendar namespace"
|
||||
);
|
||||
|
||||
@@ -478,7 +477,7 @@ async fn search_tool_hides_apps_tools_without_search() -> Result<()> {
|
||||
skip_if_no_network!(Ok(()));
|
||||
|
||||
let server = start_mock_server().await;
|
||||
let apps_server = AppsTestServer::mount_searchable(&server).await?;
|
||||
let apps_server = McpTestServer::mount_searchable(&server).await?;
|
||||
let mock = mount_sse_once(
|
||||
&server,
|
||||
sse(vec![
|
||||
@@ -489,7 +488,7 @@ async fn search_tool_hides_apps_tools_without_search() -> Result<()> {
|
||||
)
|
||||
.await;
|
||||
|
||||
let mut builder = configured_builder(apps_server.chatgpt_base_url.clone());
|
||||
let mut builder = configured_builder(apps_server.base_url.clone());
|
||||
let test = builder.build_with_auto_env(&server).await?;
|
||||
|
||||
test.submit_turn_with_approval_and_permission_profile(
|
||||
@@ -504,7 +503,7 @@ async fn search_tool_hides_apps_tools_without_search() -> Result<()> {
|
||||
assert!(tools.iter().any(|name| name == TOOL_SEARCH_TOOL_NAME));
|
||||
assert!(!tools.iter().any(|name| name == CALENDAR_CREATE_TOOL));
|
||||
assert!(!tools.iter().any(|name| name == CALENDAR_LIST_TOOL));
|
||||
assert!(!tools.iter().any(|name| name == SEARCH_CALENDAR_NAMESPACE));
|
||||
assert!(!tools.iter().any(|name| name == CALENDAR_NAMESPACE));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -514,7 +513,7 @@ async fn explicit_app_mentions_leave_app_tools_deferred() -> Result<()> {
|
||||
skip_if_no_network!(Ok(()));
|
||||
|
||||
let server = start_mock_server().await;
|
||||
let apps_server = AppsTestServer::mount(&server).await?;
|
||||
let apps_server = McpTestServer::mount(&server).await?;
|
||||
let mock = mount_sse_once(
|
||||
&server,
|
||||
sse(vec![
|
||||
@@ -525,7 +524,7 @@ async fn explicit_app_mentions_leave_app_tools_deferred() -> Result<()> {
|
||||
)
|
||||
.await;
|
||||
|
||||
let mut builder = configured_builder(apps_server.chatgpt_base_url.clone());
|
||||
let mut builder = configured_builder(apps_server.base_url.clone());
|
||||
let test = builder.build_with_auto_env(&server).await?;
|
||||
|
||||
test.submit_turn_with_approval_and_permission_profile(
|
||||
@@ -544,14 +543,14 @@ async fn explicit_app_mentions_leave_app_tools_deferred() -> Result<()> {
|
||||
assert!(
|
||||
namespace_child_tool(
|
||||
&body,
|
||||
SEARCH_CALENDAR_NAMESPACE,
|
||||
SEARCH_CALENDAR_CREATE_TOOL
|
||||
CALENDAR_NAMESPACE,
|
||||
CALENDAR_CREATE_EVENT_TOOL_NAME
|
||||
)
|
||||
.is_none(),
|
||||
"explicit app mentions should not directly expose create tool, got tools: {tools:?}"
|
||||
);
|
||||
assert!(
|
||||
namespace_child_tool(&body, SEARCH_CALENDAR_NAMESPACE, SEARCH_CALENDAR_LIST_TOOL).is_none(),
|
||||
namespace_child_tool(&body, CALENDAR_NAMESPACE, CALENDAR_LIST_EVENTS_TOOL_NAME).is_none(),
|
||||
"explicit app mentions should not directly expose list tool, got tools: {tools:?}"
|
||||
);
|
||||
|
||||
@@ -563,7 +562,7 @@ async fn tool_search_returns_deferred_tools_without_follow_up_tool_injection() -
|
||||
skip_if_no_network!(Ok(()));
|
||||
|
||||
let server = start_mock_server().await;
|
||||
let apps_server = AppsTestServer::mount_searchable(&server).await?;
|
||||
let apps_server = McpTestServer::mount_searchable(&server).await?;
|
||||
let call_id = "tool-search-1";
|
||||
let mock = mount_sse_sequence(
|
||||
&server,
|
||||
@@ -586,8 +585,8 @@ async fn tool_search_returns_deferred_tools_without_follow_up_tool_injection() -
|
||||
"item": {
|
||||
"type": "function_call",
|
||||
"call_id": "calendar-call-1",
|
||||
"name": SEARCH_CALENDAR_CREATE_TOOL,
|
||||
"namespace": SEARCH_CALENDAR_NAMESPACE,
|
||||
"name": CALENDAR_CREATE_EVENT_TOOL_NAME,
|
||||
"namespace": CALENDAR_NAMESPACE,
|
||||
"arguments": serde_json::to_string(&json!({
|
||||
"title": "Lunch",
|
||||
"starts_at": "2026-03-10T12:00:00Z"
|
||||
@@ -605,7 +604,7 @@ async fn tool_search_returns_deferred_tools_without_follow_up_tool_injection() -
|
||||
)
|
||||
.await;
|
||||
|
||||
let mut builder = configured_builder(apps_server.chatgpt_base_url.clone());
|
||||
let mut builder = configured_builder(apps_server.base_url.clone());
|
||||
let test = builder.build_with_auto_env(&server).await?;
|
||||
test.codex
|
||||
.start_or_steer_turn(TurnInputRequest::user_input(vec![UserInput::Text {
|
||||
@@ -622,8 +621,6 @@ async fn tool_search_returns_deferred_tools_without_follow_up_tool_injection() -
|
||||
unreachable!("event guard guarantees McpToolCallBegin");
|
||||
};
|
||||
assert_eq!(begin.call_id, "calendar-call-1");
|
||||
assert_eq!(begin.app_name.as_deref(), Some("Calendar"));
|
||||
assert_eq!(begin.action_name.as_deref(), Some("calendar_create_event"));
|
||||
assert_eq!(
|
||||
begin.mcp_app_resource_uri.as_deref(),
|
||||
Some(CALENDAR_CREATE_EVENT_MCP_APP_RESOURCE_URI)
|
||||
@@ -637,18 +634,14 @@ async fn tool_search_returns_deferred_tools_without_follow_up_tool_injection() -
|
||||
unreachable!("event guard guarantees McpToolCallEnd");
|
||||
};
|
||||
assert_eq!(end.call_id, "calendar-call-1");
|
||||
assert_eq!(end.connector_id.as_deref(), Some("calendar"));
|
||||
assert_eq!(end.app_name.as_deref(), Some("Calendar"));
|
||||
assert_eq!(end.action_name.as_deref(), Some("calendar_create_event"));
|
||||
assert_eq!(
|
||||
end.mcp_app_resource_uri.as_deref(),
|
||||
Some(CALENDAR_CREATE_EVENT_MCP_APP_RESOURCE_URI)
|
||||
);
|
||||
assert_eq!(end.link_id.as_deref(), Some(LINK_ID));
|
||||
assert_eq!(
|
||||
end.invocation,
|
||||
McpInvocation {
|
||||
server: "codex_apps".to_string(),
|
||||
server: MCP_TEST_SERVER_NAME.to_string(),
|
||||
tool: "calendar_create_event".to_string(),
|
||||
arguments: Some(json!({
|
||||
"title": "Lunch",
|
||||
@@ -661,15 +654,7 @@ async fn tool_search_returns_deferred_tools_without_follow_up_tool_injection() -
|
||||
.as_ref()
|
||||
.expect("tool call should succeed")
|
||||
.structured_content,
|
||||
Some(json!({
|
||||
"_codex_apps": {
|
||||
"call_id": "calendar-call-1",
|
||||
"root_turn_id": mock.requests()[0].body_json()["client_metadata"]["turn_id"],
|
||||
"resource_uri": CALENDAR_CREATE_EVENT_RESOURCE_URI,
|
||||
"contains_mcp_source": true,
|
||||
"connector_id": "calendar",
|
||||
},
|
||||
}))
|
||||
Some(json!({"called": "calendar_create_event"}))
|
||||
);
|
||||
|
||||
wait_for_event(&test.codex, |event| {
|
||||
@@ -681,17 +666,11 @@ async fn tool_search_returns_deferred_tools_without_follow_up_tool_injection() -
|
||||
assert_eq!(requests.len(), 3);
|
||||
let first_request_body = requests[0].body_json();
|
||||
|
||||
let apps_tool_call = recorded_apps_tool_call_by_call_id(&server, "calendar-call-1").await;
|
||||
let apps_tool_call = recorded_mcp_tool_call_by_call_id(&server, "calendar-call-1").await;
|
||||
|
||||
assert_eq!(
|
||||
apps_tool_call.pointer("/params/_meta/_codex_apps"),
|
||||
Some(&json!({
|
||||
"call_id": "calendar-call-1",
|
||||
"root_turn_id": first_request_body["client_metadata"]["turn_id"],
|
||||
"resource_uri": CALENDAR_CREATE_EVENT_RESOURCE_URI,
|
||||
"contains_mcp_source": true,
|
||||
"connector_id": "calendar",
|
||||
}))
|
||||
apps_tool_call.pointer("/params/_meta/callId"),
|
||||
Some(&json!("calendar-call-1"))
|
||||
);
|
||||
assert_eq!(
|
||||
apps_tool_call.pointer("/params/_meta/x-codex-turn-metadata/session_id"),
|
||||
@@ -762,7 +741,7 @@ async fn tool_search_returns_deferred_tools_without_follow_up_tool_injection() -
|
||||
assert!(
|
||||
!first_request_tools
|
||||
.iter()
|
||||
.any(|name| name == SEARCH_CALENDAR_NAMESPACE),
|
||||
.any(|name| name == CALENDAR_NAMESPACE),
|
||||
"app namespace should still be hidden before search: {first_request_tools:?}"
|
||||
);
|
||||
|
||||
@@ -781,12 +760,12 @@ async fn tool_search_returns_deferred_tools_without_follow_up_tool_injection() -
|
||||
tools,
|
||||
vec![json!({
|
||||
"type": "namespace",
|
||||
"name": SEARCH_CALENDAR_NAMESPACE,
|
||||
"description": "Plan events and manage your calendar.",
|
||||
"name": CALENDAR_NAMESPACE,
|
||||
"description": "Tools in the mcp__calendar namespace.",
|
||||
"tools": [
|
||||
{
|
||||
"type": "function",
|
||||
"name": SEARCH_CALENDAR_CREATE_TOOL,
|
||||
"name": CALENDAR_CREATE_EVENT_TOOL_NAME,
|
||||
"description": "Create a calendar event.",
|
||||
"strict": false,
|
||||
"defer_loading": true,
|
||||
@@ -815,7 +794,7 @@ async fn tool_search_returns_deferred_tools_without_follow_up_tool_injection() -
|
||||
assert!(
|
||||
!second_request_tools
|
||||
.iter()
|
||||
.any(|name| name == SEARCH_CALENDAR_NAMESPACE),
|
||||
.any(|name| name == CALENDAR_NAMESPACE),
|
||||
"follow-up request should rely on tool_search_output history, not namespace injection: {second_request_tools:?}"
|
||||
);
|
||||
|
||||
@@ -835,7 +814,7 @@ async fn tool_search_returns_deferred_tools_without_follow_up_tool_injection() -
|
||||
assert!(
|
||||
!third_request_tools
|
||||
.iter()
|
||||
.any(|name| name == SEARCH_CALENDAR_NAMESPACE),
|
||||
.any(|name| name == CALENDAR_NAMESPACE),
|
||||
"post-tool follow-up should still rely on tool_search_output history, not namespace injection: {third_request_tools:?}"
|
||||
);
|
||||
|
||||
@@ -1284,7 +1263,7 @@ async fn tool_search_indexes_only_enabled_non_app_mcp_tools() -> Result<()> {
|
||||
skip_if_no_network!(Ok(()));
|
||||
|
||||
let server = start_mock_server().await;
|
||||
let apps_server = AppsTestServer::mount_searchable(&server).await?;
|
||||
let apps_server = McpTestServer::mount_searchable(&server).await?;
|
||||
let echo_call_id = "tool-search-echo";
|
||||
let image_call_id = "tool-search-image";
|
||||
let mock = mount_sse_sequence(
|
||||
@@ -1320,7 +1299,7 @@ async fn tool_search_indexes_only_enabled_non_app_mcp_tools() -> Result<()> {
|
||||
let rmcp_test_server_bin = remote_aware_stdio_server_bin()?;
|
||||
let environment_id = remote_aware_environment_id();
|
||||
let mut builder =
|
||||
configured_builder(apps_server.chatgpt_base_url.clone()).with_config(move |config| {
|
||||
configured_builder(apps_server.base_url.clone()).with_config(move |config| {
|
||||
let mut servers = config.mcp_servers.get().clone();
|
||||
servers.insert(
|
||||
"rmcp".to_string(),
|
||||
@@ -1421,7 +1400,7 @@ async fn tool_search_surfaced_mcp_tool_errors_are_returned_to_model() -> Result<
|
||||
skip_if_no_network!(Ok(()));
|
||||
|
||||
let server = start_mock_server().await;
|
||||
let apps_server = AppsTestServer::mount_searchable(&server).await?;
|
||||
let apps_server = McpTestServer::mount_searchable(&server).await?;
|
||||
let search_call_id = "tool-search-rmcp-echo";
|
||||
let tool_call_id = "rmcp-echo-error";
|
||||
let mock = mount_sse_sequence(
|
||||
@@ -1455,7 +1434,7 @@ async fn tool_search_surfaced_mcp_tool_errors_are_returned_to_model() -> Result<
|
||||
let rmcp_test_server_bin = remote_aware_stdio_server_bin()?;
|
||||
let environment_id = remote_aware_environment_id();
|
||||
let mut builder =
|
||||
configured_builder(apps_server.chatgpt_base_url.clone()).with_config(move |config| {
|
||||
configured_builder(apps_server.base_url.clone()).with_config(move |config| {
|
||||
let mut servers = config.mcp_servers.get().clone();
|
||||
servers.insert(
|
||||
"rmcp".to_string(),
|
||||
@@ -1578,7 +1557,7 @@ async fn tool_search_uses_non_app_mcp_server_instructions_as_namespace_descripti
|
||||
skip_if_no_network!(Ok(()));
|
||||
|
||||
let server = start_mock_server().await;
|
||||
let apps_server = AppsTestServer::mount_searchable(&server).await?;
|
||||
let apps_server = McpTestServer::mount_searchable(&server).await?;
|
||||
let search_call_id = "tool-search-echo";
|
||||
let mock = mount_sse_sequence(
|
||||
&server,
|
||||
@@ -1606,7 +1585,7 @@ async fn tool_search_uses_non_app_mcp_server_instructions_as_namespace_descripti
|
||||
let rmcp_test_server_bin = remote_aware_stdio_server_bin()?;
|
||||
let environment_id = remote_aware_environment_id();
|
||||
let mut builder =
|
||||
configured_builder(apps_server.chatgpt_base_url.clone()).with_config(move |config| {
|
||||
configured_builder(apps_server.base_url.clone()).with_config(move |config| {
|
||||
let mut servers = config.mcp_servers.get().clone();
|
||||
servers.insert(
|
||||
"rmcp".to_string(),
|
||||
@@ -1675,7 +1654,7 @@ async fn tool_search_matches_mcp_tools_by_distinct_name_description_and_schema_t
|
||||
skip_if_no_network!(Ok(()));
|
||||
|
||||
let server = start_mock_server().await;
|
||||
let apps_server = AppsTestServer::mount_searchable(&server).await?;
|
||||
let apps_server = McpTestServer::mount_searchable(&server).await?;
|
||||
let query_cases = [
|
||||
("tool-search-mcp-raw-name", "calendar_timezone_option_99"),
|
||||
("tool-search-mcp-description", "uploaded document"),
|
||||
@@ -1705,7 +1684,7 @@ async fn tool_search_matches_mcp_tools_by_distinct_name_description_and_schema_t
|
||||
)
|
||||
.await;
|
||||
|
||||
let mut builder = configured_builder(apps_server.chatgpt_base_url.clone());
|
||||
let mut builder = configured_builder(apps_server.base_url.clone());
|
||||
let test = builder.build_with_auto_env(&server).await?;
|
||||
|
||||
test.submit_turn_with_approval_and_permission_profile(
|
||||
@@ -1722,18 +1701,18 @@ async fn tool_search_matches_mcp_tools_by_distinct_name_description_and_schema_t
|
||||
tool_search_output_has_namespace_child(
|
||||
&requests[1],
|
||||
"tool-search-mcp-raw-name",
|
||||
SEARCH_CALENDAR_NAMESPACE,
|
||||
"_timezone_option_99"
|
||||
CALENDAR_NAMESPACE,
|
||||
"calendar_timezone_option_99"
|
||||
),
|
||||
"expected raw MCP tool-name query to surface _timezone_option_99: {:?}",
|
||||
"expected raw MCP tool-name query to surface calendar_timezone_option_99: {:?}",
|
||||
tool_search_output_tools(&requests[1], "tool-search-mcp-raw-name")
|
||||
);
|
||||
assert!(
|
||||
tool_search_output_has_namespace_child(
|
||||
&requests[1],
|
||||
"tool-search-mcp-description",
|
||||
SEARCH_CALENDAR_NAMESPACE,
|
||||
"_extract_text"
|
||||
CALENDAR_NAMESPACE,
|
||||
"calendar_extract_text"
|
||||
),
|
||||
"expected MCP description query to surface _extract_text: {:?}",
|
||||
tool_search_output_tools(&requests[1], "tool-search-mcp-description")
|
||||
@@ -1742,10 +1721,10 @@ async fn tool_search_matches_mcp_tools_by_distinct_name_description_and_schema_t
|
||||
tool_search_output_has_namespace_child(
|
||||
&requests[1],
|
||||
"tool-search-mcp-schema",
|
||||
SEARCH_CALENDAR_NAMESPACE,
|
||||
SEARCH_CALENDAR_CREATE_TOOL
|
||||
CALENDAR_NAMESPACE,
|
||||
CALENDAR_CREATE_EVENT_TOOL_NAME
|
||||
),
|
||||
"expected MCP schema query to surface {SEARCH_CALENDAR_CREATE_TOOL}: {:?}",
|
||||
"expected MCP schema query to surface {CALENDAR_CREATE_EVENT_TOOL_NAME}: {:?}",
|
||||
tool_search_output_tools(&requests[1], "tool-search-mcp-schema")
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user