mirror of
https://github.com/openai/codex.git
synced 2026-10-19 17:28:46 +00:00
Add opt-in concurrent exec-server request dispatch (#36987)
## Why Sequential dispatch lets a long-running request block unrelated health checks and cleanup on the same connection. ## What changed - Add `--concurrent-requests <COUNT>` for local and remote exec-server connections, while retaining sequential dispatch when the option is omitted or set to `1`. - Preserve handshake ordering before enabling concurrent dispatch. - Reserve separate capacity for status, signal, terminate, and close requests so they remain responsive when ordinary request capacity is saturated. - Drain queued client responses during disconnect and cancel outstanding request tasks during connection shutdown. ## Testing - Cover CLI parsing and concurrency-limit validation. - Verify default sequential behavior, pipelined handshake ordering, concurrent request progress, control-request responsiveness, and disconnect handling. GitOrigin-RevId: 48e4b092e318204ed635543f01f9ee0e7df095fc
This commit is contained in:
committed by
copyberry
parent
1d952f027e
commit
eeae88d8a6
@@ -573,6 +573,14 @@ struct ExecServerCommand {
|
||||
#[arg(long = "strict-config", default_value_t = false)]
|
||||
strict_config: bool,
|
||||
|
||||
/// Maximum number of requests to process concurrently on each connection.
|
||||
#[arg(
|
||||
long = "concurrent-requests",
|
||||
value_name = "COUNT",
|
||||
default_value = "1"
|
||||
)]
|
||||
request_dispatch_mode: codex_exec_server::RequestDispatchMode,
|
||||
|
||||
/// Transport endpoint URL. Supported values: `ws://IP:PORT` (default), `stdio`, `stdio://`.
|
||||
#[arg(long = "listen", value_name = "URL", conflicts_with = "remote")]
|
||||
listen: Option<String>,
|
||||
@@ -1745,6 +1753,7 @@ async fn run_exec_server_command(
|
||||
if let Some(name) = cmd.name {
|
||||
remote_config.name = name;
|
||||
}
|
||||
remote_config.request_dispatch_mode = cmd.request_dispatch_mode;
|
||||
let remote_config = remote_config.with_telemetry(telemetry);
|
||||
let parent_lifetime = if cmd.exit_on_stdin_close {
|
||||
exec_server_telemetry::ParentLifetime::StdinPipe
|
||||
@@ -1794,6 +1803,7 @@ async fn run_exec_server_command(
|
||||
runtime_paths,
|
||||
telemetry,
|
||||
http_client_factory,
|
||||
cmd.request_dispatch_mode,
|
||||
)
|
||||
.await
|
||||
},
|
||||
|
||||
@@ -90,6 +90,24 @@ fn local_exec_server_ignores_invalid_config_without_strict_config() -> Result<()
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// The standalone exec-server accepts an explicit per-connection concurrency limit.
|
||||
#[test]
|
||||
fn local_exec_server_accepts_concurrent_requests_flag() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
let mut cmd = codex_command(codex_home.path())?;
|
||||
cmd.args([
|
||||
"exec-server",
|
||||
"--listen",
|
||||
"stdio",
|
||||
"--concurrent-requests",
|
||||
"2",
|
||||
])
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn local_exec_server_allows_disabled_parent_lifetime_environment_variable() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
@@ -173,6 +191,8 @@ metrics_exporter = {{ otlp-http = {{ endpoint = "{collector_url}/v1/metrics", pr
|
||||
®istry.uri(),
|
||||
"--environment-id",
|
||||
ENVIRONMENT_ID,
|
||||
"--concurrent-requests",
|
||||
"2",
|
||||
])
|
||||
.stdin(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
|
||||
Reference in New Issue
Block a user