Fix flaky test_shell_command_approval_triggers_elicitation test (#1802)
This doesn't flake very often but this should fix it.
This commit is contained in:
@@ -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
|
/// Conforms to [`mcp_types::ElicitRequestParams`] so that it can be used as the
|
||||||
/// `params` field of an [`ElicitRequest`].
|
/// `params` field of an [`ElicitRequest`].
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct ExecApprovalElicitRequestParams {
|
pub struct ExecApprovalElicitRequestParams {
|
||||||
// These fields are required so that `params`
|
// These fields are required so that `params`
|
||||||
// conforms to ElicitRequestParams.
|
// conforms to ElicitRequestParams.
|
||||||
|
|||||||
@@ -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
|
// This is the first request from the server, so the id should be 0 given
|
||||||
// how things are currently implemented.
|
// how things are currently implemented.
|
||||||
let elicitation_request_id = RequestId::Integer(0);
|
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(
|
let expected_elicitation_request = create_expected_elicitation_request(
|
||||||
elicitation_request_id.clone(),
|
elicitation_request_id.clone(),
|
||||||
shell_command.clone(),
|
shell_command.clone(),
|
||||||
workdir_for_shell_function_call.path(),
|
workdir_for_shell_function_call.path(),
|
||||||
codex_request_id.to_string(),
|
codex_request_id.to_string(),
|
||||||
// Internal Codex id: empirically it is 1, but this is
|
params.codex_event_id.clone(),
|
||||||
// admittedly an internal detail that could change.
|
|
||||||
"1".to_string(),
|
|
||||||
)?;
|
)?;
|
||||||
assert_eq!(expected_elicitation_request, elicitation_request);
|
assert_eq!(expected_elicitation_request, elicitation_request);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user