From 32f2c5c2e4bedcf10688814319ec88cc69076188 Mon Sep 17 00:00:00 2001 From: Markus Rudy Date: Fri, 15 May 2026 12:33:29 +0200 Subject: [PATCH] agent: wait for logs before aborting If the policy loading encounters an error, we `abort(3)` the agent for safety. Since abort causes the process to stop immediately, the async logs might not be flushed yet, and thus won't make it to the runtime, hiding the reason for the abort. Wait a bit before aborting so that the logs are fully written. Fixes: #13031 Signed-off-by: Markus Rudy --- src/agent/src/main.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/agent/src/main.rs b/src/agent/src/main.rs index c5328f6b38..504644a16e 100644 --- a/src/agent/src/main.rs +++ b/src/agent/src/main.rs @@ -383,6 +383,8 @@ async fn start_sandbox( if let Err(e) = initialize_policy().await { error!(logger, "Failed to initialize agent policy: {:?}", e); // Continuing execution without a security policy could be dangerous. + // Give a brief moment for the logs to flush, then abort the process to stop the VM. + tokio::time::sleep(tokio::time::Duration::from_secs(1)).await; std::process::abort(); }