Skip to content

Commit 569b9bf

Browse files
committed
Logs for failing test
1 parent fcc117b commit 569b9bf

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

codex-rs/core/src/mcp_connection_manager.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ impl McpClientAdapter {
107107
params: mcp_types::InitializeRequestParams,
108108
startup_timeout: Duration,
109109
) -> Result<Self> {
110+
tracing::error!(
111+
"new_stdio_client use_rmcp_client: {use_rmcp_client} program: {program:?} args: {args:?} env: {env:?} params: {params:?} startup_timeout: {startup_timeout:?}"
112+
);
110113
if use_rmcp_client {
111114
let client = Arc::new(RmcpClient::new_stdio_client(program, args, env).await?);
112115
client.initialize(params, Some(startup_timeout)).await?;
@@ -173,6 +176,8 @@ impl McpConnectionManager {
173176
return Ok((Self::default(), ClientStartErrors::default()));
174177
}
175178

179+
tracing::error!("new mcp_servers: {mcp_servers:?} use_rmcp_client: {use_rmcp_client}");
180+
176181
// Launch all configured servers concurrently.
177182
let mut join_set = JoinSet::new();
178183
let mut errors = ClientStartErrors::new();

codex-rs/core/tests/suite/rmcp_client.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::collections::HashMap;
2+
use std::time::Duration;
23

34
use assert_cmd::cargo::cargo_bin;
45
use codex_core::protocol::AskForApproval;
@@ -12,6 +13,7 @@ use core_test_support::responses::mount_sse_once;
1213
use core_test_support::skip_if_no_network;
1314
use core_test_support::test_codex::test_codex;
1415
use core_test_support::wait_for_event;
16+
use core_test_support::wait_for_event_with_timeout;
1517
use serde_json::Value;
1618
use wiremock::matchers::any;
1719

@@ -63,7 +65,7 @@ async fn rmcp_tool_call_round_trip() -> anyhow::Result<()> {
6365
"MCP_TEST_VALUE".to_string(),
6466
expected_env_value.to_string(),
6567
)])),
66-
startup_timeout_sec: None,
68+
startup_timeout_sec: Some(Duration::from_secs(10)),
6769
tool_timeout_sec: None,
6870
},
6971
);
@@ -88,13 +90,18 @@ async fn rmcp_tool_call_round_trip() -> anyhow::Result<()> {
8890
})
8991
.await?;
9092

91-
eprintln!("waiting for begin event");
92-
let begin_event = wait_for_event(&fixture.codex, |ev| {
93-
matches!(ev, EventMsg::McpToolCallBegin(_))
94-
})
93+
eprintln!("waiting for mcp tool call begin event");
94+
let begin_event = wait_for_event_with_timeout(
95+
&fixture.codex,
96+
|ev| {
97+
eprintln!("ev: {ev:?}");
98+
matches!(ev, EventMsg::McpToolCallBegin(_))
99+
},
100+
Duration::from_secs(10),
101+
)
95102
.await;
96103

97-
eprintln!("begin_event: {begin_event:?}");
104+
eprintln!("mcp tool call begin event: {begin_event:?}");
98105
let EventMsg::McpToolCallBegin(begin) = begin_event else {
99106
unreachable!("event guard guarantees McpToolCallBegin");
100107
};

codex-rs/rmcp-client/src/bin/rmcp_test_server.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl ServerHandler for TestToolServer {
109109

110110
let env_snapshot: HashMap<String, String> = std::env::vars().collect();
111111
let structured_content = json!({
112-
"echo": args.message,
112+
"echo": format!("TEST_ECHO: {}", args.message),
113113
"env": env_snapshot.get("MCP_TEST_VALUE"),
114114
});
115115

@@ -130,6 +130,7 @@ impl ServerHandler for TestToolServer {
130130

131131
#[tokio::main]
132132
async fn main() -> Result<(), Box<dyn std::error::Error>> {
133+
eprintln!("starting rmcp test server");
133134
// Run the server with STDIO transport. If the client disconnects we simply
134135
// bubble up the error so the process exits.
135136
let service = TestToolServer::new();

0 commit comments

Comments
 (0)