Make MultiAgentV2 wait minimum configurable (#20052)

## Why

MultiAgentV2 `wait_agent` currently clamps short waits to a fixed 10
second minimum. That default is still useful for preventing tight
polling loops, but it is too rigid for environments that need faster
mailbox wake-up checks or a larger minimum to discourage frequent
polling.

This PR makes the minimum wait timeout configurable from the existing
MultiAgentV2 feature config section, so operators can tune the behavior
without changing the legacy multi-agent tool surface.

## What Changed

- Added `features.multi_agent_v2.min_wait_timeout_ms`.
- Defaulted the new setting to the existing 10 second floor.
- Validated the configured value as `1..=3600000`, matching the existing
one hour maximum wait bound.
- Applied the configured minimum to MultiAgentV2 `wait_agent` runtime
clamping.
- Plumbed the configured minimum into the `wait_agent` tool schema,
including the effective default when the minimum is above the normal 30
second default.
- Regenerated `core/config.schema.json`.

## Verification

- `cargo test -p codex-features`
- `cargo test -p codex-tools`
- `cargo test -p codex-core --lib multi_agent_v2`
- `just fix -p codex-core`
This commit is contained in:
jif-oai authored and GitHub committed 2026-04-28 22:36:44 +02:00
1 parent 1de7a9bf69
commit 34d71d43eb
13 files changed
+220 -5

No files matched your search

+29
View File
@@ -784,6 +784,35 @@ async fn spawn_agent_description_uses_configured_usage_hint_text() {
);
}
#[tokio::test]
async fn multi_agent_v2_wait_agent_schema_uses_configured_min_timeout() {
let wait_agent_min_timeout_ms = Some(60_000);
let tools_config = multi_agent_v2_tools_config()
.await
.with_wait_agent_min_timeout_ms(wait_agent_min_timeout_ms);
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
/*deferred_mcp_tools*/ None,
&[],
)
.build();
let wait_agent = find_tool(&tools, "wait_agent");
let ToolSpec::Function(ResponsesApiTool { parameters, .. }) = &wait_agent.spec else {
panic!("wait_agent should be a function tool");
};
let timeout_description = parameters
.properties
.as_ref()
.and_then(|properties| properties.get("timeout_ms"))
.and_then(|schema| schema.description.as_deref());
assert_eq!(
timeout_description,
Some("Optional timeout in milliseconds. Defaults to 60000, min 60000, max 3600000.")
);
}
#[tokio::test]
async fn tool_suggest_requires_apps_and_plugins_features() {
let model_info = search_capable_model_info().await;