Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions codex-rs/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion codex-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ dunce = "1.0.4"
encoding_rs = "0.8.35"
env-flags = "0.1.1"
env_logger = "0.11.5"
escargot = "0.5"
eventsource-stream = "0.2.3"
futures = { version = "0.3", default-features = false }
http = "1.3.1"
Expand Down
1 change: 0 additions & 1 deletion codex-rs/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ codex-otel = { workspace = true, features = ["disable-default-metrics-exporter"]
codex-utils-cargo-bin = { workspace = true }
core_test_support = { workspace = true }
ctor = { workspace = true }
escargot = { workspace = true }
image = { workspace = true, features = ["jpeg", "png"] }
maplit = { workspace = true }
predicates = { workspace = true }
Expand Down
5 changes: 5 additions & 0 deletions codex-rs/core/tests/common/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![expect(clippy::expect_used)]

use codex_utils_cargo_bin::CargoBinError;
use codex_utils_cargo_bin::find_resource;
use tempfile::TempDir;

Expand Down Expand Up @@ -245,6 +246,10 @@ pub fn format_with_current_shell_display_non_login(command: &str) -> String {
.expect("serialize current shell command without login")
}

pub fn stdio_server_bin() -> Result<String, CargoBinError> {
codex_utils_cargo_bin::cargo_bin("test_stdio_server").map(|p| p.to_string_lossy().to_string())
}

pub mod fs_wait {
use anyhow::Result;
use anyhow::anyhow;
Expand Down
53 changes: 9 additions & 44 deletions codex-rs/core/tests/suite/rmcp_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ use codex_core::protocol::Op;
use codex_core::protocol::SandboxPolicy;
use codex_protocol::config_types::ReasoningSummary;
use codex_protocol::user_input::UserInput;
use codex_utils_cargo_bin::cargo_bin;
use core_test_support::responses;
use core_test_support::responses::mount_sse_once;
use core_test_support::skip_if_no_network;
use core_test_support::stdio_server_bin;
use core_test_support::test_codex::test_codex;
use core_test_support::wait_for_event;
use escargot::CargoBuild;
use mcp_types::ContentBlock;
use serde_json::Value;
use serde_json::json;
Expand Down Expand Up @@ -68,21 +69,15 @@ async fn stdio_server_round_trip() -> anyhow::Result<()> {
.await;

let expected_env_value = "propagated-env";
let rmcp_test_server_bin = CargoBuild::new()
.package("codex-rmcp-client")
.bin("test_stdio_server")
.run()?
.path()
.to_string_lossy()
.into_owned();
let rmcp_test_server_bin = stdio_server_bin()?;

let fixture = test_codex()
.with_config(move |config| {
config.mcp_servers.insert(
server_name.to_string(),
McpServerConfig {
transport: McpServerTransportConfig::Stdio {
command: rmcp_test_server_bin.clone(),
command: rmcp_test_server_bin,
args: Vec::new(),
env: Some(HashMap::from([(
"MCP_TEST_VALUE".to_string(),
Expand Down Expand Up @@ -205,13 +200,7 @@ async fn stdio_image_responses_round_trip() -> anyhow::Result<()> {
.await;

// Build the stdio rmcp server and pass the image as data URL so it can construct ImageContent.
let rmcp_test_server_bin = CargoBuild::new()
.package("codex-rmcp-client")
.bin("test_stdio_server")
.run()?
.path()
.to_string_lossy()
.into_owned();
let rmcp_test_server_bin = stdio_server_bin()?;

let fixture = test_codex()
.with_config(move |config| {
Expand Down Expand Up @@ -399,13 +388,7 @@ async fn stdio_image_completions_round_trip() -> anyhow::Result<()> {
.mount(&server)
.await;

let rmcp_test_server_bin = CargoBuild::new()
.package("codex-rmcp-client")
.bin("test_stdio_server")
.run()?
.path()
.to_string_lossy()
.into_owned();
let rmcp_test_server_bin = stdio_server_bin()?;

let fixture = test_codex()
.with_config(move |config| {
Expand Down Expand Up @@ -546,13 +529,7 @@ async fn stdio_server_propagates_whitelisted_env_vars() -> anyhow::Result<()> {

let expected_env_value = "propagated-env-from-whitelist";
let _guard = EnvVarGuard::set("MCP_TEST_VALUE", OsStr::new(expected_env_value));
let rmcp_test_server_bin = CargoBuild::new()
.package("codex-rmcp-client")
.bin("test_stdio_server")
.run()?
.path()
.to_string_lossy()
.into_owned();
let rmcp_test_server_bin = stdio_server_bin()?;

let fixture = test_codex()
.with_config(move |config| {
Expand Down Expand Up @@ -680,13 +657,7 @@ async fn streamable_http_tool_call_round_trip() -> anyhow::Result<()> {
.await;

let expected_env_value = "propagated-env-http";
let rmcp_http_server_bin = CargoBuild::new()
.package("codex-rmcp-client")
.bin("test_streamable_http_server")
.run()?
.path()
.to_string_lossy()
.into_owned();
let rmcp_http_server_bin = cargo_bin("test_streamable_http_server")?;

let listener = TcpListener::bind("127.0.0.1:0")?;
let port = listener.local_addr()?.port();
Expand Down Expand Up @@ -848,13 +819,7 @@ async fn streamable_http_with_oauth_round_trip() -> anyhow::Result<()> {
let expected_token = "initial-access-token";
let client_id = "test-client-id";
let refresh_token = "initial-refresh-token";
let rmcp_http_server_bin = CargoBuild::new()
.package("codex-rmcp-client")
.bin("test_streamable_http_server")
.run()?
.path()
.to_string_lossy()
.into_owned();
let rmcp_http_server_bin = cargo_bin("test_streamable_http_server")?;

let listener = TcpListener::bind("127.0.0.1:0")?;
let port = listener.local_addr()?.port();
Expand Down
26 changes: 4 additions & 22 deletions codex-rs/core/tests/suite/truncation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ use core_test_support::responses::mount_sse_sequence;
use core_test_support::responses::sse;
use core_test_support::responses::start_mock_server;
use core_test_support::skip_if_no_network;
use core_test_support::stdio_server_bin;
use core_test_support::test_codex::test_codex;
use core_test_support::wait_for_event;
use escargot::CargoBuild;
use serde_json::Value;
use serde_json::json;
use std::collections::HashMap;
Expand Down Expand Up @@ -411,13 +411,7 @@ async fn mcp_tool_call_output_exceeds_limit_truncated_for_model() -> Result<()>
.await;

// Compile the rmcp stdio test server and configure it.
let rmcp_test_server_bin = CargoBuild::new()
.package("codex-rmcp-client")
.bin("test_stdio_server")
.run()?
.path()
.to_string_lossy()
.into_owned();
let rmcp_test_server_bin = stdio_server_bin()?;

let mut builder = test_codex().with_config(move |config| {
config.mcp_servers.insert(
Expand Down Expand Up @@ -497,13 +491,7 @@ async fn mcp_image_output_preserves_image_and_no_text_summary() -> Result<()> {
.await;

// Build the stdio rmcp server and pass a tiny PNG via data URL so it can construct ImageContent.
let rmcp_test_server_bin = CargoBuild::new()
.package("codex-rmcp-client")
.bin("test_stdio_server")
.run()?
.path()
.to_string_lossy()
.into_owned();
let rmcp_test_server_bin = stdio_server_bin()?;

// 1x1 PNG data URL
let openai_png = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMB/ee9bQAAAABJRU5ErkJggg==";
Expand Down Expand Up @@ -762,13 +750,7 @@ async fn mcp_tool_call_output_not_truncated_with_custom_limit() -> Result<()> {
)
.await;

let rmcp_test_server_bin = CargoBuild::new()
.package("codex-rmcp-client")
.bin("test_stdio_server")
.run()?
.path()
.to_string_lossy()
.into_owned();
let rmcp_test_server_bin = stdio_server_bin()?;

let mut builder = test_codex().with_config(move |config| {
config.tool_output_token_limit = Some(50_000);
Expand Down
Loading