Fix subagent MCP startup status settling (#37344)

## Why

Subagents can leave cached MCP servers deferred indefinitely, causing the TUI to keep showing MCP startup as running after every server that reported startup has settled.

## What changed

- Clear configured MCP startup expectations for active subagent threads so their status is driven by actual startup notifications.
- Preserve configured-server startup tracking for primary threads and side conversations.

## Testing

Add coverage for active and resumed subagents with deferred servers, plus the existing side-conversation behavior.

GitOrigin-RevId: 4d929a162dd067b4a76351652a764a79ce60f31f
This commit is contained in:
jif authored and copyberry committed 2026-08-07 00:50:33 +00:00
1 parent a9da0bdbac
commit 4ffeddcbcc
3 files changed
+172

No files matched your search

+16
View File
@@ -18,6 +18,22 @@ use codex_app_server_protocol::ServerRequest;
impl App {
pub(super) fn refresh_mcp_startup_expected_servers_from_config(&mut self) {
if self
.current_displayed_thread_id()
.zip(self.primary_thread_id)
.is_some_and(|(thread_id, primary_thread_id)| {
self.agent_navigation.is_parent_owned(thread_id)
|| (thread_id != primary_thread_id
&& !self.side_threads.contains_key(&thread_id))
})
{
// Subagents can defer cached servers indefinitely, so only servers
// that actually report startup should keep their status running.
self.chat_widget
.set_mcp_startup_expected_servers(std::iter::empty());
return;
}
let enabled_config_mcp_servers: Vec<String> = self
.config
.mcp_servers