Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

chore: clean wait v2 (#16317)

jif-oaiec21e1fd01dc
diff --git a/codex-rs/core/src/tools/spec_tests.rs b/codex-rs/core/src/tools/spec_tests.rs
index 16f87ca50e..c914ee5172 100644
--- a/codex-rs/core/src/tools/spec_tests.rs
+++ b/codex-rs/core/src/tools/spec_tests.rs
@@ -551,8 +551,9 @@ fn test_build_specs_multi_agent_v2_uses_task_names_and_hides_resume() {
else {
panic!("wait_agent should use object params");
};
- assert!(properties.contains_key("targets"));
- assert_eq!(required.as_ref(), Some(&vec!["targets".to_string()]));
+ assert!(!properties.contains_key("targets"));
+ assert!(properties.contains_key("timeout_ms"));
+ assert_eq!(required, &None);
let output_schema = output_schema
.as_ref()
.expect("wait_agent should define output schema");
diff --git a/codex-rs/tools/src/agent_tool.rs b/codex-rs/tools/src/agent_tool.rs
index 87f5bbd9e2..03b3df5c19 100644
--- a/codex-rs/tools/src/agent_tool.rs
+++ b/codex-rs/tools/src/agent_tool.rs
@@ -695,31 +695,19 @@ fn wait_agent_tool_parameters_v1(options: WaitAgentTimeoutOptions) -> JsonSchema
}
fn wait_agent_tool_parameters_v2(options: WaitAgentTimeoutOptions) -> JsonSchema {
- let properties = BTreeMap::from([
- (
- "targets".to_string(),
- JsonSchema::Array {
- items: Box::new(JsonSchema::String { description: None }),
- description: Some(
- "Agent ids or canonical task names to wait on. Pass multiple targets to wait for whichever finishes first."
- .to_string(),
- ),
- },
- ),
- (
- "timeout_ms".to_string(),
- JsonSchema::Number {
- description: Some(format!(
- "Optional timeout in milliseconds. Defaults to {}, min {}, max {}. Prefer longer waits (minutes) to avoid busy polling.",
- options.default_timeout_ms, options.min_timeout_ms, options.max_timeout_ms,
- )),
- },
- ),
- ]);
+ let properties = BTreeMap::from([(
+ "timeout_ms".to_string(),
+ JsonSchema::Number {
+ description: Some(format!(
+ "Optional timeout in milliseconds. Defaults to {}, min {}, max {}. Prefer longer waits (minutes) to avoid busy polling.",
+ options.default_timeout_ms, options.min_timeout_ms, options.max_timeout_ms,
+ )),
+ },
+ )]);
JsonSchema::Object {
properties,
- required: Some(vec!["targets".to_string()]),
+ required: None,
additional_properties: Some(false.into()),
}
}
diff --git a/codex-rs/tools/src/agent_tool_tests.rs b/codex-rs/tools/src/agent_tool_tests.rs
index 735a6ba4db..f483b97e08 100644
--- a/codex-rs/tools/src/agent_tool_tests.rs
+++ b/codex-rs/tools/src/agent_tool_tests.rs
@@ -101,7 +101,7 @@ fn send_message_tool_requires_items_and_uses_submission_output() {
}
#[test]
-fn wait_agent_tool_v2_uses_task_targets_and_summary_output() {
+fn wait_agent_tool_v2_uses_timeout_only_summary_output() {
let ToolSpec::Function(ResponsesApiTool {
parameters,
output_schema,
@@ -114,17 +114,17 @@ fn wait_agent_tool_v2_uses_task_targets_and_summary_output() {
else {
panic!("wait_agent should be a function tool");
};
- let JsonSchema::Object { properties, .. } = parameters else {
- panic!("wait_agent should use object params");
- };
- let Some(JsonSchema::Array {
- description: Some(description),
+ let JsonSchema::Object {
+ properties,
+ required,
..
- }) = properties.get("targets")
+ } = parameters
else {
- panic!("wait_agent should define targets array");
+ panic!("wait_agent should use object params");
};
- assert!(description.contains("canonical task names"));
+ assert!(!properties.contains_key("targets"));
+ assert!(properties.contains_key("timeout_ms"));
+ assert_eq!(required, None);
assert_eq!(
output_schema.expect("wait output schema")["properties"]["message"]["description"],
json!("Brief wait summary without the agent's final content.")