Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Make gRPC code-mode yield tests deterministic (#38321)

Channing Congere0de12a126f2
diff --git a/codex-rs/code-mode-host/tests/grpc.rs b/codex-rs/code-mode-host/tests/grpc.rs
index 67e8b95aad..87a248c545 100644
--- a/codex-rs/code-mode-host/tests/grpc.rs
+++ b/codex-rs/code-mode-host/tests/grpc.rs
@@ -877,8 +877,11 @@ async fn sessions_enforce_independent_yield_limits() -> Result<()> {
})
);
assert_eq!(
- execute(&limited, request(r#"text("recovered");"#)).await?,
- text_response("2", "recovered")
+ execute(&limited, request("await new Promise(() => {});")).await?,
+ RuntimeResponse::Yielded {
+ cell_id: cell_id("2"),
+ content_items: Vec::new(),
+ }
);
limited.shutdown().await.map_err(anyhow::Error::msg)?;
other.shutdown().await.map_err(anyhow::Error::msg)?;
diff --git a/codex-rs/code-mode-host/tests/grpc_notifications.rs b/codex-rs/code-mode-host/tests/grpc_notifications.rs
index f0d3ad416e..86a361fda6 100644
--- a/codex-rs/code-mode-host/tests/grpc_notifications.rs
+++ b/codex-rs/code-mode-host/tests/grpc_notifications.rs
@@ -183,10 +183,7 @@ async fn completed_waits_drain_pending_notifications_before_returning() -> Resul
.create_session(delegate.clone())
.await
.map_err(anyhow::Error::msg)?;
- let mut pending = request(
- r#"await new Promise(resolve => setTimeout(resolve, 25)); notify("notice"); text("done");"#,
- );
- pending.yield_time_ms = Some(/*value*/ 1);
+ let pending = request(r#"yield_control(); notify("notice"); text("done");"#);
let cell = session.execute(pending).await.map_err(anyhow::Error::msg)?;
assert_eq!(
cell.initial_response().await.map_err(anyhow::Error::msg)?,