mirror of
https://github.com/openai/codex.git
synced 2026-10-26 18:38:47 +00:00
fix(core): preserve app guidance during mcp startup
This commit is contained in:
@@ -1005,7 +1005,7 @@ async fn list_ready_or_cached_tools_skips_pending_client_without_cached_tool_inf
|
||||
);
|
||||
|
||||
let tools = tokio::time::timeout(
|
||||
Duration::from_millis(10),
|
||||
Duration::from_millis(/*millis*/ 10),
|
||||
manager.list_ready_or_cached_tools(),
|
||||
)
|
||||
.await
|
||||
|
||||
@@ -3505,7 +3505,7 @@ impl Config {
|
||||
.tui
|
||||
.as_ref()
|
||||
.map(|t| t.show_mcp_startup_status)
|
||||
.unwrap_or(false),
|
||||
.unwrap_or(/*default*/ false),
|
||||
model_availability_nux: cfg
|
||||
.tui
|
||||
.as_ref()
|
||||
|
||||
@@ -96,21 +96,6 @@ pub async fn list_accessible_connectors_from_mcp_tools(
|
||||
)
|
||||
}
|
||||
|
||||
pub(crate) async fn list_accessible_and_enabled_connectors_from_manager(
|
||||
mcp_connection_manager: &McpConnectionManager,
|
||||
config: &Config,
|
||||
) -> Vec<AppInfo> {
|
||||
with_app_enabled_state(
|
||||
accessible_connectors_from_mcp_tools(
|
||||
&mcp_connection_manager.list_ready_or_cached_tools().await,
|
||||
),
|
||||
config,
|
||||
)
|
||||
.into_iter()
|
||||
.filter(|connector| connector.is_accessible && connector.is_enabled)
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub(crate) async fn list_tool_suggest_discoverable_tools_with_auth(
|
||||
config: &Config,
|
||||
auth: Option<&CodexAuth>,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#[cfg(test)]
|
||||
use codex_app_server_protocol::AppInfo;
|
||||
use codex_mcp::CODEX_APPS_MCP_SERVER_NAME;
|
||||
use codex_protocol::protocol::APPS_INSTRUCTIONS_CLOSE_TAG;
|
||||
@@ -8,6 +9,7 @@ use super::ContextualUserFragment;
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub(crate) struct AppsInstructions;
|
||||
|
||||
#[cfg(test)]
|
||||
impl AppsInstructions {
|
||||
pub(crate) fn from_connectors(connectors: &[AppInfo]) -> Option<Self> {
|
||||
connectors
|
||||
|
||||
@@ -18,7 +18,6 @@ use crate::build_available_skills;
|
||||
use crate::compact;
|
||||
use crate::config::ManagedFeatures;
|
||||
use crate::config::resolve_tool_suggest_config_from_layer_stack;
|
||||
use crate::connectors;
|
||||
use crate::context::ApprovedCommandPrefixSaved;
|
||||
use crate::context::AppsInstructions;
|
||||
use crate::context::AvailablePluginsInstructions;
|
||||
@@ -2631,10 +2630,6 @@ impl Session {
|
||||
}
|
||||
}
|
||||
|
||||
#[expect(
|
||||
clippy::await_holding_invalid_type,
|
||||
reason = "MCP app context rendering reads through the session-owned manager guard"
|
||||
)]
|
||||
pub(crate) async fn build_initial_context(
|
||||
&self,
|
||||
turn_context: &TurnContext,
|
||||
@@ -2727,18 +2722,7 @@ impl Session {
|
||||
}
|
||||
}
|
||||
if turn_context.config.include_apps_instructions && turn_context.apps_enabled() {
|
||||
let mcp_connection_manager = self.services.mcp_connection_manager.read().await;
|
||||
let accessible_and_enabled_connectors =
|
||||
connectors::list_accessible_and_enabled_connectors_from_manager(
|
||||
&mcp_connection_manager,
|
||||
&turn_context.config,
|
||||
)
|
||||
.await;
|
||||
if let Some(apps_instructions) =
|
||||
AppsInstructions::from_connectors(&accessible_and_enabled_connectors)
|
||||
{
|
||||
developer_sections.push(apps_instructions.render());
|
||||
}
|
||||
developer_sections.push(AppsInstructions.render());
|
||||
}
|
||||
if turn_context.config.include_skill_instructions {
|
||||
let available_skills = build_available_skills(
|
||||
|
||||
@@ -198,6 +198,7 @@ fn new_config(model: Option<String>, arg0_paths: Arg0DispatchPaths) -> anyhow::R
|
||||
tui_notifications: TuiNotificationSettings::default(),
|
||||
animations: true,
|
||||
show_tooltips: true,
|
||||
tui_show_mcp_startup_status: false,
|
||||
model_availability_nux: ModelAvailabilityNuxConfig::default(),
|
||||
tui_alternate_screen: AltScreenMode::Auto,
|
||||
tui_status_line: None,
|
||||
|
||||
@@ -1601,8 +1601,8 @@ async fn startup_header_handoff_visible_states_snapshot() {
|
||||
initial_plan_type: None,
|
||||
model: Some(resolved_model.clone()),
|
||||
startup_tooltip_override: Some("This is a test announcement".to_string()),
|
||||
status_line_invalid_items_warned: Arc::new(AtomicBool::new(false)),
|
||||
terminal_title_invalid_items_warned: Arc::new(AtomicBool::new(false)),
|
||||
status_line_invalid_items_warned: Arc::new(AtomicBool::new(/*v*/ false)),
|
||||
terminal_title_invalid_items_warned: Arc::new(AtomicBool::new(/*v*/ false)),
|
||||
session_telemetry: test_session_telemetry(&cfg, resolved_model.as_str()),
|
||||
};
|
||||
let mut chat = ChatWidget::new_with_app_event(init);
|
||||
|
||||
Reference in New Issue
Block a user