Lightweight coding agent that runs in your terminal
Rust
Fix flaky test_shell_command_approval_triggers_elicitation test (#1802)
Gabriel Peal4c9f7b6bcc4a
diff --git a/codex-rs/mcp-server/src/exec_approval.rs b/codex-rs/mcp-server/src/exec_approval.rsindex f073214bf5..54abfb35bd 100644--- a/codex-rs/mcp-server/src/exec_approval.rs+++ b/codex-rs/mcp-server/src/exec_approval.rs@@ -18,7 +18,7 @@ use crate::codex_tool_runner::INVALID_PARAMS_ERROR_CODE;/// Conforms to [`mcp_types::ElicitRequestParams`] so that it can be used as the/// `params` field of an [`ElicitRequest`].-#[derive(Debug, Serialize)]+#[derive(Debug, Deserialize, Serialize)]pub struct ExecApprovalElicitRequestParams {// These fields are required so that `params`// conforms to ElicitRequestParams.diff --git a/codex-rs/mcp-server/tests/codex_tool.rs b/codex-rs/mcp-server/tests/codex_tool.rsindex 7d59ff202e..fc992a8cd1 100644--- a/codex-rs/mcp-server/tests/codex_tool.rs+++ b/codex-rs/mcp-server/tests/codex_tool.rs@@ -89,14 +89,18 @@ async fn shell_command_approval_triggers_elicitation() -> anyhow::Result<()> {// This is the first request from the server, so the id should be 0 given// how things are currently implemented.let elicitation_request_id = RequestId::Integer(0);+ let params = serde_json::from_value::<ExecApprovalElicitRequestParams>(+ elicitation_request+ .params+ .clone()+ .ok_or_else(|| anyhow::anyhow!("elicitation_request.params must be set"))?,+ )?;let expected_elicitation_request = create_expected_elicitation_request(elicitation_request_id.clone(),shell_command.clone(),workdir_for_shell_function_call.path(),codex_request_id.to_string(),- // Internal Codex id: empirically it is 1, but this is- // admittedly an internal detail that could change.- "1".to_string(),+ params.codex_event_id.clone(),)?;assert_eq!(expected_elicitation_request, elicitation_request);