From f09170b574b52003b0746e18346b9f5fc4007464 Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Thu, 28 Aug 2025 12:43:13 -0700 Subject: [PATCH 1/2] chore: print stderr from MCP server to test output using eprintln! (#2849) Related to https://github.com/openai/codex/pull/2848, I don't see the stderr from `codex mcp` colocated with the other stderr from `test_shell_command_approval_triggers_elicitation()` when it fails even though we have `RUST_LOG=debug` set when we spawn `codex mcp`: https://github.com/openai/codex/blob/1e9e703b969d3f0965b31d1cc3d70fed3ebdd6f6/codex-rs/mcp-server/tests/common/mcp_process.rs#L65 Let's try this new logic which should be more explicit. --- codex-rs/mcp-server/tests/common/mcp_process.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/codex-rs/mcp-server/tests/common/mcp_process.rs b/codex-rs/mcp-server/tests/common/mcp_process.rs index eae83482d7..14939156bb 100644 --- a/codex-rs/mcp-server/tests/common/mcp_process.rs +++ b/codex-rs/mcp-server/tests/common/mcp_process.rs @@ -61,6 +61,7 @@ impl McpProcess { cmd.stdin(Stdio::piped()); cmd.stdout(Stdio::piped()); + cmd.stderr(Stdio::piped()); cmd.env("CODEX_HOME", codex_home); cmd.env("RUST_LOG", "debug"); @@ -77,6 +78,17 @@ impl McpProcess { .take() .ok_or_else(|| anyhow::format_err!("mcp should have stdout fd"))?; let stdout = BufReader::new(stdout); + + // Forward child's stderr to our stderr so failures are visible even + // when stdout/stderr are captured by the test harness. + if let Some(stderr) = process.stderr.take() { + let mut stderr_reader = BufReader::new(stderr).lines(); + tokio::spawn(async move { + while let Ok(Some(line)) = stderr_reader.next_line().await { + eprintln!("[mcp stderr] {line}"); + } + }); + } Ok(Self { next_request_id: AtomicI64::new(0), process, From c0c10f34cbb8b3bf3e44452f1f364f09eccf4a7f Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Thu, 28 Aug 2025 21:26:29 -0700 Subject: [PATCH 2/2] fix: specify --profile to `cargo clippy` in CI --- .github/workflows/rust-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.yml index fa9f1cd15f..7d02c95dee 100644 --- a/.github/workflows/rust-ci.yml +++ b/.github/workflows/rust-ci.yml @@ -134,7 +134,7 @@ jobs: - name: cargo clippy id: clippy - run: cargo clippy --target ${{ matrix.target }} --all-features --tests -- -D warnings + run: cargo clippy --target ${{ matrix.target }} --all-features --tests --profile ${{ matrix.profile }} -- -D warnings # Running `cargo build` from the workspace root builds the workspace using # the union of all features from third-party crates. This can mask errors