diff --git a/codex-rs/mcp-server/tests/common/mcp_process.rs b/codex-rs/mcp-server/tests/common/mcp_process.rs index adbeab6bf2..3cc7c97c7d 100644 --- a/codex-rs/mcp-server/tests/common/mcp_process.rs +++ b/codex-rs/mcp-server/tests/common/mcp_process.rs @@ -367,80 +367,6 @@ impl McpProcess { } } - pub async fn read_stream_until_configured_response_message( - &mut self, - ) -> anyhow::Result { - let mut sid_old: Option = None; - let mut sid_new: Option = None; - loop { - let message = self.read_jsonrpc_message().await?; - eprint!("message: {message:?}"); - - match message { - JSONRPCMessage::Notification(notification) => { - if let Some(params) = notification.params { - // Back-compat schema: method == "codex/event" and msg.type == "session_configured" - if notification.method == "codex/event" { - if let Some(msg) = params.get("msg") { - if msg.get("type").and_then(|v| v.as_str()) - == Some("session_configured") - { - if let Some(session_id) = - msg.get("session_id").and_then(|v| v.as_str()) - { - sid_old = Some(session_id.to_string()); - } - } - } - } - // New schema: method is the Display of EventMsg::SessionConfigured => "SessionConfigured" - if notification.method == "session_configured" { - if let Some(msg) = params.get("msg") { - if let Some(session_id) = - msg.get("session_id").and_then(|v| v.as_str()) - { - sid_new = Some(session_id.to_string()); - } - } - } - } - - if sid_old.is_some() && sid_new.is_some() { - // Both seen, they must match - assert_eq!( - sid_old.as_ref().unwrap(), - sid_new.as_ref().unwrap(), - "session_id mismatch between old and new schema" - ); - return Ok(sid_old.unwrap()); - } - } - JSONRPCMessage::Request(_) => { - anyhow::bail!("unexpected JSONRPCMessage::Request: {message:?}"); - } - JSONRPCMessage::Error(_) => { - anyhow::bail!("unexpected JSONRPCMessage::Error: {message:?}"); - } - JSONRPCMessage::Response(_) => { - anyhow::bail!("unexpected JSONRPCMessage::Response: {message:?}"); - } - } - } - } - - pub async fn send_notification( - &mut self, - method: &str, - params: Option, - ) -> anyhow::Result<()> { - self.send_jsonrpc_message(JSONRPCMessage::Notification(JSONRPCNotification { - jsonrpc: JSONRPC_VERSION.into(), - method: method.to_string(), - params, - })) - .await - } - /// Reads notifications until a legacy TaskComplete event is observed: /// Method "codex/event" with params.msg.type == "task_complete". pub async fn read_stream_until_legacy_task_complete_notification(