Commit Graph
2 Commits
Author SHA1 Message Date
Shayne SweeneyandCodex 06fd1307aa fix(tui): scope MCP startup events to emitting thread
Sub-agent McpConnectionManager startup events leaked into the leader
TUI's status header because McpServerStatusUpdated notifications carried
no thread identity and were routed Global, which fell through to the
leader's chat_widget and overwrote its mcp_startup_status map. Once a
sub-agent re-emitted Starting for a server the leader already had as
Ready, the leader's spinner reopened and the settle check could never
pass.

Add an optional thread_id to McpServerStatusUpdatedNotification, set it
from the emitting session in apply_bespoke_event_handling, and route
notifications carrying a thread_id through ServerNotificationThreadTarget
so non-leader threads enqueue to their own buffered store rather than
mutating the leader's map. A missing thread_id keeps the existing Global
behaviour for backward compatibility with older app servers.

Adds:
- routing unit tests covering both presence and absence of thread_id
- an app-level test asserting a sub-agent McpServerStatusUpdated does
  not flip the leader's task-running state
- thread_id assertion in the existing app-server integration test

Closes #18068
Refs #16821, #19542

Co-authored-by: Codex <noreply@openai.com>
2026-05-02 11:35:26 -04:00
Owen Lin 9e695fe830 feat(app-server): add mcpServer/startupStatus/updated notification (#15220)
Exposes the legacy `codex/event/mcp_startup_update` event as an API v2
notification.

The legacy event has this shape:
```
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
pub struct McpStartupUpdateEvent {
    /// Server name being started.
    pub server: String,
    /// Current startup status.
    pub status: McpStartupStatus,
}

#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
#[serde(rename_all = "snake_case", tag = "state")]
#[ts(rename_all = "snake_case", tag = "state")]
pub enum McpStartupStatus {
    Starting,
    Ready,
    Failed { error: String },
    Cancelled,
}
```
2026-03-19 15:09:59 -07:00