From 736f6dec57b44db217bd5b01429c7dce6886a308 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Sun, 8 Mar 2026 10:06:52 -0400 Subject: [PATCH] Reduce Daytona sandbox timeout grace period from 5s to 2s --- crates/arc-workflows/src/daytona_sandbox.rs | 3 +-- crates/arc-workflows/tests/daytona_integration.rs | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/crates/arc-workflows/src/daytona_sandbox.rs b/crates/arc-workflows/src/daytona_sandbox.rs index 8403fbe80..9c75f0762 100644 --- a/crates/arc-workflows/src/daytona_sandbox.rs +++ b/crates/arc-workflows/src/daytona_sandbox.rs @@ -916,9 +916,8 @@ impl Sandbox for DaytonaSandbox { // The Daytona API uses direct exec, not a shell. let wrapped = wrap_bash_command(&command_with_env); - let timeout_duration = std::time::Duration::from_millis(timeout_ms + 5000); // 5s grace period + let timeout_duration = std::time::Duration::from_millis(timeout_ms + 2000); // 2s grace period let token = cancel_token.unwrap_or_default(); - let exec_future = process_svc.execute_command(&wrapped, options); let result = tokio::select! { diff --git a/crates/arc-workflows/tests/daytona_integration.rs b/crates/arc-workflows/tests/daytona_integration.rs index 92ecc8935..54758a2fb 100644 --- a/crates/arc-workflows/tests/daytona_integration.rs +++ b/crates/arc-workflows/tests/daytona_integration.rs @@ -146,12 +146,12 @@ async fn daytona_exec_command_local_timeout() { let env = create_env_with_github_app(Some(creds)).await; env.initialize().await.unwrap(); - // Use a tiny timeout_ms of 100ms, our local timeout is 100 + 5000 = 5100ms. + // Use a tiny timeout_ms of 100ms, our local timeout is 100 + 2000 = 2100ms. // If the server doesn't enforce the timeout properly or drops the connection, // our local timeout should catch it. To simulate this without making a bad server, // we can't easily force the local timeout to hit before the server timeout // without mocking. But if we run `sleep 10` and Daytona does NOT respect the - // short timeout parameter, the local 5.1s timeout will definitely fire. + // short timeout parameter, the local 2.1s timeout will definitely fire. // Let's at least test that a 100ms timeout works and doesn't run for 10s. let start = std::time::Instant::now(); let result = env @@ -161,10 +161,10 @@ async fn daytona_exec_command_local_timeout() { let duration = start.elapsed(); - // It should either fail with Daytona's timeout (duration < 5000ms) or our - // local timeout (duration ~5100ms). Both are valid success conditions for + // It should either fail with Daytona's timeout (duration < 2000ms) or our + // local timeout (duration ~2100ms). Both are valid success conditions for // the system as a whole avoiding a stall. - assert!(duration < std::time::Duration::from_millis(6000), "Command stalled for longer than the local timeout mechanism"); + assert!(duration < std::time::Duration::from_millis(3000), "Command stalled for longer than the local timeout mechanism"); assert!(result.exit_code != 0); env.cleanup().await.unwrap();